feat:[response_format] Bedrock client structured output
Why are these changes needed?
This pull removes the bedrock unsupported warning on structured output / response_format param and adds support for response format referanced via beedrock documentation. https://aws.amazon.com/blogs/machine-learning/structured-data-response-with-amazon-bedrock-prompt-engineering-and-tool-use/
Related issue number
#2225
Checks
- [x] I've included any doc changes needed for https://docs.ag2.ai/. See https://docs.ag2.ai/latest/docs/contributor-guide/documentation/ to build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes introduced in this PR.
- [x] I've made sure all auto checks have passed.
📝 Documentation Analysis
All docs are up to date! 🎉
✅ Latest commit analyzed: e4dc1b7326e5c6d3d51fc36b68d3b831a6f0f2e7 | Powered by Joggr
So Im testing out the new changes here but I seem to be getting an error with my async tool calls not being awaited
Call ID: tooluse_o4Tw0b5bS9mZJTlg5dcs3w
Input arguments: {'query': 'FACULTY SCIENCE LTD technology consultancy Old Street London'}
Output:
<coroutine object web_search at 0x10a823e20>
_Group_Tool_Executor (to chat_manager):
***** Response from calling tool (tooluse_o4Tw0b5bS9mZJTlg5dcs3w) *****
<coroutine object web_search at 0x10a823e20>```
So Im testing out the new changes here but I seem to be getting an error with my async tool calls not being awaited
Call ID: tooluse_o4Tw0b5bS9mZJTlg5dcs3w Input arguments: {'query': 'FACULTY SCIENCE LTD technology consultancy Old Street London'} Output: <coroutine object web_search at 0x10a823e20> _Group_Tool_Executor (to chat_manager): ***** Response from calling tool (tooluse_o4Tw0b5bS9mZJTlg5dcs3w) ***** <coroutine object web_search at 0x10a823e20>```
solved in this PR: https://github.com/ag2ai/ag2/pull/2221
So the changes in 2221 solved the async. Agent runs but when it tries to call structured_output tool i get error:
***** Response from calling tool (tooluse_WcVAwKeaQgyEyO1KAHaTSg) *****
Error: Function __structured_output not found.`
@priyansh4320 Please add integration tests with real API calls.
@priyansh4320 sorry to be impatient but wanted to check in on this
@priyansh4320 sorry to be impatient but wanted to check in on this
@DanCorvesor integration tests should be done by today. and then we will merge bedrock PRs. :) thank you checking.
Did you see @KojoOwusu 's above comment tho, seems we've found an issue
Codecov Report
:x: Patch coverage is 62.68657% with 25 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| autogen/oai/bedrock.py | 62.68% | 15 Missing and 10 partials :warning: |
| Files with missing lines | Coverage Δ | |
|---|---|---|
| autogen/oai/bedrock.py | 62.30% <62.68%> (+15.61%) |
:arrow_up: |
... and 13 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.