Skip to content

Commit

Permalink
Merge pull request #267 from danbev/openai-api-base-url
Browse files Browse the repository at this point in the history
openai: add support for setting the base url
  • Loading branch information
williamhogman authored Feb 5, 2024
2 parents a416579 + 2ecfbff commit bb57935
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/llm-chain-openai/src/chatgpt/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ impl traits::Executor for Executor {
if let Ok(org_id) = std::env::var("OPENAI_ORG_ID") {
cfg = cfg.with_org_id(org_id);
}

if let Ok(base_url) = std::env::var("OPENAI_API_BASE_URL") {
cfg = cfg.with_api_base(base_url);
}

let client = Arc::new(async_openai::Client::with_config(cfg));
Ok(Self { client, options })
}
Expand Down

0 comments on commit bb57935

Please sign in to comment.