Class AzureOpenAiAudioTranscriptionModel

java.lang.Object
dev.langchain4j.model.azure.AzureOpenAiAudioTranscriptionModel
All Implemented Interfaces:
AudioTranscriptionModel

@Experimental public class AzureOpenAiAudioTranscriptionModel extends Object implements AudioTranscriptionModel
Represents an Azure OpenAI audio transcription model, such as Whisper.

You can find a tutorial on using Azure OpenAI for speech to text at: https://learn.microsoft.com/azure/ai-services/openai/whisper-quickstart

Mandatory parameters for initialization are:

  • endpoint: The Azure OpenAI endpoint URL
  • authentication: Either apiKey, tokenCredential (Azure Active Directory), or an existing OpenAIClient
  • deploymentName: The name of your Azure OpenAI audio model deployment

There are 3 authentication methods:

  1. Azure OpenAI API Key: The most common method using an Azure OpenAI API key. Use the apiKey() method in the Builder.
  2. Non-Azure OpenAI API Key: Use the OpenAI service directly (not Azure OpenAI). Use the nonAzureApiKey() method, which will automatically set the endpoint.
  3. Microsoft Entra ID (Azure Active Directory): Authenticate using Azure credentials. Requires the com.azure:azure-identity dependency. Use the tokenCredential() method with an appropriate credential implementation like DefaultAzureCredential.
  • Constructor Details

    • AzureOpenAiAudioTranscriptionModel

      public AzureOpenAiAudioTranscriptionModel(AzureOpenAiAudioTranscriptionModel.Builder builder)
      Creates a new AzureOpenAiAudioTranscriptionModel using the provided builder. This is the recommended constructor for future compatibility.
      Parameters:
      builder - The builder containing all the configuration
    • AzureOpenAiAudioTranscriptionModel

      public AzureOpenAiAudioTranscriptionModel(com.azure.ai.openai.OpenAIClient client, String deploymentName, com.azure.ai.openai.models.AudioTranscriptionFormat responseFormat)
      Creates a new AzureOpenAiAudioTranscriptionModel with the provided client and parameters. Use the builder for more convenient construction.
      Parameters:
      client - The Azure OpenAI client
      deploymentName - The deployment name of the audio model
      responseFormat - The response format (can be null for default JSON format)
  • Method Details