@brizz/sdk 0.1.58 → 0.1.59

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.
Files changed (35) hide show
  1. package/README.md +41 -3
  2. package/dist/{chunk-XGD5HD5W.cjs → chunk-4QNEI7VZ.cjs} +119 -119
  3. package/dist/{chunk-JGATEWJB.cjs → chunk-5QZM5EVP.cjs} +8 -8
  4. package/dist/{chunk-O2IBZJOJ.cjs → chunk-6QXPHZEO.cjs} +4 -4
  5. package/dist/{chunk-MXKQQ6AU.js → chunk-EZCNPWKM.js} +1 -1
  6. package/dist/{chunk-7PRTTYWM.js → chunk-GABRGNAU.js} +1 -1
  7. package/dist/{chunk-GUKWVI53.js → chunk-GISL4K6Z.js} +27 -1
  8. package/dist/{chunk-RV7JIIDG.cjs → chunk-NF52RMLW.cjs} +27 -1
  9. package/dist/{chunk-LXRU77IM.js → chunk-ZGX52S4U.js} +2 -2
  10. package/dist/index.cjs +284 -106
  11. package/dist/index.js +214 -36
  12. package/dist/interrupt-36U5562Z.cjs +12 -0
  13. package/dist/{interrupt-UKJK5WOA.js → interrupt-6BSXUK3O.js} +2 -2
  14. package/dist/{mcp-2JWY4GGY.js → mcp-TTECBPGZ.js} +4 -3
  15. package/dist/{mcp-YNOK6OX5.cjs → mcp-UPBKSTB7.cjs} +19 -18
  16. package/dist/session.cjs +3 -3
  17. package/dist/session.js +2 -2
  18. package/dist/types/cjs/index.d.ts +2 -2
  19. package/dist/types/cjs/internal/error-type.d.ts +1 -0
  20. package/dist/types/cjs/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  21. package/dist/types/cjs/internal/instrumentation/typesafe.d.ts +0 -8
  22. package/dist/types/cjs/internal/semantic-conventions.d.ts +13 -0
  23. package/dist/types/cjs/internal/serialization.d.ts +2 -0
  24. package/dist/types/cjs/internal/trace/decision-call.d.ts +24 -0
  25. package/dist/types/cjs/internal/trace/index.d.ts +2 -0
  26. package/dist/types/esm/index.d.ts +2 -2
  27. package/dist/types/esm/internal/error-type.d.ts +1 -0
  28. package/dist/types/esm/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  29. package/dist/types/esm/internal/instrumentation/typesafe.d.ts +0 -8
  30. package/dist/types/esm/internal/semantic-conventions.d.ts +13 -0
  31. package/dist/types/esm/internal/serialization.d.ts +2 -0
  32. package/dist/types/esm/internal/trace/decision-call.d.ts +24 -0
  33. package/dist/types/esm/internal/trace/index.d.ts +2 -0
  34. package/package.json +14 -14
  35. package/dist/interrupt-BYLSBXTV.cjs +0 -12
package/README.md CHANGED
@@ -360,8 +360,8 @@ addExternalLink('https://sentry.io/issues/456', { sessionId: 'session-123', link
360
360
 
361
361
  ### Session Title Generation
362
362
 
363
- If you use an LLM call to generate session titles, wrap it so those spans don't appear as part of
364
- the conversation:
363
+ If you use an LLM call to generate session titles, wrap it so its spans show as one "Title generated"
364
+ row instead of turns of the conversation:
365
365
 
366
366
  ```typescript
367
367
  import { startSession, startSessionTitle } from '@brizz/sdk';
@@ -369,7 +369,7 @@ import { startSession, startSessionTitle } from '@brizz/sdk';
369
369
  await startSession('session-123', async (session) => {
370
370
  const response = await openai.chat.completions.create({...});
371
371
 
372
- // Title generation — excluded from conversation view
372
+ // Title generation — shown as one row, not as turns
373
373
  await startSessionTitle(async (title) => {
374
374
  const t = await openai.chat.completions.create({
375
375
  model: 'gpt-4',
@@ -569,6 +569,44 @@ await startSession(sessionId, async () => {
569
569
  });
570
570
  ```
571
571
 
572
+ ### Recording Classification Calls
573
+
574
+ When you call a classification model through your own HTTP code, wrap the call in `decisionCall` so it shows up in the conversation with its questions, answers, tokens and cost. The callback's return value is passed through, and an error it throws is recorded and rethrown:
575
+
576
+ ```typescript
577
+ import { decisionCall } from '@brizz/sdk';
578
+
579
+ const response = await decisionCall(
580
+ { provider: 'microsoft', model: 'microsoft-decision-1', state, questions },
581
+ async (call) => {
582
+ const r = await client.decide(state, questions);
583
+ call.setAnswers(r.answers);
584
+ call.setUsage({ inputTokens: r.usage.input, outputTokens: r.usage.output });
585
+ call.setCost(0.0001); // optional, USD
586
+ return r;
587
+ },
588
+ );
589
+ ```
590
+
591
+ `state` is a string or any JSON value; `questions` and answers are sent as you pass them. The optional `requestModel` is the model name you requested, when it differs from `model`. The call joins the current session and carries the current custom properties; to set them for one call, wrap it in `callWithSessionId` or `callWithProperties`.
592
+
593
+ To record a call that already happened, pass everything at once, with optional `startTime` / `endTime` (`Date`s):
594
+
595
+ ```typescript
596
+ import { recordDecisionCall } from '@brizz/sdk';
597
+
598
+ recordDecisionCall({
599
+ provider: 'microsoft',
600
+ model: 'microsoft-decision-1',
601
+ state,
602
+ questions,
603
+ answers: r.answers,
604
+ inputTokens: 555,
605
+ outputTokens: 6,
606
+ startTime: startedAt,
607
+ });
608
+ ```
609
+
572
610
  ### Custom Properties
573
611
 
574
612
  Add custom properties to telemetry context: