@posthog/ai 8.22.2 → 8.22.4
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 +19 -12
- 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/evaluations/index.cjs +1 -1
- package/dist/evaluations/index.cjs.map +1 -1
- package/dist/evaluations/index.d.ts +1 -1
- package/dist/evaluations/index.mjs +1 -1
- package/dist/evaluations/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +4 -1
- package/dist/gemini/index.cjs.map +1 -1
- package/dist/gemini/index.mjs +4 -1
- package/dist/gemini/index.mjs.map +1 -1
- package/dist/genkit/index.cjs +1 -1
- package/dist/genkit/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/langchain/index.cjs +25 -6
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.mjs +25 -6
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/langchain/middleware/index.cjs +25 -6
- package/dist/langchain/middleware/index.cjs.map +1 -1
- package/dist/langchain/middleware/index.mjs +25 -6
- package/dist/langchain/middleware/index.mjs.map +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/vercel/index.cjs +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -146,12 +146,15 @@ requirements and does not require a `posthog-node` analytics client. Every netwo
|
|
|
146
146
|
returns a Promise that resolves only after a validated server acknowledgment; there is no
|
|
147
147
|
capture queue or flush step. Your application executes models and evaluators.
|
|
148
148
|
|
|
149
|
+
For this example, give the project's secret API key `dataset:read`, `llm_analytics:read`, and
|
|
150
|
+
`offline_evaluation_ingestion:write`. You can also pass a personal API key to `secretKey`.
|
|
151
|
+
|
|
149
152
|
```ts
|
|
150
153
|
import { OfflineEvaluations, EvaluationItem } from '@posthog/ai/evaluations'
|
|
151
154
|
|
|
152
155
|
const evaluations = new OfflineEvaluations({
|
|
153
156
|
projectId: 123,
|
|
154
|
-
secretKey: process.env.
|
|
157
|
+
secretKey: process.env.POSTHOG_PROJECT_SECRET_API_KEY!,
|
|
155
158
|
// host: 'https://eu.posthog.com',
|
|
156
159
|
// timeoutMs: 15_000,
|
|
157
160
|
// maxRetries: 3, // additional attempts, only for operations safe to replay
|
|
@@ -267,7 +270,7 @@ output bounds are checked during ingestion. The SDK never evaluates formulas or
|
|
|
267
270
|
Use `calculate: true` without a value, payload, error, evaluator trace, or evaluation time.
|
|
268
271
|
Ingestion-only keys must supply every pinned input in the same upload, including on exact retries.
|
|
269
272
|
Reusing stored inputs without resubmitting them requires both `evaluation:read` and
|
|
270
|
-
`llm_analytics:read`. Bulk uploads preserve caller order and keep all supplied results for a
|
|
273
|
+
`llm_analytics:read` in addition to `offline_evaluation_ingestion:write`. Bulk uploads preserve caller order and keep all supplied results for a
|
|
271
274
|
composite-bearing item together, including intervening results. Group each item's results together
|
|
272
275
|
in large batches: an indivisible group exceeding 1,000 items/results or 5 MiB rejects the entire
|
|
273
276
|
bulk call before any request is sent.
|
|
@@ -281,18 +284,22 @@ is open creates it again and counts as new usage for a reported result. Older re
|
|
|
281
284
|
without outcomes expose `status: null` and `errorCode: null`. Save and restore calculation
|
|
282
285
|
declarations with the same serialization and recovery methods as reported results.
|
|
283
286
|
|
|
284
|
-
| Operation |
|
|
285
|
-
| -------------------------------------- |
|
|
286
|
-
| Dataset reads/writes |
|
|
287
|
-
| Scorer reads/writes |
|
|
288
|
-
| Formula validation |
|
|
289
|
-
| Experiment create/upload/complete/fail |
|
|
290
|
-
| Experiment tags |
|
|
291
|
-
| Item and result revision reads |
|
|
292
|
-
| Item, result, and payload mutations |
|
|
287
|
+
| Operation | Required scopes |
|
|
288
|
+
| -------------------------------------- | -------------------------------------------- |
|
|
289
|
+
| Dataset reads/writes | `dataset:read` / `dataset:write` |
|
|
290
|
+
| Scorer reads/writes | `llm_analytics:read` / `llm_analytics:write` |
|
|
291
|
+
| Formula validation | `llm_analytics:read` |
|
|
292
|
+
| Experiment create/upload/complete/fail | `offline_evaluation_ingestion:write` |
|
|
293
|
+
| Experiment tags | `evaluation:read` / `evaluation:write` |
|
|
294
|
+
| Item and result revision reads | `evaluation:read` |
|
|
295
|
+
| Item, result, and payload mutations | `evaluation:write` |
|
|
296
|
+
|
|
297
|
+
These scopes apply to personal and project secret API keys. A project secret key belongs to one
|
|
298
|
+
project. Personal keys also need the user's resource permissions, including evaluation editor
|
|
299
|
+
access for corrections. Dataset exports require a personal API key with `dataset:read`.
|
|
293
300
|
|
|
294
301
|
Reading a result revision, editing or deleting a result or its payload, and deleting an item
|
|
295
|
-
also require `llm_analytics:read
|
|
302
|
+
also require `llm_analytics:read`. Personal keys need access to the affected scorers and composite inputs.
|
|
296
303
|
|
|
297
304
|
Feature availability and permissions are enforced by the service. Known ingestion hosts map to
|
|
298
305
|
the app API host; custom host path prefixes are preserved. Pagination exposes `nextOffset` or,
|
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.22.
|
|
6
|
+
var version = "8.22.4";
|
|
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 { acceptsEventOptions, eventOptionsAsLegacyProperties, toJsonSafeValue, uuidv7 } from "@posthog/core";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "8.22.
|
|
5
|
+
var version = "8.22.4";
|
|
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.22.
|
|
6
|
+
var version = "8.22.4";
|
|
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 { acceptsEventOptions, eventOptionsAsLegacyProperties, toJsonSafeValue, uuidv7 } from "@posthog/core";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "8.22.
|
|
5
|
+
var version = "8.22.4";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/captureAiEvent.ts
|
|
8
8
|
/** @internal */
|
|
@@ -364,7 +364,7 @@ const ITEM_KEYS = [
|
|
|
364
364
|
"sourceEventId",
|
|
365
365
|
"sourceTimestamp"
|
|
366
366
|
];
|
|
367
|
-
/** Dataset management. Writes require
|
|
367
|
+
/** Dataset management. Writes require dataset:write. */
|
|
368
368
|
var Datasets = class {
|
|
369
369
|
#transport;
|
|
370
370
|
#base;
|