Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbkolev/fieri
OpenAI SDK
https://github.com/lbkolev/fieri
client openai sdk
Last synced: about 2 hours ago
JSON representation
OpenAI SDK
- Host: GitHub
- URL: https://github.com/lbkolev/fieri
- Owner: lbkolev
- License: mit
- Created: 2022-12-16T19:13:53.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-16T22:47:07.000Z (about 1 year ago)
- Last Synced: 2024-10-31T11:46:19.141Z (17 days ago)
- Topics: client, openai, sdk
- Language: Rust
- Homepage: https://docs.rs/fieri
- Size: 1.97 MB
- Stars: 63
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
fieri
## Overview
### Unofficial Rust client for OpenAI.fieri provides an asynchronous Rust interface for interaction with OpenAI, allowing you to easily use OpenAI's state-of-the-art machine learning models in your Rust projects.
## Prerequisites
Before you can use the Rust Client for OpenAI, you'll need to sign up for an API key at the OpenAI Developer Portal. Once you've signed up, you'll be able to find your API key in the [API Keys](https://beta.openai.com/account/api-keys) section of the developer portal.## Installation
Run `cargo add fieri` in your terminal to add the latest version of the client.## ChatGPT
```rust
use fieri::{
chat::{chat, ChatMessageBuilder, ChatParamBuilder},
Client, Error,
};let client = Client::new();
let message = ChatMessageBuilder::new("user", "Hello!").build()?;
let param = ChatParamBuilder::new("gpt-3.5-turbo", vec![message]).build()?;let resp = chat(&client, ¶m).await?;
println!("{:#?}", resp);
```By default, the api key and organization are implicitly loaded from environment variables `OPENAI_API_KEY` & `OPENAI_ORGANIZATION`. It's possible to configure/overwrite them per client, using for example:
```rust
use fieri::Clientlet client = Client::new().api_key("");
let client_with_org = Client::new().organization("");
```More examples can be found in the [docs](https://docs.rs/fieri).
## Limitations
Note that the Rust Client for OpenAI is provided as-is, and is not officially supported by OpenAI. While we will do our best to keep the library up-to-date and bug-free, we cannot guarantee that it will always work as expected.Additionally, the API has usage limits that may affect your ability to use the models. You can view your current usage and limits in the [Usage](https://beta.openai.com/account/usage) section of your account.
## License
fieri is provided under the MIT license. See [LICENSE](LICENSE).