forked from admin/VolcanicAgenticCore
Spec 5: the HttpClient registration is named as AddHttpClient<ISpeechToText, OpenAiSpeechToText>() (package Microsoft.Extensions.Http), which is how Program.cs registers it.
12 lines
683 B
C#
12 lines
683 B
C#
namespace Volcanic.AgenticCore.Telegram.Speech;
|
|
|
|
/// <summary>Turns a voice note or audio file into text before a prompt exists. The core only ever sees the text.</summary>
|
|
public interface ISpeechToText
|
|
{
|
|
/// <summary>The trimmed transcript; throws <see cref="SpeechToTextException"/> when the service fails.</summary>
|
|
Task<string> TranscribeAsync(ReadOnlyMemory<byte> audio, string fileName, string mimeType, CancellationToken cancellationToken);
|
|
}
|
|
|
|
/// <summary>A transcription failed; the message is fit for the user and never contains the API key.</summary>
|
|
public sealed class SpeechToTextException(string message, Exception? inner = null) : Exception(message, inner);
|