mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
chore: update examples
This commit is contained in:
@ -2,15 +2,14 @@ use openai_api_rs::v1::api::Client;
|
||||
use openai_api_rs::v1::embedding::EmbeddingRequest;
|
||||
use std::env;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = Client::new(env::var("OPENAI_API_KEY").unwrap().to_string());
|
||||
let req = EmbeddingRequest {
|
||||
model: "text-embedding-ada-002".to_string(),
|
||||
input: "story time".to_string(),
|
||||
user: Option::None,
|
||||
};
|
||||
let result = client.embedding(req).await?;
|
||||
let result = client.embedding(req)?;
|
||||
println!("{:?}", result.data);
|
||||
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user