how to do question-answering with sources over an Index. It does this by using the RetrievalQAWithSourcesChain, which does the lookup of the documents from an Index. from langchain.chains import RetrievalQAWithSourcesChainfrom langchain.llms import OpenAIwith open("../../modules/state_of_the_union.txt") as f:    state_of_the_union = f.read()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)texts = text_splitter.split_text(state_of_the_union)docsearch = Weaviate.from_texts(    texts,    embeddings,    weaviate_url=WEAVIATE_URL,    by_text=False,    metadatas=[{"source": f"{i}-pl"} for i in range(len(texts))],)chain = RetrievalQAWithSourcesChain.from_chain_type(    OpenAI(temperature=0), chain_type="stuff", retriever=docsearch.as_retriever())chain(    {"question": "What did the president say about Justice Breyer"},    return_only_outputs=True,)    {'answer': " The president honored Justice Breyer for his service and mentioned his legacy of excellence. He also nominated Circuit Court of Appeals Judge Ketanji Brown Jackson to continue Justice Breyer's legacy.\n",     'sources': '31-pl, 34-pl'}PreviousVespaNextXataAuthenticationSimilarity search with scoreRetriever optionsMMRQuestion Answering with SourcesCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly into billions of data objects.
Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly into billions of data objects. ->: how to do question-answering with sources over an Index. It does this by using the RetrievalQAWithSourcesChain, which does the lookup of the documents from an Index. from langchain.chains import RetrievalQAWithSourcesChainfrom langchain.llms import OpenAIwith open("../../modules/state_of_the_union.txt") as f:    state_of_the_union = f.read()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)texts = text_splitter.split_text(state_of_the_union)docsearch = Weaviate.from_texts(    texts,    embeddings,    weaviate_url=WEAVIATE_URL,    by_text=False,    metadatas=[{"source": f"{i}-pl"} for i in range(len(texts))],)chain = RetrievalQAWithSourcesChain.from_chain_type(    OpenAI(temperature=0), chain_type="stuff", retriever=docsearch.as_retriever())chain(    {"question": "What did the president say about Justice Breyer"},    return_only_outputs=True,)    {'answer': " The president honored Justice Breyer for his service and mentioned his legacy of excellence. He also nominated Circuit Court of Appeals Judge Ketanji Brown Jackson to continue Justice Breyer's legacy.\n",     'sources': '31-pl, 34-pl'}PreviousVespaNextXataAuthenticationSimilarity search with scoreRetriever optionsMMRQuestion Answering with SourcesCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.