How to call a specific public base model ID in Streaming Speech-To-Text SDK ?

Kun Wu 146 Reputation points Microsoft Employee
2024-03-25T04:39:51.89+00:00

Hello Speech-To-Text SDK team,

With Batch API i can call specific public base model ID (if not default) per https://learn.microsoft.com/en-us/azure/ai-services/speech-service/batch-transcription-create?pivots=rest-api#use-a-custom-model

Do you know with real-time Streaming API SDK, how can i call the same public specific base mode ID directly ?

Thank you.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,778 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2024-03-25T04:39:51.91+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To call a specific public base model ID in the Streaming Speech-To-Text SDK, you can specify the model ID in the SpeechConfig object when creating a SpeechRecognizer instance. Here's an example in C#:

    // Replace "YourSubscriptionKey" and "YourServiceRegion" with your own values
    var config = SpeechConfig.FromSubscription("YourSubscriptionKey", "YourServiceRegion");
    config.SpeechRecognitionLanguage = "en-US";
    config.SetProperty("cid", Guid.NewGuid().ToString()); // Optional: set a client ID for logging purposes
    config.SetProperty("modelId", "YourBaseModelId"); // Replace "YourBaseModelId" with the ID of the base model you want to use
    
    using var recognizer = new SpeechRecognizer(config);
    

    And here's an example in Java:

    // Replace "YourSubscriptionKey" and "YourServiceRegion" with your own values
    SpeechConfig config = SpeechConfig.fromSubscription("YourSubscriptionKey", "YourServiceRegion");
    config.setSpeechRecognitionLanguage("en-US");
    config.setProperty("cid", UUID.randomUUID().toString()); // Optional: set a client ID for logging purposes
    config.setProperty("modelId", "YourBaseModelId"); // Replace "YourBaseModelId" with the ID of the base model you want to use
    
    try (SpeechRecognizer recognizer = new SpeechRecognizer(config)) {
        // Use the recognizer
    }
    

    Note that the modelId property is only applicable to the following locales: en-US, en-GB, de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, nl-NL, pt-BR, zh-CN, and zh-HK.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.