#language-model #api-client #api-bindings #ai #llm #fetch #aleph-alpha

aleph-alpha-client

Interact with large language models provided by the Aleph Alpha API in Rust code

25 releases (12 breaking)

new 0.13.1 Oct 24, 2024
0.12.0 Sep 5, 2024
0.10.1 Jul 4, 2024
0.7.1 Nov 30, 2023
0.4.0 Oct 29, 2022

#289 in Web programming

Download history 504/week @ 2024-07-04 194/week @ 2024-07-11 213/week @ 2024-07-18 172/week @ 2024-07-25 155/week @ 2024-08-01 403/week @ 2024-08-08 241/week @ 2024-08-15 328/week @ 2024-08-22 243/week @ 2024-08-29 521/week @ 2024-09-05 199/week @ 2024-09-12 329/week @ 2024-09-19 176/week @ 2024-09-26 116/week @ 2024-10-03 192/week @ 2024-10-10 486/week @ 2024-10-17

1,030 downloads per month

MIT license

1.5MB
1K SLoC

Aleph Alpha API client for Rust

Interact with large language models provided by the Aleph Alpha API in Rust code.

Usage

use aleph_alpha_client::{Client, TaskCompletion, How, Task};

#[tokio::main]
fn main() {
    // Authenticate against API. Fetches token.
    let client = Client::with_authentication("AA_API_TOKEN").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.

Dependencies

~17–30MB
~520K SLoC