jevapi 0.1.0

An asynchronous, typed Rust client for the TypeSafe AI evaluation API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use jevapi::{Client, EvaluationRequest, Question};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::from_env()?;
    let first = EvaluationRequest::new("Please fix the outage immediately.")
        .question("urgent", Question::noul("Is this urgent?"));
    let second = EvaluationRequest::new("Could we discuss pricing next month?")
        .question("urgent", Question::noul("Is this urgent?"));

    let (first, second) = tokio::try_join!(client.evaluate(&first), client.evaluate(&second))?;
    println!("First: {:?}", first.answers);
    println!("Second: {:?}", second.answers);
    Ok(())
}