mirror of
https://github.com/ollama/ollama-python.git
synced 2026-09-21 01:47:22 +00:00
16 lines
257 B
Python
16 lines
257 B
Python
from ollama import chat
|
|
|
|
|
|
messages = [
|
|
{
|
|
'role': 'user',
|
|
'content': 'Why is the sky blue?',
|
|
},
|
|
]
|
|
|
|
for part in chat('mistral', messages=messages, stream=True):
|
|
print(part['message']['content'], end='', flush=True)
|
|
|
|
# end with a newline
|
|
print()
|