ollama/ollama-python — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small Python library that makes it really easy for someone to use Ollama from their own Python scripts.

I want the main experience to feel simple, like importing the library, choosing a model, sending a chat message or prompt, and getting the answer back. It should also support streaming so people can print the response as it comes in. Please include both normal and async ways to use it.

It should work with a local Ollama app by default, but also let someone point it at another host, pass custom headers, or use Ollama cloud with an API key. Include handy functions for common Ollama actions like chat, generate, list models, show model info, pull, push, copy, delete, create, embeddings, and checking running models.

Please add clear errors when something goes wrong, typed response objects where it makes sense, basic tests, and simple examples in the README so a Python user can install it and try it quickly.

Want more depth? Deep Reverse