我正在try 使用朗链react 试剂,我想给他们我的松果指数作为背景.我找不到任何接口,可以让我提供使用Reaction链的LLM以及我的向量嵌入.
在这里,我设置了LLM并检索向量嵌入.
llm = ChatOpenAI(temperature=0.1, model_name="gpt-4")
retriever = vector_store.as_retriever(search_type='similarity', search_kwargs={'k': k})
在这里,我开始了我的react 链.
prompt = hub.pull("hwchase17/structured-chat-agent")
agent = create_structured_chat_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = agent_executor.invoke(
{
"input": question,
"chat_history": chat_history
}
)
在使用Reaction代理之前,我像这样使用了向量嵌入.
crc = ConversationalRetrievalChain.from_llm(llm, retriever)
result = crc.invoke({'question': systemPrompt, 'chat_history': chat_history})
chat_history.append((question, result['answer']))
有没有办法将这两种方法结合起来,并拥有也使用矢量嵌入的react 代理?