mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08:00
17 lines
295 B
Python
17 lines
295 B
Python
import asyncio
|
|
|
|
import ollama
|
|
|
|
|
|
async def main():
|
|
client = ollama.AsyncClient()
|
|
response = await client.generate('llama3.2', 'Why is the sky blue?')
|
|
print(response['response'])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
asyncio.run(main())
|
|
except KeyboardInterrupt:
|
|
print('\nGoodbye!')
|