MCPcopy
hub / github.com/docker/genai-stack / StreamHandler

Class StreamHandler

bot.py:42–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42class StreamHandler(BaseCallbackHandler):
43 def __init__(self, container, initial_text=""):
44 self.container = container
45 self.text = initial_text
46
47 def on_llm_new_token(self, token: str, **kwargs) -> None:
48 self.text += token
49 self.container.markdown(self.text)
50
51
52llm = load_llm(llm_name, logger=logger, config={"ollama_base_url": ollama_base_url})

Callers 1

chat_inputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected