.NET API
SpeechDialogueCapabilities
Tracon.Abstractions.dllThe limits of one dialogue request, as the provider states them.
public sealed record SpeechDialogueCapabilities : IEquatable<SpeechDialogueCapabilities>- Inheritance
- object ← SpeechDialogueCapabilities
- Implements
- IEquatable<SpeechDialogueCapabilities>
- Inherited Members
- object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”The caller plans its requests from these values: a request over a limit is refused, never split or truncated.
Constructors
Section titled “Constructors”SpeechDialogueCapabilities()
Section titled “ SpeechDialogueCapabilities()”public SpeechDialogueCapabilities()Properties
Section titled “Properties”MaxCharactersPerRequest
Section titled “ MaxCharactersPerRequest”Gets the most characters one request can carry, summed over its turns.
public required int MaxCharactersPerRequest { get; init; }Property Value
Section titled “Property Value”MaxVoices
Section titled “ MaxVoices”Gets the most distinct voices one request can use.
public required int MaxVoices { get; init; }Property Value
Section titled “Property Value”SupportsSegmentTimestamps
Section titled “ SupportsSegmentTimestamps”Gets whether the provider reports each turn’s time range when the request sets
IncludeTimestamps.
public bool SupportsSegmentTimestamps { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Check(SpeechDialogueRequest, string, string?)
Section titled “ Check(SpeechDialogueRequest, string, string?)”Checks a dialogue request against these limits.
public int Check(SpeechDialogueRequest request, string providerName, string? characterLimitSetting = null)Parameters
Section titled “Parameters”request SpeechDialogueRequest
The request.
providerName string
The provider name; the messages name it.
characterLimitSetting string?
The name of the setting that sets SpeechDialogueCapabilities.MaxCharactersPerRequest, or null when no setting does. The message names it when it is given.
Returns
Section titled “Returns”The characters of all turns: the estimate when the provider reports no count.
Remarks
Section titled “Remarks”The rule every dialogue implementation applies before it calls its service: a request over a limit is the caller’s to split, never the implementation’s to cut. An implementation that calls this method refuses the same requests the built-in ElevenLabs client refuses, in the same words.
A voice counts once however many turns use it, and the comparison is ordinal.
A dialogue implementation of your own refuses a request over its limits before it calls its service:
internal sealed class ContosoDialogueSynthesizer : ISpeechDialogueSynthesizer{ public string ProviderName => "contoso";
public SpeechDialogueCapabilities DialogueCapabilities { get; } = new() { MaxVoices = 2, MaxCharactersPerRequest = 1000, };
public ValueTask<SpeechDialogueAudio> SynthesizeDialogueAsync( SpeechDialogueRequest request, CancellationToken cancellationToken = default) { // Throws a TraconException that names the limit; the service is not called. var characters = DialogueCapabilities.Check(request, ProviderName);
// ... send the turns to the service and read the audio it answers ... var audio = new SpeechAudio { Data = Array.Empty<byte>(), MediaType = "audio/wav", CharactersBilled = characters, UsageSource = SpeechUsageSource.Estimated, };
return ValueTask.FromResult(new SpeechDialogueAudio { Audio = audio }); }}Exceptions
Section titled “Exceptions”request is null.
providerName is empty.
The request has no turn, a turn is missing or has no text or no voice, the turns use more than SpeechDialogueCapabilities.MaxVoices voices, or they carry more than SpeechDialogueCapabilities.MaxCharactersPerRequest characters. The message never carries a turn’s text.
Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(SpeechDialogueCapabilities?)
Section titled “ Equals(SpeechDialogueCapabilities?)”public bool Equals(SpeechDialogueCapabilities? other)Parameters
Section titled “Parameters”other SpeechDialogueCapabilities?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?)
Section titled “ operator ==(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?)”public static bool operator ==(SpeechDialogueCapabilities? left, SpeechDialogueCapabilities? right)Parameters
Section titled “Parameters”left SpeechDialogueCapabilities?
right SpeechDialogueCapabilities?
Returns
Section titled “Returns”operator !=(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?)
Section titled “ operator !=(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?)”public static bool operator !=(SpeechDialogueCapabilities? left, SpeechDialogueCapabilities? right)Parameters
Section titled “Parameters”left SpeechDialogueCapabilities?
right SpeechDialogueCapabilities?