| Crates.io | portkey |
| lib.rs | portkey |
| version | 0.1.0 |
| created_at | 2024-11-16 16:03:46.22941+00 |
| updated_at | 2024-11-16 16:03:46.22941+00 |
| description | A Rust SDK for interacting with Portkey AI |
| homepage | https://portkey.ai/ |
| repository | https://github.com/NewtTheWolf/portkey-rs |
| max_upload_size | |
| id | 1450444 |
| size | 57,562 |
The portkey crate is a lightweight wrapper around async-openai designed to provide a Portkey-compatible OpenAI client. It simplifies the process of configuring custom clients to work seamlessly with the Portkey AI API.
async-openai.Currently, this SDK serves as a simple wrapper around async-openai, making it Portkey-compatible. However, the goal is to expand it in the future to fully support the entire Portkey API, offering advanced functionality for developers.
Install the crate using Cargo:
cargo add portkey
Here's how to use the portkey client:
use portkey::Client;
#[tokio::main]
async fn main() {
let api_key = "your-portkey-api-key";
let virtual_key = "your-portkey-virtual-key";
// Create a new Portkey client
let client = Client::new(api_key, virtual_key);
// Access the OpenAI client
let openai_client = client.openai();
// Example API call
let response = openai_client
.completions()
.create("text-davinci-003", "Hello, Portkey!", None)
.await
.expect("API call failed");
println!("{:?}", response);
}
This project is licensed under the MIT License. See the LICENSE file for details.