billion-context 0.1.80-pr.508.331 → 0.1.80
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/dist/index.js +1 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -49850,7 +49850,6 @@ var SessionStore = class {
|
|
|
49850
49850
|
const byLabel = /* @__PURE__ */ new Map();
|
|
49851
49851
|
let unlabeled = 0;
|
|
49852
49852
|
for (const [id, envelope] of loaded) {
|
|
49853
|
-
if (id.startsWith("pfa-")) continue;
|
|
49854
49853
|
const session = buildSession(envelope.payload);
|
|
49855
49854
|
const label = session.meta.label;
|
|
49856
49855
|
if (!label) {
|
|
@@ -58008,17 +58007,9 @@ async function preflightCompressIfNeeded(prepared, runPrepare, req, res, opts, c
|
|
|
58008
58007
|
const session = prepared.session;
|
|
58009
58008
|
const limit = config.modelContextLimit;
|
|
58010
58009
|
const imageTokens = imageTokensInRawBody(prepared.protocol, prepared.body);
|
|
58011
|
-
const
|
|
58012
|
-
const payloadEstimate = textEstimate + imageTokens;
|
|
58010
|
+
const payloadEstimate = estimateCoreMessages(prepared.processedMessages) + imageTokens;
|
|
58013
58011
|
const tokenCount = Math.max(session.stats.lastInputTokens, payloadEstimate);
|
|
58014
58012
|
if (limit <= 0 || !model || tokenCount < limit) return prepared;
|
|
58015
|
-
const learnedMap = session.metadata.learnedContextLimits;
|
|
58016
|
-
const learnedLimit = (model ? learnedMap?.[model] : void 0) ?? session.metadata.learnedContextLimit;
|
|
58017
|
-
const noOverflowEvidence = session.stats.lastInputTokens < limit && learnedLimit === void 0;
|
|
58018
|
-
if (imageTokens > 0 && textEstimate < limit && noOverflowEvidence) {
|
|
58019
|
-
log2("warn", `[${session.id}] image-dominated payload (~${textEstimate} text + ~${imageTokens} image tokens) exceeds window ${limit} by estimate only, no upstream overflow evidence \u2014 forwarding once so the upstream arbitrates billing (#496)`);
|
|
58020
|
-
return prepared;
|
|
58021
|
-
}
|
|
58022
58013
|
const failFast = (status2, detail, retryable) => {
|
|
58023
58014
|
const imageNote = imageTokens >= limit ? ` Images alone account for ~${imageTokens} tokens (\u2265 window ${limit}); compression cannot remove them \u2014 shrink or remove the images, or raise the window.` : "";
|
|
58024
58015
|
const message = `context ~${tokenCount} tokens exceeds the model window ${limit} (model=${model}) and preflight compression could not bring it under: ${detail}.` + imageNote + ` The over-window payload was NOT forwarded.`;
|