Crates.io | aleph-alpha-client |
lib.rs | aleph-alpha-client |
version | |
source | src |
created_at | 2022-08-07 11:31:52.020621 |
updated_at | 2024-12-10 11:08:53.045247 |
description | Interact with large language models provided by the Aleph Alpha API in Rust code |
homepage | |
repository | https://github.com/Aleph-Alpha/aleph-alpha-client-rs |
max_upload_size | |
id | 640185 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Interact with large language models provided by the Aleph Alpha API in Rust code.
use aleph_alpha_client::{Client, TaskCompletion, How, Task};
#[tokio::main]
fn main() {
// Authenticate against API. Fetches token.
let client = Client::from_env().unwrap();
// Name of the model we we want to use. Large models give usually better answer, but are also
// more costly.
let model = "luminous-base";
// The task we want to perform. Here we want to continue the sentence: "An apple a day ..."
let task = TaskCompletion::from_text("An apple a day").with_maximum_tokens(20);
// Retrieve the answer from the API
let response = client.completion(&task, model, &How::default()).await.unwrap();
// Print entire sentence with completion
println!("An apple a day{}", response.completion);
}
This is a work in progress currently the Rust client is not a priority on our Roadmap, so expect this client to be incomplete. If we work on it expect interfaces to break.