.NET: Support custom audio-to-text endpoints - #14252
Conversation
Signed-off-by: LauraGPT <lauragpt@users.noreply.github.com>
|
@LauraGPT please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
2 similar comments
|
@LauraGPT please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
@LauraGPT please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
This PR extends the .NET OpenAI audio-to-text connector to support OpenAI-compatible custom endpoints (e.g., self-hosted transcription servers) via new Uri endpoint overloads and corresponding DI/kernel-builder registrations, with API keys being optional for such endpoints.
Changes:
- Added a custom-endpoint constructor overload to
OpenAIAudioToTextServiceallowing optional API key. - Added matching
AddOpenAIAudioToTextoverloads forIKernelBuilderandIServiceCollection. - Added unit tests validating custom endpoint usage (including
/audio/transcriptionsrouting) and a Concepts sample (skipped) demonstrating FunASR usage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Connectors/Connectors.OpenAI/Services/OpenAIAudioToTextService.cs | Adds a Uri endpoint constructor overload for OpenAI-compatible audio-to-text endpoints. |
| dotnet/src/Connectors/Connectors.OpenAI/Extensions/OpenAIServiceCollectionExtensions.cs | Exposes the custom-endpoint overload through IServiceCollection DI registration. |
| dotnet/src/Connectors/Connectors.OpenAI/Extensions/OpenAIKernelBuilderExtensions.cs | Exposes the custom-endpoint overload through IKernelBuilder. |
| dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Services/OpenAIAudioToTextServiceTests.cs | Adds a test ensuring custom endpoint requests target {endpoint}/audio/transcriptions without an API key. |
| dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Extensions/ServiceCollectionExtensionsTests.cs | Adds DI registration test for the custom-endpoint overload. |
| dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Extensions/KernelBuilderExtensionsTests.cs | Adds kernel-builder registration test for the custom-endpoint overload. |
| dotnet/samples/Concepts/AudioToText/OpenAI_AudioToText.cs | Adds a skipped Concepts sample showing a local FunASR-style endpoint configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com>
Motivation and Context
The existing .NET audio-to-text connector can use a custom
OpenAIClient, but the standard kernel-builder and dependency-injection paths do not expose a custom endpoint and their API-key overload requires a key. This makes local OpenAI-compatible transcription services unnecessarily difficult to configure.This change enables self-hosted speech-to-text servers, including FunASR, through the existing
IAudioToTextServiceabstraction without adding provider-specific dependencies.Closes #14067
Description
Uri endpointoverload toOpenAIAudioToTextService.IKernelBuilderandIServiceCollection.{endpoint}/audio/transcriptions.http://localhost:8000/v1with thesensevoicemodel.The implementation follows the existing custom-endpoint pattern used by
OpenAIChatCompletionService.Validation
Connectors.OpenAIbuild/package: net10.0, net8.0, netstandard2.0; 0 warnings, 0 errorsdotnet format --verify-no-changes: passedgit diff --check: passedContribution Checklist