Open wangpengfei2048 opened 8 months ago
I use the code with the example for @cl.on_chat_resume , the chat is OK
but I want to use the retrieval, can you give an example?
I use the code with langchain example ,but fail!
template = """Answer the question based only on the following context: {context}
Question: {question} """ prompt = ChatPromptTemplate.from_template(template) model = ChatOpenAI()
retrieval_chain = ( {"context": retriever, "question": RunnablePassthrough()} | prompt | model | StrOutputParser() )
but I want to use the retrieval, can you give an example?
I use the code with langchain example ,but fail!
template = """Answer the question based only on the following context: {context}
Question: {question} """ prompt = ChatPromptTemplate.from_template(template) model = ChatOpenAI()
retrieval_chain = ( {"context": retriever, "question": RunnablePassthrough()} | prompt | model | StrOutputParser() )