mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-14 06:07:17 +08:00
* Examples and README updates --------- Co-authored-by: fujitatomoya <tomoya.fujita825@gmail.com> Co-authored-by: Michael Yang <mxyng@pm.me>
15 lines
237 B
Python
15 lines
237 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()
|