mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
docs(configuration): document optional base_url parameter for OpenAI
Add explanation for the optional base_url parameter in genai.md, allowing custom endpoint configuration for OpenAI API. Update logic in openai.py to handle empty string by setting base_url to None.
This commit is contained in:
parent
cad422f52d
commit
ce29ccda8d
@ -112,9 +112,12 @@ genai:
|
|||||||
provider: openai
|
provider: openai
|
||||||
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
api_key: "{FRIGATE_OPENAI_API_KEY}"
|
||||||
model: gpt-4o
|
model: gpt-4o
|
||||||
base_url: https://api.openai.com/v1
|
base_url: http://example.endpoint/v1 # optional
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Optional base_url Parameter
|
||||||
|
The base_url parameter is an optional configuration setting that allows you to specify a custom endpoint for the OpenAI API. By default, the OpenAI client uses the standard API endpoint provided by OpenAI. However, if you need to route your requests through a different server or use a proxy, you can set this parameter to the desired URL.
|
||||||
|
|
||||||
## Azure OpenAI
|
## Azure OpenAI
|
||||||
|
|
||||||
Microsoft offers several vision models through Azure OpenAI. A subscription is required.
|
Microsoft offers several vision models through Azure OpenAI. A subscription is required.
|
||||||
|
@ -22,8 +22,8 @@ class OpenAIClient(GenAIClient):
|
|||||||
def _init_provider(self):
|
def _init_provider(self):
|
||||||
"""Initialize the client."""
|
"""Initialize the client."""
|
||||||
|
|
||||||
if self.genai_config.base_url is None or self.genai_config.base_url == "":
|
if self.genai_config.base_url == "":
|
||||||
self.genai_config.base_url = "https://api.openai.com/v1"
|
self.genai_config.base_url = None
|
||||||
|
|
||||||
return OpenAI(
|
return OpenAI(
|
||||||
api_key=self.genai_config.api_key, base_url=self.genai_config.base_url
|
api_key=self.genai_config.api_key, base_url=self.genai_config.base_url
|
||||||
|
Loading…
Reference in New Issue
Block a user