fix: Anthropic non-streaming function_call property casing#620
fix: Anthropic non-streaming function_call property casing#620MarvelNwachukwu wants to merge 2 commits intomainfrom
Conversation
… call properties The non-streaming path in anthropic-llm.ts was using snake_case (function_call, function_response) for part properties, but the Event API expects camelCase (functionCall, functionResponse). The streaming path already uses camelCase correctly. This caused tool use to silently break in non-streaming Anthropic mode. Fixes: Non-streaming Anthropic tool calls are now properly recognized by getFunctionCalls() Tests: All 478 tests pass
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 621aa3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug impacting Anthropic's non-streaming tool use functionality by standardizing the casing of function call and response properties. The change ensures that the system correctly processes tool-related events, which previously failed due to an inconsistency in how these properties were named, thereby restoring expected behavior for tool interactions. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
@claude do a deep review |
|
Claude finished @MarvelNwachukwu's task —— View job Deep PR Review Complete ✅This PR fixes a critical bug in the Anthropic non-streaming implementation that was causing tool use to silently fail. Here's my comprehensive review: Review Tasks:
🐛 Bug AnalysisRoot Cause: The non-streaming path in Impact: Complete failure of tool use in non-streaming Anthropic mode, while streaming worked correctly. ✅ Fix CorrectnessThe fix is technically sound and addresses the root cause:
🧪 Test CoverageThe test updates are appropriate and sufficient:
🔍 Edge Cases & Side EffectsNo negative impacts identified:
📋 Overall AssessmentSTRENGTHS:
RECOMMENDATIONS:
🎯 VerdictThis is a high-quality bug fix that resolves a critical issue with minimal risk. The change is well-tested, follows established conventions, and restores expected functionality. Recommendation: APPROVE ✅ The fix is production-ready and should resolve the tool use failures in Anthropic non-streaming mode. |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a casing mismatch for functionCall and functionResponse properties within the Anthropic non-streaming implementation. The changes in anthropic-llm.ts align the property names to the expected camelCase format, which resolves an issue causing tool use to fail silently. The corresponding test updates in anthropic-llm.test.ts are also correct and ensure the fix is verified. The changes are accurate and well-contained.
|
can you add in the PR why we are working on this? |
Description
When using Anthropic models (like Claude) in non-streaming mode, tool calls were silently failing — the agent would ignore tools and never execute them. This happened because of a simple naming mismatch: the code was using
function_call(with underscores) but the rest of the system expectsfunctionCall(camelCase). The streaming mode already used the correct naming, so this only affected non-streaming requests.TL;DR: Anthropic tool use was broken in non-streaming mode. Now it works.
Why
This fix is necessary because tool use is a core capability of the ADK framework. With the non-streaming Anthropic path broken, any agent using Anthropic models without streaming could not execute tools — function calls were silently dropped by
Event.getFunctionCalls()andEvent.getFunctionResponses()since they look for camelCase properties. This caused agents to appear to ignore their tools entirely, producing incorrect responses instead of invoking the appropriate tool. The fix ensures parity between streaming and non-streaming modes, and consistency with how other LLM providers (OpenAI, AI SDK) handle function call properties.Type of Change
How Has This Been Tested?
All 478 existing tests pass, including the updated Anthropic LLM conversion tests.
Checklist