pyllms  by kagisearch

Python SDK for LLM access and benchmarking

created 2 years ago
785 stars

Top 45.5% on sourcepulse

GitHubView on GitHub
Project Summary

PyLLMs is a Python library designed for seamless integration with a wide array of Large Language Models (LLMs), offering a unified interface for developers and researchers. It simplifies connecting to services like OpenAI, Anthropic, Google, and Hugging Face, while also providing a built-in benchmarking system to evaluate model performance across quality, speed, and cost.

How It Works

The library abstracts the complexities of interacting with different LLM providers through a consistent API. It handles request formatting, authentication, and response parsing, standardizing output to include crucial metadata like token counts, cost, and latency. This approach allows users to switch between models or query multiple models concurrently with minimal code changes, facilitating efficient A/B testing and performance analysis.

Quick Start & Requirements

  • Install via pip: pip install pyllms
  • Requires API keys for most providers, configurable via environment variables or directly in llms.init().
  • Official documentation and examples are available in the README.

Highlighted Details

  • Supports over 20 LLM providers, including OpenAI, Anthropic, Google (Vertex AI), Ollama (local), Groq, and Together.
  • Features built-in benchmarking to compare model quality, speed, and cost.
  • Offers asynchronous and streaming capabilities for compatible models.
  • Provides utilities for token counting and managing chat history/system messages.

Maintenance & Community

The project appears to be actively maintained by the kagisearch organization. Further community engagement details (e.g., Discord, Slack) are not explicitly mentioned in the README.

Licensing & Compatibility

Licensed under the MIT License, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

The list of supported models may not be exhaustive or perfectly up-to-date, requiring users to verify compatibility for specific model versions. The benchmarking feature's effectiveness relies on the chosen evaluator model.

Health Check
Last commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
19 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Joe Walnes Joe Walnes(Head of Experimental Projects at Stripe), and
2 more.

prompttools by hegelai

0.3%
3k
Open-source tools for prompt testing and experimentation
created 2 years ago
updated 11 months ago
Feedback? Help us improve.