-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat:Add language_detection_options to TranscriptOptionalParams #118
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 a new language_detection_options object to TranscriptOptionalParams in src/libs/AssemblyAI/openapi.yaml, introducing expected_languages (array of strings) and fallback_language (string, default "auto"). No other fields are changed. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant API as Transcript API
participant Lang as Language Detector
Client->>API: Create transcript (language_detection_options)
API->>Lang: Detect language from audio
Lang-->>API: Detected language + confidences
alt Detected ∈ expected_languages
API-->>Client: Use detected language
else Not in expected_languages
alt fallback_language == "auto"
API->>API: Select highest-confidence from expected_languages
else fallback_language specified
API->>API: Use specified fallback_language
end
API-->>Client: Use fallback selection
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ 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 (2)
src/libs/AssemblyAI/openapi.yaml (2)
1263-1264: Incorrect x-label copy/paste on expected_languages“Minimum speakers expected” is unrelated and likely pasted from speaker_options. Use a label that matches the field’s purpose.
See the label fix in the diff in my previous comment.
1256-1261: Refinelanguage_detection_optionsvalidation & labelsVerified that there are no accidental array-schema misuses (no
objects:under arrays) and no lingering["auto"]examples. Now please apply the following optional refactors to strengthen validation and improve ergonomics:• In components.schemas.TranscriptOptionalParams, add a
dependentRequiredrule so thatlanguage_detection_optionscan only be provided whenlanguage_detectionis true:components: schemas: TranscriptOptionalParams: type: object # … existing properties … dependentRequired: language_detection_options: - language_detection• Harmonize labels/descriptions for clarity and to avoid duplication:
- language_detection_options: - x-label: Specify options for Automatic Language Detection. - description: Specify options for Automatic Language Detection. + language_detection_options: + x-label: Automatic language detection options + description: Options for Automatic Language Detection.• (Optional) Update your example usages under
components.examplesfor bothTranscriptParamsandTranscriptOptionalParamsto illustrate correct patterns, e.g.:components: examples: TranscriptOptionalParamsExample: summary: Enable language detection with expected and fallback languages value: language_detection: true language_detection_options: expected_languages: ["en", "es"] fallback_language: "en"
📜 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 (4)
src/libs/AssemblyAI/Generated/AssemblyAI.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParams.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParamsLanguageDetectionOptions.Json.g.csis excluded by!**/generated/**src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParamsLanguageDetectionOptions.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/AssemblyAI/openapi.yaml(1 hunks)
| expected_languages: | ||
| x-label: Minimum speakers expected | ||
| description: List of languages expected in the audio file. | ||
| type: array | ||
| objects: | ||
| x-label: language | ||
| type: string | ||
| fallback_language: |
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
Array schema bug: use items, not objects, and type the array elements
In JSON Schema/OpenAPI, arrays must declare items, not objects. As written, expected_languages will fail validation and codegen.
Apply this diff to fix the array definition and strongly type elements:
expected_languages:
- x-label: Minimum speakers expected
+ x-label: Expected languages
description: List of languages expected in the audio file.
type: array
- objects:
- x-label: language
- type: string
+ items:
+ anyOf:
+ - $ref: "#/components/schemas/TranscriptLanguageCode"
+ - type: string
+ x-ts-type: LiteralUnion<TranscriptLanguageCode, string>
+ minItems: 1
+ uniqueItems: true📝 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.
| expected_languages: | |
| x-label: Minimum speakers expected | |
| description: List of languages expected in the audio file. | |
| type: array | |
| objects: | |
| x-label: language | |
| type: string | |
| fallback_language: | |
| expected_languages: | |
| x-label: Expected languages | |
| description: List of languages expected in the audio file. | |
| type: array | |
| items: | |
| anyOf: | |
| - $ref: "#/components/schemas/TranscriptLanguageCode" | |
| - type: string | |
| x-ts-type: LiteralUnion<TranscriptLanguageCode, string> | |
| minItems: 1 | |
| uniqueItems: true | |
| fallback_language: |
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1262 to 1269, the array schema
for expected_languages incorrectly uses "objects" causing validation/codegen
failures; replace "objects" with "items" and move the element typing/metadata
under items so the array stays type: array and each element is typed as string
(e.g., items: type: string and items: x-label: language).
| x-label: Fallback language | ||
| description: | | ||
| If the detected language of the audio file is not in the list of expected languages, the `fallback_language` is used. Specify `["auto"]` to let our model choose the fallback language from `expected_languages` with the highest confidence score. | ||
| type: string | ||
| default: "auto" | ||
|
|
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.
Doc/type mismatch: fallback_language is a string but docs say ["auto"]
The description instructs to set ["auto"], which contradicts the string type and default "auto". This will confuse users and SDK docs.
Apply this diff to correct the guidance:
fallback_language:
x-label: Fallback language
description: |
- If the detected language of the audio file is not in the list of expected languages, the `fallback_language` is used. Specify `["auto"]` to let our model choose the fallback language from `expected_languages` with the highest confidence score.
+ If the detected language of the audio file is not in `expected_languages`, this value is used. Specify `"auto"` to let our model choose a fallback from `expected_languages` with the highest confidence score.
type: string
default: "auto"📝 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.
| x-label: Fallback language | |
| description: | | |
| If the detected language of the audio file is not in the list of expected languages, the `fallback_language` is used. Specify `["auto"]` to let our model choose the fallback language from `expected_languages` with the highest confidence score. | |
| type: string | |
| default: "auto" | |
| fallback_language: | |
| x-label: Fallback language | |
| description: | | |
| If the detected language of the audio file is not in `expected_languages`, this value is used. Specify `"auto"` to let our model choose a fallback from `expected_languages` with the highest confidence score. | |
| type: string | |
| default: "auto" |
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1270-1275, the description
incorrectly shows ["auto"] which implies an array while the schema type is
string and default is "auto"; update the description to reference the string
value "auto" (remove the square brackets) so it matches the type and default,
and ensure any example or related docs in this block reflect the string form
"auto".
Pull request was closed
Summary by CodeRabbit