= loader.load()# Splittext_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)splits = text_splitter.split_documents(data)# VectorDBembedding = OpenAIEmbeddings()vectordb = Chroma.from_documents(documents=splits, embedding=embedding)Simple usage‚ÄãSpecify the LLM to use for query generation, and the retriever will do the rest.from langchain.chat_models import ChatOpenAIfrom langchain.retrievers.multi_query import MultiQueryRetrieverquestion = "What are the approaches to Task Decomposition?"llm = ChatOpenAI(temperature=0)retriever_from_llm = MultiQueryRetriever.from_llm(    retriever=vectordb.as_retriever(), llm=llm)# Set logging for the queriesimport logginglogging.basicConfig()logging.getLogger("langchain.retrievers.multi_query").setLevel(logging.INFO)unique_docs = retriever_from_llm.get_relevant_documents(query=question)len(unique_docs)    INFO:langchain.retrievers.multi_query:Generated queries: ['1. How can Task Decomposition be approached?', '2. What are the different methods for Task Decomposition?', '3. What are the various approaches to decomposing tasks?']    5Supplying your own prompt‚ÄãYou can also supply a prompt along with an output parser to split the results into a list of queries.from typing import Listfrom langchain.chains import LLMChainfrom pydantic import BaseModel, Fieldfrom langchain.prompts import PromptTemplatefrom langchain.output_parsers import PydanticOutputParser# Output parser will split the LLM result into a list of queriesclass LineList(BaseModel):    # "lines" is the key (attribute name) of the parsed output    lines: List[str] = Field(description="Lines of text")class LineListOutputParser(PydanticOutputParser):    def __init__(self) -> None:        super().__init__(pydantic_object=LineList)    def parse(self, text: str) -> LineList:        lines = text.strip().split("\n")        return LineList(lines=lines)output_parser = LineListOutputParser()QUERY_PROMPT = PromptTemplate(    input_variables=["question"],
Distance-based vector database retrieval embeds (represents) queries in high-dimensional space and finds similar embedded documents based on "distance". But, retrieval may produce different results with subtle changes in query wording or if the embeddings do not capture the semantics of the data well. Prompt engineering / tuning is sometimes done to manually address these problems, but can be tedious.
Distance-based vector database retrieval embeds (represents) queries in high-dimensional space and finds similar embedded documents based on "distance". But, retrieval may produce different results with subtle changes in query wording or if the embeddings do not capture the semantics of the data well. Prompt engineering / tuning is sometimes done to manually address these problems, but can be tedious. ->: = loader.load()# Splittext_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)splits = text_splitter.split_documents(data)# VectorDBembedding = OpenAIEmbeddings()vectordb = Chroma.from_documents(documents=splits, embedding=embedding)Simple usage‚ÄãSpecify the LLM to use for query generation, and the retriever will do the rest.from langchain.chat_models import ChatOpenAIfrom langchain.retrievers.multi_query import MultiQueryRetrieverquestion = "What are the approaches to Task Decomposition?"llm = ChatOpenAI(temperature=0)retriever_from_llm = MultiQueryRetriever.from_llm(    retriever=vectordb.as_retriever(), llm=llm)# Set logging for the queriesimport logginglogging.basicConfig()logging.getLogger("langchain.retrievers.multi_query").setLevel(logging.INFO)unique_docs = retriever_from_llm.get_relevant_documents(query=question)len(unique_docs)    INFO:langchain.retrievers.multi_query:Generated queries: ['1. How can Task Decomposition be approached?', '2. What are the different methods for Task Decomposition?', '3. What are the various approaches to decomposing tasks?']    5Supplying your own prompt‚ÄãYou can also supply a prompt along with an output parser to split the results into a list of queries.from typing import Listfrom langchain.chains import LLMChainfrom pydantic import BaseModel, Fieldfrom langchain.prompts import PromptTemplatefrom langchain.output_parsers import PydanticOutputParser# Output parser will split the LLM result into a list of queriesclass LineList(BaseModel):    # "lines" is the key (attribute name) of the parsed output    lines: List[str] = Field(description="Lines of text")class LineListOutputParser(PydanticOutputParser):    def __init__(self) -> None:        super().__init__(pydantic_object=LineList)    def parse(self, text: str) -> LineList:        lines = text.strip().split("\n")        return LineList(lines=lines)output_parser = LineListOutputParser()QUERY_PROMPT = PromptTemplate(    input_variables=["question"],