Skip to content

fix: metadata field does not handle null values (#1538)#1795

Open
tao501 wants to merge 1 commit into
0xPlaygrounds:mainfrom
tao501:fix/metadata-null-handling
Open

fix: metadata field does not handle null values (#1538)#1795
tao501 wants to merge 1 commit into
0xPlaygrounds:mainfrom
tao501:fix/metadata-null-handling

Conversation

@tao501
Copy link
Copy Markdown

@tao501 tao501 commented May 21, 2026

Fixes #1538

The metadata field in AdditionalParameters was typed as Map<String, Value> without null handling. When OpenAI-compatible providers (e.g., vLLM) return metadata: null in the response, deserialization fails.

Changes:

  • Changed metadata type to Option<Map<String, Value>> in responses_api/mod.rs
  • Updated .metadata.clear() to .metadata = None in chatgpt/mod.rs

All existing tests pass (74 openai + 13 chatgpt).

@tao501 tao501 force-pushed the fix/metadata-null-handling branch from 996237c to b33119c Compare May 21, 2026 13:25
The `metadata` field in `AdditionalParameters` (OpenAI Responses API) was typed as `Map<String, Value>` without null handling.
When OpenAI-compatible providers return `metadata: null`, deserialization fails.

- Changed `metadata` type to `Option<Map<String, Value>>` in responses_api/mod.rs
- Updated `.metadata.clear()` to `.metadata = None` in chatgpt/mod.rs
- Added 7 test cases covering null/empty/missing/object metadata deserialization
@tao501 tao501 force-pushed the fix/metadata-null-handling branch from b33119c to b135b6e Compare May 24, 2026 07:36
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: metadata field does not handle null values

1 participant