Skip to content

Conversation

ManuelPeixotoCegid
Copy link

This pull request updates the handling of Anthropic message responses by supporting the new ThinkingBlock type introduced in Anthropic version 0.23.1 and improving the extraction logic for JSON responses. The changes ensure that the code can correctly parse both TextBlock and ThinkingBlock content types.

Support for new Anthropic content types:

  • Imported the ThinkingBlock type from anthropic.types to enable handling of messages that use this new block type.

Improved response extraction logic:

  • Updated the _extract_json_response method in autogen/oai/anthropic.py to check the type of the first item in the response.content list, extracting text from TextBlock or thinking from ThinkingBlock as appropriate.

@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

@randombet
Copy link
Collaborator

@ManuelPeixotoCegid Could you add a test to cover this part?

@randombet randombet self-requested a review October 8, 2025 17:26
@randombet
Copy link
Collaborator

@ManuelPeixotoCegid Could you share your contacts (discord or email) that I could follow up on this? And could you sign the Contributor License Agreement?

@ManuelPeixotoCegid
Copy link
Author

@randombet reachout to me at mapeixoto@cegid.com and I have just signed it :)

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
autogen/oai/anthropic.py 14.28% 6 Missing ⚠️
Files with missing lines Coverage Δ
autogen/oai/anthropic.py 23.61% <14.28%> (-0.34%) ⬇️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@randombet
Copy link
Collaborator

@ManuelPeixotoCegid Could you address the comments and add the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants