-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat:Add and refactor InputAudio schema; update Tools and webhook JSON #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds InputAudio schema and integrates it into allowed input types and the inputs array. Refactors InputAudio to nest data/format under input_audio with required fields updated. Updates Tools description to reference SharePoint. Fixes webhook example JSON to use double quotes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as OpenAI-compatible API
participant Model as Model Runtime
Note over Client,API: Submit inputs including optional input_audio (mp3/wav)
Client->>API: POST /... with inputs [text|image|audio]
API->>API: Validate schema (input_audio.data, .format)
API->>Model: Dispatch request with mixed inputs
Model-->>API: Processed output (text/other)
API-->>Client: Response
alt Invalid audio format/data
API-->>Client: 4xx validation error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
src/libs/tryAGI.OpenAI/openapi.yaml (3)
16641-16655: Tighten schema: add format: byte and a property description.
- Mark base64 with format: byte for better tooling.
- Add a short description to input_audio.
Apply:
input_audio: + description: "Audio payload and format." required: - data - format type: object properties: data: type: string + format: byte description: "Base64-encoded audio data.\n" format: enum: - mp3 - wav type: string description: "The format of the audio data. Currently supported formats are `mp3` and `wav`.\n"
16656-16658: Align with other discriminated types: make type const.Other input_* schemas set x-stainless-const: true on type. Add it here for consistency and better codegen.
type: enum: - input_audio + x-stainless-const: true
16669-16671: Add discriminator mapping for input_audio.Explicit mapping improves client generation when multiple schemas share the discriminator.
discriminator: propertyName: type + mapping: + input_audio: '#/components/schemas/InputAudio'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (15)
src/libs/tryAGI.OpenAI/Generated/AnyOf.6.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/AnyOf.6.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.AnyOf6.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputAudioInputAudio1Format.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputAudioInputAudio1FormatNullable.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.InputContent.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.EvalItem.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputAudio.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputAudioInputAudio1.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputAudioInputAudio1.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputAudioInputAudio1Format.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputContent.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseProperties.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/tryAGI.OpenAI/openapi.yaml(5 hunks)
🔇 Additional comments (2)
src/libs/tryAGI.OpenAI/openapi.yaml (2)
14272-14275: Make sure arrays can carry audio items too.You added InputAudio to the union and updated the array title/description. Please verify that the array branch’s items.oneOf also includes InputAudio; otherwise arrays of inputs won’t accept audio elements.
24472-24472: Docs-only change LGTM.SharePoint mention and links read well. No structural OpenAPI impact.
| title: Input audio | ||
| required: | ||
| - type | ||
| - data | ||
| - format | ||
| - input_audio | ||
| type: object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid a breaking change: accept both nested and legacy flat shapes.
Refactoring data/format under input_audio breaks existing clients. Consider accepting both shapes and deprecating the flat one.
- required:
- - type
- - input_audio
+ oneOf:
+ - required: [type, input_audio]
+ - required: [type, data, format] # legacy
type: object
properties:
input_audio:
required:
- data
- format
type: object
properties:
data:
type: string
format: byte
description: "Base64-encoded audio data.\n"
format:
enum:
- mp3
- wav
type: string
description: "The format of the audio data. Currently supported formats are `mp3` and
`wav`.\n"
+ # Legacy flat shape (deprecated)
+ data:
+ deprecated: true
+ type: string
+ format: byte
+ description: "Deprecated: use input_audio.data."
+ format:
+ deprecated: true
+ type: string
+ enum: [mp3, wav]
+ description: "Deprecated: use input_audio.format."Also applies to: 16641-16655
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 16635-16639 and 16641-16655,
the schema change for input_audio is breaking clients that still send the legacy
flat shape; update the OpenAPI schema to accept both the new nested shape and
the old flat shape (use oneOf/anyOf or nullable/alternate properties) and add a
deprecation note for the flat shape, then update the server-side request
handling to detect the legacy flat payload and transform it into the nested
format before further processing, and include example payloads for both variants
in the spec.
| description: "Sent when Realtime API Receives a incoming SIP call.\n" | ||
| x-oaiMeta: | ||
| example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {'name': 'Max-Forwards', 'value': '63'},\n {'name': 'CSeq', 'value': '851287 INVITE'},\n {'name': 'Content-Type', 'value': 'application/sdp'},\n ]\n }\n}\n" | ||
| example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"},\n ]\n }\n}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammar and invalid JSON (trailing comma).
- “Receives a incoming” → “receives an incoming”.
- Remove trailing comma after the last element in sip_headers to make the JSON valid.
- description: "Sent when Realtime API Receives a incoming SIP call.\n"
+ description: "Sent when the Realtime API receives an incoming SIP call.\n"
@@
- example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"},\n ]\n }\n}\n"
+ example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"}\n ]\n }\n}\n"📝 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.
| description: "Sent when Realtime API Receives a incoming SIP call.\n" | |
| x-oaiMeta: | |
| example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {'name': 'Max-Forwards', 'value': '63'},\n {'name': 'CSeq', 'value': '851287 INVITE'},\n {'name': 'Content-Type', 'value': 'application/sdp'},\n ]\n }\n}\n" | |
| example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"},\n ]\n }\n}\n" | |
| description: "Sent when the Realtime API receives an incoming SIP call.\n" | |
| example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"realtime.call.incoming\",\n \"created_at\": 1719168000,\n \"data\": {\n \"call_id\": \"rtc_479a275623b54bdb9b6fbae2f7cbd408\",\n \"sip_headers\": [\n {\"name\": \"Max-Forwards\", \"value\": \"63\"},\n {\"name\": \"CSeq\", \"value\": \"851287 INVITE\"},\n {\"name\": \"Content-Type\", \"value\": \"application/sdp\"}\n ]\n }\n}\n" |
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 28873 to 28875, fix the
grammar and invalid JSON in the example: change the phrase “Receives a incoming”
to “receives an incoming” (or “receives an incoming request” if more context
desired) and remove the trailing comma after the last element in the sip_headers
array so the JSON parses correctly; update the YAML snippet accordingly to
reflect these edits.
Summary by CodeRabbit
New Features
Documentation