标签: langchain-js

如何在 LangChain 中结合 ConversationalRetrievalQAChain、代理和工具

我想结合ConversationalRetrievalQAChain- 例如 - SerpAPILangChain 中的工具。

我用来ConversationalRetrievalQAChain搜索使用 OpenAI 嵌入 API 和本地 Chroma 矢量数据库摄取的产品 PDF。这很好用。但是,产品 PDF 没有最新的定价信息。所以当用户询问定价信息时,我希望LangChain使用该SerpAPI工具来谷歌搜索价格。我有两个部分分开工作,但我很想将它们结合起来。

这是文档搜索部分(请记住:这是 PoC 质量的代码):

// Prompt used to rephrase/condose the question
const CONDENSE_PROMPT = `Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.

Chat History:
{chat_history}

Follow Up Input: {question}

Standalone question:`;

// Prompt for the actual question
const QA_PROMPT = `You are a helpful AI assistant for sales …
Run Code Online (Sandbox Code Playgroud)

agent openai-api langchain langchain-js

9
推荐指数
1
解决办法
1765
查看次数

标签 统计

agent ×1

langchain ×1

langchain-js ×1

openai-api ×1