Merge pull request #2053 from yamoyamoto/chore/add-error-log

chore: add error log on model prediction failure
This commit is contained in:
ofir-frd 2025-10-11 16:03:52 +03:00 committed by GitHub
commit 01a7c04263
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -329,12 +329,13 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT
)
get_settings().set("openai.deployment_id", deployment_id)
return await f(model)
except:
except Exception as e:
get_logger().warning(
f"Failed to generate prediction with {model}"
f"Failed to generate prediction with {model}",
artifact={"error": e},
)
if i == len(all_models) - 1: # If it's the last iteration
raise Exception(f"Failed to generate prediction with any model of {all_models}")
raise Exception(f"Failed to generate prediction with any model of {all_models}") from e
def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]: