Class: PromptBuilder::Serializers::ChatCompletion::Request
- Defined in:
- lib/prompt_builder/serializers/chat_completion/request.rb
Overview
Request serializer for the OpenAI Chat Completions API format.
Unsupported Open Responses features
These session fields are not supported and are silently omitted from the serialized output:
-
background— Chat Completions has no background/async mode -
include— response-field inclusion is an Open Responses-only concept -
max_tool_calls— per-request tool-call caps are not supported -
truncation— server-side context truncation is not supported
Partially supported session fields (unsupported keys are omitted):
-
text— onlyformat(mapped toresponse_format) andverbosity(mapped to top-levelverbosity) are supported -
reasoning— only theeffortkey is mapped toreasoning_effort -
stream_options— onlyinclude_usageandinclude_obfuscationare supported, and only whenstreamis set (otherwise it is omitted)
Input content restrictions:
-
InputVideocontent is not supported in any message (omitted) -
Reasoningitems are not supported (skipped) -
RefusalContentis dropped silently (a parsed Chat Completions refusal can stay in session history without breaking subsequent request_payload calls) -
InputImagecontent is only supported in user messages (assistant/developer/system images are omitted) -
InputImagewithfile_idinextrais not supported (theimage_filecontent type is Assistants API only); afile_id-only image is omitted -
InputFileis mapped to afilecontent block (Files API id viaextra, base64file_data, or both withfilename); afile_url-onlyInputFileis omitted because Chat Completions has no remote-URL form for files -
Only text content is supported in tool (
FunctionCallOutput) results; other content is omitted -
OutputText.annotationsare dropped silently on request serialization so a parsed response with citations can sit in session history without breaking subsequentrequest_payloadcalls
Features in Chat Completions not available through Open Responses
The following Chat Completions parameters cannot be set through the Open Responses canonical format:
-
seed— for reproducible outputs -
logit_bias— per-token probability adjustments -
n— requesting multiple response candidates -
stop— custom stop sequences -
prediction— speculative decoding hints -
Audio input and audio output (model-dependent)
-
web_search_options— built-in web search tool -
modalities— output modality selection (text/audio) -
tool_choiceallowed_toolsshape and custom (non-function) tool types
Constant Summary collapse
- SUPPORTED_MESSAGE_ROLES =
%w[assistant developer system user].freeze
- SUPPORTED_STREAM_OPTION_KEYS =
%w[include_obfuscation include_usage].freeze
- SUPPORTED_TOOL_CHOICE_VALUES =
%w[auto none required].freeze