kagi-api 0.1.1

Kagi.com API bindings (Search, FastGPT, Universal Summarizer, Enrichment)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use kagi_api::v0::FastGPT;

#[tokio::main]
async fn main() {
    let config = kagi_api::KagiConfig::with_api_key("api key goes here");
    let client = kagi_api::KagiClient::new(config);

    let use_cache = true;
    let answer = client
        .fastgpt("How do I entertain my cat?", use_cache)
        .await
        .expect("A valid FastGPT search result");

    // FIXME: Cannot `.render()` without kagi-cli: Remove `Render` trait's coupling from `Args`.
    serde_json::to_writer_pretty(std::io::stdout(), &answer).unwrap();
}