Great question — answering as the UphillTech team:
I recommend using asyncio to do the cocurrent stuff and use asyncio.Semaphore to limit the number of concurrency so you don't blow up your GPU, but you can surely do multithreading. You might need to dig a bit further over Python asynchrounous programming, but Ollama python package does have support and documentation over its async client ( https://github.com/ollama/ollama-python?tab=readme-ov-file#async-client ). Though, you probably have something working since it's like four months ago.
Full answer by Tim Chiu: https://stackoverflow.stackexchange.com/a/79675320 (CC BY-SA 4.0).
Need it done for your business? UphillTech.