Skip to content

Commit 5fb1f77

Browse files
authored
feat: allow custom openai base url (#108)
1 parent 33e61d1 commit 5fb1f77

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

agentverse/llms/openai.py

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
if os.environ.get("OPENAI_API_KEY") != None:
3131
openai.api_key = os.environ.get("OPENAI_API_KEY")
3232
is_openai_available = True
33+
# set openai api base url if it is set
34+
if os.environ.get("OPENAI_BASE_URL") != None:
35+
openai.base_url = os.environ.get("OPENAI_BASE_URL")
36+
print("use new openai base url", openai.base_url)
3337
elif os.environ.get("AZURE_OPENAI_API_KEY") != None:
3438
openai.api_type = "azure"
3539
openai.api_key = os.environ.get("AZURE_OPENAI_API_KEY")

0 commit comments

Comments
 (0)