@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.mjs CHANGED
@@ -3932,6 +3932,19 @@ async function executeWithAiSdk(context) {
3932
3932
  } catch (err) {
3933
3933
  const baseMsg = err instanceof Error ? err.message : String(err);
3934
3934
  const ctx = extractGatewayErrorContext(err);
3935
+ const apiError = findApiCallError(err);
3936
+ console.error(
3937
+ "[AI gateway error]",
3938
+ JSON.stringify({
3939
+ provider,
3940
+ model: modelId,
3941
+ message: baseMsg,
3942
+ statusCode: apiError?.statusCode,
3943
+ xWixRequestId: getHeader(apiError?.responseHeaders, "x-wix-request-id"),
3944
+ proxyRequestId: getProxyBodyFields(apiError?.responseBody).proxy_request_id,
3945
+ failurePhase: getProxyBodyFields(apiError?.responseBody).failure_phase
3946
+ })
3947
+ );
3935
3948
  throw new Error(
3936
3949
  `AI gateway request failed (provider=${provider}, model=${modelId}): ${baseMsg}${ctx}`,
3937
3950
  { cause: err }