-
Notifications
You must be signed in to change notification settings - Fork 470
fix(llmobs): safely output format bedrock cohere rerank spans #15124
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
Merged
+92
−12
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
releasenotes/notes/fix-bedrock-llmobs-cohere-a1bcb48e9b252d77.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| fixes: | ||
| - | | ||
| LLM Observability: Resolves an issue in the bedrock integration where invoking cohere rerank models would result in missing spans due to output formatting index errors. |
52 changes: 52 additions & 0 deletions
52
tests/contrib/botocore/bedrock_cassettes/cohere_rerank_invoke.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"query": "What is the capital of the United States?", "documents": ["Carson | ||
| City is the capital city of the American state of Nevada.", "The Commonwealth | ||
| of the Northern Mariana Islands is a group of islands in the Pacific Ocean. | ||
| Its capital is Saipan.", "Washington, D.C. (also known as simply Washington | ||
| or D.C., and officially as the District of Columbia) is the capital of the United | ||
| States. It is a federal district.", "Capitalization or capitalisation in English | ||
| grammar is the use of a capital letter at the start of a word. English usage | ||
| varies from capitalization in other languages.", "Capital punishment has existed | ||
| in the United States since beforethe United States was a country. As of 2017, | ||
| capital punishment is legal in 30 of the 50 states."], "api_version": 2, "top_n": | ||
| 3}' | ||
| headers: | ||
| Content-Length: | ||
| - '790' | ||
| User-Agent: | ||
| - !!binary | | ||
| Qm90bzMvMS4zNC40OSBtZC9Cb3RvY29yZSMxLjM0LjQ5IHVhLzIuMCBvcy9tYWNvcyMyNC42LjAg | ||
| bWQvYXJjaCNhcm02NCBsYW5nL3B5dGhvbiMzLjExLjEzIG1kL3B5aW1wbCNDUHl0aG9uIGNmZy9y | ||
| ZXRyeS1tb2RlI2xlZ2FjeSBCb3RvY29yZS8xLjM0LjQ5 | ||
| X-Amz-Date: | ||
| - !!binary | | ||
| MjAyNTEwMzFUMjEwODQ2Wg== | ||
| amz-sdk-invocation-id: | ||
| - !!binary | | ||
| NDNlZWJhN2EtNGY1Yy00ZDI1LWFmNzUtYjY0NDNjNmUzYzM0 | ||
| amz-sdk-request: | ||
| - !!binary | | ||
| YXR0ZW1wdD0x | ||
| method: POST | ||
| uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.rerank-v3-5%3A0/invoke | ||
| response: | ||
| body: | ||
| string: '{"results":[{"index":2,"relevance_score":0.8742601},{"index":0,"relevance_score":0.1728413},{"index":4,"relevance_score":0.10793502}]}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '134' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Fri, 31 Oct 2025 21:08:47 GMT | ||
| X-Amzn-Bedrock-Invocation-Latency: | ||
| - '109' | ||
| x-amzn-RequestId: | ||
| - de4d85e7-fe35-4809-bda9-7675d0eb091f | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.