@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 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.POSTHOG_PERSONAL_API_KEY!,
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 | Credential and scope |
285
- | -------------------------------------- | -------------------------------------------------------------------- |
286
- | Dataset reads/writes | Personal key: `dataset:read` / `dataset:write` |
287
- | Scorer reads/writes | Personal key: `llm_analytics:read` / `llm_analytics:write` |
288
- | Formula validation | Personal key: `llm_analytics:read` |
289
- | Experiment create/upload/complete/fail | Personal or project secret key: `offline_evaluation_ingestion:write` |
290
- | Experiment tags | Personal key: `evaluation:read` / `evaluation:write` |
291
- | Item and result revision reads | Personal key: `evaluation:read` |
292
- | Item, result, and payload mutations | Personal key: `evaluation:write` and evaluation editor access |
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` and access to the affected scorers and composite inputs.
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,
@@ -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.2";
6
+ var version = "8.22.4";
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 { acceptsEventOptions, eventOptionsAsLegacyProperties, toJsonSafeValue, uuidv7 } from "@posthog/core";
4
4
  //#region package.json
5
- var version = "8.22.2";
5
+ var version = "8.22.4";
6
6
  //#endregion
7
7
  //#region src/typeGuards.ts
8
8
  const isObject = (value) => {
@@ -569,7 +569,7 @@ function addDefaults(params) {
569
569
  }
570
570
  //#endregion
571
571
  //#region package.json
572
- var version = "8.22.2";
572
+ var version = "8.22.4";
573
573
  //#endregion
574
574
  //#region src/serializeError.ts
575
575
  const DEFAULT_MAX_DEPTH = 3;
@@ -542,7 +542,7 @@ function addDefaults(params) {
542
542
  }
543
543
  //#endregion
544
544
  //#region package.json
545
- var version = "8.22.2";
545
+ var version = "8.22.4";
546
546
  //#endregion
547
547
  //#region src/serializeError.ts
548
548
  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.22.2";
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.2";
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 a personal key with dataset:write. */
367
+ /** Dataset management. Writes require dataset:write. */
368
368
  var Datasets = class {
369
369
  #transport;
370
370
  #base;