Vibeleaderboard
Index / tool
Visit github.com
Category
Developer Tools
Rank
Pricing
Open Source
Type
TOOL
Builder
ollama
Latest release
v0.6.2
Date

About

Official Python library for Ollama — run, manage, and chat with locally-served LLMs from Python.

What it does

This package turns Ollama’s REST endpoints into typed Python objects and straightforward synchronous or asynchronous requests. It handles conversations, text generation, embeddings, model administration, streaming output, tool descriptions, multimodal image input, web search, and web fetching. Clients can target a local service or Ollama’s cloud API.

Why it's ranked here

This is a strong default for Python projects already committed to Ollama. Its API covers inference and model lifecycle work, supports streaming in both synchronous and asynchronous code, and validates request and response data with Pydantic. The narrow dependency set and direct REST mapping keep the abstraction understandable.

What's good

Responses support both attribute and mapping-style access, easing typed adoption without forcing one access pattern. Streaming yields validated response objects and raises explicit errors during the stream. Custom clients accept transport settings such as headers, host, redirects, and timeouts. Python functions can also be converted into model tool schemas from signatures and docstrings.

Tradeoffs

The package is a client, so local use still requires Ollama installed, running, and supplied with a pulled model. Direct cloud access requires an API key, while cloud use through local Ollama requires sign-in and pulling a cloud model. Tool argument values may not exactly match their declared schema, and the example explicitly casts them before execution.

How to use it well

Use it in Python services, scripts, notebooks, or asynchronous applications that need typed access to an existing Ollama endpoint. Choose streaming for incremental output and a custom client for remote hosts or authentication. Keep server installation, model selection, model acquisition, and tool execution logic outside the library.

Technical notes+

pyproject.toml declares Python >=3.8, MIT licensing, httpx>=0.27, pydantic>=2.9, and a Hatchling build with VCS-derived versions. ollama/_client.py implements Client and AsyncClient over httpx, maps methods to /api endpoints, parses streamed JSON lines, and wraps connection or HTTP failures. ollama/_types.py defines Pydantic request and response models, mapping-style model access, image serialization, tool schemas, thinking controls, log probabilities, and generation fields. ollama/_utils.py builds Tool schemas from callable signatures and Google-style docstrings. ollama/__init__.py exports both client classes, response types, errors, and module-level methods backed by a shared Client instance. requirements.txt provides a hash-pinned exported environment.

Observed

License
MIT
Primary language
Python
Python support
Python 3.8 or newer
Installation
Published package installed with pip install ollama
Interface
Python library client for the Ollama REST API, with synchronous and asynchronous clients
Runtime dependencies
httpx and Pydantic
Build system
Hatchling with VCS-derived package versions

Read from README.md, pyproject.toml, requirements.txt, ollama/_types.py, ollama/_utils.py, ollama/_client.py, ollama/__init__.py, examples/ps.py, examples/chat.py, examples/list.py, examples/pull.py, examples/show.py, examples/embed.py, examples/tools.py, examples/create.py.

What it can do

  • Run local LLM inference

    Text prompt and model nameGenerated text response

  • Chat with LLM in conversation format

    Conversation history and new messageContextual chat response

  • List available local models

    API requestArray of installed model names and details

  • Pull and download LLM models

    Model name/identifierDownloaded model ready for use

  • Delete local LLM models

    Model nameModel removed from local storage

  • Stream text generation responses

    Text prompt with streaming enabledReal-time text tokens as they generate

  • Generate embeddings from text

    Text string and embedding modelNumerical vector representation

Tags

ollamapythonsdkllmlocal-ai

Tech Stack

Python

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.