feat:Update OpenAPI spec with revised schemas and enhanced event structures#193
feat:Update OpenAPI spec with revised schemas and enhanced event structures#193
Conversation
WalkthroughThe OpenAPI specification was updated with new and revised schemas for image generation usage and token log probabilities, enhanced event structures for MCP tool calls, and the removal of certain reasoning event schemas. Descriptions and enumerations were clarified or corrected, and some properties were retyped or made required in various event schemas. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant MCP Tool
participant ImageGen
Client->>API: Request image generation
API->>ImageGen: Generate image with prompt
ImageGen-->>API: Image + ImageGenUsage (token counts)
API-->>Client: Response with image and usage details
Client->>API: Initiate MCP tool call
API->>MCP Tool: Execute tool (with item_id, output_index)
MCP Tool-->>API: Result or error (includes item_id, output_index)
API-->>Client: Event with updated MCP call schema (JSON string arguments/delta)
Estimated code review effort4 (~90 minutes) Poem
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
src/libs/tryAGI.OpenAI/openapi.yaml (5)
14901-14914: Validate that token counts can’t go negative
image_tokens/text_tokensare plain integers without any boundary checks. Adding a lower bound of0prevents impossible negative counts and helps downstream validation tooling.properties: image_tokens: type: integer + minimum: 0 description: The number of image tokens in the input prompt. text_tokens: type: integer + minimum: 0 description: The number of text tokens in the input prompt.
15108-15118: Add basic invariants to the usage object
input_tokens,output_tokens, andtotal_tokensshould never be negative and it is typical fortotal_tokens≥input_tokens+output_tokens. While OpenAPI cannot express the cross–field invariant, you can at least disallow negative values withminimum: 0.input_tokens: type: integer + minimum: 0 description: The number of tokens (images and text) in the input prompt. ... output_tokens: type: integer + minimum: 0 description: The number of output tokens generated by the model. ... total_tokens: type: integer + minimum: 0 description: The total number of tokens (images and text) used for the image generation.
17437-17441: Prefer block scalars for multi-line descriptionsEmbedding
\nescape sequences inside a quoted string decreases readability and is easy to break. YAML block scalars (|or|-) render the same text in a cleaner way and avoid the need to double-escape backslashes.- description: "The number of partial images to generate. This parameter is used for\nstreaming responses that return partial images. Value must be between 0 and 3.\nWhen set to 0, the response will be a single image sent in one streaming event.\n\nNote that the final image may be sent before the full number of partial images \nare generated if the full image is generated more quickly.\n" + description: | + The number of partial images to generate. This parameter is used for + streaming responses that return partial images. Value must be between + 0 and 3. When set to 0, the response will be a single image sent in one + streaming event. + + Note that the final image may be sent before the full number of partial + images are generated if the full image is generated more quickly.
21442-21447: Mark JSON-encoded strings with a media type
deltais now a raw string that contains JSON. To help clients validate and tooling recognise the content, add the OpenAPI 3.1contentMediaTypehint.delta: type: string + contentMediaType: application/json description: "A JSON string containing the partial update to the arguments for the MCP tool call."
21478-21480: Same media-type hint for the finalisedargumentsfieldFor consistency with the delta event, mark
argumentsas JSON-encoded.arguments: type: string + contentMediaType: application/json description: "A JSON string containing the finalized arguments for the MCP tool call."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (50)
src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImage.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEdit.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImage.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseReasoningDeltaEventType.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseReasoningDeltaEventTypeNullable.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseReasoningDoneEventType.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseReasoningDoneEventTypeNullable.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ResponseStreamEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.AuditLog.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.AuditLogProject.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CodeInterpreterToolCall.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CodeInterpreterToolCallStatus.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateChatCompletionResponse.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateChatCompletionStreamResponse.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateImageEditRequest.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateImageRequest.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FunctionObject.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ImageGenInputUsageDetails.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ImageGenInputUsageDetails.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ImageGenUsage.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ImageGenUsage.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ImagesResponse.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ModelResponseProperties.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseLogProb.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseLogProb.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseLogProbTopLogprob.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseLogProbTopLogprob.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDeltaEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDeltaEventDelta.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDoneEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDoneEventArguments.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDoneEventArguments.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallCompletedEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallFailedEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPListToolsCompletedEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPListToolsFailedEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPListToolsInProgressEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseReasoningDeltaEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseReasoningDeltaEventDelta.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseReasoningDeltaEventType.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseReasoningDoneEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseReasoningDoneEventType.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseStreamEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseTextDeltaEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseTextDoneEvent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ServiceTier.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VoiceIdsSharedEnum.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/tryAGI.OpenAI/openapi.yaml(23 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test / Build, test and publish
🔇 Additional comments (2)
src/libs/tryAGI.OpenAI/openapi.yaml (2)
21464-21465: Example payload is syntactically invalid JSON
"delta": "{",is just an opening brace and isn’t valid JSON. Consider using a minimal but complete example (or an obvious JSON fragment such as"{"arg": "value"}").
22260-22264: Confirm cardinality oflogprobs
logprobsis an array withoutminItems/maxItems. If the intention is to mirror the “top-20” behaviour noted intop_logprobs, consider enforcingmaxItems: 20(or documenting why the bound is omitted).
| - interpreting | ||
| - failed | ||
| type: string | ||
| description: "The status of the code interpreter tool call.\n" | ||
| description: "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n" | ||
| type: |
There was a problem hiding this comment.
🛠️ Refactor suggestion
incomplete status missing from the enum
The description lists five valid status values but the enum shown in the spec fragment only contains interpreting and failed (the rest may be above the snippet, but it is easy to miss). If incomplete is indeed a valid status, make sure it is explicitly present in the enum array, otherwise the schema and the documentation will diverge.
- - interpreting
- - failed
+ - in_progress
+ - completed
+ - incomplete
+ - interpreting
+ - failedCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 9057 to 9061, the enum for
status values is missing the 'incomplete' entry, which is listed as a valid
status in the description. Add 'incomplete' explicitly to the enum array to
ensure the schema matches the documented valid status values and avoid
divergence between the schema and documentation.
Summary by CodeRabbit
New Features
Improvements
Removals