[Bugfix] accept redacted thinking blocks in Anthropic messages#36992
Conversation
Allow Anthropic clients to replay assistant turns that include redacted thinking blocks without failing request validation, and keep opaque redacted reasoning out of the converted OpenAI prompt.\n\nGenerated-by: OpenCode (GPT-5.4) Signed-off-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local>
There was a problem hiding this comment.
Code Review
This pull request introduces changes to handle redacted_thinking content blocks from Anthropic. The AnthropicContentBlock protocol is updated to accept redacted_thinking as a valid type, and the corresponding request conversion logic is modified to ignore these blocks, preventing validation errors. New regression tests are added to verify the handling of thinking blocks, including redacted_thinking, in assistant messages during multi-turn conversations. The changes are localized to the Anthropic protocol and serving logic, with corresponding test coverage.
DarkLight1337
left a comment
There was a problem hiding this comment.
Please fix the merge conflicts though
|
This pull request has merge conflicts that must be resolved before it can be |
…c-redacted-thinking
|
@DarkLight1337 Fixed merge conflicts! |
Head branch was pushed to by a user without write access
Signed-off-by: bbartels <benjamin@bartels.dev>
7c12374 to
b45f105
Compare
|
@DarkLight1337 fixed tests, all passing now |
…project#36992) Signed-off-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local> Signed-off-by: bbartels <benjamin@bartels.dev> Co-authored-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local>
…project#36992) Signed-off-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local> Signed-off-by: bbartels <benjamin@bartels.dev> Co-authored-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local>
…project#36992) Signed-off-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local> Signed-off-by: bbartels <benjamin@bartels.dev> Co-authored-by: Benjamin Bartels <benjaminba@tiglab-ubuntu.ilab.local>
Purpose
redacted_thinkingcontent blocks in echoed assistant messages so follow-up/v1/messagesrequests do not fail validation.thinking->reasoninghandling.redacted_thinkinginputs.Test Plan
pytest tests/entrypoints/openai/test_anthropic_messages_conversion.py -qTest Result
pytestis not installed (/bin/bash: line 1: pytest: command not found).