MCPcopy
hub / github.com/langchain-ai/langchain / __init__

Method __init__

libs/langchain/langchain/agents/react/base.py:146–162  ·  view source on GitHub ↗

Initialize with the LLM and a docstore.

(self, llm: BaseLanguageModel, docstore: Docstore, **kwargs: Any)

Source from the content-addressed store, hash-verified

144 """[Deprecated] Chain that implements the ReAct paper."""
145
146 def __init__(self, llm: BaseLanguageModel, docstore: Docstore, **kwargs: Any):
147 """Initialize with the LLM and a docstore."""
148 docstore_explorer = DocstoreExplorer(docstore)
149 tools = [
150 Tool(
151 name="Search",
152 func=docstore_explorer.search,
153 description="Search for a term in the docstore.",
154 ),
155 Tool(
156 name="Lookup",
157 func=docstore_explorer.lookup,
158 description="Lookup a term in the docstore.",
159 ),
160 ]
161 agent = ReActDocstoreAgent.from_llm_and_tools(llm, tools)
162 super().__init__(agent=agent, tools=tools, **kwargs)

Callers

nothing calls this directly

Calls 3

ToolClass · 0.90
DocstoreExplorerClass · 0.85
from_llm_and_toolsMethod · 0.45

Tested by

no test coverage detected