MCPcopy Index your code
hub / github.com/docker/genai-stack / StreamHandler

Class StreamHandler

pdf_bot.py:41–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected