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
|
@@ -250,7 +250,7 @@ function runWithContext(overrides, fn) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// src/version.ts
|
|
253
|
-
var SDK_VERSION = "0.9.
|
|
253
|
+
var SDK_VERSION = "0.9.2";
|
|
254
254
|
|
|
255
255
|
// src/exporters/quota.ts
|
|
256
256
|
var QUOTA_REASON = "monthly_quota_exceeded";
|
|
@@ -395,6 +395,8 @@ var HttpExporter = class {
|
|
|
395
395
|
_calls = /* @__PURE__ */ new Map();
|
|
396
396
|
/** The ack of each finished call, by its batch. Read once by `takeAck(spans)`. */
|
|
397
397
|
_acks = /* @__PURE__ */ new WeakMap();
|
|
398
|
+
/** The requests that each finished call sent, by its batch. Read once by `takeAttempts(spans)`. */
|
|
399
|
+
_requests = /* @__PURE__ */ new WeakMap();
|
|
398
400
|
/** The batch processor dropped span(s) from a full queue in the quota pause (S-1). */
|
|
399
401
|
noteQuotaDrop(count = 1) {
|
|
400
402
|
this._quota.addDrops(count);
|
|
@@ -446,6 +448,18 @@ var HttpExporter = class {
|
|
|
446
448
|
get attemptsPerExport() {
|
|
447
449
|
return this._maxRetries;
|
|
448
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Returns the number of HTTP requests that the `export()` call for `spans` sent, and clears
|
|
453
|
+
* it. This is the number that was sent, not the most that the call may send
|
|
454
|
+
* (`attemptsPerExport`): a 401 or 403 stops the loop after one request, and an open circuit
|
|
455
|
+
* breaker sends none. Returns `null` when no call is on record for `spans`. The answer is
|
|
456
|
+
* kept per batch, as `takeAck` keeps the ack.
|
|
457
|
+
*/
|
|
458
|
+
takeAttempts(spans) {
|
|
459
|
+
const n = this._requests.get(spans) ?? null;
|
|
460
|
+
this._requests.delete(spans);
|
|
461
|
+
return n;
|
|
462
|
+
}
|
|
449
463
|
/**
|
|
450
464
|
* Returns the counts of the ack that the `export()` call for `spans` received, and clears
|
|
451
465
|
* them. The answer is kept per batch, not on the instance: two processors that share this
|
|
@@ -490,13 +504,15 @@ var HttpExporter = class {
|
|
|
490
504
|
misroute: null,
|
|
491
505
|
noRetry: false,
|
|
492
506
|
status: null,
|
|
493
|
-
error: null
|
|
507
|
+
error: null,
|
|
508
|
+
attempts: 0
|
|
494
509
|
};
|
|
495
510
|
this._calls.set(spans, call);
|
|
496
511
|
try {
|
|
497
512
|
return await this._export(spans, call);
|
|
498
513
|
} finally {
|
|
499
514
|
this._calls.delete(spans);
|
|
515
|
+
this._requests.set(spans, this._endpointHasCredentials ? 0 : call.attempts);
|
|
500
516
|
}
|
|
501
517
|
}
|
|
502
518
|
async _export(spans, call) {
|
|
@@ -536,14 +552,13 @@ var HttpExporter = class {
|
|
|
536
552
|
isHalfOpen = true;
|
|
537
553
|
}
|
|
538
554
|
const maxAttempts = isHalfOpen ? 1 : this._maxRetries;
|
|
539
|
-
let attempts = 0;
|
|
540
555
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
541
556
|
call.refusalAfterMs = null;
|
|
542
557
|
call.misroute = null;
|
|
543
558
|
call.noRetry = false;
|
|
544
559
|
call.status = null;
|
|
545
560
|
call.error = null;
|
|
546
|
-
attempts++;
|
|
561
|
+
call.attempts++;
|
|
547
562
|
const result = await this._sendRequest(payload, parts.length, call, spans);
|
|
548
563
|
if (cancelled.aborted) {
|
|
549
564
|
this._acks.delete(spans);
|
|
@@ -565,7 +580,7 @@ var HttpExporter = class {
|
|
|
565
580
|
}
|
|
566
581
|
if (call.refusalAfterMs !== null) {
|
|
567
582
|
warn(
|
|
568
|
-
`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.`
|
|
583
|
+
`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.`
|
|
569
584
|
);
|
|
570
585
|
return "failure" /* FAILURE */;
|
|
571
586
|
}
|