mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08:00
14 lines
236 B
Python
14 lines
236 B
Python
from ollama import chat
|
|
|
|
messages = [
|
|
{
|
|
'role': 'user',
|
|
'content': 'Why is the sky blue?',
|
|
},
|
|
]
|
|
|
|
for part in chat('llama3.2', messages=messages, stream=True):
|
|
print(part['message']['content'], end='', flush=True)
|
|
|
|
print()
|