-
-
Notifications
You must be signed in to change notification settings - Fork 931
fix(bedrock): add Bedrock-native format conversion to OpenAI format #1696
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
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b888745
fix(bedrock): add Bedrock-native format conversion to OpenAI format
claude[bot] bd071f0
fix(tests): correct Bedrock test direction and add mixed format scena…
claude[bot] 38d4c75
Merge branch 'main' into claude/issue-1689-20250711_194632
jxnl 85ad605
docs(bedrock): clarify support for mixed OpenAI/Bedrock kwargs and mo…
jxnl 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its actually the other wayr around
the input is
assert result["model"] == "anthropic.claude-3-haiku-20240307-v1:0"
assert len(result["messages"]) == 2
assert result["messages"][0] == {"role": "system", "content": "You are a helpful assistant."}
assert result["messages"][1]["role"] == "user"
assert result["messages"][1]["content"] == [{'text': "Extract: Jason is 22 years old"}]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude make this test in the other direction go from openai args to bedrock args, but also support the case where some of the args are bedrock format
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @jxnl's task —— View job
Fixing Test Direction: OpenAI to Bedrock Format ✅
Fixed the test direction to go from OpenAI args to Bedrock args as requested, and added support for mixed format scenarios.
Todo List:
Changes Made
Fixed existing tests:
test_bedrock_combined_system_and_content_format()- Now tests OpenAI → Bedrock conversion properlytest_bedrock_backward_compatibility_openai_format()- Now expects proper Bedrock format outputtest_bedrock_system_parameter_conversion()- Fixed to expect Bedrock format outputAdded new test cases:
test_bedrock_mixed_format_scenarios()- Tests mixed format where system parameter is already in Bedrock format but messages are in OpenAI formattest_bedrock_mixed_format_content()- Tests mixed content formats (some as text objects, others as strings)All tests now correctly test the actual behavior: OpenAI input → Bedrock output with support for mixed format scenarios as requested.
Commit:
bd071f0- fix(tests): correct Bedrock test direction and add mixed format scenarios