MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / __call__

Method __call__

bmtools/agent/executor.py:84–114  ·  view source on GitHub ↗

Run the logic of this chain and add to output if desired. Args: inputs: Dictionary of inputs, or single input if chain expects only one param. return_only_outputs: boolean for whether to return only outputs in the response. If True, on

(
        self, inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False
    )

Source from the content-addressed store, hash-verified

82 return
83
84 def __call__(
85 self, inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False
86 ) -> Dict[str, Any]:
87 """Run the logic of this chain and add to output if desired.
88
89 Args:
90 inputs: Dictionary of inputs, or single input if chain expects
91 only one param.
92 return_only_outputs: boolean for whether to return only outputs in the
93 response. If True, only new keys generated by this chain will be
94 returned. If False, both input keys and new keys generated by this
95 chain will be returned. Defaults to False.
96
97 """
98 inputs = self.prep_inputs(inputs)
99 self.callback_manager.on_chain_start(
100 {"name": self.__class__.__name__},
101 inputs,
102 verbose=self.verbose,
103 )
104 try:
105 for output in self._call(inputs):
106 if type(output) is dict:
107 output = self.prep_outputs(inputs, output, return_only_outputs)
108 yield output
109 except (KeyboardInterrupt, Exception) as e:
110 self.callback_manager.on_chain_error(e, verbose=self.verbose)
111 raise e
112 self.callback_manager.on_chain_end(output, verbose=self.verbose)
113 # return self.prep_outputs(inputs, output, return_only_outputs)
114 return output

Callers

nothing calls this directly

Calls 2

_callMethod · 0.95
prep_outputsMethod · 0.80

Tested by

no test coverage detected