@brizz/sdk 0.1.33 → 0.1.34
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 +40 -1
- package/dist/{chunk-N4X2B6BC.js → chunk-24CEDVD2.js} +1 -1
- package/dist/{chunk-WXHBHJRJ.cjs → chunk-3LR22M4E.cjs} +245 -109
- package/dist/{chunk-PY6FJBVY.js → chunk-64STNQKL.js} +1 -1
- package/dist/{chunk-KDFV63CU.js → chunk-F3O3MTQ4.js} +151 -15
- package/dist/{chunk-LFLYWZ6D.cjs → chunk-M3UGFLH7.cjs} +4 -4
- package/dist/{chunk-LIFLVFK6.cjs → chunk-NEF2O7HF.cjs} +38 -1
- package/dist/{chunk-GRRKMMG6.js → chunk-QY4VADPP.js} +38 -1
- package/dist/{chunk-3ITCDKTJ.cjs → chunk-VU5YDLUD.cjs} +1 -1
- package/dist/index.cjs +9 -7
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +8 -6
- package/dist/interrupt-7MWQCOY3.cjs +12 -0
- package/dist/{interrupt-AOYNN5AB.js → interrupt-KADNA6WK.js} +2 -2
- package/dist/{mcp-OKSS2R56.cjs → mcp-WCMY6ED6.cjs} +7 -7
- package/dist/{mcp-XIHWT2AU.js → mcp-ZP6AY3FE.js} +2 -2
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +12 -10
- package/dist/interrupt-EMUUN3ER.cjs +0 -12
package/README.md
CHANGED
|
@@ -536,12 +536,51 @@ await startSession(sessionId, async () => {
|
|
|
536
536
|
});
|
|
537
537
|
```
|
|
538
538
|
|
|
539
|
-
Only `type` is required; `score`, `reason`, `comment`, and `source` are optional, and `
|
|
539
|
+
Only `type` is required; `score`, `reason`, `comment`, and `source` are optional, and `attributes` adds free-form `brizz.feedback.<key>` entries. Feedback is anchored by `messageId` and/or `sessionId`, so you can send it later — even minutes or days after the reply — by passing the id(s) explicitly:
|
|
540
540
|
|
|
541
541
|
```typescript
|
|
542
542
|
recordFeedback('thumbs_down', { messageId: message.id, sessionId, reason: 'inaccurate' });
|
|
543
543
|
```
|
|
544
544
|
|
|
545
|
+
### Recording Metrics
|
|
546
|
+
|
|
547
|
+
Report a number your own system already computes about an interaction — an eval score, a customer rating, a latency, a cost. It becomes a real Brizz metric you can filter and chart by, rather than an untyped bag of event attributes.
|
|
548
|
+
|
|
549
|
+
```typescript
|
|
550
|
+
import { startSession, recordMetric } from '@brizz/sdk';
|
|
551
|
+
|
|
552
|
+
await startSession(sessionId, async () => {
|
|
553
|
+
const reply = await agent.run(prompt);
|
|
554
|
+
|
|
555
|
+
const score = await myEvaluator.score(prompt, reply);
|
|
556
|
+
recordMetric({
|
|
557
|
+
name: 'quality_score',
|
|
558
|
+
value: score,
|
|
559
|
+
unit: 'score',
|
|
560
|
+
minValue: 0,
|
|
561
|
+
maxValue: 1,
|
|
562
|
+
polarity: 'positive',
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
`polarity` tells Brizz which direction is good — a rising `quality_score` is an improvement, a rising `hallucination_rate` is a regression. `minValue` / `maxValue` describe the scale, so a 4 out of 5 isn't read as a 4 out of 1.
|
|
568
|
+
|
|
569
|
+
Scoring often happens after the fact. Pass `sessionId` to attach a metric from anywhere, and `timestamp` to say *when the measured thing happened*, so a nightly job lands the score on the turn it describes rather than on the evaluation run:
|
|
570
|
+
|
|
571
|
+
```typescript
|
|
572
|
+
recordMetric({
|
|
573
|
+
name: 'quality_score',
|
|
574
|
+
value: await judge.score(session),
|
|
575
|
+
sessionId: session.id,
|
|
576
|
+
timestamp: session.endedAt,
|
|
577
|
+
comment: 'graded by the nightly LLM judge',
|
|
578
|
+
attributes: { evaluator: 'gpt-4o', rubric: 'v2' },
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
`attributes` are flat labels you can slice the metric by. Re-reporting the same metric supersedes the previous value, so a re-score wins over the original.
|
|
583
|
+
|
|
545
584
|
### Custom Properties
|
|
546
585
|
|
|
547
586
|
Add custom properties to telemetry context:
|