feat(core): sync models.dev reasoning options
This commit is contained in:
parent
80c0b06980
commit
a47ff5c746
9 changed files with 112 additions and 2 deletions
68
packages/core/test/plugin/models-dev.test.ts
Normal file
68
packages/core/test/plugin/models-dev.test.ts
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import { describe, expect } from "bun:test"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { Catalog } from "@opencode-ai/core/catalog"
|
||||
import { EventV2 } from "@opencode-ai/core/event"
|
||||
import { Location } from "@opencode-ai/core/location"
|
||||
import { ModelV2 } from "@opencode-ai/core/model"
|
||||
import { ModelsDev } from "@opencode-ai/core/models-dev"
|
||||
import { ModelsDevPlugin } from "@opencode-ai/core/plugin/models-dev"
|
||||
import { ProviderV2 } from "@opencode-ai/core/provider"
|
||||
import { AbsolutePath } from "@opencode-ai/core/schema"
|
||||
import { location } from "../fixture/location"
|
||||
import { testEffect } from "../lib/effect"
|
||||
|
||||
const reasoningOptions: ModelsDev.ReasoningOption[] = [
|
||||
{ type: "effort", values: [null, "low", "ultrathink"], default: "low" },
|
||||
{ type: "future_dynamic_budget", curve: { min: 1, max: 10 }, enabled: true },
|
||||
]
|
||||
|
||||
const modelsDev = Layer.succeed(
|
||||
ModelsDev.Service,
|
||||
ModelsDev.Service.of({
|
||||
get: () =>
|
||||
Effect.succeed({
|
||||
acme: {
|
||||
id: "acme",
|
||||
name: "Acme",
|
||||
env: [],
|
||||
models: {
|
||||
"acme-1": {
|
||||
id: "acme-1",
|
||||
name: "Acme One",
|
||||
release_date: "2026-01-01",
|
||||
attachment: false,
|
||||
reasoning: true,
|
||||
reasoning_options: reasoningOptions,
|
||||
temperature: true,
|
||||
tool_call: true,
|
||||
limit: { context: 128_000, output: 8_192 },
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
refresh: () => Effect.void,
|
||||
}),
|
||||
)
|
||||
const locationLayer = Layer.succeed(
|
||||
Location.Service,
|
||||
Location.Service.of(location({ directory: AbsolutePath.make("test") })),
|
||||
)
|
||||
const catalog = Catalog.locationLayer.pipe(
|
||||
Layer.provideMerge(EventV2.defaultLayer),
|
||||
Layer.provideMerge(locationLayer),
|
||||
)
|
||||
const it = testEffect(Layer.merge(catalog, modelsDev))
|
||||
|
||||
describe("ModelsDevPlugin", () => {
|
||||
it.effect("preserves reasoning options in V2 model capabilities", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* ModelsDevPlugin.effect
|
||||
const model = yield* (yield* Catalog.Service).model.get(
|
||||
ProviderV2.ID.make("acme"),
|
||||
ModelV2.ID.make("acme-1"),
|
||||
)
|
||||
|
||||
expect(model.capabilities.reasoningOptions).toEqual(reasoningOptions)
|
||||
}),
|
||||
)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue