MCPcopy
hub / github.com/SqueezeAILab/LLMCompiler / plan

Method plan

src/agents/agent.py:99–125  ·  view source on GitHub ↗

Given input, decided what to do. Args: intermediate_steps: Steps the LLM has taken to date, along with observations callbacks: Callbacks to run. **kwargs: User inputs. Returns: Action specifying what tool to use.

(
        self,
        intermediate_steps: List[Tuple[AgentAction, str]],
        callbacks: Callbacks = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

97 return thoughts
98
99 def plan(
100 self,
101 intermediate_steps: List[Tuple[AgentAction, str]],
102 callbacks: Callbacks = None,
103 **kwargs: Any,
104 ) -> Union[AgentAction, AgentFinish]:
105 """Given input, decided what to do.
106
107 Args:
108 intermediate_steps: Steps the LLM has taken to date,
109 along with observations
110 callbacks: Callbacks to run.
111 **kwargs: User inputs.
112
113 Returns:
114 Action specifying what tool to use.
115 """
116 try:
117 full_inputs = self.get_full_inputs(intermediate_steps, **kwargs)
118 full_output = self.llm_chain.predict(callbacks=callbacks, **full_inputs)
119 return self.output_parser.parse(full_output)
120 except Exception as e:
121 full_inputs["agent_scratchpad"] = (
122 full_inputs["agent_scratchpad"] + full_output + "\nAction: "
123 )
124 full_output = self.llm_chain.predict(callbacks=callbacks, **full_inputs)
125 return self.output_parser.parse("Action: " + full_output)
126
127 async def aplan(
128 self,

Callers 1

_take_next_stepMethod · 0.45

Calls 3

get_full_inputsMethod · 0.95
predictMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected