AnswerDotAI / AnswerDotAI/fastllm

Empty markdown cell during time to first token in adisplay_stream

Open Beginner friendly
#104 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15
Forks
4
Avg merge
1h 23m
Merged PRs (30d)
12

Description

Hi,
in
```python
async def adisplay_stream(rs, chat=None, mx=2000):
"Use IPython.display to markdown display the response stream, refreshing from `chat.full()` on `Refresh`."
try: from IPython.display import display, Markdown
except ModuleNotFoundError: raise ModuleNotFoundError("This function requires ipython. Please run `pip install ipython` to use.")
acc,h = StreamAccum(chat, mx=mx), display(Markdown(' '), display_id=True)
async for o in rs:
if acc(o) and acc.txt: h.update(Markdown(acc.txt))
return acc.txt
```
h is initialized before the stream starts, leading to an empty Markdown cell being displayed while waiting for the first token.
If desired, this could be circumvented for example by initializing `h=None` at first, and then only creating h in the first loop iteration.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the adisplay_stream entry point and reproduce a stream with a delayed first token. Adjust the initialization so no empty Markdown cell appears before content arrives, while streamed content still refreshes normally; verify the first visible output contains the response text.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, python
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.