Skip to main content

Irona AI Python SDK

Project description

Getting started with Irona AI

Irona AI is an AI model router that automatically determines which LLM is best-suited to respond to any query, improving LLM output quality by combining multiple LLMs into a meta-model that learns when to call each LLM.

Key features

Installation

Python: Requires Python 3.10+. It’s recommended that you create and activate a virtualenv prior to installing the package. For this example, we'll be installing the optional additional create dependencies, which you can learn more about here.

pip install ironaai

Setting up

Create a .env file with your Irona AI API key and the API keys of the models you want to route between:

IRONAAI_API_KEY = "YOUR_IRONAAI_API_KEY"
OPENAI_API_KEY = "YOUR_OPENAI_API_KEY"
ANTHROPIC_API_KEY = "YOUR_ANTHROPIC_API_KEY"

Sending your first Irona AI API request

Create a new file in the same directory as your .env file and copy and run the code below (you can toggle between Python and TypeScript in the top left of the code block):

from ironaai import IronaAI

# Define the Irona AI routing client
client = IronaAI()

# The best LLM is determined by Irona AI based on the messages and specified models
result, session_id, provider = client.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Concisely explain merge sort."}  # Adjust as desired
    ],
    model=['openai/gpt-3.5-turbo', 'openai/gpt-4o', 'anthropic/claude-3-5-sonnet-20240620']
)

print("ND session ID: ", session_id)   # A unique ID of Irona AI's recommendation
print("LLM called: ", provider.model)  # The LLM routed to
print("LLM output: ", result.content)  # The LLM response

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

ironaai-0.1.12.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

ironaai-0.1.12-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file ironaai-0.1.12.tar.gz.

File metadata

  • Download URL: ironaai-0.1.12.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Darwin/23.0.0

File hashes

Hashes for ironaai-0.1.12.tar.gz
Algorithm Hash digest
SHA256 f4e0bcff67f5a6b3712674c173876fc8ff7412a9c7a58d020124a86cb15efd02
MD5 0632433135e945cdcb70c46ce35ce33b
BLAKE2b-256 66ad3ca78a16123fb6b30c025a94b437f2cbde48ab01c7dba904de02ac7f08f0

See more details on using hashes here.

File details

Details for the file ironaai-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: ironaai-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Darwin/23.0.0

File hashes

Hashes for ironaai-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 def9118cfb133a1bf2c3ad47a9f531fb0b04e4009a7bd081470d879eeeb06f33
MD5 aa37f16044afe7f8ab6708a587aba933
BLAKE2b-256 5e474f8bd50789b3d7202126654451a729c2b56c57ec661b0b1811a231b150e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page