risicare 0.9.1 → 0.9.2
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/CHANGELOG.md +1236 -0
- package/dist/frameworks/instructor.cjs +20 -5
- package/dist/frameworks/instructor.cjs.map +1 -1
- package/dist/frameworks/instructor.js +20 -5
- package/dist/frameworks/instructor.js.map +1 -1
- package/dist/frameworks/langchain.cjs +20 -5
- package/dist/frameworks/langchain.cjs.map +1 -1
- package/dist/frameworks/langchain.js +20 -5
- package/dist/frameworks/langchain.js.map +1 -1
- package/dist/frameworks/langgraph.cjs +20 -5
- package/dist/frameworks/langgraph.cjs.map +1 -1
- package/dist/frameworks/langgraph.js +20 -5
- package/dist/frameworks/langgraph.js.map +1 -1
- package/dist/frameworks/llamaindex.cjs +20 -5
- package/dist/frameworks/llamaindex.cjs.map +1 -1
- package/dist/frameworks/llamaindex.js +20 -5
- package/dist/frameworks/llamaindex.js.map +1 -1
- package/dist/index.cjs +77 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +77 -13
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic/index.cjs +25 -6
- package/dist/providers/anthropic/index.cjs.map +1 -1
- package/dist/providers/anthropic/index.d.cts +3 -0
- package/dist/providers/anthropic/index.d.ts +3 -0
- package/dist/providers/anthropic/index.js +25 -6
- package/dist/providers/anthropic/index.js.map +1 -1
- package/dist/providers/bedrock/index.cjs +25 -6
- package/dist/providers/bedrock/index.cjs.map +1 -1
- package/dist/providers/bedrock/index.d.cts +3 -0
- package/dist/providers/bedrock/index.d.ts +3 -0
- package/dist/providers/bedrock/index.js +25 -6
- package/dist/providers/bedrock/index.js.map +1 -1
- package/dist/providers/cerebras/index.cjs +25 -6
- package/dist/providers/cerebras/index.cjs.map +1 -1
- package/dist/providers/cerebras/index.d.cts +3 -0
- package/dist/providers/cerebras/index.d.ts +3 -0
- package/dist/providers/cerebras/index.js +25 -6
- package/dist/providers/cerebras/index.js.map +1 -1
- package/dist/providers/cohere/index.cjs +25 -6
- package/dist/providers/cohere/index.cjs.map +1 -1
- package/dist/providers/cohere/index.d.cts +3 -0
- package/dist/providers/cohere/index.d.ts +3 -0
- package/dist/providers/cohere/index.js +25 -6
- package/dist/providers/cohere/index.js.map +1 -1
- package/dist/providers/google/index.cjs +25 -6
- package/dist/providers/google/index.cjs.map +1 -1
- package/dist/providers/google/index.d.cts +3 -0
- package/dist/providers/google/index.d.ts +3 -0
- package/dist/providers/google/index.js +25 -6
- package/dist/providers/google/index.js.map +1 -1
- package/dist/providers/groq/index.cjs +25 -6
- package/dist/providers/groq/index.cjs.map +1 -1
- package/dist/providers/groq/index.d.cts +3 -0
- package/dist/providers/groq/index.d.ts +3 -0
- package/dist/providers/groq/index.js +25 -6
- package/dist/providers/groq/index.js.map +1 -1
- package/dist/providers/huggingface/index.cjs +23 -5
- package/dist/providers/huggingface/index.cjs.map +1 -1
- package/dist/providers/huggingface/index.js +23 -5
- package/dist/providers/huggingface/index.js.map +1 -1
- package/dist/providers/mistral/index.cjs +25 -6
- package/dist/providers/mistral/index.cjs.map +1 -1
- package/dist/providers/mistral/index.d.cts +3 -0
- package/dist/providers/mistral/index.d.ts +3 -0
- package/dist/providers/mistral/index.js +25 -6
- package/dist/providers/mistral/index.js.map +1 -1
- package/dist/providers/ollama/index.cjs +25 -6
- package/dist/providers/ollama/index.cjs.map +1 -1
- package/dist/providers/ollama/index.d.cts +3 -0
- package/dist/providers/ollama/index.d.ts +3 -0
- package/dist/providers/ollama/index.js +25 -6
- package/dist/providers/ollama/index.js.map +1 -1
- package/dist/providers/openai/index.cjs +25 -6
- package/dist/providers/openai/index.cjs.map +1 -1
- package/dist/providers/openai/index.d.cts +3 -0
- package/dist/providers/openai/index.d.ts +3 -0
- package/dist/providers/openai/index.js +25 -6
- package/dist/providers/openai/index.js.map +1 -1
- package/dist/providers/together/index.cjs +25 -6
- package/dist/providers/together/index.cjs.map +1 -1
- package/dist/providers/together/index.d.cts +3 -0
- package/dist/providers/together/index.d.ts +3 -0
- package/dist/providers/together/index.js +25 -6
- package/dist/providers/together/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.cjs +20 -5
- package/dist/providers/vercel-ai/index.cjs.map +1 -1
- package/dist/providers/vercel-ai/index.js +20 -5
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -286,7 +286,7 @@ function runWithContext(overrides, fn) {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
// src/version.ts
|
|
289
|
-
var SDK_VERSION = "0.9.
|
|
289
|
+
var SDK_VERSION = "0.9.2";
|
|
290
290
|
|
|
291
291
|
// src/exporters/quota.ts
|
|
292
292
|
var QUOTA_REASON = "monthly_quota_exceeded";
|
|
@@ -431,6 +431,8 @@ var HttpExporter = class {
|
|
|
431
431
|
_calls = /* @__PURE__ */ new Map();
|
|
432
432
|
/** The ack of each finished call, by its batch. Read once by `takeAck(spans)`. */
|
|
433
433
|
_acks = /* @__PURE__ */ new WeakMap();
|
|
434
|
+
/** The requests that each finished call sent, by its batch. Read once by `takeAttempts(spans)`. */
|
|
435
|
+
_requests = /* @__PURE__ */ new WeakMap();
|
|
434
436
|
/** The batch processor dropped span(s) from a full queue in the quota pause (S-1). */
|
|
435
437
|
noteQuotaDrop(count = 1) {
|
|
436
438
|
this._quota.addDrops(count);
|
|
@@ -482,6 +484,18 @@ var HttpExporter = class {
|
|
|
482
484
|
get attemptsPerExport() {
|
|
483
485
|
return this._maxRetries;
|
|
484
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Returns the number of HTTP requests that the `export()` call for `spans` sent, and clears
|
|
489
|
+
* it. This is the number that was sent, not the most that the call may send
|
|
490
|
+
* (`attemptsPerExport`): a 401 or 403 stops the loop after one request, and an open circuit
|
|
491
|
+
* breaker sends none. Returns `null` when no call is on record for `spans`. The answer is
|
|
492
|
+
* kept per batch, as `takeAck` keeps the ack.
|
|
493
|
+
*/
|
|
494
|
+
takeAttempts(spans) {
|
|
495
|
+
const n = this._requests.get(spans) ?? null;
|
|
496
|
+
this._requests.delete(spans);
|
|
497
|
+
return n;
|
|
498
|
+
}
|
|
485
499
|
/**
|
|
486
500
|
* Returns the counts of the ack that the `export()` call for `spans` received, and clears
|
|
487
501
|
* them. The answer is kept per batch, not on the instance: two processors that share this
|
|
@@ -526,13 +540,15 @@ var HttpExporter = class {
|
|
|
526
540
|
misroute: null,
|
|
527
541
|
noRetry: false,
|
|
528
542
|
status: null,
|
|
529
|
-
error: null
|
|
543
|
+
error: null,
|
|
544
|
+
attempts: 0
|
|
530
545
|
};
|
|
531
546
|
this._calls.set(spans, call);
|
|
532
547
|
try {
|
|
533
548
|
return await this._export(spans, call);
|
|
534
549
|
} finally {
|
|
535
550
|
this._calls.delete(spans);
|
|
551
|
+
this._requests.set(spans, this._endpointHasCredentials ? 0 : call.attempts);
|
|
536
552
|
}
|
|
537
553
|
}
|
|
538
554
|
async _export(spans, call) {
|
|
@@ -572,14 +588,13 @@ var HttpExporter = class {
|
|
|
572
588
|
isHalfOpen = true;
|
|
573
589
|
}
|
|
574
590
|
const maxAttempts = isHalfOpen ? 1 : this._maxRetries;
|
|
575
|
-
let attempts = 0;
|
|
576
591
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
577
592
|
call.refusalAfterMs = null;
|
|
578
593
|
call.misroute = null;
|
|
579
594
|
call.noRetry = false;
|
|
580
595
|
call.status = null;
|
|
581
596
|
call.error = null;
|
|
582
|
-
attempts++;
|
|
597
|
+
call.attempts++;
|
|
583
598
|
const result = await this._sendRequest(payload, parts.length, call, spans);
|
|
584
599
|
if (cancelled.aborted) {
|
|
585
600
|
this._acks.delete(spans);
|
|
@@ -601,7 +616,7 @@ var HttpExporter = class {
|
|
|
601
616
|
}
|
|
602
617
|
if (call.refusalAfterMs !== null) {
|
|
603
618
|
warn(
|
|
604
|
-
`Risicare: the ingest endpoint refused this batch for capacity (HTTP 429/503) after ${attempts} attempt(s). This is a healthy server shedding load, not an outage. This export of the batch failed; the circuit breaker does not count it. Reduce batch size or export rate if it persists.`
|
|
619
|
+
`Risicare: the ingest endpoint refused this batch for capacity (HTTP 429/503) after ${call.attempts} attempt(s). This is a healthy server shedding load, not an outage. This export of the batch failed; the circuit breaker does not count it. Reduce batch size or export rate if it persists.`
|
|
605
620
|
);
|
|
606
621
|
return "failure" /* FAILURE */;
|
|
607
622
|
}
|