Skip to content

Commit 8fa8081

Browse files
authored
release v0.0.1 (#86)
* update cargo.toml Signed-off-by: kerthcet <kerthcet@gmail.com> * release v0.0.1 Signed-off-by: kerthcet <kerthcet@gmail.com> * remove main.rs Signed-off-by: kerthcet <kerthcet@gmail.com> --------- Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent 90bdea3 commit 8fa8081

File tree

4 files changed

+111
-145
lines changed

4 files changed

+111
-145
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name = "arms"
33
version = "0.0.1"
44
edition = "2024"
55

6+
description = "🧬 The adaptive model routing system for exploration and exploitation."
7+
license = "MIT"
8+
repository = "https://github.com/InftyAI/AMRS"
9+
readme = "README.md"
10+
keywords = ["llmops", "ai-gateway", "ai-proxy", "sdk", "llm"]
11+
categories = ["router"]
12+
613
[dependencies]
714
async-openai = { version = "0.31.1", features = ["_api", "response-types", "responses", "chat-completion"] }
815
async-trait = "0.1.89"

README.md

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ AMRS builds on top of [async-openai](https://github.com/64bit/async-openai) to p
2323
- OpenAI compatible providers (OpenAI, DeepInfra, etc.)
2424
- More on the way
2525

26-
## How to use
26+
## How to Install
27+
28+
Run the following Cargo command in your project directory:
29+
30+
`cargo add arms`
31+
32+
Or add the following line to your Cargo.toml:
33+
34+
`arms = "0.0.1"`
35+
36+
## How to Use
2737

2838
Here's a simple example with the Weighted Round Robin (WRR) routing mode. Before running the code, make sure to set your provider API key in the environment variable by running `export <PROVIDER>_API_KEY="your_openai_api_key"`.
2939
Here we use OpenAI as an example.
@@ -32,54 +42,60 @@ Here we use OpenAI as an example.
3242
```rust
3343
# Make sure OPENAI_API_KEY is set in your environment variables before running this code.
3444

35-
use tokio::runtime::Runtime;
3645
use arms::client;
3746
use arms::types::chat;
47+
use tokio::runtime::Runtime;
3848

39-
let config = client::Config::builder()
40-
.provider("openai")
41-
.routing_mode(client::RoutingMode::WRR)
42-
.model(
43-
client::ModelConfig::builder()
44-
.name("gpt-3.5-turbo")
45-
.weight(2)
46-
.build()
47-
.unwrap(),
48-
)
49-
.model(
50-
client::ModelConfig::builder()
51-
.name("gpt-4")
52-
.weight(1)
53-
.build()
54-
.unwrap(),
55-
)
56-
.build()
57-
.unwrap();
58-
59-
let mut client = client::Client::new(config);
60-
let request = chat::CreateChatCompletionRequestArgs::default()
61-
.messages([
62-
chat::ChatCompletionRequestSystemMessage::from("You are a helpful assistant.").into(),
63-
chat::ChatCompletionRequestUserMessage::from("Who won the FIFA World Cup in 2025?").into(),
64-
])
65-
.build()
66-
.unwrap();
67-
68-
let result = Runtime::new().unwrap().block_on(client.create_completion(request));
69-
match result {
70-
Ok(response) => {
71-
for choice in response.choices {
72-
println!("Response: {:?}", choice.message.content);
49+
fn main() {
50+
let config = client::Config::builder()
51+
.provider("deepinfra")
52+
.routing_mode(client::RoutingMode::WRR)
53+
.model(
54+
client::ModelConfig::builder()
55+
.name("deepseek-ai/DeepSeek-V3.2")
56+
.weight(2)
57+
.build()
58+
.unwrap(),
59+
)
60+
.model(
61+
client::ModelConfig::builder()
62+
.name("nvidia/Nemotron-3-Nano-30B-A3B")
63+
.weight(1)
64+
.build()
65+
.unwrap(),
66+
)
67+
.build()
68+
.unwrap();
69+
70+
let mut client = client::Client::new(config);
71+
let request = chat::CreateChatCompletionRequestArgs::default()
72+
.messages([
73+
chat::ChatCompletionRequestSystemMessage::from("You are a helpful assistant.").into(),
74+
chat::ChatCompletionRequestUserMessage::from("How long it takes to learn Rust?").into(),
75+
])
76+
.build()
77+
.unwrap();
78+
79+
let result = Runtime::new()
80+
.unwrap()
81+
.block_on(client.create_completion(request));
82+
match result {
83+
Ok(response) => {
84+
for choice in response.choices {
85+
println!("Response: {:?}", choice.message.content);
86+
}
87+
}
88+
Err(e) => {
89+
eprintln!("Error: {}", e);
7390
}
74-
}
75-
Err(e) => {
76-
eprintln!("Error: {}", e);
7791
}
7892
}
7993
```
8094

95+
See more examples [here](/examples) folder.
96+
8197
## Contributing
8298

8399
🚀 All kinds of contributions are welcomed ! Please follow [Contributing](/CONTRIBUTING.md).
84100

85-
[![Star History Chart](https://api.star-history.com/svg?repos=inftyai/amrs&type=Date)](https://www.star-history.com/#inftyai/amrs&Date)
101+
[![Star History Chart](https://api.star-history.com/svg?repos=inftyai/amrs&type=Date)](https://www.star-history.com/#inftyai/amrs&Date)

examples/wrr.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
use arms::client;
2+
use arms::types::chat;
3+
use tokio::runtime::Runtime;
4+
5+
fn main() {
6+
let config = client::Config::builder()
7+
.provider("deepinfra")
8+
.routing_mode(client::RoutingMode::WRR)
9+
.model(
10+
client::ModelConfig::builder()
11+
.name("deepseek-ai/DeepSeek-V3.2")
12+
.weight(2)
13+
.build()
14+
.unwrap(),
15+
)
16+
.model(
17+
client::ModelConfig::builder()
18+
.name("nvidia/Nemotron-3-Nano-30B-A3B")
19+
.weight(1)
20+
.build()
21+
.unwrap(),
22+
)
23+
.build()
24+
.unwrap();
25+
26+
let mut client = client::Client::new(config);
27+
let request = chat::CreateChatCompletionRequestArgs::default()
28+
.messages([
29+
chat::ChatCompletionRequestSystemMessage::from("You are a helpful assistant.").into(),
30+
chat::ChatCompletionRequestUserMessage::from("How long it takes to learn Rust?").into(),
31+
])
32+
.build()
33+
.unwrap();
34+
35+
let result = Runtime::new()
36+
.unwrap()
37+
.block_on(client.create_completion(request));
38+
match result {
39+
Ok(response) => {
40+
for choice in response.choices {
41+
println!("Response: {:?}", choice.message.content);
42+
}
43+
}
44+
Err(e) => {
45+
eprintln!("Error: {}", e);
46+
}
47+
}
48+
}

src/main.rs

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)