#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

27 releases (13 breaking)

new 0.14.0 Nov 28, 2024
0.12.3 Oct 23, 2024
0.10.1 Jul 4, 2024
0.7.1 Nov 30, 2023
0.4.0 Oct 29, 2022

#296 in Web programming

Download history 404/week @ 2024-08-07 241/week @ 2024-08-14 241/week @ 2024-08-21 293/week @ 2024-08-28 510/week @ 2024-09-04 253/week @ 2024-09-11 287/week @ 2024-09-18 203/week @ 2024-09-25 122/week @ 2024-10-02 150/week @ 2024-10-09 372/week @ 2024-10-16 680/week @ 2024-10-23 268/week @ 2024-10-30 375/week @ 2024-11-06 48/week @ 2024-11-13 109/week @ 2024-11-20

872 downloads per month

MIT license

1.5MB
1.5K 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

~18–32MB
~526K SLoC