@posthog/ai 8.17.1 → 8.18.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/README.md CHANGED
@@ -93,6 +93,28 @@ Stopping iteration finalizes the generation data received so far.
93
93
  When iterating manually, await the query's `return()` or `Symbol.asyncDispose` method before shutting down PostHog.
94
94
  The SDK's synchronous `close()` method also starts finalization; await `return()` afterward to wait for it.
95
95
 
96
+ ## Genkit
97
+
98
+ `PostHogGenkitSpanProcessor` from `@posthog/ai/genkit` reads the OpenTelemetry spans that Genkit already creates.
99
+ Pass it to Genkit's `enableTelemetry({ spanProcessors: [...] })` from `genkit/tracing`, or to your own OpenTelemetry SDK.
100
+
101
+ With npm, install with `npm install --legacy-peer-deps`, or add `legacy-peer-deps=true` to `.npmrc`.
102
+ Without it, npm stops with `ERESOLVE`: Genkit 1.x installs `@opentelemetry/exporter-trace-otlp-http` 0.52, and `@posthog/ai/otel` declares it as an optional peer `>=0.200.0`.
103
+ The Genkit processor does not import OpenTelemetry, so the older version is safe. pnpm only warns.
104
+
105
+ - The root span of a trace, usually a flow, becomes an `$ai_trace`.
106
+ - Each model call becomes an `$ai_generation`. The provider and model come from the Genkit model name, for example `vertexai/gemini-2.5-flash`.
107
+ - Each embedder call becomes an `$ai_embedding`, without the vectors. Genkit does not report embedding token counts, so these events have no cost.
108
+ - Tool calls, `generate` steps and other Genkit actions become `$ai_span` events.
109
+
110
+ The `googleai` and `vertexai` plugin names are sent as the `gemini` and `vertex` providers, the same names the other integrations use.
111
+ A streamed model call gives one `$ai_generation` with the complete response.
112
+ Model parameters include only the common sampling settings.
113
+ In span input and output, credential fields such as `apiKey`, `authorization` and `headers` are replaced with `[REDACTED]`.
114
+ When `distinctId` is not set, events use the distinct ID from `client.withContext()` when each span starts, even if it ends outside that context.
115
+ In serverless functions, `await flushTracing()` from `genkit/tracing` before the function returns, so the PostHog client sends its queued events.
116
+ Capture and flush failures never reach the Genkit flow. Pass `onError` to see them.
117
+
96
118
  ## Questions?
97
119
 
98
120
  ### [Check out our community page.](https://posthog.com/posts)
@@ -3,7 +3,7 @@ let _google_adk = require("@google/adk");
3
3
  let uuid = require("uuid");
4
4
  let _posthog_core = require("@posthog/core");
5
5
  //#region package.json
6
- var version = "8.17.1";
6
+ var version = "8.18.0";
7
7
  //#endregion
8
8
  //#region src/typeGuards.ts
9
9
  const isObject = (value) => {
@@ -2,7 +2,7 @@ import { BasePlugin } from "@google/adk";
2
2
  import { v4 } from "uuid";
3
3
  import { toJsonSafeValue, uuidv7 } from "@posthog/core";
4
4
  //#region package.json
5
- var version = "8.17.1";
5
+ var version = "8.18.0";
6
6
  //#endregion
7
7
  //#region src/typeGuards.ts
8
8
  const isObject = (value) => {
@@ -415,7 +415,7 @@ function addDefaults(params) {
415
415
  }
416
416
  //#endregion
417
417
  //#region package.json
418
- var version = "8.17.1";
418
+ var version = "8.18.0";
419
419
  //#endregion
420
420
  //#region src/serializeError.ts
421
421
  const DEFAULT_MAX_DEPTH = 3;
@@ -388,7 +388,7 @@ function addDefaults(params) {
388
388
  }
389
389
  //#endregion
390
390
  //#region package.json
391
- var version = "8.17.1";
391
+ var version = "8.18.0";
392
392
  //#endregion
393
393
  //#region src/serializeError.ts
394
394
  const DEFAULT_MAX_DEPTH = 3;
@@ -3,7 +3,7 @@ let _anthropic_ai_claude_agent_sdk = require("@anthropic-ai/claude-agent-sdk");
3
3
  let uuid = require("uuid");
4
4
  let _posthog_core = require("@posthog/core");
5
5
  //#region package.json
6
- var version = "8.17.1";
6
+ var version = "8.18.0";
7
7
  //#endregion
8
8
  //#region src/captureAiEvent.ts
9
9
  /** @internal */
@@ -2,7 +2,7 @@ import { SYSTEM_PROMPT_DYNAMIC_BOUNDARY, query as query$1 } from "@anthropic-ai/
2
2
  import { v4 } from "uuid";
3
3
  import { toJsonSafeValue, uuidv7 } from "@posthog/core";
4
4
  //#region package.json
5
- var version = "8.17.1";
5
+ var version = "8.18.0";
6
6
  //#endregion
7
7
  //#region src/captureAiEvent.ts
8
8
  /** @internal */
@@ -466,7 +466,7 @@ function addDefaults(params) {
466
466
  }
467
467
  //#endregion
468
468
  //#region package.json
469
- var version = "8.17.1";
469
+ var version = "8.18.0";
470
470
  //#endregion
471
471
  //#region src/serializeError.ts
472
472
  const DEFAULT_MAX_DEPTH = 3;
@@ -462,7 +462,7 @@ function addDefaults(params) {
462
462
  }
463
463
  //#endregion
464
464
  //#region package.json
465
- var version = "8.17.1";
465
+ var version = "8.18.0";
466
466
  //#endregion
467
467
  //#region src/serializeError.ts
468
468
  const DEFAULT_MAX_DEPTH = 3;