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

Method wrap_inference

AgentBench.old/src/agent.py:77–92  ·  view source on GitHub ↗
(self, inference_function: Callable[[List[dict]], str])

Source from the content-addressed store, hash-verified

75 return segments
76
77 def wrap_inference(self, inference_function: Callable[[List[dict]], str]) -> Callable[[List[dict]], str]:
78 def _func(history: List[dict]) -> str:
79 if self.exception_raised:
80 return ""
81 messages = self.filter_messages(history)
82 try:
83 result = inference_function(messages)
84 except Exception as e:
85 print(e)
86 import traceback
87 traceback.print_exc()
88 print("Warning: Exception raised during inference.")
89 self.exception_raised = True
90 result = ""
91 return result
92 return _func
93
94 def filter_messages(self, messages: List[Dict]) -> List[Dict]:
95 try:

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected