Skip to content

Commit

Permalink
feat: allow using DANGER_ACCEPT_INVALID_CERTS to disable https verifi…
Browse files Browse the repository at this point in the history
…cation (#901)

Some users have issues connecting to OpenAI due to invalid certs, so
expose this knob:
https://community.openai.com/t/ssl-certificate-verify-failed/32442

Co-authored-by: hellovai <[email protected]>
  • Loading branch information
sxlijin and hellovai committed Sep 10, 2024
1 parent d44730e commit 8873fe7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/baml-runtime/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ fn builder() -> reqwest::ClientBuilder {
if #[cfg(target_arch = "wasm32")] {
reqwest::Client::builder()
} else {
let danger_accept_invalid_certs = matches!(std::env::var("DANGER_ACCEPT_INVALID_CERTS").as_deref(), Ok("1"));
reqwest::Client::builder()
// NB: we can NOT set a total request timeout here: our users
// regularly have requests that take multiple minutes, due to how
// long LLMs take
.connect_timeout(Duration::from_secs(10))
.danger_accept_invalid_certs(danger_accept_invalid_certs)
.http2_keep_alive_interval(Some(Duration::from_secs(10)))
}
}
Expand Down

0 comments on commit 8873fe7

Please sign in to comment.