Skip to content

Commit

Permalink
Merge pull request #787 from PrefectHQ/base-url
Browse files Browse the repository at this point in the history
allow setting base_url
  • Loading branch information
zzstoatzz authored Jan 19, 2024
2 parents b521314 + 67f0e62 commit 60a891f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/marvin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ class OpenAISettings(MarvinSettings):
description="Your OpenAI organization ID.",
)

base_url: Optional[str] = Field(
default=None,
description="Your OpenAI base URL.",
)

chat: ChatSettings = Field(default_factory=ChatSettings)
images: ImageSettings = Field(default_factory=ImageSettings)
audio: AudioSettings = Field(default_factory=AudioSettings)
Expand Down
6 changes: 5 additions & 1 deletion src/marvin/utilities/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def get_openai_client(
)
)

kwargs.update(api_key=api_key, organization=marvin.settings.openai.organization)
kwargs.update(
api_key=api_key,
organization=marvin.settings.openai.organization,
base_url=marvin.settings.openai.base_url,
)

# --- Azure OpenAI
elif marvin.settings.provider == "azure_openai":
Expand Down

0 comments on commit 60a891f

Please sign in to comment.