Skip to content

A simple crate to interface with Azure OpenAI API asynchronously

License

Notifications You must be signed in to change notification settings

Kakise/az-openai-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

A simple crate to interface with Azure OpenAI API asynchronously

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages