aionic 0.1.7

AIonic: A unified, user-friendly Rust library for seamless integration with various public Language Model APIs, such as openAI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use aionic::openai::{Chat, OpenAI};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let context_primer = "Answer as if you were Yoda";
    let message = "What is the meaning of life?";

    let _res = OpenAI::<Chat>::new()
        .set_model(Chat::get_default_model())
        .set_temperature(Chat::get_default_temperature())
        .set_max_tokens(Chat::get_default_max_tokens())
        .set_stream_responses(Chat::get_default_stream())
        .set_primer(context_primer)
        .ask(message, false)
        .await?;
    Ok(())
}