openlm  by r2d4

OpenAI-compatible Python client for calling LLMs

created 2 years ago
372 stars

Top 77.3% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides an OpenAI-compatible Python client for interacting with various Large Language Models (LLMs) beyond OpenAI's offerings. It targets developers and researchers who want to easily switch between or query multiple LLM providers, including HuggingFace and Cohere, using a unified API, thereby simplifying experimentation and model selection.

How It Works

OpenLM acts as a drop-in replacement for the OpenAI Python client, mimicking its Completion.create API structure. It achieves cross-provider compatibility by directly calling the inference APIs of supported services. This approach minimizes dependencies and overhead, allowing users to send multiple prompts to multiple models concurrently within a single request, returning a consolidated response.

Quick Start & Requirements

  • Install via pip: pip install openlm
  • Requires API keys for the respective LLM providers (e.g., OpenAI, Cohere) to be set as environment variables.
  • Supports calling models from HuggingFace's inference endpoint API.

Highlighted Details

  • OpenAI-compatible API for Completion.create.
  • Supports multiple LLM providers (OpenAI, HuggingFace, Cohere) and custom implementations.
  • Enables concurrent prompting across multiple models in a single request.
  • Minimal footprint by directly calling inference APIs.

Maintenance & Community

  • Contributions are welcome via issues or pull requests.
  • No explicit community channels (Discord/Slack) or roadmap details are provided in the README.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The library currently only supports the Completion endpoint; other standardized endpoints like ChatCompletion or Embeddings are planned but not yet implemented. The README does not specify version requirements for Python or other dependencies.

Health Check
Last commit

2 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 90 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%
374
Python scripts for OpenAI API demos
created 1 year ago
updated 1 week ago
Feedback? Help us improve.