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
- Maximize output quality: Irona AI outperforms every foundation model on major evaluation benchmarks by always calling the best model for every prompt.
- Reduce cost and latency: Irona AI lets you define intelligent cost and latency tradeoffs to efficiently leverage smaller and cheaper models without degrading quality.
- Train your own router: Irona AI lets you train your own custom routers optimized to your data and use case.
- Python, TypeScript, and REST API support: Irona AI works across a variety of stacks.
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
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4e0bcff67f5a6b3712674c173876fc8ff7412a9c7a58d020124a86cb15efd02 |
|
MD5 | 0632433135e945cdcb70c46ce35ce33b |
|
BLAKE2b-256 | 66ad3ca78a16123fb6b30c025a94b437f2cbde48ab01c7dba904de02ac7f08f0 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | def9118cfb133a1bf2c3ad47a9f531fb0b04e4009a7bd081470d879eeeb06f33 |
|
MD5 | aa37f16044afe7f8ab6708a587aba933 |
|
BLAKE2b-256 | 5e474f8bd50789b3d7202126654451a729c2b56c57ec661b0b1811a231b150e5 |