Skip to content

feat: update Chat Completions request/response schemas - #127

Merged
adubovik merged 1 commit into
developmentfrom
feat/sync-chat-completion-schemas
Aug 13, 2026
Merged

adubovik merged 1 commit into
developmentfrom
feat/sync-chat-completion-schemas

Conversation

@adubovik

@adubovik adubovik commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Resolves #39

Syncs the Chat Completions schemas with the latest ai-dial-sdk==0.39.0.

Request

Path Added
messages[] role: "developer", content parts (text, image_url, file, input_audio, refusal), refusal, custom_fields.cache_breakpoint
messages[].custom_content stages, form_value, form_schema
tools[] function.strict, custom_fields.cache_breakpoint, static_function tools
top level tool_choice: "required", parallel_tool_calls, max_completion_tokens, reasoning_effort, stream_options, response_format: json_schema
custom_fields cache_breakpoint

Response

Path Added
choices[].message refusal
choices[].message.custom_content stages, form_value, form_schema
usage prompt_tokens_details.cached_tokens, prompt_tokens_details.cache_write_tokens, completion_tokens_details.reasoning_tokens
statistics usage_per_model, discarded_messages

Attachments got the streaming-only index field. Same additions apply to streaming deltas.

Fixes

  • max_prompt_tokens and custom_fields were passed as openai kwargs, raising TypeError: Completions.create() got an unexpected keyword argument. They never worked.
  • response_format was accepted by create() but never sent.
  • logprobs / top_logprobs were missing from one async overload.

DIAL-specific and recent OpenAI parameters now go through extra_body, so they don't depend on the installed openai version.

Sync the missing fields with ai-dial-sdk.

Request:
- messages: "developer" role, content parts, custom_fields.cache_breakpoint,
  refusal, custom_content.stages/form_value/form_schema
- tools: function.strict, custom_fields.cache_breakpoint, static_function
  tools, tool_choice="required", parallel_tool_calls
- max_completion_tokens, reasoning_effort, stream_options,
  response_format=json_schema, custom_fields.cache_breakpoint

Response:
- custom_content.stages/form_value/form_schema, message.refusal
- usage.prompt_tokens_details, usage.completion_tokens_details
- statistics.usage_per_model, statistics.discarded_messages

DIAL-specific and recent OpenAI parameters are now sent via extra_body:
max_prompt_tokens and custom_fields used to be passed as openai kwargs,
which raised TypeError, and response_format was never sent at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adubovik adubovik self-assigned this Aug 13, 2026
@adubovik
adubovik merged commit ccae5fa into development Aug 13, 2026
14 checks passed
@adubovik
adubovik deleted the feat/sync-chat-completion-schemas branch August 13, 2026 13:15
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.

Support Stages in aidial_client.AsyncDial#client.chat.completions.create

2 participants