我想结合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)