# SpeechDialogueCapabilities

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.speechdialoguecapabilities/
> Summary: SpeechDialogueCapabilities: The limits of one dialogue request, as the provider states them.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The limits of one dialogue request, as the provider states them.

```csharp
public sealed record SpeechDialogueCapabilities : IEquatable<SpeechDialogueCapabilities>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.speechdialoguecapabilities/">SpeechDialogueCapabilities</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;SpeechDialogueCapabilities&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

The caller plans its requests from these values: a request over a limit is refused,
never split or truncated.

## Constructors

### <a id="Tracon_SpeechDialogueCapabilities__ctor"></a> SpeechDialogueCapabilities\(\)

```csharp
public SpeechDialogueCapabilities()
```

## Properties

### <a id="Tracon_SpeechDialogueCapabilities_MaxCharactersPerRequest"></a> MaxCharactersPerRequest

Gets the most characters one request can carry, summed over its turns.

```csharp
public required int MaxCharactersPerRequest { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_SpeechDialogueCapabilities_MaxVoices"></a> MaxVoices

Gets the most distinct voices one request can use.

```csharp
public required int MaxVoices { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_SpeechDialogueCapabilities_SupportsSegmentTimestamps"></a> SupportsSegmentTimestamps

Gets whether the provider reports each turn's time range when the request sets
`IncludeTimestamps`.

```csharp
public bool SupportsSegmentTimestamps { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

## Methods

### <a id="Tracon_SpeechDialogueCapabilities_Check_Tracon_SpeechDialogueRequest_System_String_System_String_"></a> Check\(SpeechDialogueRequest, string, string?\)

Checks a dialogue request against these limits.

```csharp
public int Check(SpeechDialogueRequest request, string providerName, string? characterLimitSetting = null)
```

#### Parameters

`request` [SpeechDialogueRequest](/api/tracon.speechdialoguerequest/)

The request.

`providerName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The provider name; the messages name it.

`characterLimitSetting` [string](https://learn.microsoft.com/dotnet/api/system.string)?

The name of the setting that sets [SpeechDialogueCapabilities.MaxCharactersPerRequest](/api/tracon.speechdialoguecapabilities/#Tracon_SpeechDialogueCapabilities_MaxCharactersPerRequest), or
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when no setting does. The message names it when it is given.

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

The characters of all turns: the estimate when the provider reports no count.

#### 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:

```csharp
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

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`request` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`providerName` is empty.

 [TraconException](/api/tracon.traconexception/)

The request has no turn, a turn is missing or has no text or no voice, the turns use more
than [SpeechDialogueCapabilities.MaxVoices](/api/tracon.speechdialoguecapabilities/#Tracon_SpeechDialogueCapabilities_MaxVoices) voices, or they carry more than [SpeechDialogueCapabilities.MaxCharactersPerRequest](/api/tracon.speechdialoguecapabilities/#Tracon_SpeechDialogueCapabilities_MaxCharactersPerRequest)
characters. The message never carries a turn's text.

### <a id="Tracon_SpeechDialogueCapabilities_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechDialogueCapabilities_Equals_Tracon_SpeechDialogueCapabilities_"></a> Equals\(SpeechDialogueCapabilities?\)

```csharp
public bool Equals(SpeechDialogueCapabilities? other)
```

#### Parameters

`other` [SpeechDialogueCapabilities](/api/tracon.speechdialoguecapabilities/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechDialogueCapabilities_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_SpeechDialogueCapabilities_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_SpeechDialogueCapabilities_op_Equality_Tracon_SpeechDialogueCapabilities_Tracon_SpeechDialogueCapabilities_"></a> operator ==\(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?\)

```csharp
public static bool operator ==(SpeechDialogueCapabilities? left, SpeechDialogueCapabilities? right)
```

#### Parameters

`left` [SpeechDialogueCapabilities](/api/tracon.speechdialoguecapabilities/)?

`right` [SpeechDialogueCapabilities](/api/tracon.speechdialoguecapabilities/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechDialogueCapabilities_op_Inequality_Tracon_SpeechDialogueCapabilities_Tracon_SpeechDialogueCapabilities_"></a> operator \!=\(SpeechDialogueCapabilities?, SpeechDialogueCapabilities?\)

```csharp
public static bool operator !=(SpeechDialogueCapabilities? left, SpeechDialogueCapabilities? right)
```

#### Parameters

`left` [SpeechDialogueCapabilities](/api/tracon.speechdialoguecapabilities/)?

`right` [SpeechDialogueCapabilities](/api/tracon.speechdialoguecapabilities/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
