llama-index-llms-ollama
llama-index llms ollama integration
What it is and what it does
This package bridges LlamaIndex and Ollama, allowing you to run local language models through a standardized LLM interface. Instead of calling Ollama's API directly, you instantiate an Ollama object with a model name and interact with it via familiar LlamaIndex methods: complete() for text generation, chat() for multi-turn conversations, and stream_complete() or stream_chat() for incremental responses. It also supports JSON mode for structured outputs and Pydantic-based response schemas.
The package assumes Ollama is already running locally on your machine (typically on localhost:11434). You configure the model, request timeout, and optional JSON mode when creating the Ollama instance. It's a thin adapter layer that translates LlamaIndex's LLM protocol into Ollama API calls, making it straightforward to swap local models into LlamaIndex workflows without rewriting application code.
Use it for:
- Build RAG pipelines with local models using LlamaIndex, avoiding cloud API costs and latency.
- Stream long-form text generation from local Ollama models in real-time chat applications.
- Extract structured data (JSON objects, Pydantic models) from local LLMs for downstream processing.
- Prototype and test LLM-powered features locally before migrating to production endpoints.
- Combine Ollama with LlamaIndex's retrieval and indexing tools for document Q&A on private data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates local Ollama language models with LlamaIndex, enabling text completion, chat, streaming, and structured JSON responses through a unified Python interface.
Yes, if you are already using LlamaIndex and want to run models locally via Ollama. Install friction is minimal, maintenance is active, and the MIT license is permissive. The package is straightforward to set up once Ollama is running. No vulnerabilities are known. The main prerequisite is having Ollama installed and a model downloaded locally.
Install
llama-index-llms-ollama on PyPI
pip
pip install llama-index-llms-ollamauv
uv add llama-index-llms-ollamapoetry
poetry add llama-index-llms-ollamaInstalling llama-index-llms-ollama
Before you install
Low friction: pure Python wheel with only two runtime dependencies (llama-index-core and ollama). Marked active with a recent release (147 days ago). No known vulnerabilities.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install llama-index-llms-ollama
from llama_index.llms.ollama import Ollama
from llama_index.core.llms import ChatMessage
llm = Ollama(model="llama3.1:latest", request_timeout=120.0)
resp = llm.complete("Who is Paul Graham?")
print(resp)
Requires a running local Ollama instance serving models on localhost:11434; Python 3.10 or later.
Verify before relying
- Performance characteristics and latency when streaming large responses.
- Compatibility with specific Ollama model versions beyond the examples shown.
- Memory requirements for concurrent requests or large model loads.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — llama-index-core, ollama |
| Maintenance | actively maintained — 147 days since the last release |
| First released | |
| Downloads | 250,227/month — #8,635 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: llama_index_llms_ollama-0.10.1-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
llama-index-llms-openaiIntegrates OpenAI's language models into…
permissive · top 1,000 on PyPI
ollamaProvides a Python client to interact with…
permissive · top 5,000 on PyPI
llama-index-llms-google-genaiIntegrates Google's Gemini models into…
permissive · top 15,000 on PyPI
llama-index-llms-bedrockIntegrates AWS Bedrock LLMs into LlamaIndex,…
permissive · top 15,000 on PyPI
ai21Python SDK for accessing AI21 Labs' language…
unclear · top 15,000 on PyPI
llama-index-llms-litellmIntegrates LiteLLM with LlamaIndex to provide…
permissive · top 15,000 on PyPI
llama-index-llms-azure-openaiIntegrates Azure OpenAI language models into…
permissive · top 15,000 on PyPI
lmstudioPython SDK for interacting with LM Studio, a…
unclear · top 15,000 on PyPI
llama-index-llms-bedrock-converseIntegrates AWS Bedrock's Converse API with…
permissive · top 15,000 on PyPI
npmainpmai provides a Python interface to access…
permissive · top 5,000 on PyPI