Crate prediction_guard

Crate prediction_guard 

Source
Expand description

Prediction Guard api client. Used to communicate with Prediction Guard API.

You must have an API key to use the client. Once you have your API key you create an instance of client::Client. This will allow access to all the endpoints.

§Example


use prediction_guard::{chat, client};

#[tokio::main]
async fn main() {
    let clt = client::Client::new().expect("client value");

    let req = chat::Request::<chat::Message>::new("Neural-Chat-7B".to_string())
                .add_message(
                    chat::Roles::User,
                    "How do you feel about the world in general?".to_string(),
                )
                .max_tokens(1000)
                .temperature(0.85);

    let result = clt.generate_chat_completion(&req)
                    .await
                    .expect("error from generate chat completion");

    println!("\nchat completion response:\n\n {:?}", result);
}

See the /examples directory for more examples.

Modules§

chat
Data types that are used for the chat endpoints, including chat completions, chat vision and chat events.
client
Used to connect to the Prediction Guard API.
completion
Data types that are used for the completion endpoints.
embedding
Data types to be used in the embedding endpoint.
factuality
Data types that are used for the factuality endpoints.
image
Utility module used to download and base64 encode an image.
injection
Data types used for the injection endpoint.
models
Data types that are used for the factuality endpoints.
pii
Data types for the PII detection endpoint.
rerank
Data types that are used for the rerank endpoint.
tokenize
Data types that are used for the tokenize endpoint.
toxicity
Data types for the toxicity endpoint.
translate
Data types used for the translate endpoint.

Type Aliases§

Result