ollama-python  by ollama

Python library for interacting with Ollama

Created 1 year ago
8,440 stars

Top 6.1% on SourcePulse

GitHubView on GitHub
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

20 hours ago

Responsiveness

1 week

Pull Requests (30d)
7
Issues (30d)
10
Star History
181 stars in the last 30 days

Explore Similar Projects

Starred by Peter Norvig Peter Norvig(Author of "Artificial Intelligence: A Modern Approach"; Research Director at Google).

python-openai-demos by pamelafox

0.5%
381
Python scripts for OpenAI API demos
Created 1 year ago
Updated 1 week ago
Starred by John Resig John Resig(Author of jQuery; Chief Software Architect at Khan Academy), Shawn Wang Shawn Wang(Editor of Latent Space), and
5 more.

ollama-js by ollama

0.3%
4k
JS SDK for Ollama
Created 2 years ago
Updated 19 hours ago
Feedback? Help us improve.