9 releases (4 breaking)
0.5.2 | Sep 12, 2024 |
---|---|
0.5.1 | Sep 12, 2024 |
0.4.0 | Sep 12, 2024 |
0.3.0 | Sep 10, 2024 |
0.1.0 | Sep 5, 2024 |
#577 in Machine learning
130KB
3K
SLoC
Mesh
Mesh is a Rust SDK designed to build AI-powered applications using (popular) LLM providers such as Anthropic, OpenAI, Replicate and more.
More information about this crate can be found in the crate documentation.
Getting started
Add mesh
as a dependency in your application.
$ cargo add mesh
An example to create a message using Claude 3.5 Sonnet from Anthropic.
use mesh::anthropic::{
client::Client,
completion::message::{Content, ContentType, Message, MessageRequest, Role},
config::Config,
models::claude::ClaudeModel,
};
#[tokio::main]
async fn main() {
let api_key = std::env::var("ANTHROPIC_API_KEY").expect("ANTHROPIC_API_KEY should be defined");
let config = Config::new(api_key);
let client = Client::new(config).unwrap();
let message = MessageRequest {
model: ClaudeModel::Claude35Sonnet,
max_tokens: 1024,
messages: vec![Message {
role: Role::User,
content: vec![Content {
content_type: ContentType::Text,
text: "Explain the theory of relativity".to_string(),
}],
}],
..Default::default()
};
let result = client.create_message(message.clone()).await.unwrap();
println!("{:?}", result);
}
Licenses
This project is licensed under the MIT license and Apache-2.0 license.
Dependencies
~7–18MB
~233K SLoC