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
|
@@ -496,7 +496,7 @@ function attachErrorCode(span, error) {
|
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
// src/version.ts
|
|
499
|
-
var SDK_VERSION = "0.9.
|
|
499
|
+
var SDK_VERSION = "0.9.2";
|
|
500
500
|
|
|
501
501
|
// src/exporters/quota.ts
|
|
502
502
|
var QUOTA_REASON = "monthly_quota_exceeded";
|
|
@@ -641,6 +641,8 @@ var HttpExporter = class {
|
|
|
641
641
|
_calls = /* @__PURE__ */ new Map();
|
|
642
642
|
/** The ack of each finished call, by its batch. Read once by `takeAck(spans)`. */
|
|
643
643
|
_acks = /* @__PURE__ */ new WeakMap();
|
|
644
|
+
/** The requests that each finished call sent, by its batch. Read once by `takeAttempts(spans)`. */
|
|
645
|
+
_requests = /* @__PURE__ */ new WeakMap();
|
|
644
646
|
/** The batch processor dropped span(s) from a full queue in the quota pause (S-1). */
|
|
645
647
|
noteQuotaDrop(count = 1) {
|
|
646
648
|
this._quota.addDrops(count);
|
|
@@ -692,6 +694,18 @@ var HttpExporter = class {
|
|
|
692
694
|
get attemptsPerExport() {
|
|
693
695
|
return this._maxRetries;
|
|
694
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Returns the number of HTTP requests that the `export()` call for `spans` sent, and clears
|
|
699
|
+
* it. This is the number that was sent, not the most that the call may send
|
|
700
|
+
* (`attemptsPerExport`): a 401 or 403 stops the loop after one request, and an open circuit
|
|
701
|
+
* breaker sends none. Returns `null` when no call is on record for `spans`. The answer is
|
|
702
|
+
* kept per batch, as `takeAck` keeps the ack.
|
|
703
|
+
*/
|
|
704
|
+
takeAttempts(spans) {
|
|
705
|
+
const n = this._requests.get(spans) ?? null;
|
|
706
|
+
this._requests.delete(spans);
|
|
707
|
+
return n;
|
|
708
|
+
}
|
|
695
709
|
/**
|
|
696
710
|
* Returns the counts of the ack that the `export()` call for `spans` received, and clears
|
|
697
711
|
* them. The answer is kept per batch, not on the instance: two processors that share this
|
|
@@ -736,13 +750,15 @@ var HttpExporter = class {
|
|
|
736
750
|
misroute: null,
|
|
737
751
|
noRetry: false,
|
|
738
752
|
status: null,
|
|
739
|
-
error: null
|
|
753
|
+
error: null,
|
|
754
|
+
attempts: 0
|
|
740
755
|
};
|
|
741
756
|
this._calls.set(spans, call);
|
|
742
757
|
try {
|
|
743
758
|
return await this._export(spans, call);
|
|
744
759
|
} finally {
|
|
745
760
|
this._calls.delete(spans);
|
|
761
|
+
this._requests.set(spans, this._endpointHasCredentials ? 0 : call.attempts);
|
|
746
762
|
}
|
|
747
763
|
}
|
|
748
764
|
async _export(spans, call) {
|
|
@@ -782,14 +798,13 @@ var HttpExporter = class {
|
|
|
782
798
|
isHalfOpen = true;
|
|
783
799
|
}
|
|
784
800
|
const maxAttempts = isHalfOpen ? 1 : this._maxRetries;
|
|
785
|
-
let attempts = 0;
|
|
786
801
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
787
802
|
call.refusalAfterMs = null;
|
|
788
803
|
call.misroute = null;
|
|
789
804
|
call.noRetry = false;
|
|
790
805
|
call.status = null;
|
|
791
806
|
call.error = null;
|
|
792
|
-
attempts++;
|
|
807
|
+
call.attempts++;
|
|
793
808
|
const result = await this._sendRequest(payload, parts.length, call, spans);
|
|
794
809
|
if (cancelled.aborted) {
|
|
795
810
|
this._acks.delete(spans);
|
|
@@ -811,7 +826,7 @@ var HttpExporter = class {
|
|
|
811
826
|
}
|
|
812
827
|
if (call.refusalAfterMs !== null) {
|
|
813
828
|
warn(
|
|
814
|
-
`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.`
|
|
829
|
+
`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.`
|
|
815
830
|
);
|
|
816
831
|
return "failure" /* FAILURE */;
|
|
817
832
|
}
|
|
@@ -1985,9 +2000,11 @@ function createStreamProxy(original) {
|
|
|
1985
2000
|
);
|
|
1986
2001
|
};
|
|
1987
2002
|
}
|
|
2003
|
+
var PATCHED = /* @__PURE__ */ new WeakSet();
|
|
1988
2004
|
function patchMistral(client) {
|
|
1989
2005
|
assertClient("patchMistral", client);
|
|
1990
|
-
|
|
2006
|
+
if (PATCHED.has(client)) return client;
|
|
2007
|
+
const proxy = new Proxy(client, {
|
|
1991
2008
|
get(target, prop, receiver) {
|
|
1992
2009
|
const value = Reflect.get(target, prop, receiver);
|
|
1993
2010
|
if (prop === "chat" && value && typeof value === "object") {
|
|
@@ -2007,6 +2024,8 @@ function patchMistral(client) {
|
|
|
2007
2024
|
return value;
|
|
2008
2025
|
}
|
|
2009
2026
|
});
|
|
2027
|
+
PATCHED.add(proxy);
|
|
2028
|
+
return proxy;
|
|
2010
2029
|
}
|
|
2011
2030
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2012
2031
|
0 && (module.exports = {
|