5 implementations of ISpeechToTextClient
Microsoft.Extensions.AI.Abstractions (1)
SpeechToText\DelegatingSpeechToTextClient.cs (1)
22public class DelegatingSpeechToTextClient : ISpeechToTextClient
Microsoft.Extensions.AI.Abstractions.Tests (1)
TestSpeechToTextClient.cs (1)
12public sealed class TestSpeechToTextClient : ISpeechToTextClient
Microsoft.Extensions.AI.Integration.Tests (1)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestSpeechToTextClient.cs (1)
12public sealed class TestSpeechToTextClient : ISpeechToTextClient
Microsoft.Extensions.AI.OpenAI (1)
OpenAISpeechToTextClient.cs (1)
23internal sealed class OpenAISpeechToTextClient : ISpeechToTextClient
Microsoft.Extensions.AI.Tests (1)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestSpeechToTextClient.cs (1)
12public sealed class TestSpeechToTextClient : ISpeechToTextClient
132 references to ISpeechToTextClient
Microsoft.Extensions.AI (39)
SpeechToText\ConfigureOptionsSpeechToTextClient.cs (1)
33public ConfigureOptionsSpeechToTextClient(ISpeechToTextClient innerClient, Action<SpeechToTextOptions> configure)
SpeechToText\LoggingSpeechToTextClient.cs (3)
19/// The provided implementation of <see cref="ISpeechToTextClient"/> is thread-safe for concurrent use so long as the 32/// <param name="innerClient">The underlying <see cref="ISpeechToTextClient"/>.</param> 34public LoggingSpeechToTextClient(ISpeechToTextClient innerClient, ILogger logger)
SpeechToText\SpeechToTextClientBuilder.cs (18)
11/// <summary>A builder for creating pipelines of <see cref="ISpeechToTextClient"/>.</summary> 15private readonly Func<IServiceProvider, ISpeechToTextClient> _innerClientFactory; 18private List<Func<ISpeechToTextClient, IServiceProvider, ISpeechToTextClient>>? _clientFactories; 21/// <param name="innerClient">The inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 22public SpeechToTextClientBuilder(ISpeechToTextClient innerClient) 29/// <param name="innerClientFactory">A callback that produces the inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 30public SpeechToTextClientBuilder(Func<IServiceProvider, ISpeechToTextClient> innerClientFactory) 35/// <summary>Builds an <see cref="ISpeechToTextClient"/> that represents the entire pipeline. Calls to this instance will pass through each of the pipeline stages in turn.</summary> 37/// The <see cref="IServiceProvider"/> that should provide services to the <see cref="ISpeechToTextClient"/> instances. 40/// <returns>An instance of <see cref="ISpeechToTextClient"/> that represents the entire pipeline.</returns> 41public ISpeechToTextClient Build(IServiceProvider? services = null) 44var audioClient = _innerClientFactory(services); 54$"Ensure that the callbacks passed to {nameof(Use)} return non-null {nameof(ISpeechToTextClient)} instances."); 64public SpeechToTextClientBuilder Use(Func<ISpeechToTextClient, ISpeechToTextClient> clientFactory) 74public SpeechToTextClientBuilder Use(Func<ISpeechToTextClient, IServiceProvider, ISpeechToTextClient> clientFactory)
SpeechToText\SpeechToTextClientBuilderServiceCollectionExtensions.cs (15)
11/// <summary>Provides extension methods for registering <see cref="ISpeechToTextClient"/> with a <see cref="IServiceCollection"/>.</summary> 15/// <summary>Registers a singleton <see cref="ISpeechToTextClient"/> in the <see cref="IServiceCollection"/>.</summary> 17/// <param name="innerClient">The inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 23ISpeechToTextClient innerClient, 27/// <summary>Registers a singleton <see cref="ISpeechToTextClient"/> in the <see cref="IServiceCollection"/>.</summary> 29/// <param name="innerClientFactory">A callback that produces the inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 35Func<IServiceProvider, ISpeechToTextClient> innerClientFactory, 42serviceCollection.Add(new ServiceDescriptor(typeof(ISpeechToTextClient), builder.Build, lifetime)); 46/// <summary>Registers a keyed singleton <see cref="ISpeechToTextClient"/> in the <see cref="IServiceCollection"/>.</summary> 49/// <param name="innerClient">The inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 56ISpeechToTextClient innerClient, 60/// <summary>Registers a keyed singleton <see cref="ISpeechToTextClient"/> in the <see cref="IServiceCollection"/>.</summary> 63/// <param name="innerClientFactory">A callback that produces the inner <see cref="ISpeechToTextClient"/> that represents the underlying backend.</param> 70Func<IServiceProvider, ISpeechToTextClient> innerClientFactory, 78serviceCollection.Add(new ServiceDescriptor(typeof(ISpeechToTextClient), serviceKey, factory: (services, serviceKey) => builder.Build(services), lifetime));
SpeechToText\SpeechToTextClientBuilderSpeechToTextClientExtensions.cs (2)
9/// <summary>Provides extension methods for working with <see cref="ISpeechToTextClient"/> in the context of <see cref="SpeechToTextClientBuilder"/>.</summary> 20public static SpeechToTextClientBuilder AsBuilder(this ISpeechToTextClient innerClient)
Microsoft.Extensions.AI.Abstractions (19)
SpeechToText\DelegatingSpeechToTextClient.cs (5)
15/// Provides an optional base class for an <see cref="ISpeechToTextClient"/> that passes through calls to another instance. 18/// This is recommended as a base type when building clients that can be chained in any order around an underlying <see cref="ISpeechToTextClient"/>. 28protected DelegatingSpeechToTextClient(ISpeechToTextClient innerClient) 40/// <summary>Gets the inner <see cref="ISpeechToTextClient" />.</summary> 41protected ISpeechToTextClient InnerClient { get; }
SpeechToText\ISpeechToTextClient.cs (6)
16/// Unless otherwise specified, all members of <see cref="ISpeechToTextClient"/> are thread-safe for concurrent use. 17/// It is expected that all implementations of <see cref="ISpeechToTextClient"/> support being used by multiple requests concurrently. 20/// However, implementations of <see cref="ISpeechToTextClient"/> might mutate the arguments supplied to <see cref="GetTextAsync"/> and 23/// <see cref="ISpeechToTextClient"/> instances are used which might employ such mutation. For example, the ConfigureOptions method be 51/// <summary>Asks the <see cref="ISpeechToTextClient"/> for an object of the specified type <paramref name="serviceType"/>.</summary> 57/// The purpose of this method is to allow for the retrieval of strongly typed services that might be provided by the <see cref="ISpeechToTextClient"/>,
SpeechToText\SpeechToTextClientExtensions.cs (6)
14/// <summary>Extensions for <see cref="ISpeechToTextClient"/>.</summary> 18/// <summary>Asks the <see cref="ISpeechToTextClient"/> for an object of type <typeparamref name="TService"/>.</summary> 24/// The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the <see cref="ISpeechToTextClient"/>, 27public static TService? GetService<TService>(this ISpeechToTextClient client, object? serviceKey = null) 41this ISpeechToTextClient client, 63this ISpeechToTextClient client,
SpeechToText\SpeechToTextClientMetadata.cs (1)
9/// <summary>Provides metadata about an <see cref="ISpeechToTextClient"/>.</summary>
SpeechToText\SpeechToTextResponseUpdate.cs (1)
15/// Represents a single streaming response chunk from an <see cref="ISpeechToTextClient"/>.
Microsoft.Extensions.AI.Abstractions.Tests (5)
SpeechToText\DelegatingSpeechToTextClientTests.cs (3)
127var client = delegating.GetService<ISpeechToTextClient>(expectedKey); 164private sealed class NoOpDelegatingSpeechToTextClient(ISpeechToTextClient innerClient)
SpeechToText\SpeechToTextClientExtensionsTests.cs (2)
27ISpeechToTextClient? client = null; 41ISpeechToTextClient? client = null;
Microsoft.Extensions.AI.Integration.Tests (2)
SpeechToTextClientIntegrationTests.cs (2)
18private readonly ISpeechToTextClient? _client; 31protected abstract ISpeechToTextClient? CreateClient();
Microsoft.Extensions.AI.OpenAI (4)
OpenAIClientExtensions.cs (3)
40/// <summary>Gets an <see cref="ISpeechToTextClient"/> for use with this <see cref="AudioClient"/>.</summary> 42/// <returns>An <see cref="ISpeechToTextClient"/> that can be used to transcribe audio via the <see cref="AudioClient"/>.</returns> 44public static ISpeechToTextClient AsISpeechToTextClient(this AudioClient audioClient) =>
OpenAISpeechToTextClient.cs (1)
21/// <summary>Represents an <see cref="ISpeechToTextClient"/> for an OpenAI <see cref="OpenAIClient"/> or <see cref="OpenAI.Audio.AudioClient"/>.</summary>
Microsoft.Extensions.AI.OpenAI.Tests (14)
OpenAISpeechToTextClientIntegrationTests.cs (1)
8protected override ISpeechToTextClient? CreateClient()
OpenAISpeechToTextClientTests.cs (13)
41ISpeechToTextClient speechToTextClient = client.GetAudioClient(model).AsISpeechToTextClient(); 52ISpeechToTextClient speechToTextClient = audioClient.AsISpeechToTextClient(); 53Assert.Same(speechToTextClient, speechToTextClient.GetService<ISpeechToTextClient>()); 56using ISpeechToTextClient pipeline = speechToTextClient 64Assert.IsType<LoggingSpeechToTextClient>(pipeline.GetService<ISpeechToTextClient>()); 89using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 110using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 124using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 163using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 198using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 234using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 268using ISpeechToTextClient client = CreateSpeechToTextClient(httpClient, "whisper-1"); 280private static ISpeechToTextClient CreateSpeechToTextClient(HttpClient httpClient, string modelId) =>
Microsoft.Extensions.AI.Tests (49)
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (2)
42using ISpeechToTextClient innerClient = new TestSpeechToTextClient 59using var client = innerClient
SpeechToText\LoggingSpeechToTextClientTests.cs (17)
32Assert.Same(innerClient, innerClient.AsBuilder().UseLogging(NullLoggerFactory.Instance).Build().GetService(typeof(ISpeechToTextClient))); 57using ISpeechToTextClient innerClient = new TestSpeechToTextClient 65using ISpeechToTextClient client = innerClient 79entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetTextAsync)} invoked:") && entry.Message.Contains("\"speechLanguage\": \"pt\"")), 80entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetTextAsync)} completed:") && entry.Message.Contains("blue whale"))); 85entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetTextAsync)} invoked.") && !entry.Message.Contains("\"speechLanguage\": \"pt\"")), 86entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetTextAsync)} completed.") && !entry.Message.Contains("blue whale"))); 103using ISpeechToTextClient innerClient = new TestSpeechToTextClient 115using ISpeechToTextClient client = innerClient 132entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} invoked:") && entry.Message.Contains("\"speechLanguage\": \"pt\"")), 133entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} received update:") && entry.Message.Contains("blue")), 134entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} received update:") && entry.Message.Contains("whale")), 135entry => Assert.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} completed.", entry.Message)); 140entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} invoked.") && !entry.Message.Contains("speechLanguage")), 141entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} received update.") && !entry.Message.Contains("blue")), 142entry => Assert.True(entry.Message.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} received update.") && !entry.Message.Contains("whale")), 143entry => Assert.Contains($"{nameof(ISpeechToTextClient.GetStreamingTextAsync)} completed.", entry.Message));
SpeechToText\SpeechToTextClientDependencyInjectionPatterns.cs (30)
26var instance1 = scope1.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 27var instance1Copy = scope1.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 28var instance2 = scope2.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 50var instance1 = scope1.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 51var instance1Copy = scope1.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 52var instance2 = scope2.ServiceProvider.GetRequiredService<ISpeechToTextClient>(); 73Assert.Null(services.GetService<ISpeechToTextClient>()); 75var instance1 = scope1.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 76var instance1Copy = scope1.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 77var instance2 = scope2.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 99Assert.Null(services.GetService<ISpeechToTextClient>()); 101var instance1 = scope1.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 102var instance1Copy = scope1.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 103var instance2 = scope2.ServiceProvider.GetRequiredKeyedService<ISpeechToTextClient>("mykey"); 126Assert.Equal(typeof(ISpeechToTextClient), sd.ServiceType); 148Assert.Equal(typeof(ISpeechToTextClient), sd.ServiceType); 157public class SingletonMiddleware(ISpeechToTextClient inner, IServiceProvider services) : DelegatingSpeechToTextClient(inner) 159public new ISpeechToTextClient InnerClient => base.InnerClient;