fix(llm): inject _noop tool for all providers when messages contain tool history#34603
Open
Robin1987China wants to merge 1 commit into
Open
fix(llm): inject _noop tool for all providers when messages contain tool history#34603Robin1987China wants to merge 1 commit into
Robin1987China wants to merge 1 commit into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PR FoundPR #34094:
|
…ool history Bedrock (and other providers) requires a toolConfig when messages contain toolUse/toolResult content blocks, even if no active tools are being used. Previously the _noop tool injection was limited to github-copilot, but the underlying constraint affects Compaction on Bedrock-backed providers too (e.g. Portkey) — resulting in "toolConfig field must be defined" errors. Remove the github-copilot-specific guard so the _noop tool is injected whenever messages contain prior tool calls but no current tools are active. Closes anomalyco#34089
37158ed to
e1714ba
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #34089
Type of change
What does this PR do?
The _noop tool injection in request.ts has a provider guard that only runs for github-copilot. However, when tool_use messages are present in history, the AI SDK requires a tool list to be non-empty. Without _noop, providers without native tool support fail to process conversations that contain prior tool interactions.
This removes the provider guard so _noop is injected unconditionally when messages contain tool history.
How did you verify your code works?
Checklist