@posthog/ai 8.9.2 → 8.10.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.
Files changed (39) hide show
  1. package/dist/adk/index.cjs +1267 -0
  2. package/dist/adk/index.cjs.map +1 -0
  3. package/dist/adk/index.d.ts +149 -0
  4. package/dist/adk/index.mjs +1265 -0
  5. package/dist/adk/index.mjs.map +1 -0
  6. package/dist/anthropic/index.cjs +9 -2
  7. package/dist/anthropic/index.cjs.map +1 -1
  8. package/dist/anthropic/index.mjs +9 -2
  9. package/dist/anthropic/index.mjs.map +1 -1
  10. package/dist/gemini/index.cjs +51 -51
  11. package/dist/gemini/index.cjs.map +1 -1
  12. package/dist/gemini/index.mjs +51 -51
  13. package/dist/gemini/index.mjs.map +1 -1
  14. package/dist/index.cjs +9 -2
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +7 -1
  17. package/dist/index.mjs +9 -2
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/langchain/index.cjs +6 -2
  20. package/dist/langchain/index.cjs.map +1 -1
  21. package/dist/langchain/index.mjs +6 -2
  22. package/dist/langchain/index.mjs.map +1 -1
  23. package/dist/langchain/middleware/index.cjs +6 -2
  24. package/dist/langchain/middleware/index.cjs.map +1 -1
  25. package/dist/langchain/middleware/index.mjs +6 -2
  26. package/dist/langchain/middleware/index.mjs.map +1 -1
  27. package/dist/openai/index.cjs +9 -2
  28. package/dist/openai/index.cjs.map +1 -1
  29. package/dist/openai/index.mjs +9 -2
  30. package/dist/openai/index.mjs.map +1 -1
  31. package/dist/openai-agents/index.cjs +1 -1
  32. package/dist/openai-agents/index.cjs.map +1 -1
  33. package/dist/openai-agents/index.mjs +1 -1
  34. package/dist/openai-agents/index.mjs.map +1 -1
  35. package/dist/vercel/index.cjs +9 -2
  36. package/dist/vercel/index.cjs.map +1 -1
  37. package/dist/vercel/index.mjs +9 -2
  38. package/dist/vercel/index.mjs.map +1 -1
  39. package/package.json +13 -3
@@ -330,7 +330,7 @@ function addDefaults(params) {
330
330
  };
331
331
  }
332
332
 
333
- var version = "8.9.2";
333
+ var version = "8.10.0";
334
334
 
335
335
  const DEFAULT_MAX_DEPTH = 3;
336
336
  const MAX_STACK_LINES = 20;
@@ -560,7 +560,9 @@ const captureAiGeneration = async (client, options) => {
560
560
  $ai_time_to_first_token: options.timeToFirstToken
561
561
  } : {}),
562
562
  $ai_trace_id: traceId,
563
- $ai_base_url: options.baseURL ?? '',
563
+ ...(options.baseURL === null ? {} : {
564
+ $ai_base_url: options.baseURL ?? ''
565
+ }),
564
566
  ...options.properties,
565
567
  $ai_tokens_source: getTokensSource(options.properties),
566
568
  ...(options.distinctId ? {} : {
@@ -594,6 +596,11 @@ const captureAiGeneration = async (client, options) => {
594
596
  }
595
597
  } catch (error) {
596
598
  // Telemetry failures must never affect the instrumented provider call.
599
+ try {
600
+ options.onError?.(error);
601
+ } catch {
602
+ // Error reporting must not affect the instrumented provider call either.
603
+ }
597
604
  console.warn('[PostHog AI] Failed to capture generation telemetry:', error);
598
605
  }
599
606
  };