@raoxxxwq/pi-codebuddy-sdk 0.3.0 → 0.3.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.
- package/package.json +1 -1
- package/src/index.ts +5 -5
- package/src/model-calibration.ts +2 -2
- package/src/models.ts +2 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -899,7 +899,7 @@ function observeServedContextWindow(label: string, servedModel: string, observed
|
|
|
899
899
|
if (!Number.isFinite(observed) || observed <= 0) return;
|
|
900
900
|
try {
|
|
901
901
|
const previousRegistered = MODELS.find((candidate) => candidate.id === model.id)?.contextWindow;
|
|
902
|
-
const { changed,
|
|
902
|
+
const { changed, record } = recordObservedContextWindow(
|
|
903
903
|
calibrationCache,
|
|
904
904
|
model.id,
|
|
905
905
|
calibrationEnvironment,
|
|
@@ -907,11 +907,11 @@ function observeServedContextWindow(label: string, servedModel: string, observed
|
|
|
907
907
|
);
|
|
908
908
|
if (!changed) return;
|
|
909
909
|
saveCalibrationCache(calibrationCache);
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
910
|
+
const latest = record.capabilities.contextWindow?.latest;
|
|
911
|
+
if (latest != null) {
|
|
912
912
|
MODELS = MODELS.map((candidate) => (
|
|
913
913
|
candidate.id === model.id
|
|
914
|
-
? { ...candidate, contextWindow:
|
|
914
|
+
? { ...candidate, contextWindow: latest }
|
|
915
915
|
: candidate
|
|
916
916
|
));
|
|
917
917
|
}
|
|
@@ -919,7 +919,7 @@ function observeServedContextWindow(label: string, servedModel: string, observed
|
|
|
919
919
|
`calibration: ${label} observed=${observed} floor=${record.capabilities.contextWindow?.floor ?? "?"} ` +
|
|
920
920
|
`latest=${record.capabilities.contextWindow?.latest ?? "?"} servedModel=${servedModel} registeredBefore=${previousRegistered ?? "?"}`,
|
|
921
921
|
);
|
|
922
|
-
if (
|
|
922
|
+
if (latest != null && previousRegistered != null && latest !== previousRegistered) {
|
|
923
923
|
scheduleCalibrationRefresh(`contextWindow:${model.id}`);
|
|
924
924
|
}
|
|
925
925
|
} catch (err) {
|
package/src/model-calibration.ts
CHANGED
|
@@ -90,8 +90,8 @@ export function applyContextWindowCalibrations<T extends { id: string; contextWi
|
|
|
90
90
|
): T[] {
|
|
91
91
|
return models.map((model) => {
|
|
92
92
|
const metric = getContextWindowCalibration(cache, model.id, environment);
|
|
93
|
-
if (!metric?.
|
|
94
|
-
|
|
93
|
+
if (!metric?.latest) return model;
|
|
94
|
+
return { ...model, contextWindow: metric.latest };
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
|
package/src/models.ts
CHANGED
|
@@ -12,8 +12,8 @@ export type PiModel = {
|
|
|
12
12
|
cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const CONSERVATIVE_DEFAULT_CONTEXT =
|
|
16
|
-
const CONSERVATIVE_GEMINI_CONTEXT =
|
|
15
|
+
const CONSERVATIVE_DEFAULT_CONTEXT = 200_000;
|
|
16
|
+
const CONSERVATIVE_GEMINI_CONTEXT = 1_048_576;
|
|
17
17
|
const DEFAULT_MAX_TOKENS = 8192;
|
|
18
18
|
|
|
19
19
|
function detectThinking(id: string): boolean {
|