Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/core/src/v1/config/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,9 @@ function migrateModel(info: typeof ConfigProviderV1.Model.Type, npm: string | un
]
: []),
]
const defaults = Model.Capabilities.default()
const capabilities =
info.tool_call !== undefined || info.modalities?.input !== undefined || info.modalities?.output !== undefined
? {
tools: info.tool_call ?? defaults.tools,
input: info.modalities?.input ?? defaults.input,
output: info.modalities?.output ?? defaults.output,
}
? { tools: info.tool_call, input: info.modalities?.input, output: info.modalities?.output }
: undefined
return {
modelID: info.id,
Expand Down
22 changes: 22 additions & 0 deletions packages/core/test/config/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,28 @@ describe("ConfigProviderPlugin.Plugin", () => {
}),
)

it.effect("keeps catalog capabilities that a migrated override omits", () =>
Effect.gen(function* () {
const providers = yield* Provider.Service
const models = yield* Model.Service
const providerID = Provider.ID.make("custom")
const modelID = Model.ID.make("chat")
yield* providers.transform((editor) => {
editor.models.update(providerID, modelID, (model) => {
model.capabilities = { tools: false, input: ["audio"], output: ["audio"] }
})
})
const result = ConfigNormalize.normalize({ provider: { custom: { models: { chat: { tool_call: true } } } } })
if (result.type !== "normalized") throw new Error("Expected normalized config")
yield* addPlugin([new Document({ type: "document", info: decode(result.encoded) })])
expect((yield* models.get(providerID, modelID))?.capabilities).toEqual({
tools: true,
input: ["audio"],
output: ["audio"],
})
}),
)

it.effect("lets a configured provider baseURL override catalog model baseURLs", () =>
Effect.gen(function* () {
const providers = yield* Provider.Service
Expand Down
Loading