MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / __init__

Method __init__

eval_heldout/rewoo/algos/react.py:14–34  ·  view source on GitHub ↗
(self, fewshot, model_name="text-davinci-002", max_iter=8, verbose=True)

Source from the content-addressed store, hash-verified

12
13class ReactBase:
14 def __init__(self, fewshot, model_name="text-davinci-002", max_iter=8, verbose=True):
15 self.model_name = model_name
16 self.max_iter = max_iter
17 self.verbose = verbose
18 self.fewshot = fewshot
19 self.tools = self._load_tools()
20 if model_name in OPENAI_COMPLETION_MODELS:
21 self.agent = initialize_agent(self.tools,
22 OpenAI(temperature=0, model_name=self.model_name),
23 agent=AgentType.REACT_DOCSTORE,
24 verbose=self.verbose,
25 return_intermediate_steps=True,
26 max_iterations=max_iter)
27 elif model_name in OPENAI_CHAT_MODELS:
28 self.agent = initialize_agent(self.tools,
29 ChatOpenAI(temperature=0, model_name=self.model_name),
30 agent=AgentType.REACT_DOCSTORE,
31 verbose=self.verbose,
32 return_intermediate_steps=True,
33 max_iterations=max_iter)
34 self.agent.agent.llm_chain.prompt.template = fewshot
35
36 def run(self, prompt):
37 self.reset()

Callers

nothing calls this directly

Calls 1

_load_toolsMethod · 0.95

Tested by

no test coverage detected