@brizz/sdk 0.1.33 → 0.1.35
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 +72 -1
- package/dist/{chunk-N4X2B6BC.js → chunk-24CEDVD2.js} +1 -1
- package/dist/{chunk-WXHBHJRJ.cjs → chunk-D27LNW3M.cjs} +275 -124
- package/dist/{chunk-PY6FJBVY.js → chunk-GSKXPOLQ.js} +1 -1
- package/dist/{chunk-3ITCDKTJ.cjs → chunk-HZOBDXDS.cjs} +1 -1
- package/dist/chunk-KFETJN5M.cjs +63 -0
- package/dist/{chunk-KDFV63CU.js → chunk-KP3KG66W.js} +166 -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-TEY6FAVZ.js +63 -0
- package/dist/google-genai-LMEZ62FB.cjs +10 -0
- package/dist/google-genai-T7I4FFIP.js +10 -0
- package/dist/google-genai.cjs +8 -0
- package/dist/google-genai.d.cts +7 -0
- package/dist/google-genai.d.ts +7 -0
- package/dist/google-genai.js +8 -0
- package/dist/index.cjs +24 -7
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +23 -6
- package/dist/interrupt-7MWQCOY3.cjs +12 -0
- package/dist/{interrupt-AOYNN5AB.js → interrupt-KADNA6WK.js} +2 -2
- package/dist/{mcp-XIHWT2AU.js → mcp-EJNZYON6.js} +2 -2
- package/dist/{mcp-OKSS2R56.cjs → mcp-KAYXU4AU.cjs} +7 -7
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +28 -10
- package/dist/interrupt-EMUUN3ER.cjs +0 -12
package/README.md
CHANGED
|
@@ -201,6 +201,7 @@ pulled in when you need them. Install the matching package(s) to enable them:
|
|
|
201
201
|
| To trace | Install |
|
|
202
202
|
| --- | --- |
|
|
203
203
|
| **Vercel AI SDK v7+** (`ai@7`) — required for span capture | `npm install @ai-sdk/otel` |
|
|
204
|
+
| **Google GenAI / Gemini** (`@google/genai`) — see [Gemini](#google-genai-gemini) | `npm install @traceloop/instrumentation-google-generativeai` |
|
|
204
205
|
| **Google Vertex AI** (`@google-cloud/vertexai`) | `npm install @traceloop/instrumentation-vertexai` |
|
|
205
206
|
| **MCP** (Model Context Protocol) | `npm install @arizeai/openinference-instrumentation-mcp @modelcontextprotocol/sdk` |
|
|
206
207
|
|
|
@@ -284,6 +285,37 @@ registerOTel({
|
|
|
284
285
|
`@brizz/sdk/eve` is a standalone, side-effect-free export: it does not initialize the full SDK, so
|
|
285
286
|
it won't duplicate the spans eve already emits.
|
|
286
287
|
|
|
288
|
+
### Google GenAI (Gemini)
|
|
289
|
+
|
|
290
|
+
[`@google/genai`](https://www.npmjs.com/package/@google/genai) is Google's unified SDK for Gemini
|
|
291
|
+
(both the Gemini Developer API and Vertex AI). Install the peer dependency, then build your client
|
|
292
|
+
from the class `instrumentGoogleGenAI` returns:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { Brizz } from '@brizz/sdk';
|
|
296
|
+
import { instrumentGoogleGenAI } from '@brizz/sdk/google-genai';
|
|
297
|
+
import * as genai from '@google/genai';
|
|
298
|
+
|
|
299
|
+
Brizz.initialize({ appName: 'my-app' });
|
|
300
|
+
|
|
301
|
+
// Call after Brizz.initialize(). The returned class is instrumented — build the client from it.
|
|
302
|
+
const GoogleGenAI = instrumentGoogleGenAI(genai);
|
|
303
|
+
const ai = new GoogleGenAI({ vertexai: true, project, location });
|
|
304
|
+
|
|
305
|
+
const response = await ai.models.generateContent({
|
|
306
|
+
model: 'gemini-2.5-flash',
|
|
307
|
+
contents: 'Hello, world!',
|
|
308
|
+
});
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
This traces `generateContent` / `generateContentStream` — messages, tool calls, token usage, and
|
|
312
|
+
cost — with no per-call instrumentation.
|
|
313
|
+
|
|
314
|
+
Unlike the other integrations, `@google/genai` is **not** wired through `instrumentModules`.
|
|
315
|
+
It's an ESM-only package, and a Node ES module namespace is read-only, so it can't be patched in
|
|
316
|
+
place — `instrumentGoogleGenAI` returns an instrumented `GoogleGenAI` class instead. Construct
|
|
317
|
+
your client from that class and you're done.
|
|
318
|
+
|
|
287
319
|
## PII Masking
|
|
288
320
|
|
|
289
321
|
Optional masking for span attributes.
|
|
@@ -536,12 +568,51 @@ await startSession(sessionId, async () => {
|
|
|
536
568
|
});
|
|
537
569
|
```
|
|
538
570
|
|
|
539
|
-
Only `type` is required; `score`, `reason`, `comment`, and `source` are optional, and `
|
|
571
|
+
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
572
|
|
|
541
573
|
```typescript
|
|
542
574
|
recordFeedback('thumbs_down', { messageId: message.id, sessionId, reason: 'inaccurate' });
|
|
543
575
|
```
|
|
544
576
|
|
|
577
|
+
### Recording Metrics
|
|
578
|
+
|
|
579
|
+
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.
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
import { startSession, recordMetric } from '@brizz/sdk';
|
|
583
|
+
|
|
584
|
+
await startSession(sessionId, async () => {
|
|
585
|
+
const reply = await agent.run(prompt);
|
|
586
|
+
|
|
587
|
+
const score = await myEvaluator.score(prompt, reply);
|
|
588
|
+
recordMetric({
|
|
589
|
+
name: 'quality_score',
|
|
590
|
+
value: score,
|
|
591
|
+
unit: 'score',
|
|
592
|
+
minValue: 0,
|
|
593
|
+
maxValue: 1,
|
|
594
|
+
polarity: 'positive',
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
`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.
|
|
600
|
+
|
|
601
|
+
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:
|
|
602
|
+
|
|
603
|
+
```typescript
|
|
604
|
+
recordMetric({
|
|
605
|
+
name: 'quality_score',
|
|
606
|
+
value: await judge.score(session),
|
|
607
|
+
sessionId: session.id,
|
|
608
|
+
timestamp: session.endedAt,
|
|
609
|
+
comment: 'graded by the nightly LLM judge',
|
|
610
|
+
attributes: { evaluator: 'gpt-4o', rubric: 'v2' },
|
|
611
|
+
});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
`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.
|
|
615
|
+
|
|
545
616
|
### Custom Properties
|
|
546
617
|
|
|
547
618
|
Add custom properties to telemetry context:
|