A unified interface for multiple LLM providers
Project description
LLM Nexus
LLM Nexus is a Python package that provides a unified interface for interacting with multiple Language Model providers, including OpenAI, Anthropic, and Google AI.
Features
- Unified API for multiple LLM providers
- Support for text completions and function calls
- Easy integration with OpenAI, Anthropic, and Google AI models
Installation
You can install LLM Nexus using pip:
pip install llm-nexus
Usage
Here's a quick example of how to use LLM Nexus:
from llm_nexus import ModelProvider
provider = ModelProvider(openai_api_key="your-openai-key", anthropic_api_key="your-anthropic-key", googleai_api_key="your-googleai-key")
result = provider.completion(
instructions="Return a rhyme.",
user_prompt="Would a rose by any other name smell as sweet?",
provider_name="openai",
model_name="gpt-3.5-turbo"
)
print(result)
For function calls:
from llm_nexus import ModelProvider, Function, Argument, ParamType
provider = ModelProvider(openai_api_key="your-openai-key", anthropic_api_key="your-anthropic-key", googleai_api_key="your-googleai-key")
function = Function(
name="underrated_historical_events",
description="Name up to 3 underrated historical events based on the user's request",
arguments=[
Argument(name="event", param_type=ParamType.STRING, description="The name of the event."),
Argument(name="year", param_type=ParamType.INTEGER, description="The year the event began."),
Argument(name="reasoning", param_type=ParamType.STRING, description="A brief description of why you feel this event is underrated.")
],
)
result = provider.function_call(
user_prompt="What are some underrated A.D. events in African history?",
function=function,
provider_name="openai",
model_name="gpt-3.5-turbo",
return_array=True
)
print(result)
Supported Python Versions
LLM Nexus supports Python 3.7 and above.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
llm-nexus-0.1.1.tar.gz
(16.6 kB
view details)
Built Distribution
llm_nexus-0.1.1-py3-none-any.whl
(16.0 kB
view details)
File details
Details for the file llm-nexus-0.1.1.tar.gz
.
File metadata
- Download URL: llm-nexus-0.1.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 527dec6d1fa82a4a4ecb04cd5434e51d3f1e66943d61407bae321611cd551797 |
|
MD5 | aafa24e6e5f1728a30f00f000f07500e |
|
BLAKE2b-256 | 9af44b6b6805c26e718ce6f00626bd936a12e2cf322085ef8c05cf54fc1b26c7 |
File details
Details for the file llm_nexus-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: llm_nexus-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d60ad8fafa04c5a5ada8793364bbb047c2573a8319416b6c5ba78d3bca9875db |
|
MD5 | cd248f1ee167adca05b39b4d38ed78c5 |
|
BLAKE2b-256 | 6376d4155c72c99ba7f4f8f971155014331c42ecf089e61c34571bcfb83b1151 |