使用 Azure OpenAI 的 Whisper 模型进行语音转文本
Spring AI 集成了 Azure OpenAI 的 Whisper 模型,以实现语音转文本功能。
将以下依赖项添加到您的项目中:
<dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId> </dependency>
spring.ai.azure.openai.api-key=YOUR_API_KEY spring.ai.azure.openai.endpoint=YOUR_ENDPOINT spring.ai.azure.openai.audio.model=whisper-1
@Autowired private TranscriptionClient transcriptionClient; // 转录音频 TranscriptionResponse response = transcriptionClient.call( new TranscriptionPrompt(audioFile) );
发现文档问题?点击此处直接在 GitHub 上编辑并提交 PR,帮助我们改进文档!