@wix/evalforge-evaluator 0.160.0 → 0.161.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -3913,6 +3913,19 @@ async function executeWithAiSdk(context) {
3913
3913
  } catch (err) {
3914
3914
  const baseMsg = err instanceof Error ? err.message : String(err);
3915
3915
  const ctx = extractGatewayErrorContext(err);
3916
+ const apiError = findApiCallError(err);
3917
+ console.error(
3918
+ "[AI gateway error]",
3919
+ JSON.stringify({
3920
+ provider,
3921
+ model: modelId,
3922
+ message: baseMsg,
3923
+ statusCode: apiError?.statusCode,
3924
+ xWixRequestId: getHeader(apiError?.responseHeaders, "x-wix-request-id"),
3925
+ proxyRequestId: getProxyBodyFields(apiError?.responseBody).proxy_request_id,
3926
+ failurePhase: getProxyBodyFields(apiError?.responseBody).failure_phase
3927
+ })
3928
+ );
3916
3929
  throw new Error(
3917
3930
  `AI gateway request failed (provider=${provider}, model=${modelId}): ${baseMsg}${ctx}`,
3918
3931
  { cause: err }