Repository navigation
fix(py/anthropic): keep every system message in the request - #7073
Closed
pcbeingused33 wants to merge 1 commit into
Closed
pcbeingused33 wants to merge 1 commit into
pcbeingused33 wants to merge 1 commit into
Conversation
_extract_system returned at the first system message, so any later system messages were dropped silently. Collect the text of all system messages in order and join them with blank lines, as the Gemini and Bedrock plugins do.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the _extract_system method in the Anthropic model implementation to extract and concatenate text from all system messages (separated by double newlines) rather than only returning the first one. A corresponding unit test has been added to verify this behavior. I have no feedback to provide.
Contributor
|
Hi @pcbeingused333 — heads up that Genkit Python SDK development has moved to https://github.com/genkit-ai/genkit-python! Could you re-open this PR over there (file paths map 1:1 after stripping the leading py/ prefix), and link/close this PR once moved? cc @huangjeff5 |
Author
|
Moved to genkit-ai/genkit-python#146 as requested; closing this one. |
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.
AnthropicModel._extract_systemreturned as soon as it found the first system message, so a request with several system messages sent only the first one to Anthropic and silently dropped the rest. The Gemini and Bedrock plugins already accumulate all of them.Fix: collect the text of every system message, in order, and join them with a blank line.
Test:
test_extract_system_keeps_all_system_messagesuses two system messages around a user message and expects both in the result. It fails before the change and passes after.Disclosure: this change was prepared with AI assistance (Claude Code).