chunk_overlap=0)    docs = text_splitter.split_documents(pages)    embeddings = OpenAIEmbeddings()    retriever = FAISS.from_documents(docs, embeddings).as_retriever()    # Wrap retrievers in a Tool    tools.append(        Tool(            args_schema=DocumentInput,            name=file["name"],            description=f"useful when you want to answer questions about {file['name']}",            func=RetrievalQA.from_chain_type(llm=llm, retriever=retriever),        )    )from langchain.agents import initialize_agentfrom langchain.agents import AgentTypellm = ChatOpenAI(    temperature=0,    model="gpt-3.5-turbo-0613",)agent = initialize_agent(    agent=AgentType.OPENAI_FUNCTIONS,    tools=tools,    llm=llm,    verbose=True,)agent({"input": "did alphabet or tesla have more revenue?"})            > Entering new  chain...        Invoking: `alphabet-earnings` with `{'question': 'revenue'}`            {'query': 'revenue', 'result': 'The revenue for Alphabet Inc. for the quarter ended March 31, 2023, was $69,787 million.'}    Invoking: `tesla-earnings` with `{'question': 'revenue'}`            {'query': 'revenue', 'result': 'Total revenue for Q1-2023 was $23.3 billion.'}Alphabet Inc. had more revenue than Tesla. Alphabet's revenue for the quarter ended March 31, 2023, was $69,787 million, while Tesla's total revenue for Q1-2023 was $23.3 billion.        > Finished chain.    {'input': 'did alphabet or tesla have more revenue?',     'output': "Alphabet Inc. had more revenue than Tesla. Alphabet's revenue for the quarter ended March 31, 2023, was $69,787 million, while Tesla's total revenue for Q1-2023 was $23.3 billion."}OpenAI Multi Functions‚ÄãThis type of agent allows calling multiple functions at once. This is really useful when some steps can be computed in parallel - like when asked to compare multiple documentsfrom langchain.globals import set_debugset_debug(True)llm = ChatOpenAI(    temperature=0,    model="gpt-3.5-turbo-0613",)agent = initialize_agent(
This notebook shows how to use an agent to compare two documents.
This notebook shows how to use an agent to compare two documents. ->: chunk_overlap=0)    docs = text_splitter.split_documents(pages)    embeddings = OpenAIEmbeddings()    retriever = FAISS.from_documents(docs, embeddings).as_retriever()    # Wrap retrievers in a Tool    tools.append(        Tool(            args_schema=DocumentInput,            name=file["name"],            description=f"useful when you want to answer questions about {file['name']}",            func=RetrievalQA.from_chain_type(llm=llm, retriever=retriever),        )    )from langchain.agents import initialize_agentfrom langchain.agents import AgentTypellm = ChatOpenAI(    temperature=0,    model="gpt-3.5-turbo-0613",)agent = initialize_agent(    agent=AgentType.OPENAI_FUNCTIONS,    tools=tools,    llm=llm,    verbose=True,)agent({"input": "did alphabet or tesla have more revenue?"})            > Entering new  chain...        Invoking: `alphabet-earnings` with `{'question': 'revenue'}`            {'query': 'revenue', 'result': 'The revenue for Alphabet Inc. for the quarter ended March 31, 2023, was $69,787 million.'}    Invoking: `tesla-earnings` with `{'question': 'revenue'}`            {'query': 'revenue', 'result': 'Total revenue for Q1-2023 was $23.3 billion.'}Alphabet Inc. had more revenue than Tesla. Alphabet's revenue for the quarter ended March 31, 2023, was $69,787 million, while Tesla's total revenue for Q1-2023 was $23.3 billion.        > Finished chain.    {'input': 'did alphabet or tesla have more revenue?',     'output': "Alphabet Inc. had more revenue than Tesla. Alphabet's revenue for the quarter ended March 31, 2023, was $69,787 million, while Tesla's total revenue for Q1-2023 was $23.3 billion."}OpenAI Multi Functions‚ÄãThis type of agent allows calling multiple functions at once. This is really useful when some steps can be computed in parallel - like when asked to compare multiple documentsfrom langchain.globals import set_debugset_debug(True)llm = ChatOpenAI(    temperature=0,    model="gpt-3.5-turbo-0613",)agent = initialize_agent(