Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -434,58 +434,62 @@ public sealed partial class JsonSerializerContextTypes
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptOptionalParamsRedactPiiAudioOptions? Type102 { get; set; }
public global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions? Type102 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptOptionalParamsSpeakerOptions? Type103 { get; set; }
public byte[]? Type103 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptParams? Type104 { get; set; }
public global::AssemblyAI.TranscriptOptionalParamsRedactPiiAudioOptions? Type104 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptParamsVariant1? Type105 { get; set; }
public global::AssemblyAI.TranscriptOptionalParamsSpeakerOptions? Type105 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptReadyNotification? Type106 { get; set; }
public global::AssemblyAI.TranscriptParams? Type106 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptReadyStatus? Type107 { get; set; }
public global::AssemblyAI.TranscriptParamsVariant1? Type107 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptWebhookNotification? Type108 { get; set; }
public global::AssemblyAI.TranscriptReadyNotification? Type108 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.UploadedFile? Type109 { get; set; }
public global::AssemblyAI.TranscriptReadyStatus? Type109 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.WordSearchMatch? Type110 { get; set; }
public global::AssemblyAI.TranscriptWebhookNotification? Type110 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<int>? Type111 { get; set; }
public global::AssemblyAI.UploadedFile? Type111 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? Type112 { get; set; }
public global::AssemblyAI.WordSearchMatch? Type112 { get; set; }
/// <summary>
///
/// </summary>
public global::AssemblyAI.WordSearchResponse? Type113 { get; set; }
public global::System.Collections.Generic.IList<int>? Type113 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::AssemblyAI.WordSearchMatch>? Type114 { get; set; }
public global::System.Collections.Generic.IList<global::System.Collections.Generic.IList<int>>? Type114 { get; set; }
/// <summary>
///
/// </summary>
public byte[]? Type115 { get; set; }
public global::AssemblyAI.WordSearchResponse? Type115 { get; set; }
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.IList<global::AssemblyAI.WordSearchMatch>? Type116 { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public sealed partial class TranscriptOptionalParams
[global::System.Text.Json.Serialization.JsonPropertyName("language_detection")]
public bool? LanguageDetection { get; set; }

/// <summary>
/// Specify options for Automatic Language Detection.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("language_detection_options")]
public global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions? LanguageDetectionOptions { get; set; }

/// <summary>
/// Enable [Multichannel](https://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) transcription, can be true or false.<br/>
/// Default Value: false
Expand Down Expand Up @@ -377,6 +383,9 @@ public sealed partial class TranscriptOptionalParams
/// Enable [Automatic language detection](https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection), either true or false.<br/>
/// Default Value: false
/// </param>
/// <param name="languageDetectionOptions">
/// Specify options for Automatic Language Detection.
/// </param>
/// <param name="multichannel">
/// Enable [Multichannel](https://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) transcription, can be true or false.<br/>
/// Default Value: false
Expand Down Expand Up @@ -475,6 +484,7 @@ public TranscriptOptionalParams(
object? languageCode,
float? languageConfidenceThreshold,
bool? languageDetection,
global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions? languageDetectionOptions,
bool? multichannel,
bool? punctuate,
bool? redactPii,
Expand Down Expand Up @@ -514,6 +524,7 @@ public TranscriptOptionalParams(
this.LanguageCode = languageCode;
this.LanguageConfidenceThreshold = languageConfidenceThreshold;
this.LanguageDetection = languageDetection;
this.LanguageDetectionOptions = languageDetectionOptions;
this.Multichannel = multichannel;
this.Punctuate = punctuate;
this.RedactPii = redactPii;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#nullable enable

namespace AssemblyAI
{
public sealed partial class TranscriptOptionalParamsLanguageDetectionOptions
{
/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public string ToJson(
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions),
jsonSerializerContext) as global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions>(
json,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerContext.
/// </summary>
public static async global::System.Threading.Tasks.ValueTask<global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
jsonStream,
typeof(global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions),
jsonSerializerContext).ConfigureAwait(false)) as global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions;
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::System.Threading.Tasks.ValueTask<global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::AssemblyAI.TranscriptOptionalParamsLanguageDetectionOptions?>(
jsonStream,
jsonSerializerOptions);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

#nullable enable

namespace AssemblyAI
{
/// <summary>
/// Specify options for Automatic Language Detection.
/// </summary>
public sealed partial class TranscriptOptionalParamsLanguageDetectionOptions
{
/// <summary>
/// List of languages expected in the audio file.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("expected_languages")]
public byte[]? ExpectedLanguages { get; set; }

/// <summary>
/// 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.<br/>
/// Default Value: auto
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("fallback_language")]
public string? FallbackLanguage { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();

/// <summary>
/// Initializes a new instance of the <see cref="TranscriptOptionalParamsLanguageDetectionOptions" /> class.
/// </summary>
/// <param name="expectedLanguages">
/// List of languages expected in the audio file.
/// </param>
/// <param name="fallbackLanguage">
/// 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.<br/>
/// Default Value: auto
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public TranscriptOptionalParamsLanguageDetectionOptions(
byte[]? expectedLanguages,
string? fallbackLanguage)
{
this.ExpectedLanguages = expectedLanguages;
this.FallbackLanguage = fallbackLanguage;
}

/// <summary>
/// Initializes a new instance of the <see cref="TranscriptOptionalParamsLanguageDetectionOptions" /> class.
/// </summary>
public TranscriptOptionalParamsLanguageDetectionOptions()
{
}
}
}
20 changes: 20 additions & 0 deletions src/libs/AssemblyAI/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,26 @@ components:
type: boolean
default: false

language_detection_options:
x-label: Specify options for Automatic Language Detection.
description: Specify options for Automatic Language Detection.
type: object
additionalProperties: false
properties:
expected_languages:
x-label: Minimum speakers expected
description: List of languages expected in the audio file.
type: array
objects:
x-label: language
type: string
Comment on lines +1262 to +1268
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Fix invalid OpenAPI keyword and align types with TranscriptLanguageCode

  • Replace non-standard "objects" with "items" (breaks validation/codegen).
  • Correct mislabeled x-label and item typing; allow either known codes or custom strings like language_code does.
             expected_languages:
-              x-label: Minimum speakers expected
-              description: List of languages expected in the audio file.
-              type: array
-              objects:
-                x-label: language
-                type: string
+              x-label: Expected languages
+              description: List of expected language codes (see TranscriptLanguageCode).
+              type: array
+              items:
+                x-label: Language
+                anyOf:
+                  - $ref: "#/components/schemas/TranscriptLanguageCode"
+                  - type: string
+              x-ts-type: Array<LiteralUnion<TranscriptLanguageCode, string>>
📝 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
expected_languages:
x-label: Expected languages
description: List of expected language codes (see TranscriptLanguageCode).
type: array
items:
x-label: Language
anyOf:
- $ref: "#/components/schemas/TranscriptLanguageCode"
- type: string
x-ts-type: Array<LiteralUnion<TranscriptLanguageCode, string>>
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1262 to 1268, the schema uses
the non-standard keyword "objects" and has a mislabeled x-label/type; replace
"objects" with "items", change the x-label to "language" (or remove if
redundant), and make items a string type that matches the TranscriptLanguageCode
behavior (i.e., allow known language codes but accept custom strings — implement
as type: string with the same enum/ref as TranscriptLanguageCode if available or
leave unconstrained string to allow custom codes). Ensure description remains
"List of languages expected in the audio file."

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.
type: string
default: "auto"

Comment on lines +1270 to +1275
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Make fallback_language schema consistent; fix doc that suggests an array

  • The description instructs to set ["auto"] (array) but the field is a string. Use "auto".
  • Also model the type as union of "auto" or a language code (or custom string), mirroring language_code.
             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.
-              type: string
-              default: "auto"
+              description: |
+                If the detected language is not in `expected_languages`, use this fallback.
+                Set to `"auto"` to let the model choose the fallback from `expected_languages` with the highest confidence.
+              anyOf:
+                - enum: ["auto"]
+                - $ref: "#/components/schemas/TranscriptLanguageCode"
+                - 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 is not in `expected_languages`, use this fallback.
Set to `"auto"` to let the model choose the fallback from `expected_languages` with the highest confidence.
anyOf:
- enum: ["auto"]
- $ref: "#/components/schemas/TranscriptLanguageCode"
- type: string
default: "auto"
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1270 to 1275, the
fallback_language entry is inconsistent: the description suggests an array
["auto"] while the schema types as string; update the description to reference
"auto" (not ["auto"]) and change the schema to mirror language_code by modeling
a union that allows the literal "auto" or a language code/custom string (e.g.,
enum/oneOf or pattern-based string) so the field accepts either the special
"auto" token or a language identifier; ensure the default remains "auto" and
update any wording to clarify behavior when "auto" is used.

language_confidence_threshold:
x-label: Language confidence threshold
description: |
Expand Down
Loading