ollama-python  by ollama

Python library for interacting with Ollama

created 1 year ago
8,136 stars

Top 6.5% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This library provides a Python interface for interacting with the Ollama API, enabling seamless integration of large language models into Python applications. It is designed for Python 3.8+ developers looking to leverage LLMs for tasks like chat, content generation, and model management.

How It Works

The library acts as a client for the Ollama REST API, abstracting away HTTP requests and responses. It supports both synchronous and asynchronous operations via Client and AsyncClient classes, respectively. Responses can be processed directly or streamed as Python generators for real-time interaction. The client can be customized with host and header configurations, passing additional arguments to the underlying httpx client.

Quick Start & Requirements

  • Primary install: pip install ollama
  • Prerequisites: Ollama must be installed and running. A model needs to be pulled (e.g., ollama pull llama3.2).
  • Documentation: Ollama.com

Highlighted Details

  • Supports synchronous and asynchronous API calls.
  • Enables streaming responses for real-time LLM interaction.
  • Provides methods for common Ollama operations: chat, generate, list, show, create, copy, delete, pull, push, and embed.
  • Includes robust error handling for API interactions.

Maintenance & Community

The project is maintained by the Ollama team. Further community engagement details are not specified in the README.

Licensing & Compatibility

The library is released under an unspecified license. Compatibility for commercial use or closed-source linking is not detailed.

Limitations & Caveats

The README does not specify the license, which may impact commercial adoption. It assumes Ollama is installed and running locally, and requires specific model pulls before use.

Health Check
Last commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
8
Issues (30d)
8
Star History
736 stars in the last 90 days

Explore Similar Projects

Starred by John Resig John Resig(Author of jQuery; Chief Software Architect at Khan Academy), Shawn Wang Shawn Wang(Editor of Latent Space), and
3 more.

ollama-js by ollama

0.4%
4k
JS SDK for Ollama
created 1 year ago
updated 3 weeks ago
Feedback? Help us improve.