benchmarks: fin

This commit is contained in:
Per Stark
2025-12-08 21:57:53 +01:00
parent e77f2d51e8
commit 192e6480e0
39 changed files with 774 additions and 714 deletions
+16
View File
@@ -0,0 +1,16 @@
use anyhow::{Context, Result};
use async_openai::{config::OpenAIConfig, Client};
const DEFAULT_BASE_URL: &str = "https://api.openai.com/v1";
pub fn build_client_from_env() -> Result<(Client<OpenAIConfig>, String)> {
let api_key = std::env::var("OPENAI_API_KEY")
.context("OPENAI_API_KEY must be set to run retrieval evaluations")?;
let base_url =
std::env::var("OPENAI_BASE_URL").unwrap_or_else(|_| DEFAULT_BASE_URL.to_string());
let config = OpenAIConfig::new()
.with_api_key(api_key)
.with_api_base(&base_url);
Ok((Client::with_config(config), base_url))
}