ollama-python/examples/async-generate.py
2024-11-20 13:45:38 -08:00

16 lines
294 B
Python

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