I have created a python app where I am storing some documents (pdf, url ) using langchain chroma db. I then retrieve this data and start ask questions and get response from a locally stored AI.
I was able to add chat history when using ChatPromptTemplate.from_messages. On the below however I do not know where to add the chat history when using ChatPromptTemplate.from_template.
2. Retrieval-Augmented Generation
after_rag_template = """You are an respectful and honest assistant. You have to answer the user's
questions using only the context provided to you. If you don't know the answer,
just say you don't know. Don't try to make up an answer.:
{context}
Question: {question}
"""
after_rag_prompt = ChatPromptTemplate.from_template(after_rag_template)
after_rag_chain = (
{"context": retriever, "question": RunnablePassthrough()}
| after_rag_prompt
| model_local
| StrOutputParser()
)
content = after_rag_chain.invoke(prompt)