@posthog/ai 8.17.0 → 8.17.2

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.
@@ -388,7 +388,7 @@ function addDefaults(params) {
388
388
  }
389
389
  //#endregion
390
390
  //#region package.json
391
- var version = "8.17.0";
391
+ var version = "8.17.2";
392
392
  //#endregion
393
393
  //#region src/serializeError.ts
394
394
  const DEFAULT_MAX_DEPTH = 3;
@@ -1199,6 +1199,21 @@ var WrappedMessages = class extends AnthropicOriginal.Messages {
1199
1199
  return stream2;
1200
1200
  }
1201
1201
  return value;
1202
+ }).catch(async (error) => {
1203
+ await captureAiGeneration(this.phClient, {
1204
+ ...posthogParams,
1205
+ model: anthropicParams.model,
1206
+ provider: "anthropic",
1207
+ input: this.formatInputForPostHog(anthropicParams, posthogParams.privacyMode),
1208
+ output: [],
1209
+ latency: (Date.now() - startTime) / 1e3,
1210
+ baseURL: this.baseURL,
1211
+ modelParameters: getModelParams(body),
1212
+ httpStatus: error?.status ? error.status : 500,
1213
+ usage: {},
1214
+ error
1215
+ });
1216
+ throw error;
1202
1217
  }), {
1203
1218
  requestIdHeader: "request-id",
1204
1219
  workspaceIdHeader: "anthropic-workspace-id"