Skip to main content

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)
# Example response:  "Yes, a rose's fragrance can't be beat."

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)
# Example reponse: 
# {
#     "array": [
#         {
#             "event": "Kingdom of Aksum",
#             "year": 100,
#             "reasoning": "One of the most powerful early medieval empires in East Africa, yet not widely known or studied in history classes."
#         },
#         {
#             "event": "Mali Empire",
#             "year": 1235,
#             "reasoning": "A prosperous West African empire centered in Mali that controlled trade routes across the Sahara. Advanced cities and universities but its achievements are not always emphasized."
#         },
#         {
#             "event": "Great Zimbabwe",
#             "year": 1450,
#             "reasoning": "Sophisticated city and trade center indicating a highly organized society, but origins are still debated and its influence on the region could be discussed more."
#         }
#     ]
# }

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.

Metadata

Release files for llm-nexus 0.2.0

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

Source distribution (sdist)

Source distribution for llm-nexus 0.2.0
File Size Uploaded Provenance
llm_nexus-0.2.0.tar.gz 18.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-nexus 0.2.0
File Interpreter ABI Platform
llm_nexus-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.9 kB

Release files / llm_nexus-0.2.0.tar.gz

Download URL llm_nexus-0.2.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1902c57556f5c064715c6724af3cf809d7db49ca14c9c14e153860ba0b739619
BLAKE2b-256 checksum
How to use checksums
5d737209a94aa002a37b5c81a5e1ff09b23b9da95d46a11de8d94aa2264d6a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release files / llm_nexus-0.2.0-py3-none-any.whl

Download URL llm_nexus-0.2.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4fcd7a4833e037c2601868260caba8c5486828cec11fb26c1661c267b609767
BLAKE2b-256 checksum
How to use checksums
6cfb6404aa38e862f137e8b93e1b4bd5fc55189a5f10ea9aa49d55ce6421cb24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Security for llm-nexus 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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