openai: Fix image_model assignment, add method to check if the used chat model supports images messages
This commit is contained in:
parent
1b290c6b92
commit
c238da9b99
1 changed files with 4 additions and 0 deletions
|
@ -28,9 +28,13 @@ class OpenAI:
|
|||
def __init__(self, api_key, chat_model=None, image_model=None, logger=None):
|
||||
self.api_key = api_key
|
||||
self.chat_model = chat_model or self.chat_model
|
||||
self.image_model = image_model or self.image_model
|
||||
self.logger = logger or Logger()
|
||||
self.base_url = openai.api_base
|
||||
|
||||
def supports_chat_images(self):
|
||||
return "vision" in self.chat_model
|
||||
|
||||
async def _request_with_retries(self, request: partial, attempts: int = 5, retry_interval: int = 2) -> AsyncGenerator[Any | list | Dict, None]:
|
||||
"""Retry a request a set number of times if it fails.
|
||||
|
||||
|
|
Loading…
Reference in a new issue