cleaned up client refs

This commit is contained in:
Paul Gauthier 2024-04-17 15:47:07 -07:00
parent f1a31d3944
commit c770fc4380
7 changed files with 16 additions and 30 deletions

View file

@ -106,14 +106,12 @@ def show_messages(messages, title=None, functions=None):
dump(functions)
def is_gpt4_with_openai_base_url(model_name, client):
# TODO: fix this
def is_gpt4_with_openai_base_url(model_name):
"""
Check if the model_name starts with 'gpt-4' and the client base URL includes 'api.openai.com'.
:param model_name: The name of the model to check.
:param client: The OpenAI client instance.
:return: True if conditions are met, False otherwise.
"""
if client is None or not hasattr(client, "base_url"):
return False
return model_name.startswith("gpt-4") and "api.openai.com" in client.base_url.host
return model_name.startswith("gpt-4")