-
Notifications
You must be signed in to change notification settings - Fork 121
fix(anthropic): marshalling errors for anthropic system messages #1513
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: secustor <sebastian@poxhofer.at>
Signed-off-by: secustor <sebastian@poxhofer.at>
Signed-off-by: secustor <sebastian@poxhofer.at>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1513 +/- ##
=======================================
Coverage 83.94% 83.94%
=======================================
Files 144 144
Lines 12667 12667
=======================================
Hits 10633 10633
Misses 1419 1419
Partials 615 615 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // SystemPrompt represents a system prompt to guide the model's behavior. | ||
| // https://docs.claude.com/en/api/messages#body-system | ||
| type SystemPrompt struct{} // TODO when we need it for observability, etc. | ||
| type SystemPrompt interface{} // TODO when we need it for observability, etc. |
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.
Would this be a problem for other fields as well ?
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.
After your comment I have checked it and yeah other are effected too.
|
@secustor thanks for the fix, did you test the tool calls which my have similar issues. |
|
I think this will affect all fields, and that we should change all occurences of empty An example to illustrte the issue: So I think we should:
Thoughts? I'm leaning towards reverting those PRs now for the release, and keep working on the Anthropic model and release it shortly after v0.4, when we have the typed model plus metrics & tracing. |
agreed, let’s revert the previous PR #1513 considering the scope of impact of this and broke the major use case like Claude Code. We need to test it thoroughly. |
|
No, we tested our setup with ClaudeCode when we ran into this. After that everything worked fine again.
No, only a simple hello world. As commented above other fields have also fall backs to other types. |
Right tool calls and thinking will stop working as these fields are not passed along. |
|
these structs are read only so as long as this unmarshal is resolved, there should be zero impact though, I'm ok reverting it since it's near v0.4 release |
|
#1516 reverting |
Description
Currently if a client sends system messages to the Anthropic API endpoint of the Gateway JSON parsing fails.
That field is an union type of
string | []object. https://docs.claude.com/en/api/messages#body-systemWhen it is a string:
or in the array format too:
After this system prompts are correctly handled:
Related Issues/PRs (if applicable)
Special notes for reviewers (if applicable)