Crates.io | az-openai-rs |
lib.rs | az-openai-rs |
version | 0.1.0 |
source | src |
created_at | 2023-04-11 09:34:40.447776 |
updated_at | 2023-04-11 09:34:40.447776 |
description | Azure OpenAI API wrapper for Rust |
homepage | |
repository | https://github.com/Kakise/az-openai-rs |
max_upload_size | |
id | 835909 |
size | 10,214 |
This crate is a library to interface with Azure OpenAI in Rust.
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;