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 @@ -21,6 +21,13 @@ public sealed partial class TranscriptOptionalParamsSpeakerOptions
[global::System.Text.Json.Serialization.JsonPropertyName("max_speakers_expected")]
public int? MaxSpeakersExpected { get; set; }

/// <summary>
/// When `true`, includes a `speaker_confidence` field per word and per utterance in the response. See [Speaker Diarization](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers#configuration) for more details.<br/>
/// Default Value: false
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("include_speaker_confidence")]
public bool? IncludeSpeakerConfidence { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -37,15 +44,21 @@ public sealed partial class TranscriptOptionalParamsSpeakerOptions
/// &lt;Warning&gt;Setting this parameter too high may hurt model accuracy&lt;/Warning&gt;<br/>
/// A hard upper limit on the number of speaker labels. If more people speak than this value, the additional speakers are merged into existing labels. Setting it higher than the true number of speakers can cause the model to over-split and return more speakers than are actually present. The default depends on audio duration: no limit for 0-2 minutes, 10 for 2-10 minutes, and 30 for 10+ minutes. See [Set a range of possible speakers](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers#set-a-range-of-possible-speakers) for more details.
/// </param>
/// <param name="includeSpeakerConfidence">
/// When `true`, includes a `speaker_confidence` field per word and per utterance in the response. See [Speaker Diarization](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers#configuration) for more details.<br/>
/// Default Value: false
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public TranscriptOptionalParamsSpeakerOptions(
int? minSpeakersExpected,
int? maxSpeakersExpected)
int? maxSpeakersExpected,
bool? includeSpeakerConfidence)
{
this.MinSpeakersExpected = minSpeakersExpected;
this.MaxSpeakersExpected = maxSpeakersExpected;
this.IncludeSpeakerConfidence = includeSpeakerConfidence;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public sealed partial class TranscriptUtterance
[global::System.Text.Json.Serialization.JsonRequired]
public required string Speaker { get; set; }

/// <summary>
/// The confidence score for the speaker label of this utterance, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("speaker_confidence")]
public double? SpeakerConfidence { get; set; }

/// <summary>
/// Translations keyed by language code (e.g., `{"es": "Texto traducido", "de": "Übersetzter Text"}`). Only present when `match_original_utterance` is enabled with translation.
/// </summary>
Expand Down Expand Up @@ -93,6 +99,9 @@ public sealed partial class TranscriptUtterance
/// <param name="channel">
/// The channel of this utterance. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially.
/// </param>
/// <param name="speakerConfidence">
/// The confidence score for the speaker label of this utterance, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
/// </param>
/// <param name="translatedTexts">
/// Translations keyed by language code (e.g., `{"es": "Texto traducido", "de": "Übersetzter Text"}`). Only present when `match_original_utterance` is enabled with translation.
/// </param>
Expand All @@ -107,6 +116,7 @@ public TranscriptUtterance(
global::System.Collections.Generic.IList<global::AssemblyAI.TranscriptWord> words,
string speaker,
string? channel,
double? speakerConfidence,
global::System.Collections.Generic.Dictionary<string, string>? translatedTexts)
{
this.Confidence = confidence;
Expand All @@ -116,6 +126,7 @@ public TranscriptUtterance(
this.Words = words ?? throw new global::System.ArgumentNullException(nameof(words));
this.Channel = channel;
this.Speaker = speaker ?? throw new global::System.ArgumentNullException(nameof(speaker));
this.SpeakerConfidence = speakerConfidence;
this.TranslatedTexts = translatedTexts;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public sealed partial class TranscriptWord
[global::System.Text.Json.Serialization.JsonPropertyName("speaker")]
public string? Speaker { get; set; }

/// <summary>
/// The confidence score for the speaker label of this word, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("speaker_confidence")]
public double? SpeakerConfidence { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand Down Expand Up @@ -76,6 +82,9 @@ public sealed partial class TranscriptWord
/// <param name="speaker">
/// The speaker of the word if [Speaker Diarization](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers) is enabled, else null
/// </param>
/// <param name="speakerConfidence">
/// The confidence score for the speaker label of this word, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
Expand All @@ -85,14 +94,16 @@ public TranscriptWord(
int end,
string text,
string? channel,
string? speaker)
string? speaker,
double? speakerConfidence)
{
this.Confidence = confidence;
this.Start = start;
this.End = end;
this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text));
this.Channel = channel;
this.Speaker = speaker;
this.SpeakerConfidence = speakerConfidence;
}

/// <summary>
Expand Down
19 changes: 19 additions & 0 deletions src/libs/AssemblyAI/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,11 @@ components:
<Warning>Setting this parameter too high may hurt model accuracy</Warning>
A hard upper limit on the number of speaker labels. If more people speak than this value, the additional speakers are merged into existing labels. Setting it higher than the true number of speakers can cause the model to over-split and return more speakers than are actually present. The default depends on audio duration: no limit for 0-2 minutes, 10 for 2-10 minutes, and 30 for 10+ minutes. See [Set a range of possible speakers](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers#set-a-range-of-possible-speakers) for more details.
type: integer
include_speaker_confidence:
x-label: Include speaker confidence
description: When `true`, includes a `speaker_confidence` field per word and per utterance in the response. See [Speaker Diarization](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers#configuration) for more details.
type: boolean
default: false

speakers_expected:
x-label: Speakers expected
Expand Down Expand Up @@ -2262,6 +2267,13 @@ components:
x-label: Speaker
description: The speaker of this utterance, where each speaker is assigned a sequential capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc.
type: string
speaker_confidence:
x-label: Speaker confidence
description: The confidence score for the speaker label of this utterance, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
type: [number, "null"]
format: double
minimum: 0
maximum: 1
translated_texts:
x-label: Translated texts
description: 'Translations keyed by language code (e.g., `{"es": "Texto traducido", "de": "Übersetzter Text"}`). Only present when `match_original_utterance` is enabled with translation.'
Expand Down Expand Up @@ -5388,6 +5400,13 @@ components:
x-label: Speaker
description: The speaker of the word if [Speaker Diarization](https://www.assemblyai.com/docs/pre-recorded-audio/label-speakers) is enabled, else null
type: [string, "null"]
speaker_confidence:
x-label: Speaker confidence
description: The confidence score for the speaker label of this word, between 0 and 1. Only present when `speaker_options.include_speaker_confidence` is `true`.
type: [number, "null"]
format: double
minimum: 0
maximum: 1
example:
{
text: "Smoke",
Expand Down