Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roushou/mesh
Build AI-powered apps in Rust using popular LLM providers
https://github.com/roushou/mesh
ai anthropic replicate rust
Last synced: about 2 months ago
JSON representation
Build AI-powered apps in Rust using popular LLM providers
- Host: GitHub
- URL: https://github.com/roushou/mesh
- Owner: roushou
- License: apache-2.0
- Created: 2024-09-05T09:42:33.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-22T11:57:25.000Z (3 months ago)
- Last Synced: 2024-10-31T11:46:44.972Z (2 months ago)
- Topics: ai, anthropic, replicate, rust
- Language: Rust
- Homepage: https://crates.io/crates/mesh
- Size: 219 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Mesh
[![Crates.io][crates-badge]][crates-url]
[![MIT licensed][mit-badge]][mit-url]
[![APACHE-2.0 licensed][apache-badge]][apache-url]
[![Build Status][actions-badge]][actions-url][crates-badge]: https://img.shields.io/crates/v/mesh.svg
[crates-url]: https://crates.io/crates/mesh
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-url]: https://github.com/roushou/mesh/blob/master/LICENSE-MIT
[apache-badge]: https://img.shields.io/badge/license-apache-blue.svg
[apache-url]: https://github.com/roushou/mesh/blob/master/LICENSE-APACHE
[actions-badge]: https://github.com/roushou/mesh/workflows/CI/badge.svg
[actions-url]: https://github.com/roushou/mesh/actions?query=workflow%3ACI+branch%3AmasterMesh 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](https://crates.io/crates/mesh).
## Getting started
Add `mesh` as a dependency in your application.
```sh
$ cargo add mesh
```An example to create a message using Claude 3.5 Sonnet from Anthropic.
```rust,ignore
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).await.unwrap();
println!("{:?}", result);
}
```## Licenses
This project is licensed under the [MIT license](./LICENSE-MIT) and [Apache-2.0](./LICENSE-APACHE) license.