| Crates.io | arms |
| lib.rs | arms |
| version | 0.0.3 |
| created_at | 2025-12-29 02:13:39.261361+00 |
| updated_at | 2026-01-02 00:43:49.372527+00 |
| description | 🧬 The adaptive model routing system for exploration and exploitation. |
| homepage | |
| repository | https://github.com/InftyAI/AMRS |
| max_upload_size | |
| id | 2009842 |
| size | 158,018 |
The Adaptive Model Routing System (AMRS) is a framework designed to select the best-fit model for exploration and exploitation. Rust core with python bindings. Still under active development 🚧.
AMRS builds on top of async-openai to provide API services for quick setup. Thanks to open source 💙.
Endpoints Support:
Flexible Routing Strategies:
Various Providers Support:
Run the following Cargo command in your project directory:
cargo add arms
Or add the following line to your Cargo.toml:
arms = "0.0.3"
Here's a simple example with the Weighted Round Robin (WRR) router mode. Before running the code, make sure to set your provider API key in the environment variable by running export <PROVIDER>_API_KEY="your_provider_api_key".
Here we use OpenAI as an example.
// Make sure OPENAI_API_KEY is set in your environment variables before running this code.
use arms::client;
use arms::types::chat;
use tokio::runtime::Runtime;
fn main() {
let config = client::Config::builder()
.provider("openai")
.router_mode(client::RouterMode::WRR)
.model(
client::ModelConfig::builder()
.name("gpt-3.5-turbo")
.weight(2)
.build()
.unwrap(),
)
.model(
client::ModelConfig::builder()
.name("gpt-4")
.weight(1)
.build()
.unwrap(),
)
.build()
.unwrap();
let mut client = client::Client::new(config);
let request = chat::CreateChatCompletionRequestArgs::default()
.messages([
chat::ChatCompletionRequestSystemMessage::from("You are a helpful assistant.").into(),
chat::ChatCompletionRequestUserMessage::from("How long it takes to learn Rust?").into(),
])
.build()
.unwrap();
let result = Runtime::new()
.unwrap()
.block_on(client.create_completion(request));
match result {
Ok(response) => {
for choice in response.choices {
println!("Response: {:?}", choice.message.content);
}
}
Err(e) => {
eprintln!("Error: {}", e);
}
}
}
See more examples here folder.
🚀 All kinds of contributions are welcomed ! Please follow Contributing.