Skip to content

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
penguine-ip committed Jan 23, 2025
1 parent f1bec94 commit f3e31e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deepeval/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ def initialize_model(
# If model is a DeepEvalBaseLLM but not a GPTModel, we can not assume it is a native model
if isinstance(model, DeepEvalBaseLLM):
return model, False
# Otherwise (the model is a string or None), we initialize a GPTModel and use as a native model
return GPTModel(model=model), True

# If the model is a string, we initialize a GPTModel and use as a native model
if isinstance(model, str):
return GPTModel(model=model), True

# Otherwise (the model is a wrong type), we raise an error
raise TypeError(f"Unsupported type for model: {type(model)}. Expected None, str, DeepEvalBaseLLM, or GPTModel.")


# Please don't use this method, dirty hack
Expand Down

0 comments on commit f3e31e9

Please sign in to comment.