mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
feat(genai): add configurable base_url for OpenAI API integration
This commit is contained in:
parent
ed9c67804a
commit
cad422f52d
@ -112,6 +112,7 @@ 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
|
||||||
```
|
```
|
||||||
|
|
||||||
## Azure OpenAI
|
## Azure OpenAI
|
||||||
|
@ -21,7 +21,13 @@ class OpenAIClient(GenAIClient):
|
|||||||
|
|
||||||
def _init_provider(self):
|
def _init_provider(self):
|
||||||
"""Initialize the client."""
|
"""Initialize the client."""
|
||||||
return OpenAI(api_key=self.genai_config.api_key)
|
|
||||||
|
if self.genai_config.base_url is None or self.genai_config.base_url == "":
|
||||||
|
self.genai_config.base_url = "https://api.openai.com/v1"
|
||||||
|
|
||||||
|
return OpenAI(
|
||||||
|
api_key=self.genai_config.api_key, base_url=self.genai_config.base_url
|
||||||
|
)
|
||||||
|
|
||||||
def _send(self, prompt: str, images: list[bytes]) -> Optional[str]:
|
def _send(self, prompt: str, images: list[bytes]) -> Optional[str]:
|
||||||
"""Submit a request to OpenAI."""
|
"""Submit a request to OpenAI."""
|
||||||
|
Loading…
Reference in New Issue
Block a user