@brizz/sdk 0.1.34 → 0.1.36

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
@@ -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.
@@ -640,7 +672,7 @@ warnings, and is less prone to `this` binding issues.
640
672
 
641
673
  ## Mute Messages
642
674
 
643
- Keep internal or unrelated LLM calls — summarization, title generation, classification, guardrail checks — out of the captured conversation. The call still runs and its telemetry (latency, tokens, cost) is recorded; only the user and/or assistant content is left out.
675
+ Keep internal or unrelated LLM calls — summarization, title generation, classification, guardrail checks — out of the captured conversation. The call still runs and its telemetry (latency, tokens, cost) is recorded; only the content is left out — the prompt, the reply, and the tool calls.
644
676
 
645
677
  ```typescript
646
678
  import { callWithMute, withMute } from '@brizz/sdk';
@@ -651,10 +683,15 @@ await callWithMute({}, () => agent.run('Summarize this conversation for internal
651
683
  // Keep the assistant reply, drop the prompt
652
684
  await callWithMute({ output: false }, () => agent.run('…a long internal prompt…'));
653
685
 
686
+ // Keep the tool calls, drop the prompt and the reply
687
+ await callWithMute({ tools: false }, () => agent.run('…a long internal prompt…'));
688
+
654
689
  // Pre-wrap a function to reuse the same muting
655
690
  const muteTitle = withMute({}, agent.run, agent);
656
691
  ```
657
692
 
693
+ `tools` covers tool calls and their results. Leave it out and it follows `output`.
694
+
658
695
  ## Deployment Environment
659
696
 
660
697
  Optionally specify the deployment environment for better filtering and organization:
@@ -1,6 +1,6 @@
1
1
  // src/internal/version.ts
2
2
  function getSDKVersion() {
3
- return "0.1.34";
3
+ return "0.1.36";
4
4
  }
5
5
 
