risicare 0.8.0 → 0.9.1

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 (72) hide show
  1. package/README.md +98 -21
  2. package/dist/frameworks/instructor.cjs +144 -2
  3. package/dist/frameworks/instructor.cjs.map +1 -1
  4. package/dist/frameworks/instructor.js +144 -2
  5. package/dist/frameworks/instructor.js.map +1 -1
  6. package/dist/frameworks/langchain.cjs +144 -2
  7. package/dist/frameworks/langchain.cjs.map +1 -1
  8. package/dist/frameworks/langchain.js +144 -2
  9. package/dist/frameworks/langchain.js.map +1 -1
  10. package/dist/frameworks/langgraph.cjs +144 -2
  11. package/dist/frameworks/langgraph.cjs.map +1 -1
  12. package/dist/frameworks/langgraph.js +144 -2
  13. package/dist/frameworks/langgraph.js.map +1 -1
  14. package/dist/frameworks/llamaindex.cjs +144 -2
  15. package/dist/frameworks/llamaindex.cjs.map +1 -1
  16. package/dist/frameworks/llamaindex.js +144 -2
  17. package/dist/frameworks/llamaindex.js.map +1 -1
  18. package/dist/index.cjs +329 -67
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +29 -9
  21. package/dist/index.d.ts +29 -9
  22. package/dist/index.js +329 -67
  23. package/dist/index.js.map +1 -1
  24. package/dist/providers/anthropic/index.cjs +144 -2
  25. package/dist/providers/anthropic/index.cjs.map +1 -1
  26. package/dist/providers/anthropic/index.js +144 -2
  27. package/dist/providers/anthropic/index.js.map +1 -1
  28. package/dist/providers/bedrock/index.cjs +144 -2
  29. package/dist/providers/bedrock/index.cjs.map +1 -1
  30. package/dist/providers/bedrock/index.js +144 -2
  31. package/dist/providers/bedrock/index.js.map +1 -1
  32. package/dist/providers/cerebras/index.cjs +144 -2
  33. package/dist/providers/cerebras/index.cjs.map +1 -1
  34. package/dist/providers/cerebras/index.js +144 -2
  35. package/dist/providers/cerebras/index.js.map +1 -1
  36. package/dist/providers/cohere/index.cjs +144 -2
  37. package/dist/providers/cohere/index.cjs.map +1 -1
  38. package/dist/providers/cohere/index.js +144 -2
  39. package/dist/providers/cohere/index.js.map +1 -1
  40. package/dist/providers/google/index.cjs +144 -2
  41. package/dist/providers/google/index.cjs.map +1 -1
  42. package/dist/providers/google/index.js +144 -2
  43. package/dist/providers/google/index.js.map +1 -1
  44. package/dist/providers/groq/index.cjs +144 -2
  45. package/dist/providers/groq/index.cjs.map +1 -1
  46. package/dist/providers/groq/index.js +144 -2
  47. package/dist/providers/groq/index.js.map +1 -1
  48. package/dist/providers/huggingface/index.cjs +144 -2
  49. package/dist/providers/huggingface/index.cjs.map +1 -1
  50. package/dist/providers/huggingface/index.js +144 -2
  51. package/dist/providers/huggingface/index.js.map +1 -1
  52. package/dist/providers/mistral/index.cjs +144 -2
  53. package/dist/providers/mistral/index.cjs.map +1 -1
  54. package/dist/providers/mistral/index.js +144 -2
  55. package/dist/providers/mistral/index.js.map +1 -1
  56. package/dist/providers/ollama/index.cjs +144 -2
  57. package/dist/providers/ollama/index.cjs.map +1 -1
  58. package/dist/providers/ollama/index.js +144 -2
  59. package/dist/providers/ollama/index.js.map +1 -1
  60. package/dist/providers/openai/index.cjs +144 -2
  61. package/dist/providers/openai/index.cjs.map +1 -1
  62. package/dist/providers/openai/index.js +144 -2
  63. package/dist/providers/openai/index.js.map +1 -1
  64. package/dist/providers/together/index.cjs +144 -2
  65. package/dist/providers/together/index.cjs.map +1 -1
  66. package/dist/providers/together/index.js +144 -2
  67. package/dist/providers/together/index.js.map +1 -1
  68. package/dist/providers/vercel-ai/index.cjs +144 -2
  69. package/dist/providers/vercel-ai/index.cjs.map +1 -1
  70. package/dist/providers/vercel-ai/index.js +144 -2
  71. package/dist/providers/vercel-ai/index.js.map +1 -1
  72. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -301,7 +301,11 @@ interface RisicareConfig {
301
301
  serviceName?: string;
302
302
  /** Service version */
303
303
  serviceVersion?: string;
304
- /** Whether tracing is enabled (default: true if apiKey provided) */
304
+ /**
305
+ * Whether tracing is enabled (default: true if apiKey provided).
306
+ * With no API key tracing is always off, also with `enabled: true`,
307
+ * `RISICARE_TRACING=true` or `enable()`: the SDK sends nothing without a key.
308
+ */
305
309
  enabled?: boolean;
306
310
  /**
307
311
  * Whether prompt/completion content may leave the process.
@@ -511,9 +515,15 @@ declare function shutdown(timeoutMs?: number): Promise<void>;
511
515
  * - a span was discarded since the previous flush returned (F-SDKCB-001 §6);
512
516
  * - the backend rejected a span since the previous flush returned, or its ack
513
517
  * did not account for a span;
514
- * - it is called after a `shutdown()` that left spans undelivered
515
- * (`shutdown_residue`).
516
- * An uninitialised SDK returns `true`: it was handed nothing, and it lost nothing.
518
+ * - a `shutdown()` left spans undelivered (`shutdown_residue`) since the previous
519
+ * flush returned. That loss is reported once, as every other loss.
520
+ * A `flush()` that comes while a `shutdown()` runs (the SDK's own drain at
521
+ * SIGTERM / SIGINT, or one that nobody awaited) waits for it inside its own
522
+ * deadline, and then answers from the final tally with the same rule. So does a
523
+ * `flush()` after `shutdown()`. Through 0.8.0 both answered from the empty queue.
524
+ * Not active means not true: `flush()` returns `false` before `init()`, with tracing
525
+ * off (`enabled: false`, `RISICARE_TRACING=false`), and with no API key. Through
526
+ * 0.8.0 it returned `true` in those cases: nothing was queued.
517
527
  *
518
528
  * `flush()` never stops a request that is already sent. At the deadline it stops
519
529
  * waiting; the export in flight continues and ends by its own rules.
@@ -541,7 +551,9 @@ declare function enable(): void;
541
551
  */
542
552
  declare function disable(): void;
543
553
  /**
544
- * Check whether tracing is currently enabled.
554
+ * Check whether tracing is currently enabled. False before `init()`, with no API
555
+ * key (also with `RISICARE_TRACING=true`, `enabled: true` or `enable()`), with
556
+ * tracing off, and after `shutdown()` or the SDK's own drain at SIGTERM / SIGINT.
545
557
  */
546
558
  declare function isEnabled(): boolean;
547
559
  /**
@@ -554,7 +566,7 @@ declare function getTracer(): Tracer$1 | undefined;
554
566
  declare function getTraceContent(): boolean;
555
567
  /**
556
568
  * Get SDK metrics: exported spans (accepted by the backend), `rejectedSpans`,
557
- * dropped spans and their reasons (`unacknowledged` included), failed exports,
569
+ * dropped spans and their reasons (`unacknowledged` and `quota_exceeded` included; `droppedQuota` is the latter), failed exports,
558
570
  * queue stats, and `failedScores` (`score()` requests that failed since
559
571
  * `init()`).
560
572
  *
@@ -590,7 +602,9 @@ declare function getMetrics(): {
590
602
  transport_refused: number;
591
603
  shutdown_residue: number;
592
604
  unacknowledged: number;
605
+ quota_exceeded: number;
593
606
  };
607
+ droppedQuota: number;
594
608
  failedExports: number;
595
609
  maskErrors: number;
596
610
  queueSize: number;
@@ -603,11 +617,13 @@ declare function getMetrics(): {
603
617
  transport_refused: number;
604
618
  shutdown_residue: number;
605
619
  unacknowledged: number;
620
+ quota_exceeded: number;
606
621
  };
607
622
  sdkState: "shutdown";
608
623
  exportedSpans: number;
609
624
  rejectedSpans: number;
610
625
  droppedSpans: number;
626
+ droppedQuota: number;
611
627
  failedExports: number;
612
628
  maskErrors: number;
613
629
  queueSize: number;
@@ -623,7 +639,9 @@ declare function getMetrics(): {
623
639
  transport_refused: number;
624
640
  shutdown_residue: number;
625
641
  unacknowledged: number;
642
+ quota_exceeded: number;
626
643
  };
644
+ droppedQuota: number;
627
645
  failedExports: number;
628
646
  queueSize: number;
629
647
  queueCapacity: number;
@@ -660,9 +678,11 @@ declare function reportError(error: unknown, options?: {
660
678
  * the score name and the status or the error code. Later failures in the next
661
679
  * 10 s are counted, and the next WARNING gives their number. Root `flush()`
662
680
  * waits for pending scores inside its deadline, and returns `false` when a
663
- * score failed since the previous `flush()` returned. An out-of-range value, or an empty `traceId`
664
- * or `name`, writes one WARNING, and the SDK does not send the score. `true`
665
- * and `false` count as 1 and 0.
681
+ * score failed since the previous `flush()` returned. An out-of-range value, a
682
+ * value that is not a number, or an empty `traceId` or `name` writes one WARNING,
683
+ * and the SDK does not send the score. It counts as a failed score, so the next
684
+ * `flush()` is false (not when the SDK is not active: then nothing is counted).
685
+ * `true` and `false` count as 1 and 0.
666
686
  *
667
687
  * If a `mask` is configured on `init()`, `options.comment` is passed to it under
668
688
  * the key `score.comment` before the request is built. `traceId`, `spanId` and
package/dist/index.d.ts CHANGED
@@ -301,7 +301,11 @@ interface RisicareConfig {
301
301
  serviceName?: string;
302
302
  /** Service version */
303
303
  serviceVersion?: string;
304
- /** Whether tracing is enabled (default: true if apiKey provided) */
304
+ /**
305
+ * Whether tracing is enabled (default: true if apiKey provided).
306
+ * With no API key tracing is always off, also with `enabled: true`,
307
+ * `RISICARE_TRACING=true` or `enable()`: the SDK sends nothing without a key.
308
+ */
305
309
  enabled?: boolean;
306
310
  /**
307
311
  * Whether prompt/completion content may leave the process.
@@ -511,9 +515,15 @@ declare function shutdown(timeoutMs?: number): Promise<void>;
511
515
  * - a span was discarded since the previous flush returned (F-SDKCB-001 §6);
512
516
  * - the backend rejected a span since the previous flush returned, or its ack
513
517
  * did not account for a span;
514
- * - it is called after a `shutdown()` that left spans undelivered
515
- * (`shutdown_residue`).
516
- * An uninitialised SDK returns `true`: it was handed nothing, and it lost nothing.
518
+ * - a `shutdown()` left spans undelivered (`shutdown_residue`) since the previous
519
+ * flush returned. That loss is reported once, as every other loss.
520
+ * A `flush()` that comes while a `shutdown()` runs (the SDK's own drain at
521
+ * SIGTERM / SIGINT, or one that nobody awaited) waits for it inside its own
522
+ * deadline, and then answers from the final tally with the same rule. So does a
523
+ * `flush()` after `shutdown()`. Through 0.8.0 both answered from the empty queue.
524
+ * Not active means not true: `flush()` returns `false` before `init()`, with tracing
525
+ * off (`enabled: false`, `RISICARE_TRACING=false`), and with no API key. Through
526
+ * 0.8.0 it returned `true` in those cases: nothing was queued.
517
527
  *
518
528
  * `flush()` never stops a request that is already sent. At the deadline it stops
519
529
  * waiting; the export in flight continues and ends by its own rules.
@@ -541,7 +551,9 @@ declare function enable(): void;
541
551
  */
542
552
  declare function disable(): void;
543
553
  /**
544
- * Check whether tracing is currently enabled.
554
+ * Check whether tracing is currently enabled. False before `init()`, with no API
555
+ * key (also with `RISICARE_TRACING=true`, `enabled: true` or `enable()`), with
556
+ * tracing off, and after `shutdown()` or the SDK's own drain at SIGTERM / SIGINT.
545
557
  */
546
558
  declare function isEnabled(): boolean;
547
559
  /**
@@ -554,7 +566,7 @@ declare function getTracer(): Tracer$1 | undefined;
554
566
  declare function getTraceContent(): boolean;
555
567
  /**
556
568
  * Get SDK metrics: exported spans (accepted by the backend), `rejectedSpans`,
557
- * dropped spans and their reasons (`unacknowledged` included), failed exports,
569
+ * dropped spans and their reasons (`unacknowledged` and `quota_exceeded` included; `droppedQuota` is the latter), failed exports,
558
570
  * queue stats, and `failedScores` (`score()` requests that failed since
559
571
  * `init()`).
560
572
  *
@@ -590,7 +602,9 @@ declare function getMetrics(): {
590
602
  transport_refused: number;
591
603
  shutdown_residue: number;
592
604
  unacknowledged: number;
605
+ quota_exceeded: number;
593
606
  };
607
+ droppedQuota: number;
594
608
  failedExports: number;
595
609
  maskErrors: number;
596
610
  queueSize: number;
@@ -603,11 +617,13 @@ declare function getMetrics(): {
603
617
  transport_refused: number;
604
618
  shutdown_residue: number;
605
619
  unacknowledged: number;
620
+ quota_exceeded: number;
606
621
  };
607
622
  sdkState: "shutdown";
608
623
  exportedSpans: number;
609
624
  rejectedSpans: number;
610
625
  droppedSpans: number;
626
+ droppedQuota: number;
611
627
  failedExports: number;
612
628
  maskErrors: number;
613
629
  queueSize: number;
@@ -623,7 +639,9 @@ declare function getMetrics(): {
623
639
  transport_refused: number;
624
640
  shutdown_residue: number;
625
641
  unacknowledged: number;
642
+ quota_exceeded: number;
626
643
  };
644
+ droppedQuota: number;
627
645
  failedExports: number;
628
646
  queueSize: number;
629
647
  queueCapacity: number;
@@ -660,9 +678,11 @@ declare function reportError(error: unknown, options?: {
660
678
  * the score name and the status or the error code. Later failures in the next
661
679
  * 10 s are counted, and the next WARNING gives their number. Root `flush()`
662
680
  * waits for pending scores inside its deadline, and returns `false` when a
663
- * score failed since the previous `flush()` returned. An out-of-range value, or an empty `traceId`
664
- * or `name`, writes one WARNING, and the SDK does not send the score. `true`
665
- * and `false` count as 1 and 0.
681
+ * score failed since the previous `flush()` returned. An out-of-range value, a
682
+ * value that is not a number, or an empty `traceId` or `name` writes one WARNING,
683
+ * and the SDK does not send the score. It counts as a failed score, so the next
684
+ * `flush()` is false (not when the SDK is not active: then nothing is counted).
685
+ * `true` and `false` count as 1 and 0.
666
686
  *
667
687
  * If a `mask` is configured on `init()`, `options.comment` is passed to it under
668
688
  * the key `score.comment` before the request is built. `traceId`, `spanId` and