Skip to content
Merged
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
fallback_language:
Comment on lines +1262 to +1269
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: use items (not objects) and correct label/schema for expected_languages.

Array schemas must use items. Current use of objects will break validation/SDK generation. Also the x-label is incorrect.

Apply:

-            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 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
📝 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
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1262 to 1269, the
expected_languages array schema is invalid: it uses "objects" and misplaces
x-label. Replace "objects" with "items", move the per-item x-label (if needed)
under items, and ensure items:type is string; keep the array-level
x-label/description/type as-is. Concretely, define expected_languages with type:
array, an optional x-label for the array, description, and an items block with
type: string and any per-item x-label/schema.

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

Align fallback_language description with type and constrain values.

Doc says specify ["auto"] (array) but the field is a string. Use "auto" (no brackets) and constrain to either a language code or the literal "auto".

-            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"
+            fallback_language:
+              x-label: Fallback language
+              description: |
+                If the detected language is not in `expected_languages`, this value is used. Set to "auto" to choose the highest-confidence language from `expected_languages`. Requires `expected_languages` to be non-empty when "auto" is used.
+              anyOf:
+                - $ref: "#/components/schemas/TranscriptLanguageCode"
+                - type: string
+                  enum: ["auto"]
+              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`, this value is used. Set to "auto" to choose the highest-confidence language from `expected_languages`. Requires `expected_languages` to be non-empty when "auto" is used.
anyOf:
- $ref: "#/components/schemas/TranscriptLanguageCode"
- type: string
enum: ["auto"]
default: "auto"
🤖 Prompt for AI Agents
In src/libs/AssemblyAI/openapi.yaml around lines 1270-1275, the description
incorrectly refers to ["auto"] (an array) while the field is defined as a
string; update the description to say use "auto" (a string) and then add a
constraint so the value must be either the literal "auto" or a valid language
code (e.g., BCP-47); implement that constraint via an enum of allowed literals
or a regex/pattern that permits "auto" or language codes and adjust the
description to reflect the allowed values.

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