mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Fix test failures by updating model ID validation logic
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -149,14 +149,11 @@ class LLM:
|
|||||||
callbacks: List[Any] = [],
|
callbacks: List[Any] = [],
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
# Validate model ID to ensure it's not empty, whitespace, or a numeric value without a provider prefix
|
# Only validate model ID if it's not None and is a numeric value without a provider prefix
|
||||||
if not model or (isinstance(model, str) and model.strip() == ""):
|
if model is not None and (
|
||||||
raise ValueError(
|
isinstance(model, (int, float)) or
|
||||||
f"Invalid model ID: '{model}'. Model ID cannot be empty or whitespace. "
|
(isinstance(model, str) and model.strip() and model.strip().isdigit())
|
||||||
"Please specify a valid model ID with a provider prefix, e.g., 'openai/gpt-4'."
|
):
|
||||||
)
|
|
||||||
|
|
||||||
if isinstance(model, (int, float)) or (isinstance(model, str) and model.isdigit()):
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Invalid model ID: {model}. Model ID cannot be a numeric value without a provider prefix. "
|
f"Invalid model ID: {model}. Model ID cannot be a numeric value without a provider prefix. "
|
||||||
"Please specify a valid model ID with a provider prefix, e.g., 'openai/gpt-4'."
|
"Please specify a valid model ID with a provider prefix, e.g., 'openai/gpt-4'."
|
||||||
|
|||||||
Reference in New Issue
Block a user