chore: Clarify support-related Exceptions in utils.py (#5447)

Improved the clarity of Exceptions in supports_system_messages, supports_response_schema, supports_function_calling, and supports_parallel_function_calling. Previously, it was difficult to determine the cause of Exception logs due to vague messaging. Each case now includes a more specific and appropriate Exception message.
This commit is contained in:
JooHo Kim 2024-08-31 00:29:05 +09:00 committed by GitHub
parent 7f1531006c
commit 5b1d9712c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2103,7 +2103,7 @@ def supports_system_messages(model: str, custom_llm_provider: Optional[str]) ->
return False return False
except Exception: except Exception:
raise Exception( raise Exception(
f"Model not in model_prices_and_context_window.json. You passed model={model}, custom_llm_provider={custom_llm_provider}." f"Model not supports system messages. You passed model={model}, custom_llm_provider={custom_llm_provider}."
) )
@ -2139,7 +2139,7 @@ def supports_response_schema(model: str, custom_llm_provider: Optional[str]) ->
return False return False
except Exception: except Exception:
verbose_logger.error( verbose_logger.error(
f"Model not in model_prices_and_context_window.json. You passed model={model}, custom_llm_provider={custom_llm_provider}." f"Model not supports response_schema. You passed model={model}, custom_llm_provider={custom_llm_provider}."
) )
return False return False
@ -2165,7 +2165,7 @@ def supports_function_calling(model: str) -> bool:
return False return False
else: else:
raise Exception( raise Exception(
f"Model not in model_prices_and_context_window.json. You passed model={model}." f"Model not supports function calling. You passed model={model}."
) )
@ -2211,7 +2211,7 @@ def supports_parallel_function_calling(model: str):
return False return False
else: else:
raise Exception( raise Exception(
f"Model not in model_prices_and_context_window.json. You passed model={model}." f"Model not supports parallel function calling. You passed model={model}."
) )