Skip to content
Open
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
15 changes: 12 additions & 3 deletions packages/core/src/models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ type SourceProvider = {
readonly models: Readonly<Record<string, SourceModel>>
}

type SnapshotModel = ModelV2.Info & {
readonly capabilities: ModelV2.Info["capabilities"] &
Partial<Pick<SourceModel, "temperature" | "reasoning" | "attachment" | "interleaved">>
}

export type Snapshot = {
readonly info: ProviderV2.Info
readonly models: readonly ModelV2.Info[]
readonly models: readonly SnapshotModel[]
readonly environment: readonly string[]
}

Expand All @@ -93,7 +98,7 @@ function normalize(input: Record<string, SourceProvider>): readonly Snapshot[] {
package: ProviderV2.aisdk(item.npm),
...(item.api ? { settings: { baseURL: item.api } } : {}),
} satisfies ProviderV2.Info
const models: ModelV2.Info[] = []
const models: SnapshotModel[] = []
for (const model of Object.values(item.models)) {
const baseCost = cost(model.cost)
const variants = reasoningVariants(item, model)
Expand Down Expand Up @@ -492,7 +497,7 @@ function modelInfo(
readonly request?: NonNullable<NonNullable<SourceModel["experimental"]>["modes"]>[string]["provider"]
readonly variants?: NonNullable<ModelV2.Info["variants"]>
} = {},
): ModelV2.Info {
): SnapshotModel {
return {
id,
modelID: ModelV2.ID.make(model.id),
Expand All @@ -503,6 +508,10 @@ function modelInfo(
settings: model.provider?.api ? { baseURL: model.provider.api } : undefined,
capabilities: {
tools: model.tool_call,
temperature: model.temperature,
reasoning: model.reasoning,
attachment: model.attachment,
interleaved: model.interleaved,
input: [...(model.modalities?.input ?? [])],
output: [...(model.modalities?.output ?? [])],
},
Expand Down
22 changes: 19 additions & 3 deletions packages/core/test/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const fixture = {
id: "acme-1",
name: "Acme One",
release_date: "2026-01-01",
attachment: false,
attachment: true,
reasoning: false,
temperature: true,
tool_call: true,
Expand All @@ -69,7 +69,15 @@ const fixtureSnapshot = [
family: undefined,
package: undefined,
settings: undefined,
capabilities: { tools: true, input: [], output: [] },
capabilities: {
tools: true,
temperature: true,
reasoning: false,
attachment: true,
interleaved: undefined,
input: [],
output: [],
},
variants: [],
time: { released: Date.parse("2026-01-01") },
cost: [
Expand Down Expand Up @@ -130,7 +138,15 @@ const fixture2Snapshot = [
family: undefined,
package: undefined,
settings: undefined,
capabilities: { tools: false, input: [], output: [] },
capabilities: {
tools: false,
temperature: false,
reasoning: true,
attachment: false,
interleaved: undefined,
input: [],
output: [],
},
variants: [],
time: { released: Date.parse("2026-02-01") },
cost: [
Expand Down
Loading
Loading