Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 26, 2025

Summary by CodeRabbit

  • New Features
    • Added language detection options for transcripts. Specify expected languages to guide detection and set a fallback language when the detected language isn’t in the expected list. If fallback is set to “auto” (default), the most confident expected language is chosen automatically. Existing workflows continue to work with defaults unchanged.

@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
AssemblyAI OpenAPI schema
src/libs/AssemblyAI/openapi.yaml
Added language_detection_options to TranscriptOptionalParams with expected_languages (string array) and fallback_language (string, default "auto"). No changes to existing fields.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at tongues anew,
A list of sounds I now can view—
If words hop far from fields I know,
A fallback path will softly show.
With YAML burrows neat and tight,
I parse the chatter through the night. 🐇✨

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508261826

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) August 26, 2025 18:27
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add language_detection_options to TranscriptOptionalParams Aug 26, 2025
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: 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: Refine language_detection_options validation & labels

Verified 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 dependentRequired rule so that language_detection_options can only be provided when language_detection is 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.examples for both TranscriptParams and TranscriptOptionalParams to 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.

📥 Commits

Reviewing files that changed from the base of the PR and between c531b33 and 1943171.

⛔ Files ignored due to path filters (4)
  • src/libs/AssemblyAI/Generated/AssemblyAI.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParams.g.cs is excluded by !**/generated/**
  • src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParamsLanguageDetectionOptions.Json.g.cs is excluded by !**/generated/**
  • src/libs/AssemblyAI/Generated/AssemblyAI.Models.TranscriptOptionalParamsLanguageDetectionOptions.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/AssemblyAI/openapi.yaml (1 hunks)

Comment on lines +1262 to +1269
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:
Copy link

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.

Suggested change
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).

Comment on lines +1270 to +1275
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"

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
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".

@HavenDV HavenDV closed this Aug 27, 2025
auto-merge was automatically disabled August 27, 2025 11:18

Pull request was closed

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.

2 participants