fix(core): keep custom providers whose model sets only part of limit (#62240)

This commit is contained in:
DS
2026-11-06 15:39:51 -05:00
committed by GitHub
Unverified
parent f27034763e
commit 4e9c00aa9a
3 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -250,9 +250,9 @@ function migrateModel(info: typeof ConfigProviderV1.Model.Type, npm: string | un
cost: costs,
disabled: info.status === "deprecated" ? true : undefined,
limit: info.limit && {
context: int(info.limit.context),
context: info.limit.context === undefined ? undefined : int(info.limit.context),
input: info.limit.input === undefined ? undefined : int(info.limit.input),
output: int(info.limit.output),
output: info.limit.output === undefined ? undefined : int(info.limit.output),
},
}
}
+2 -2
View File
@@ -41,9 +41,9 @@ export const Model = Schema.Struct({
),
limit: Schema.optional(
Schema.Struct({
context: Schema.Finite,
context: Schema.optional(Schema.Finite),
input: Schema.optional(Schema.Finite),
output: Schema.Finite,
output: Schema.optional(Schema.Finite),
}),
),
modalities: Schema.optional(
@@ -694,6 +694,11 @@ describe("ConfigProviderPlugin.Plugin", () => {
legacy: { models: { chat: { cost: { input: 0, output: 0 } } } },
native: { models: { chat: { cost: { input: 0, output: 0 } } } },
},
{
name: "context-only limits",
legacy: { models: { chat: { limit: { context: 1000000 } } } },
native: { models: { chat: { limit: { context: 1000000 } } } },
},
]) {
it.effect(`matches native configuration for migrated ${scenario.name}`, () =>
Effect.gen(function* () {