Skip to main content
本页介绍如何在 LangChain 中使用 Metal

什么是 Metal?

Metal 是一款专为生产环境构建的托管检索与记忆平台。轻松将您的数据索引到 Metal,并在其上运行语义搜索和检索。

快速开始

首先创建 Metal 账户 然后,您可以轻松利用 MetalRetriever 类开始检索数据,用于语义搜索、提示词上下文等。该类接受一个 Metal 实例和传递给 Metal API 的参数字典。
from langchain_classic.retrievers import MetalRetriever
from metal_sdk.metal import Metal


metal = Metal("API_KEY", "CLIENT_ID", "INDEX_ID");
retriever = MetalRetriever(metal, params={"limit": 2})

docs = retriever.invoke("search term")