docs.rs failed to build rust-openai-lib-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
rust-openai-lib
This project is a Rust library for interacting with the OpenAI API. It provides a simple and intuitive interface for sending requests to the API and processing the responses. The library supports various features of the OpenAI API, including chat completions. It's designed for developers who want to integrate OpenAI's powerful AI models into their Rust applications.
Installation
Install this project with cargo
Usage/Examples
use rust-openai-;
let openai = new;
API Reference
Initialize OpenAI
let openai = new;
Parameter | Type | Description |
---|---|---|
api_key | String |
Your OpenAI API key |
model | Model |
The model to use |
Returns: Openai
Get chat completion
let messages = vec!;
let response = openai.get_chat_completion.await.unwrap;
Parameter | Type | Description |
---|---|---|
messages | Vec<Message> |
List of messages for the chat completion |
Returns: Result<Value, Error>
Where Value
is response object.