making image code more robust

This commit is contained in:
Joshua Vial 2023-12-11 22:21:24 +13:00
parent f9ba8e7b41
commit 9ceaf97f08
3 changed files with 9 additions and 6 deletions

View file

@ -1,5 +1,4 @@
from pathlib import Path
from openai import OpenAIError
# Set of image file extensions
IMAGE_EXTENSIONS = {'.png', '.jpg', '.jpeg', '.gif', '.bmp', '.tiff', '.webp'}
@ -42,6 +41,7 @@ def show_messages(messages, title=None, functions=None):
if functions:
dump(functions)
def is_gpt4_with_openai_base_url(model_name, client):
"""
Check if the model_name starts with 'gpt-4' and the client base URL includes 'api.openai.com'.