跳到主要内容
兼容性仅在 Node.js 上可用。
本文档介绍如何使用 Open AI Whisper API 从音频文件加载文档对象。

设置

要运行此加载器,您需要在 Open AI 上创建一个帐户,并从 https://platform.openai.com/account 页面获取身份验证密钥。

用法

配置身份验证密钥后,您可以使用加载器创建转录,然后将其转换为文档。
import { OpenAIWhisperAudio } from "@langchain/community/document_loaders/fs/openai_whisper_audio";

const filePath = "./src/document_loaders/example_data/test.mp3";

const loader = new OpenAIWhisperAudio(filePath, {
  transcriptionCreateParams: {
    language: "en",
  },
});

const docs = await loader.load();

console.log(docs);

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.