pyllms  by kagisearch

Python SDK for LLM access and benchmarking

Created 2 years ago
792 stars

Top 44.4% 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
2 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.