' Ketanji Brown Jackson succeeded Justice Breyer.'Pass in chat history‚ÄãIn the above example, we used a Memory object to track chat history. We can also just pass it in explicitly. In order to do this, we need to initialize a chain without any memory object.qa = ConversationalRetrievalChain.from_llm(    OpenAI(temperature=0), vectorstore.as_retriever())Here's an example of asking a question with no chat historychat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})result["answer"]    " The president said that Ketanji Brown Jackson is one of the nation's top legal minds and a former top litigator in private practice, and that she will continue Justice Breyer's legacy of excellence."Here's an example of asking a question with some chat historychat_history = [(query, result["answer"])]query = "Did he mention who she succeeded"result = qa({"question": query, "chat_history": chat_history})result["answer"]    ' Ketanji Brown Jackson succeeded Justice Breyer.'Return Source Documents‚ÄãYou can also easily return source documents from the ConversationalRetrievalChain. This is useful for when you want to inspect what documents were returned.qa = ConversationalRetrievalChain.from_llm(    llm, vectorstore.as_retriever(), return_source_documents=True)chat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})result["source_documents"][0]    Document(page_content='Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation‚Äôs top legal minds, who will continue Justice Breyer‚Äôs legacy of excellence. A former top litigator in private practice.', metadata={'source':
This notebook is based on the chatvectordb notebook, but using Vectara as the vector database.
This notebook is based on the chatvectordb notebook, but using Vectara as the vector database. ->: ' Ketanji Brown Jackson succeeded Justice Breyer.'Pass in chat history‚ÄãIn the above example, we used a Memory object to track chat history. We can also just pass it in explicitly. In order to do this, we need to initialize a chain without any memory object.qa = ConversationalRetrievalChain.from_llm(    OpenAI(temperature=0), vectorstore.as_retriever())Here's an example of asking a question with no chat historychat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})result["answer"]    " The president said that Ketanji Brown Jackson is one of the nation's top legal minds and a former top litigator in private practice, and that she will continue Justice Breyer's legacy of excellence."Here's an example of asking a question with some chat historychat_history = [(query, result["answer"])]query = "Did he mention who she succeeded"result = qa({"question": query, "chat_history": chat_history})result["answer"]    ' Ketanji Brown Jackson succeeded Justice Breyer.'Return Source Documents‚ÄãYou can also easily return source documents from the ConversationalRetrievalChain. This is useful for when you want to inspect what documents were returned.qa = ConversationalRetrievalChain.from_llm(    llm, vectorstore.as_retriever(), return_source_documents=True)chat_history = []query = "What did the president say about Ketanji Brown Jackson"result = qa({"question": query, "chat_history": chat_history})result["source_documents"][0]    Document(page_content='Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation‚Äôs top legal minds, who will continue Justice Breyer‚Äôs legacy of excellence. A former top litigator in private practice.', metadata={'source':