Skip to content

fix(openai): handle encrypted_content field in assistant messages#1529

Open
BillionClaw wants to merge 1 commit into0xPlaygrounds:mainfrom
BillionClaw:clawoss/fix/1515-encrypted-content-field
Open

fix(openai): handle encrypted_content field in assistant messages#1529
BillionClaw wants to merge 1 commit into0xPlaygrounds:mainfrom
BillionClaw:clawoss/fix/1515-encrypted-content-field

Conversation

@BillionClaw
Copy link
Copy Markdown
Contributor

Fixes #1515

Problem

Some providers (e.g., Doubao/ByteDance) return an "encrypted_content" field in assistant messages that wasn't handled by the OpenAI completion API client, causing a JSON deserialization error.

Solution

Added an additional_params field with #[serde(flatten)] to the Message::Assistant variant to capture any provider-specific fields, making deserialization flexible and forward-compatible.

Changes

  • Added additional_params: Option<serde_json::Value> to Message::Assistant
  • Updated all code constructing/pattern-matching on Message::Assistant
  • Added regression tests for encrypted_content and unknown field handling

Testing

  • All 441 tests pass
  • Clippy and fmt checks pass

Add additional_params field to Message::Assistant variant to capture
provider-specific fields like encrypted_content that some providers
(e.g., Doubao) return in their API responses.

Fixes 0xPlaygrounds#1515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: json: unknown field \"encrypted_content\"

1 participant