Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: fallback to error.status for eval error handling (#5037)

Steffen Schmitzf8e61c26598e
diff --git a/worker/src/features/utilities.ts b/worker/src/features/utilities.ts
index fd6317f3d9..e4bb493831 100644
--- a/worker/src/features/utilities.ts
+++ b/worker/src/features/utilities.ts
@@ -49,7 +49,7 @@ export async function callStructuredLLM<T extends ZodSchema>(
logger.error(`Job ${jeId} failed to call LLM. Eval will fail.`, e);
throw new ApiError(
`Failed to call LLM: ${e}`,
- (e as any)?.response?.status,
+ (e as any)?.response?.status ?? (e as any)?.status,
);
}
}
@@ -91,7 +91,7 @@ export async function callLLM(
logger.error(`Job ${jeId} failed to call LLM. Eval will fail.`, e);
throw new ApiError(
`Failed to call LLM: ${e}`,
- (e as any)?.response?.status,
+ (e as any)?.response?.status ?? (e as any)?.status,
);
}
}