ISpeechSynthesizer
AgentPrism.Abstractions.dllA provider that generates speech from text.
public interface ISpeechSynthesizerRemarks
Section titled “Remarks”ElevenLabs is an implementation, not a dependency. A consumer wanting another provider registers their own implementation; tools know only this contract.
The contract lives HERE, not in AgentPrism.Voice: the HTTP layer
(AgentPrism.AspNetCore) sees these types while serving the voice
endpoints, but it CANNOT reference AgentPrism.Voice (the package
direction rule). The same pattern was applied to the MCP abstractions —.
Properties
Section titled “Properties”MaxCharactersPerRequest
Section titled “ MaxCharactersPerRequest”The maximum number of characters accepted in a single ISpeechSynthesizer.SynthesizeAsync call.
int MaxCharactersPerRequest { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The tool call (speak) AND the direct HTTP operator endpoint
(POST /api/voice/speak) read the SAME value — the limit is
applied consistently across both paths.
ProviderName
Section titled “ ProviderName”The provider name. Used in cost records and health checks.
string ProviderName { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”ListVoicesAsync(CancellationToken)
Section titled “ ListVoicesAsync(CancellationToken)”Lists the available voices.
ValueTask<IReadOnlyList<VoiceDescriptor>> ListVoicesAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<VoiceDescriptor>>
The voices, ordered by name.
SynthesizeAsync(SpeechRequest, CancellationToken)
Section titled “ SynthesizeAsync(SpeechRequest, CancellationToken)”Synthesizes speech from a text.
ValueTask<SpeechAudio> SynthesizeAsync(SpeechRequest request, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”request SpeechRequest
The request.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The generated audio.
SynthesizeStreamingAsync(SpeechRequest, CancellationToken)
Section titled “ SynthesizeStreamingAsync(SpeechRequest, CancellationToken)”Synthesizes speech from a text and streams the audio piece by piece.
IAsyncEnumerable<ReadOnlyMemory<byte>> SynthesizeStreamingAsync(SpeechRequest request, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”request SpeechRequest
The request.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”IAsyncEnumerable<ReadOnlyMemory<byte>>
The audio chunks.
Remarks
Section titled “Remarks”The streaming path is for low latency, and the voice layer uses it. The signature is defined now: adding a member to an interface later is a breaking change for consumers implementing that interface.
Streamed audio is not stored as an attachment. The
billed quantity is unknown until the stream ends, and the chunks are
not a valid file on their own; the speak tool uses the
non-streaming path for this reason.