Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesConversationalOpenAI functionsOpenAI Multi Functions AgentReActReAct document storeSelf-ask with searchStructured tool chatXML AgentHow-toToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsAgent TypesReAct document storeReAct document storeThis walkthrough showcases using an agent to implement the ReAct logic for working with document store specifically.from langchain.llms import OpenAIfrom langchain.docstore import Wikipediafrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.agents.react.base import DocstoreExplorerdocstore = DocstoreExplorer(Wikipedia())tools = [    Tool(        name="Search",        func=docstore.search,        description="useful for when you need to ask with search",    ),    Tool(        name="Lookup",        func=docstore.lookup,        description="useful for when you need to ask with lookup",    ),]llm = OpenAI(temperature=0, model_name="text-davinci-002")react = initialize_agent(tools, llm, agent=AgentType.REACT_DOCSTORE, verbose=True)question = "Author David Chanoff has collaborated with a U.S. Navy admiral who served as the ambassador to the United Kingdom under which President?"react.run(question)            > Entering new AgentExecutor chain...        Thought: I need to search David Chanoff and find the U.S. Navy admiral he collaborated with. Then I need to find which President the admiral served under.        Action: Search[David Chanoff]        Observation: David Chanoff is a noted author of non-fiction work. His work has typically involved collaborations with the principal protagonist of the work concerned. His collaborators have included; Augustus A.
This walkthrough showcases using an agent to implement the ReAct logic for working with document store specifically.
This walkthrough showcases using an agent to implement the ReAct logic for working with document store specifically. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesConversationalOpenAI functionsOpenAI Multi Functions AgentReActReAct document storeSelf-ask with searchStructured tool chatXML AgentHow-toToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsAgent TypesReAct document storeReAct document storeThis walkthrough showcases using an agent to implement the ReAct logic for working with document store specifically.from langchain.llms import OpenAIfrom langchain.docstore import Wikipediafrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.agents.react.base import DocstoreExplorerdocstore = DocstoreExplorer(Wikipedia())tools = [    Tool(        name="Search",        func=docstore.search,        description="useful for when you need to ask with search",    ),    Tool(        name="Lookup",        func=docstore.lookup,        description="useful for when you need to ask with lookup",    ),]llm = OpenAI(temperature=0, model_name="text-davinci-002")react = initialize_agent(tools, llm, agent=AgentType.REACT_DOCSTORE, verbose=True)question = "Author David Chanoff has collaborated with a U.S. Navy admiral who served as the ambassador to the United Kingdom under which President?"react.run(question)            > Entering new AgentExecutor chain...        Thought: I need to search David Chanoff and find the U.S. Navy admiral he collaborated with. Then I need to find which President the admiral served under.        Action: Search[David Chanoff]        Observation: David Chanoff is a noted author of non-fiction work. His work has typically involved collaborations with the principal protagonist of the work concerned. His collaborators have included; Augustus A.