Skip to content

feat:Expand OpenAI OpenAPI schema with streaming and multi-modal support#253

Merged
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202603102121
Mar 10, 2026
Merged

feat:Expand OpenAI OpenAPI schema with streaming and multi-modal support#253
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202603102121

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Mar 10, 2026

Summary by CodeRabbit

  • New Features
    • Enhanced real-time streaming capabilities for audio, text, and transcripts
    • Multi-modal content support including audio and visual inputs
    • Advanced session management and configuration options
    • Batch and fine-tuning job management workflows
    • Expanded tool and plugin integration framework
    • Improved event handling, error management, and status tracking

@HavenDV HavenDV merged commit a6e4595 into main Mar 10, 2026
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202603102121 branch March 10, 2026 21:22
@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Walkthrough

The OpenAI OpenAPI schema has been updated with expanded definitions for streaming events, multi-modal content support, response structures, and API management features including audio/visual handling, session lifecycle management, and role-based access control.

Changes

Cohort / File(s) Summary
OpenAPI Schema Updates
src/libs/tryAGI.OpenAI/openapi.yaml
Expanded YAML schema definitions adding streaming event types (SSE), response structures with delta/done events, multi-modal content support (audio, visual, text), session management, file handling, batch operations, fine-tuning jobs, tools/plugins, and administrative features (roles, permissions, audit logs).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A schema grows, with streams so fine,
Audio whispers, vision divine,
Events cascade in real-time dance,
Multi-modal dreams in every glance!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title Check ✅ Passed Title check skipped as CodeRabbit has written the PR title.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202603102121

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Expand OpenAI OpenAPI schema with streaming and multi-modal support Mar 10, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/libs/tryAGI.OpenAI/openapi.yaml`:
- Around line 18492-18496: The min/max item constraints are incorrectly placed
under the numeric item schema (unrecognizedKeywords: min_items/max_items) and
thus do not limit array length; move the constraints to the array schema that
contains the items and use OpenAPI's minItems and maxItems keys (e.g., add
minItems: 2 and maxItems: 2 alongside the items: block) so the array itself
enforces a 2-element length (locate the items definition shown and update its
parent array schema accordingly).
- Around line 13369-13370: The OpenAPI schema's seed property uses numeric
bounds that exceed signed 64-bit range; update the seed property's maximum and
minimum values (currently 9223372036854776000 and -9223372036854776000) to the
correct Int64 limits 9223372036854775807 and -9223372036854775808 respectively
so generated .NET models/validators won't overflow; locate the seed property in
openapi.yaml and replace those two numeric literals accordingly.
- Around line 12171-12174: The ChatCompletionResponseMessage schema currently
lists "content" and "refusal" as required but they are conditionally present;
update the OpenAPI schema for ChatCompletionResponseMessage to remove "content"
and "refusal" from the required array so they are optional, and add/update the
property descriptions to note that "content" is present when no tool_calls are
returned and "refusal" appears only on model refusal events; this change ensures
generated models match the API contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4db513ce-2baa-442f-86ce-66c7e531c944

📥 Commits

Reviewing files that changed from the base of the PR and between 3d8b1cd and f2581d4.

⛔ Files ignored due to path filters (117)
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateRun.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThreadAndRun.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateRun.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThreadAndRun.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AllOf2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Annotation.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AnnotationsItem3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AnyOf2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AnyOf3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ApplyPatchOperationParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AssistantStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AssistantsApiResponseFormatOption.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AssistantsApiToolChoiceOption.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionMessageToolCallsItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionRequestAssistantMessageContentPart.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionRequestMessage.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionRequestSystemMessageContentPart.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionRequestToolMessageContentPart.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionRequestUserMessageContentPart.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChatCompletionToolChoiceOption.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ChunkingStrategyRequestParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ComputerAction.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ComputerToolCallOutputResource.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Content5.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ContentItem3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ContentItem4.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ConversationItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ConversationParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateChatCompletionRequest.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateEvalItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateModelResponseProperties.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateResponse.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateSpeechResponseStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateTranscriptionResponseDiarizedJsonUsage.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.CreateTranscriptionResponseStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.DeletedConversation.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EnvironmentVariant1.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EnvironmentVariant12.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EnvironmentVariant13.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalGraderLabelModel.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalGraderPython.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalGraderScoreModel.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalGraderStringCheck.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalGraderTextSimilarity.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Filters2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FiltersItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FineTuneChatCompletionRequestAssistantMessage.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Format2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FunctionAndCustomToolCallOutput.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FunctionShellCallOutputOutcomeParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FunctionToolCallOutputResource.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.FunctionToolCallResource.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ImageEditStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ImageGenStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputMessageResource.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Item.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ItemField.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ItemResource.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.MessageStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ModelIds.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ModelIdsCompaction.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ModelIdsResponses.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ModelIdsShared.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.NetworkPolicy.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.NetworkPolicy2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.NetworkPolicy3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OneOf2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OneOf3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OneOf4.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OneOf5.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OneOf9.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Operation.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Outcome.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputMessageContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputsVariant1Item.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RealtimeAudioFormats.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RealtimeClientEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RealtimeServerEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RealtimeTruncation.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RealtimeTurnDetectionRealtimeTurnDetection1.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Response.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseFormat.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponsesClientEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponsesClientEventResponseCreate.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponsesServerEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RunStepStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.RunStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Session2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.SkillsItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.SkillsItem2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Status.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.StopConfiguration.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.TextResponseFormatConfiguration.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ThreadItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ThreadStreamEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.Tool.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ToolChoiceParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ToolsItem13.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.TranscriptionChunkingStrategy.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.VideoModel.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.VoiceIdsOrCustomVoice.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.VoiceIdsShared.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.WebSearchToolCallAction.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateChatCompletionRequestVariant2.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateRunRequest.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateThreadAndRunRequest.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MessageObject.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RunObject.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/tryAGI.OpenAI/openapi.yaml

Comment on lines 12171 to +12174
required:
- role
- content
- refusal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In the official OpenAI Chat Completions response schema/docs, are assistant message fields contentandrefusal both always present, or are they conditionally present depending on the response?

💡 Result:

They’re conditional, not both always present.

  • content on an assistant message is optional (it’s required unless the assistant returns tool_calls / function_call instead). [1]
  • refusal is also optional and only appears when the model produces a refusal. [1]

So, in the official Chat Completions schema, you should not assume both fields are always present. [1]

Sources:
[1] OpenAI API Reference – Create chat completion (ChatCompletionMessage / assistant message fields) (developers.openai.com)

Citations:


Fix ChatCompletionResponseMessage required fields—content and refusal are conditionally present, not always required.

According to the official OpenAI Chat Completions schema, both content and refusal are optional fields:

  • content is only required when the assistant does not return tool_calls
  • refusal appears only when the model produces a refusal

Marking both as required (lines 12171–12174) will make the generated models stricter than the actual API contract, causing deserialization failures when the API returns valid responses lacking one or both fields.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 12171 - 12174, The
ChatCompletionResponseMessage schema currently lists "content" and "refusal" as
required but they are conditionally present; update the OpenAPI schema for
ChatCompletionResponseMessage to remove "content" and "refusal" from the
required array so they are optional, and add/update the property descriptions to
note that "content" is present when no tool_calls are returned and "refusal"
appears only on model refusal events; this change ensures generated models match
the API contract.

Comment on lines 13369 to +13370
maximum: 9223372036854776000
minimum: -9223372036854776000
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
max_spec = 9223372036854776000
min_spec = -9223372036854776000
int64_max = 2**63 - 1
int64_min = -(2**63)

print("spec maximum:", max_spec)
print("int64 maximum:", int64_max)
print("maximum overflows int64:", max_spec > int64_max)
print()
print("spec minimum:", min_spec)
print("int64 minimum:", int64_min)
print("minimum underflows int64:", min_spec < int64_min)
PY

Repository: tryAGI/OpenAI

Length of output: 258


🏁 Script executed:

sed -n '13360,13380p' src/libs/tryAGI.OpenAI/openapi.yaml

Repository: tryAGI/OpenAI

Length of output: 1525


Clamp seed to signed 64-bit bounds.

The current bounds exceed Int64 range by 193 and 192 respectively, which will cause overflow/underflow in generated .NET models and validators.

Suggested fix
            seed:
-              maximum: 9223372036854776000
-              minimum: -9223372036854776000
+              maximum: 9223372036854775807
+              minimum: -9223372036854775808
               type:
                 - 'null'
                 - integer
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
maximum: 9223372036854776000
minimum: -9223372036854776000
seed:
maximum: 9223372036854775807
minimum: -9223372036854775808
type:
- 'null'
- integer
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 13369 - 13370, The OpenAPI
schema's seed property uses numeric bounds that exceed signed 64-bit range;
update the seed property's maximum and minimum values (currently
9223372036854776000 and -9223372036854776000) to the correct Int64 limits
9223372036854775807 and -9223372036854775808 respectively so generated .NET
models/validators won't overflow; locate the seed property in openapi.yaml and
replace those two numeric literals accordingly.

Comment on lines 18492 to +18496
items:
type: number
unrecognizedKeywords:
unrecognizedKeywords:
min_items: 2
max_items: 2
min_items: 2
max_items: 2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Move the 2-item constraint onto the array, not the element schema.

As written, this does not constrain the range length at all. minItems/maxItems need to live on the array schema, otherwise clients can generate or accept invalid ranges.

Suggested fix
         items:
           type: number
-          unrecognizedKeywords:
-            min_items: 2
-            max_items: 2
+        minItems: 2
+        maxItems: 2
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
items:
type: number
unrecognizedKeywords:
unrecognizedKeywords:
min_items: 2
max_items: 2
min_items: 2
max_items: 2
items:
type: number
minItems: 2
maxItems: 2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 18492 - 18496, The min/max
item constraints are incorrectly placed under the numeric item schema
(unrecognizedKeywords: min_items/max_items) and thus do not limit array length;
move the constraints to the array schema that contains the items and use
OpenAPI's minItems and maxItems keys (e.g., add minItems: 2 and maxItems: 2
alongside the items: block) so the array itself enforces a 2-element length
(locate the items definition shown and update its parent array schema
accordingly).

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.

1 participant