-
Notifications
You must be signed in to change notification settings - Fork 824
fix(bedrock): Add prompt caching support for Converse API #3390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ff8e343
83bdb0b
4fa3792
c8abf60
7d65ff8
6cf3366
a3c94e3
277499e
979db5d
1965083
750a59e
d4c2ca6
419ae0f
440295c
a5563d5
771b5d5
ea2b0da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"messages": [{"role": "user", "content": [{"text": "Hello, this is a test | ||
| prompt for caching."}]}], "inferenceConfig": {"maxTokens": 50}, "additionalModelRequestFields": | ||
| {"cacheControl": {"type": "ephemeral"}}}' | ||
| headers: | ||
| Content-Length: | ||
| - '211' | ||
| Content-Type: | ||
| - !!binary | | ||
| YXBwbGljYXRpb24vanNvbg== | ||
| User-Agent: | ||
| - !!binary | | ||
| Qm90bzMvMS4zNC4xNDUgbWQvQm90b2NvcmUjMS4zNC4xNDUgdWEvMi4wIG9zL3dpbmRvd3MjMTAg | ||
| bWQvYXJjaCNhbWQ2NCBsYW5nL3B5dGhvbiMzLjExLjggbWQvcHlpbXBsI0NQeXRob24gY2ZnL3Jl | ||
| dHJ5LW1vZGUjbGVnYWN5IEJvdG9jb3JlLzEuMzQuMTQ1 | ||
| X-Amz-Date: | ||
| - !!binary | | ||
| MjAyNTEwMzBUMTY1MTI4Wg== | ||
| amz-sdk-invocation-id: | ||
| - !!binary | | ||
| ZTFmM2VjZTMtM2VlMC00ZGZiLWE2MWEtYjBiYmU4M2U2NDFm | ||
| amz-sdk-request: | ||
| - !!binary | | ||
| YXR0ZW1wdD0x | ||
| method: POST | ||
| uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/amazon.titan-text-express-v1/converse | ||
| response: | ||
| body: | ||
| string: '{"message":"The security token included in the request is invalid."}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '68' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Thu, 30 Oct 2025 16:51:30 GMT | ||
| x-amzn-ErrorType: | ||
| - UnrecognizedClientException:http://internal.amazon.com/coral/com.amazon.coral.service/ | ||
| x-amzn-RequestId: | ||
| - f0fdf86b-d85a-4f16-8713-1b9b5fccbe25 | ||
| status: | ||
| code: 403 | ||
| message: Forbidden | ||
| version: 1 | ||
|
Comment on lines
+1
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainCassette contains authentication failure instead of valid caching response. The cassette records a 403 Forbidden response with "The security token included in the request is invalid" rather than a successful API response with caching metadata. This means the test
Per the PR objectives, you need AWS credentials to record a valid cassette. Ask the maintainer to run: and commit the generated cassette. 🏁 Script executed: poetry run pytest packages/opentelemetry-instrumentation-bedrock/tests/traces/test_titan.py::test_titan_converse_with_caching --record-mode=onceLength of output: 44 Length of output: 77 🏁 Script executed: #!/bin/bash
# Inspect the test function test_titan_converse_with_caching
ast-grep --pattern 'def test_titan_converse_with_caching($_) {
$$$
}'Length of output: 0 🏁 Script executed: #!/bin/bash
# Search for the test function and display context
rg -n "def test_titan_converse_with_caching" --type py -A 50Length of output: 6541 Cassette is invalid and will cause test failure; AWS credentials required to regenerate. The cassette indeed contains a 403 Forbidden response instead of a valid caching response. The test will fail at line 1086 when attempting to access 🤖 Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.