OpenAI 转录

Spring AI 集成了 OpenAI 的 Whisper 模型,以实现语音转文本功能。

配置

将以下依赖项添加到您的项目中:

<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>

属性

spring.ai.openai.api-key=YOUR_API_KEY
spring.ai.openai.audio.model=whisper-1

用法

@Autowired
private TranscriptionClient transcriptionClient;

// 转录音频
TranscriptionResponse response = transcriptionClient.call(
    new TranscriptionPrompt(audioFile)
);

文档有误?请协助编辑

发现文档问题?点击此处直接在 GitHub 上编辑并提交 PR,帮助我们改进文档!