Refactoring new client

This commit is contained in:
Dongri Jin
2024-11-10 15:03:34 +09:00
parent b02db53bf3
commit 78c8fee839
13 changed files with 104 additions and 63 deletions

View File

@ -17,7 +17,8 @@ fn get_coin_price(coin: &str) -> f64 {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = OpenAIClient::new(env::var("OPENAI_API_KEY").unwrap().to_string());
let api_key = env::var("OPENAI_API_KEY").unwrap().to_string();
let client = OpenAIClient::builder().with_api_key(api_key).build()?;
let mut properties = HashMap::new();
properties.insert(