Great question — answering as the UphillTech team:
mess is a list with objects ChatMessage() and you have to convert it to dictionary. messages=[{"role": item.role, "content": item.content} for item in mess], Or you can use only last item if you don't want history messages=[{"role": "user", "content": mess[-1].content}], Full working code from ollama import chat model = "llama3.2" def simple_stream(messages, config): stream = chat( messages=[{"role": item.role, "content": item.content} for item in messages], model=model, stream=True, ) for chunk in stream: yield chunk["message"]["content"] mo.ui.chat(simple_stream, prompts=[""])
Full answer by furas: https://stackoverflow.stackexchange.com/a/79905047 (CC BY-SA 4.0).
Need it done for your business? UphillTech.