Find answers from the community

Updated 4 months ago

Generator

I'm trying to have the llm stream the output but get this message:
<generator object llm_chat_callback.<locals>.wrap.<locals>.wrapped_llm_chat.<locals>.wrapped_gen at 0x766381b12340>

How should I have properly done it? (without the selected code in the script the code runs fine.
Attachment
Screenshot_from_2024-08-12_14-00-58.png
L
M
3 comments
You need to iterate over the generator in a for loop
How do I iterate over the generator? (forgive me for being a bit more inexperienced here, and thanks for your help!)
I thhiiink it should be just

Plain Text
for chunk in output
  print(chunk, end="")
Add a reply
Sign up and join the conversation on Discord