live-markdown 0.1.0

Render markdown stream in real time. Useful for rendering LLM output.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
import live_markdown
import llm

model = llm.get_model()
resp = model.prompt("show some markdown with code block python code")
streamer = live_markdown.MarkdownStreamer()
for chunk in resp:
    streamer.terminal_stream(chunk)
    text = streamer.read_available()
    print(text, end="", flush=True)
streamer.finish()
text = streamer.read_available()
print(text, end="", flush=True)