mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 04:07:54 +00:00
remove chat-history (#15286)
This commit is contained in:
parent
90aa26a90e
commit
bc5a0ef6ca
@ -63,7 +63,6 @@ def create_retrieval_chain(
|
|||||||
retrieval_chain = (
|
retrieval_chain = (
|
||||||
RunnablePassthrough.assign(
|
RunnablePassthrough.assign(
|
||||||
context=retrieval_docs.with_config(run_name="retrieve_documents"),
|
context=retrieval_docs.with_config(run_name="retrieve_documents"),
|
||||||
chat_history=lambda x: x.get("chat_history", []),
|
|
||||||
).assign(answer=combine_docs_chain)
|
).assign(answer=combine_docs_chain)
|
||||||
).with_config(run_name="retrieval_chain")
|
).with_config(run_name="retrieval_chain")
|
||||||
|
|
||||||
|
@ -13,14 +13,6 @@ def test_create() -> None:
|
|||||||
retriever = FakeParrotRetriever()
|
retriever = FakeParrotRetriever()
|
||||||
question_gen_prompt = PromptTemplate.from_template("hi! {input} {chat_history}")
|
question_gen_prompt = PromptTemplate.from_template("hi! {input} {chat_history}")
|
||||||
chain = create_retrieval_chain(retriever, question_gen_prompt | llm)
|
chain = create_retrieval_chain(retriever, question_gen_prompt | llm)
|
||||||
expected_output = {
|
|
||||||
"answer": "I know the answer!",
|
|
||||||
"chat_history": [],
|
|
||||||
"context": [Document(page_content="What is the answer?")],
|
|
||||||
"input": "What is the answer?",
|
|
||||||
}
|
|
||||||
output = chain.invoke({"input": "What is the answer?"})
|
|
||||||
assert output == expected_output
|
|
||||||
|
|
||||||
expected_output = {
|
expected_output = {
|
||||||
"answer": "I know the answer!",
|
"answer": "I know the answer!",
|
||||||
|
Loading…
Reference in New Issue
Block a user