openai_agents_rust/config/
schema.rs

1use serde::{Deserialize, Serialize};
2use std::path::PathBuf;
3
4/// Configuration schema for the OpenAI Agents crate.
5#[derive(Debug, Clone, Deserialize, Serialize)]
6pub struct Config {
7    /// OpenAI API key (optional if using local/unauthenticated endpoint).
8    #[serde(default)]
9    pub api_key: String,
10    /// Model name to use (e.g., "gpt-4o-mini").
11    pub model: String,
12    /// Base URL for OpenAI-compatible API (e.g., "https://api.openai.com/v1" or local OSS server).
13    pub base_url: String,
14    /// Logging level (e.g., "info", "debug").
15    pub log_level: String,
16    /// Directory where plugins are stored.
17    #[serde(default = "default_plugins_path")]
18    pub plugins_path: PathBuf,
19    /// Optional maximum number of concurrent requests.
20    #[serde(default)]
21    pub max_concurrent_requests: Option<usize>,
22}
23
24pub(crate) fn default_plugins_path() -> PathBuf {
25    dirs::home_dir()
26        .unwrap_or_else(|| PathBuf::from("."))
27        .join(".config")
28        .join("openai_agents")
29        .join("plugins")
30}