Skip to main content

UniLLM: Unified Large Language Model Interface

License: MIT PyPI GitHub stars Documentation Status

UniLLM is a versatile Python library and command-line tool designed to provide unified access to various large language models such as ChatGPT, Llama2, Mistral, Claude, MistralAI, RAG, Llama3, and CommandRPlus. This library simplifies the integration of these models into your projects or allows for direct interaction via the command line.

Features

  • Unified API for interacting with multiple language models.
  • Support for both API and local models.
  • Extensible framework allowing the addition of more models in the future.
  • Command-line tool for easy interaction with models.
  • Configuration via YAML file for API keys.

Installation

Install UniLLM using pip:

pip install unillm

Configuration

Configure your API keys for the models by creating a .unillm.yaml file in your home directory:

chatgpt: YOUR_CHATGPT_API_KEY
claude: YOUR_CLAUDE_API_KEY
mistralai: YOUR_MISTRALAI_API_KEY
# Add other model API keys as needed

Supported Models

Model Support API Support Local
ChatGPT
Llama2
Mistral
Claude
MistralAI
RAG
Llama3
CommandRPlus

Usage

As a Python Library

Interact with language models seamlessly in your Python projects:

from unillm import UniLLM

# Initialize Llama with specific settings
model = UniLLM('Llama2', peft_path="path_to_peft_model", max_new_tokens=1024)

# Generate a response
response = model.generate_response("How can AI help humans?")
print(response)

As a Command-Line Tool

Start the CLI by running:

unillm

Follow the prompts to select a model and enter your queries. For example:

Please choose a model by number (default is 1):
1: ChatGPT
2: Llama2
...

👨Please Ask a Question: What are the latest AI trends?
🤖 (ChatGPT): AI trends include...

To exit, type exit.

Contributing

We welcome contributions! If you have suggestions or enhancements, fork the repository, create a feature branch, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for unillm 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unillm 0.0.8
File Size Uploaded
unillm-0.0.8.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unillm 0.0.8
File Interpreter ABI Platform
unillm-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / unillm-0.0.8.tar.gz

Download URL unillm-0.0.8.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
051e13b12f23c1f135277cdb01089bdd86169268ac12bb07eee80c4cb9ce01b0
BLAKE2b-256 checksum
How to use checksums
9a80ac0dfbffbab7eb315427f387e59611d971182168f7e9d96740c5c3a41f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release files / unillm-0.0.8-py3-none-any.whl

Download URL unillm-0.0.8-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7000324536030ebb42b7ac9fa587b5cd3ad920d56febfb8ecebf2f5e456469b
BLAKE2b-256 checksum
How to use checksums
70eb83935e6978bdadce05f9d5da23c489ddf9d8cf5a682e8792403296580b30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page