6
6
  export {
@@ -12,6 +12,7 @@ var SESSION_OUTPUT_CONTEXT = "brizz.session.output.context";
12
12
  var SESSION_SPAN_NAME = "brizz.start_session";
13
13
  var MUTE_INPUT = "mute.input";
14
14
  var MUTE_OUTPUT = "mute.output";
15
+ var MUTE_TOOLS = "mute.tools";
15
16
  var USER_ID = "user.id";
16
17
  var USER_EMAIL = "user.email";
17
18
  var USER_NAME = "user.name";
@@ -114,4 +115,5 @@ var METRIC_POLARITY_NEGATIVE = "negative";
114
115
 
115
116
 
116
117
 
117
- exports.BRIZZ = BRIZZ; exports.SESSION_ID = SESSION_ID; exports.PROPERTIES_CONTEXT_KEY = PROPERTIES_CONTEXT_KEY; exports.SESSION_OBJECT_CONTEXT_KEY = SESSION_OBJECT_CONTEXT_KEY; exports.SESSION_INPUT = SESSION_INPUT; exports.SESSION_OUTPUT = SESSION_OUTPUT; exports.SESSION_INPUT_CONTEXT = SESSION_INPUT_CONTEXT; exports.SESSION_OUTPUT_CONTEXT = SESSION_OUTPUT_CONTEXT; exports.SESSION_SPAN_NAME = SESSION_SPAN_NAME; exports.MUTE_INPUT = MUTE_INPUT; exports.MUTE_OUTPUT = MUTE_OUTPUT; exports.USER_ID = USER_ID; exports.USER_EMAIL = USER_EMAIL; exports.USER_NAME = USER_NAME; exports.USER_ROLE = USER_ROLE; exports.USER_PLAN = USER_PLAN; exports.ORGANIZATION_ID = ORGANIZATION_ID; exports.ORGANIZATION_NAME = ORGANIZATION_NAME; exports.ORGANIZATION_PLAN = ORGANIZATION_PLAN; exports.ORGANIZATION_DOMAIN = ORGANIZATION_DOMAIN; exports.MESSAGE_ID = MESSAGE_ID; exports.SESSION_TITLE_SPAN_NAME = SESSION_TITLE_SPAN_NAME; exports.SESSION_TITLE_GENERATION = SESSION_TITLE_GENERATION; exports.SESSION_TITLE = SESSION_TITLE; exports.INTERRUPT_TOOLS = INTERRUPT_TOOLS; exports.INTERNAL_EVENT_PREFIX = INTERNAL_EVENT_PREFIX; exports.EXTERNAL_LINK_EVENT_NAME = EXTERNAL_LINK_EVENT_NAME; exports.EXTERNAL_LINK_URL = EXTERNAL_LINK_URL; exports.EXTERNAL_LINK_TITLE = EXTERNAL_LINK_TITLE; exports.EXTERNAL_LINK_TYPE = EXTERNAL_LINK_TYPE; exports.FEEDBACK_EVENT_NAME = FEEDBACK_EVENT_NAME; exports.FEEDBACK_TYPE = FEEDBACK_TYPE; exports.FEEDBACK_SCORE = FEEDBACK_SCORE; exports.FEEDBACK_REASON = FEEDBACK_REASON; exports.FEEDBACK_COMMENT = FEEDBACK_COMMENT; exports.FEEDBACK_SOURCE = FEEDBACK_SOURCE; exports.FEEDBACK_ATTR_PREFIX = FEEDBACK_ATTR_PREFIX; exports.METRIC_EVENT_NAME = METRIC_EVENT_NAME; exports.METRIC_NAME = METRIC_NAME; exports.METRIC_VALUE = METRIC_VALUE; exports.METRIC_UNIT = METRIC_UNIT; exports.METRIC_COMMENT = METRIC_COMMENT; exports.METRIC_POLARITY = METRIC_POLARITY; exports.METRIC_MIN = METRIC_MIN; exports.METRIC_MAX = METRIC_MAX; exports.METRIC_TIMESTAMP = METRIC_TIMESTAMP; exports.METRIC_ATTRIBUTE_PREFIX = METRIC_ATTRIBUTE_PREFIX; exports.RESERVED_METRIC_NAMES = RESERVED_METRIC_NAMES; exports.METRIC_POLARITY_POSITIVE = METRIC_POLARITY_POSITIVE; exports.METRIC_POLARITY_NEGATIVE = METRIC_POLARITY_NEGATIVE;
118
+
119
+ exports.BRIZZ = BRIZZ; exports.SESSION_ID = SESSION_ID; exports.PROPERTIES_CONTEXT_KEY = PROPERTIES_CONTEXT_KEY; exports.SESSION_OBJECT_CONTEXT_KEY = SESSION_OBJECT_CONTEXT_KEY; exports.SESSION_INPUT = SESSION_INPUT; exports.SESSION_OUTPUT = SESSION_OUTPUT; exports.SESSION_INPUT_CONTEXT = SESSION_INPUT_CONTEXT; exports.SESSION_OUTPUT_CONTEXT = SESSION_OUTPUT_CONTEXT; exports.SESSION_SPAN_NAME = SESSION_SPAN_NAME; exports.MUTE_INPUT = MUTE_INPUT; exports.MUTE_OUTPUT = MUTE_OUTPUT; exports.MUTE_TOOLS = MUTE_TOOLS; exports.USER_ID = USER_ID; exports.USER_EMAIL = USER_EMAIL; exports.USER_NAME = USER_NAME; exports.USER_ROLE = USER_ROLE; exports.USER_PLAN = USER_PLAN; exports.ORGANIZATION_ID = ORGANIZATION_ID; exports.ORGANIZATION_NAME = ORGANIZATION_NAME; exports.ORGANIZATION_PLAN = ORGANIZATION_PLAN; exports.ORGANIZATION_DOMAIN = ORGANIZATION_DOMAIN; exports.MESSAGE_ID = MESSAGE_ID; exports.SESSION_TITLE_SPAN_NAME = SESSION_TITLE_SPAN_NAME; exports.SESSION_TITLE_GENERATION = SESSION_TITLE_GENERATION; exports.SESSION_TITLE = SESSION_TITLE; exports.INTERRUPT_TOOLS = INTERRUPT_TOOLS; exports.INTERNAL_EVENT_PREFIX = INTERNAL_EVENT_PREFIX; exports.EXTERNAL_LINK_EVENT_NAME = EXTERNAL_LINK_EVENT_NAME; exports.EXTERNAL_LINK_URL = EXTERNAL_LINK_URL; exports.EXTERNAL_LINK_TITLE = EXTERNAL_LINK_TITLE; exports.EXTERNAL_LINK_TYPE = EXTERNAL_LINK_TYPE; exports.FEEDBACK_EVENT_NAME = FEEDBACK_EVENT_NAME; exports.FEEDBACK_TYPE = FEEDBACK_TYPE; exports.FEEDBACK_SCORE = FEEDBACK_SCORE; exports.FEEDBACK_REASON = FEEDBACK_REASON; exports.FEEDBACK_COMMENT = FEEDBACK_COMMENT; exports.FEEDBACK_SOURCE = FEEDBACK_SOURCE; exports.FEEDBACK_ATTR_PREFIX = FEEDBACK_ATTR_PREFIX; exports.METRIC_EVENT_NAME = METRIC_EVENT_NAME; exports.METRIC_NAME = METRIC_NAME; exports.METRIC_VALUE = METRIC_VALUE; exports.METRIC_UNIT = METRIC_UNIT; exports.METRIC_COMMENT = METRIC_COMMENT; exports.METRIC_POLARITY = METRIC_POLARITY; exports.METRIC_MIN = METRIC_MIN; exports.METRIC_MAX = METRIC_MAX; exports.METRIC_TIMESTAMP = METRIC_TIMESTAMP; exports.METRIC_ATTRIBUTE_PREFIX = METRIC_ATTRIBUTE_PREFIX; exports.RESERVED_METRIC_NAMES = RESERVED_METRIC_NAMES; exports.METRIC_POLARITY_POSITIVE = METRIC_POLARITY_POSITIVE; exports.METRIC_POLARITY_NEGATIVE = METRIC_POLARITY_NEGATIVE;