MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / stream_output

Method stream_output

toolbench/inference/utils.py:247–257  ·  view source on GitHub ↗
(self, output_stream)

Source from the content-addressed store, hash-verified

245 print(f"{role}: ", end="", flush=True)
246
247 def stream_output(self, output_stream):
248 pre = 0
249 for outputs in output_stream:
250 output_text = outputs["text"]
251 output_text = output_text.strip().split(" ")
252 now = len(output_text) - 1
253 if now > pre:
254 print(" ".join(output_text[pre:now]), end=" ", flush=True)
255 pre = now
256 print(" ".join(output_text[pre:]), flush=True)
257 return " ".join(output_text)
258
259 def return_output(self, output_stream):
260 pre = 0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected