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

aleph-alpha-client

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

20 unstable releases (9 breaking)

new 0.10.1 Jul 4, 2024
0.8.0 May 28, 2024
0.7.1 Nov 30, 2023
0.7.0 Jul 26, 2023
0.4.0 Oct 29, 2022

#68 in Machine learning

Download history 211/week @ 2024-03-14 188/week @ 2024-03-21 149/week @ 2024-03-28 199/week @ 2024-04-04 211/week @ 2024-04-11 228/week @ 2024-04-18 120/week @ 2024-04-25 168/week @ 2024-05-02 86/week @ 2024-05-09 111/week @ 2024-05-16 256/week @ 2024-05-23 139/week @ 2024-05-30 90/week @ 2024-06-06 375/week @ 2024-06-13 443/week @ 2024-06-20 352/week @ 2024-06-27

1,268 downloads per month

MIT license

1.5MB
856 lines

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", 10);
    
    // 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

~15–29MB
~282K SLoC