1 unstable release

0.1.0 Apr 11, 2023

#94 in #azure

Download history 110/week @ 2024-11-15 98/week @ 2024-11-22 50/week @ 2024-11-29 39/week @ 2024-12-06 214/week @ 2024-12-13 35/week @ 2024-12-20 43/week @ 2024-12-27 266/week @ 2025-01-03 172/week @ 2025-01-10 311/week @ 2025-01-17 542/week @ 2025-01-24 207/week @ 2025-01-31 325/week @ 2025-02-07 154/week @ 2025-02-14 147/week @ 2025-02-21 247/week @ 2025-02-28

928 downloads per month

GPL-2.0 license

11KB
260 lines

az-openai-rs

This crate is a library to interface with Azure OpenAI in Rust.

How-to use

You need to set the following env variables:

OPENAI_API_KEY: <Your Azure OpenAI API Key>
OPENAI_API_URL: <Your Azure deployment url>
OPENAI_API_VERSION: <Your deployment version>
OPENAI_API_DEPLOYMENT: <Your deployment name>

An example of using the Chat api:

    let mut messages = Vec::new();
    messages.push((
        "system",
        "You're an AI language model designed to help the user",
    ));
    messages.push(("assistant", "Hello, how can I help you?"));
    messages.push(("user", &query.query));

    let response = completions::chat()
        .messages(messages)
        .max_tokens(456)
        .send();

And of using the completion api:

let response = completions::completion().prompt("Your prompt").send().await;

Dependencies

~4–16MB
~222K SLoC