2 releases
0.1.1 | Sep 22, 2024 |
---|---|
0.1.0 | Sep 22, 2024 |
#1808 in Web programming
32KB
594 lines
Groq Unofficial Rust SDK
This is an unofficial Rust SDK for the Groq API.
More information about this crate can be found in the crate documentation.
Installation
Add gruq
as a dependency to your Cargo.toml
$ cargo add gruq
Usage
An example to create a completion.
use gruq::{
chat::message::{CreateChatCompletion, Message, Role},
client::Client,
config::Config,
models::Model,
};
#[tokio::main]
async fn main() {
let config = Config::from_env().unwrap();
let client = Client::new(config).unwrap();
let messages: Vec<Message> = vec![Message {
role: Role::User,
content: "Hello World".to_string(),
name: None,
}];
let completion_request = CreateChatCompletion::new(Model::Llama38B, messages);
let completion = client
.chat
.create_completion(completion_request)
.await
.unwrap();
println!("{:?}", completion);
}
License
This project is licensed under the MIT license and Apache-2.0 license.
Dependencies
~7–18MB
~232K SLoC