document_chain.invoke({"input":"how can langsmith help with testing?","context":[Document(page_content="langsmith can let you visualize test results")]})
from langchain.chains import create_history_aware_retriever
from langchain_core.prompts import MessagesPlaceholder
# 首先,我们需要一个提示,可以传递给 LLM 以生成这个搜索查询
prompt = ChatPromptTemplate.from_messages([
MessagesPlaceholder(variable_name="chat_history"),("user","{input}"),("user","Given the above conversation, generate a search query to look up in order to get information relevant to the conversation")])
description="A simple API server using LangChain's Runnable interfaces",)# 5. Adding chain route# We need to add these input/output schemas because the current AgentExecutor# is lacking in schemas.classInput(BaseModel):input:str