Skip to main content

Metal 检索器

此示例展示了如何在检索链中使用 Metal 检索器,从 Metal 索引中检索文档。

安装配置

:::提示 请参阅安装集成包的一般说明部分。 :::

npm i @getmetal/metal-sdk @langchain/community @langchain/core

使用方法

/* eslint-disable @typescript-eslint/no-non-null-assertion */
import Metal from "@getmetal/metal-sdk";
import { MetalRetriever } from "@langchain/community/retrievers/metal";

export const run = async () => {
const MetalSDK = Metal;

const client = new MetalSDK(
process.env.METAL_API_KEY!,
process.env.METAL_CLIENT_ID!,
process.env.METAL_INDEX_ID
);
const retriever = new MetalRetriever({ client });

const docs = await retriever.invoke("hello");

console.log(docs);
};

API Reference:

相关内容


Was this page helpful?


You can also leave detailed feedback on GitHub.