pathlib import Pathrelevant_parts = []for p in Path(".").absolute().parts:    relevant_parts.append(p)    if relevant_parts[-3:] == ["langchain", "docs", "modules"]:        breakdoc_path = str(Path(*relevant_parts) / "state_of_the_union.txt")from langchain.document_loaders import TextLoaderloader = TextLoader(doc_path)documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)texts = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()docsearch = Chroma.from_documents(texts, embeddings, collection_name="state-of-union")    Running Chroma using direct local API.    Using DuckDB in-memory for database. Data will be transient.state_of_union = RetrievalQA.from_chain_type(    llm=llm, chain_type="stuff", retriever=docsearch.as_retriever())from langchain.document_loaders import WebBaseLoaderloader = WebBaseLoader("https://beta.ruff.rs/docs/faq/")docs = loader.load()ruff_texts = text_splitter.split_documents(docs)ruff_db = Chroma.from_documents(ruff_texts, embeddings, collection_name="ruff")ruff = RetrievalQA.from_chain_type(    llm=llm, chain_type="stuff", retriever=ruff_db.as_retriever())    Running Chroma using direct local API.    Using DuckDB in-memory for database. Data will be transient.Create the Agent‚Äã# Import things that are needed genericallyfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.tools import BaseToolfrom langchain.llms import OpenAIfrom langchain.chains import LLMMathChainfrom langchain.utilities import SerpAPIWrappertools = [    Tool(        name="State of Union QA System",        func=state_of_union.run,        description="useful for when you need to answer questions about the most recent state of the union address. Input should be a fully formed question.",    ),    Tool(        name="Ruff QA System",        func=ruff.run,        description="useful for when you need to answer questions about ruff (a python linter). Input should be a
This notebook covers how to combine agents and vector stores. The use case for this is that you've ingested your data into a vector store and want to interact with it in an agentic manner.
This notebook covers how to combine agents and vector stores. The use case for this is that you've ingested your data into a vector store and want to interact with it in an agentic manner. ->: pathlib import Pathrelevant_parts = []for p in Path(".").absolute().parts:    relevant_parts.append(p)    if relevant_parts[-3:] == ["langchain", "docs", "modules"]:        breakdoc_path = str(Path(*relevant_parts) / "state_of_the_union.txt")from langchain.document_loaders import TextLoaderloader = TextLoader(doc_path)documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)texts = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()docsearch = Chroma.from_documents(texts, embeddings, collection_name="state-of-union")    Running Chroma using direct local API.    Using DuckDB in-memory for database. Data will be transient.state_of_union = RetrievalQA.from_chain_type(    llm=llm, chain_type="stuff", retriever=docsearch.as_retriever())from langchain.document_loaders import WebBaseLoaderloader = WebBaseLoader("https://beta.ruff.rs/docs/faq/")docs = loader.load()ruff_texts = text_splitter.split_documents(docs)ruff_db = Chroma.from_documents(ruff_texts, embeddings, collection_name="ruff")ruff = RetrievalQA.from_chain_type(    llm=llm, chain_type="stuff", retriever=ruff_db.as_retriever())    Running Chroma using direct local API.    Using DuckDB in-memory for database. Data will be transient.Create the Agent‚Äã# Import things that are needed genericallyfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.tools import BaseToolfrom langchain.llms import OpenAIfrom langchain.chains import LLMMathChainfrom langchain.utilities import SerpAPIWrappertools = [    Tool(        name="State of Union QA System",        func=state_of_union.run,        description="useful for when you need to answer questions about the most recent state of the union address. Input should be a fully formed question.",    ),    Tool(        name="Ruff QA System",        func=ruff.run,        description="useful for when you need to answer questions about ruff (a python linter). Input should be a