跳到主要内容

Open AI Whisper 音频

兼容性

仅在 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);

API 参考


此页面对您有帮助吗?


您也可以留下详细的反馈 在 GitHub 上.

© . This site is unofficial and not affiliated with LangChain, Inc.
这些文档随着 LangChain v1.0 在 2025 年 10 月的发布而弃用,并且不再维护。 请访问 v1.0 文档