Skip to content

Commit

Permalink
feat: allow custom openai base url (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Dec 28, 2023
1 parent 33e61d1 commit 5fb1f77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions agentverse/llms/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
if os.environ.get("OPENAI_API_KEY") != None:
openai.api_key = os.environ.get("OPENAI_API_KEY")
is_openai_available = True
# set openai api base url if it is set
if os.environ.get("OPENAI_BASE_URL") != None:
openai.base_url = os.environ.get("OPENAI_BASE_URL")
print("use new openai base url", openai.base_url)
elif os.environ.get("AZURE_OPENAI_API_KEY") != None:
openai.api_type = "azure"
openai.api_key = os.environ.get("AZURE_OPENAI_API_KEY")
Expand Down

0 comments on commit 5fb1f77

Please sign in to comment.