MCPcopy Create free account
hub / github.com/FreedomIntelligence/LLMZoo / SimpleChatIO

Class SimpleChatIO

llmzoo/deploy/cli.py:15–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class SimpleChatIO(ChatIO):
16 def prompt_for_input(self, role) -> str:
17 return input(f"{role}: ")
18
19 def prompt_for_output(self, role: str):
20 print(f"{role}: ", end="", flush=True)
21
22 def stream_output(self, output_stream):
23 pre = 0
24 for outputs in output_stream:
25 outputs = outputs.strip()
26 outputs = outputs.split(" ")
27 now = len(outputs) - 1
28 if now > pre:
29 print(" ".join(outputs[pre:now]), end=" ", flush=True)
30 pre = now
31 print(" ".join(outputs[pre:]), flush=True)
32 return " ".join(outputs)
33
34
35class RichChatIO(ChatIO):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected