Alchemyst AI 检索器
该 **Alchemyst AI 检索器** 使您的生成式 AI 应用能够检索相关的上下文和知识。它从 Alchemyst 平台获取这些信息。它提供统一的接口来访问、搜索和检索数据,以增强 LLM 和代理的响应。 ## 设置
- 如果您没有账户, 注册一个新账户 在 Alchemyst 平台上。
- 登录后,前往 **Alchemyst 平台设置** 获取您的 API 密钥。
npm i @alchemystai/langchain-js
yarn add @alchemystai/langchain-js
pnpm add @alchemystai/langchain-js
bun add @alchemystai/langchain-js
用法
dotenv.config();
// Instantiate the retriever with your API key and optional config
const retriever = new AlchemystRetriever({
apiKey: process.env.ALCHEMYST_AI_API_KEY!,
similarityThreshold: 0.8,
minimumSimilarityThreshold: 0.5,
scope: "internal"
});
// Example: Use the retriever in a LangChain pipeline
async function main() {
// Create a simple pipeline that retrieves documents and outputs their content
const pipeline = RunnableSequence.from([
async (input: string) => {
const docs = await retriever.getRelevantDocuments(input);
return docs.map(doc => doc.pageContent).join("\n---\n");
}
]);
const query = "Show me the latest HR policies"; // Put your business/practical query here
const result = await pipeline.invoke(query);
console.log("Retrieved Documents:\n", result);
}
main().catch(console.error);
## 支持与反馈 如需支持、反馈或报告问题,请访问 Alchemyst AI 文档,您将在其中找到最新的联系和社区信息。