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

Class AgentExecutorWithTranslation

bmtools/agent/executor.py:9–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7from bmtools.agent.translator import Translator
8
9class AgentExecutorWithTranslation(AgentExecutor):
10
11 translator: Translator = Translator()
12
13 def prep_outputs(
14 self,
15 inputs: Dict[str, str],
16 outputs: Dict[str, str],
17 return_only_outputs: bool = False,
18 ) -> Dict[str, str]:
19 try:
20 outputs = super().prep_outputs(inputs, outputs, return_only_outputs)
21 except ValueError as e:
22 return outputs
23 else:
24 if "input" in outputs:
25 outputs = self.translator(outputs)
26 return outputs
27
28class Executor(AgentExecutorWithTranslation):
29 def _call(self, inputs: Dict[str, str]) -> Dict[str, Any]:

Callers

nothing calls this directly

Calls 1

TranslatorClass · 0.90

Tested by

no test coverage detected