refactor(compaction): drop the spec's reservedCompletionTokens field
Review follow-up: nothing consumed the field. The reserve stays an input to `resolveCompactSpec`, whose returned budgets already express its effect, so `ResolvedCompactSpec` keeps its exported shape. Note the name collision a consumer would have hit: `ResolvedTargetPolicy.maxTokens` is the compaction *summarization* output cap (default 8192), not the routed request's cap reserved from the same window.
This commit is contained in:
1 parent
0fadb08fbd
commit
a1cebebd40
3 files changed
-5
No files matched your search
@@ -181,7 +181,6 @@ export function resolveCompactSpec(
|
||||
return deepFreeze({
|
||||
target: { ...policy.target },
|
||||
contextWindow,
|
||||
reservedCompletionTokens,
|
||||
thresholdRatio: policy.thresholdRatio,
|
||||
thresholdTokens,
|
||||
retainTokens,
|
||||
|
||||
@@ -71,8 +71,6 @@ export type ResolvedTargetPolicy = ResolvedPolicyFields & ResolvedRetention & {
|
||||
/** One routed model's concrete pressure and retention budget. */
|
||||
export type ResolvedCompactSpec = Omit<ResolvedTargetPolicy, 'retainRatio' | 'retainTokens'> & {
|
||||
readonly contextWindow: number
|
||||
/** Output tokens one routed request reserves, excluded from both budgets. */
|
||||
readonly reservedCompletionTokens: number
|
||||
readonly thresholdTokens: number
|
||||
readonly retainTokens: number
|
||||
}
|
||||
@@ -408,14 +408,12 @@ describe('compact configuration and defaults', () => {
|
||||
// point where the provider rejects the request.
|
||||
expect(resolveCompactSpec(policy, 1_048_576, 256_000)).toMatchObject({
|
||||
contextWindow: 1_048_576,
|
||||
reservedCompletionTokens: 256_000,
|
||||
thresholdTokens: 634_060,
|
||||
retainTokens: 126_812,
|
||||
})
|
||||
|
||||
// No declared reserve keeps the whole window available, as before.
|
||||
expect(resolveCompactSpec(policy, 1_000)).toMatchObject({
|
||||
reservedCompletionTokens: 0,
|
||||
thresholdTokens: 800,
|
||||
retainTokens: 160,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user