chore: add error log on model prediction failure

This commit is contained in:
tomoya-kawaguchi 2025-10-07 19:19:03 +09:00
parent fea8bc5150
commit be93651db8

View file

@ -329,9 +329,9 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT
) )
get_settings().set("openai.deployment_id", deployment_id) get_settings().set("openai.deployment_id", deployment_id)
return await f(model) return await f(model)
except: except Exception as e:
get_logger().warning( get_logger().warning(
f"Failed to generate prediction with {model}" f"Failed to generate prediction with {model}: {e}",
) )
if i == len(all_models) - 1: # If it's the last iteration 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}")