feat: Allow setting OpenAI timeout from config (#1819)
This commit is contained in:
@@ -54,8 +54,9 @@ impl OpenAiProvider {
|
||||
.unwrap_or_else(|_| "v1/chat/completions".to_string());
|
||||
let organization: Option<String> = config.get_param("OPENAI_ORGANIZATION").ok();
|
||||
let project: Option<String> = config.get_param("OPENAI_PROJECT").ok();
|
||||
let timeout_secs: u64 = config.get_param("OPENAI_TIMEOUT").unwrap_or(600);
|
||||
let client = Client::builder()
|
||||
.timeout(Duration::from_secs(600))
|
||||
.timeout(Duration::from_secs(timeout_secs))
|
||||
.build()?;
|
||||
|
||||
Ok(Self {
|
||||
@@ -116,6 +117,7 @@ impl Provider for OpenAiProvider {
|
||||
ConfigKey::new("OPENAI_BASE_PATH", true, false, Some("v1/chat/completions")),
|
||||
ConfigKey::new("OPENAI_ORGANIZATION", false, false, None),
|
||||
ConfigKey::new("OPENAI_PROJECT", false, false, None),
|
||||
ConfigKey::new("OPENAI_TIMEOUT", false, false, Some("600")),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user