-
Notifications
You must be signed in to change notification settings - Fork 1.3k
bugfix: parse anthropic response content block type logic error. #1070
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
Conversation
|
|
qbc2016
left a comment
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.
Thank you very much for your PR. I have a small question about the implementation. I'm trying to understand how this modification addresses the bad case mentioned in the PR description.
From my understanding, the logic for handling TextBlock and ToolUseBlock appears to remain the same before and after the change:
For TextBlock: both versions extract the text content
For ToolUseBlock: it wouldn't enter this branch in either case
Could you help clarify the connection? I might be missing something in my analysis.
@qbc2016 Thanks for your response. Yes, the logic appears identical when reviewing the old version statically However, I encountered a runtime bug:
please check bellow debug snapshot for old version
Furthermore, using new version - |
DavdGao
left a comment
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.
LGTM
* main: chore(version): update version to 1.0.11 (agentscope-ai#1074) fix(anthropic): fix the bug that anthropic response may have text field even for the tool_use block. (agentscope-ai#1070) fix(Gemini): fix the bug that Gemini LLMs doesn't support nested JSON schema in its tools API (agentscope-ai#1050) fix(mcp): support to raise the exception on MCP disconnection (agentscope-ai#1024) feat(a2a): support A2A protocol for inter-agent communication (agentscope-ai#1027)
…ld even for the tool_use block. (agentscope-ai#1070)


AgentScope Version
1.0.10 via
import agentscope; print(agentscope.__version__)Description
This PR fixes type process error and inconsistent while parsing anthropic response which may return error result.
The buggy parser behave different for text block and may cause problem in many edge case,
ref to
agentscope.model._anthropic_model.AnthropicChatModel._parse_anthropic_stream_completion_responseChecklist
Please check the following items before code is ready to be reviewed.
pre-commit run --all-filescommand