feat: update Chat Completions request/response schemas - #127
Merged
Merged
Conversation
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>
alex-chernyshov
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #39
Syncs the Chat Completions schemas with the latest ai-dial-sdk==0.39.0.
Request
messages[]role: "developer",contentparts (text,image_url,file,input_audio,refusal),refusal,custom_fields.cache_breakpointmessages[].custom_contentstages,form_value,form_schematools[]function.strict,custom_fields.cache_breakpoint,static_functiontoolstool_choice: "required",parallel_tool_calls,max_completion_tokens,reasoning_effort,stream_options,response_format: json_schemacustom_fieldscache_breakpointResponse
choices[].messagerefusalchoices[].message.custom_contentstages,form_value,form_schemausageprompt_tokens_details.cached_tokens,prompt_tokens_details.cache_write_tokens,completion_tokens_details.reasoning_tokensstatisticsusage_per_model,discarded_messagesAttachments got the streaming-only
indexfield. Same additions apply to streaming deltas.Fixes
max_prompt_tokensandcustom_fieldswere passed asopenaikwargs, raisingTypeError: Completions.create() got an unexpected keyword argument. They never worked.response_formatwas accepted bycreate()but never sent.logprobs/top_logprobswere missing from one async overload.DIAL-specific and recent OpenAI parameters now go through
extra_body, so they don't depend on the installedopenaiversion.