ollama-python/examples/async-generate.py
2025-07-22 16:27:16 -07:00

17 lines
293 B
Python

import asyncio
import ollama
async def main():
client = ollama.AsyncClient()
response = await client.generate('gemma3', 'Why is the sky blue?')
print(response['response'])
if __name__ == '__main__':
try:
asyncio.run(main())
except KeyboardInterrupt:
print('\nGoodbye!')