Unified Large Language Model Interface for ChatGPT, LLaMA, Mistral, Claude, and RAG
Project description
UniLLM: Unified Large Language Model Interface
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file unillm-0.0.8.tar.gz
.
File metadata
- Download URL: unillm-0.0.8.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 051e13b12f23c1f135277cdb01089bdd86169268ac12bb07eee80c4cb9ce01b0 |
|
MD5 | d0299a5fd70b053aa28540fb68eac779 |
|
BLAKE2b-256 | 9a80ac0dfbffbab7eb315427f387e59611d971182168f7e9d96740c5c3a41f82 |
File details
Details for the file unillm-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: unillm-0.0.8-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7000324536030ebb42b7ac9fa587b5cd3ad920d56febfb8ecebf2f5e456469b |
|
MD5 | b74ab0330c3149c04f05da817f6cd359 |
|
BLAKE2b-256 | 70eb83935e6978bdadce05f9d5da23c489ddf9d8cf5a682e8792403296580b30 |