mirror of
https://github.com/ollama/ollama-python.git
synced 2026-10-07 09:27:28 +00:00
* Examples and README updates --------- Co-authored-by: fujitatomoya <[email protected]> Co-authored-by: Michael Yang <[email protected]>
16 lines
294 B
Python
16 lines
294 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!')
|