Repository navigation
feat(anthropic): preserve thinking display and URL image sources - #484
Conversation
Signed-off-by: maheshrbapatu <maheshbapatu@gmail.com>
Signed-off-by: maheshrbapatu <maheshbapatu@gmail.com>
Signed-off-by: maheshrbapatu <maheshbapatu@gmail.com>
furionw
left a comment
There was a problem hiding this comment.
Thank you. The PR is aligned with https://platform.claude.com/docs/en/build-with-claude/vision
|
/ok to test 893b8ef |
|
[P2: Low-risk, non-blocking issue such as a narrow edge case, defensive-hardening opportunity, or minor maintainability/test gap] @maheshrbapatu Recording a compatibility caveat alongside the documented Rust API migration. Adding the URL variant preserves the standard base64 wire shape, but {
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "<base64 JPEG bytes>",
"url": null
}
}Before this PR, the source struct reads No affected client has been identified; this is a potential compatibility impact of the deliberate validation tightening, not an observed client regression or a request to change the behavior. It is useful context for consumers upgrading the server as well as those migrating Rust struct construction. |
Anthropic URL image sources currently fail deserialization, and
thinking.displaydisappears while parsing. Add typed Base64/URL source variants and preserve thesummarized/omitteddisplay values and betaupdatesvariant, including ordinary images and image-bearing tool results. Reject non-null, non-booleantool_result.is_errorvalues. Propagate malformed nested tool-content errors instead of silently treating them as missing content; omission, null, empty arrays, and valid text retain their behavior.This is the protocol prerequisite for ai-dynamo/dynamo#17376 and ai-dynamo/dynamo#17377, consumed by draft PRs ai-dynamo/dynamo#17381 and ai-dynamo/dynamo#17380. Fetching, URL security policy, display enforcement, and semantic validation of thinking modes remain in the serving layer. Dynamo explicitly rejects the beta updates mode until it can distinguish progress updates from reasoning; representing the value is not an implementation of that feature.
Rust API migration: callers must replace
AnthropicImageSourcestruct literals/field access with enum variants/matches and adddisplay: Noneto existingThinkingConfigliterals. The README documents this migration.Draft release gate: agree on the crate release/version migration before marking ready. Downstream draft PRs pin the identical changes cherry-picked onto protocol 8.2.0 at
bc547588eac8890bfeda2e206bc559959b273f72onmaheshrbapatu/frontend-crates:fix/anthropic-display-url-sources-8.2. This avoids unrelated 8.4 API changes that do not compile with Dynamo's pinned parser. All three downstream workspaces (root, Python bindings, KVBM bindings) pin the backport independently. They must switch to the agreed published release before readiness. This PR does not claim compatibility with existing Rust struct literals.Validation:
cargo test --locked -p dynamo-protocolscargo clippy --locked -p dynamo-protocols --all-targets -- -D warningscargo fmt -p dynamo-protocols --checkContract: https://platform.claude.com/docs/en/build-with-claude/vision and https://platform.claude.com/docs/en/build-with-claude/thinking