@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 +22 -0
- package/dist/adk/index.cjs +1 -1
- package/dist/adk/index.mjs +1 -1
- package/dist/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/claude-agent-sdk/index.cjs +1 -1
- package/dist/claude-agent-sdk/index.mjs +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/genkit/index.cjs +1002 -0
- package/dist/genkit/index.cjs.map +1 -0
- package/dist/genkit/index.d.ts +95 -0
- package/dist/genkit/index.mjs +1001 -0
- package/dist/genkit/index.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.mjs +1 -1
- package/dist/langchain/middleware/index.cjs +1 -1
- package/dist/langchain/middleware/index.mjs +1 -1
- package/dist/openai/index.cjs +1 -1
- package/dist/openai/index.mjs +1 -1
- package/dist/openai-agents/index.cjs +1 -1
- package/dist/openai-agents/index.mjs +1 -1
- package/dist/otel/index.cjs +16 -2
- package/dist/otel/index.cjs.map +1 -1
- package/dist/otel/index.d.ts +12 -3
- package/dist/otel/index.mjs +16 -2
- package/dist/otel/index.mjs.map +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/package.json +19 -4
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)
|
package/dist/adk/index.cjs
CHANGED
|
@@ -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.
|
|
6
|
+
var version = "8.18.0";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/typeGuards.ts
|
|
9
9
|
const isObject = (value) => {
|
package/dist/adk/index.mjs
CHANGED
|
@@ -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.
|
|
5
|
+
var version = "8.18.0";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/typeGuards.ts
|
|
8
8
|
const isObject = (value) => {
|
package/dist/anthropic/index.cjs
CHANGED
package/dist/anthropic/index.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
5
|
+
var version = "8.18.0";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/captureAiEvent.ts
|
|
8
8
|
/** @internal */
|
package/dist/gemini/index.cjs
CHANGED
package/dist/gemini/index.mjs
CHANGED