refactor(core): migrate provider consumers
This commit is contained in:
parent
e40ce1d556
commit
248db536e2
71 changed files with 1313 additions and 1138 deletions
|
|
@ -23,7 +23,13 @@ const connections = Credential.defaultLayer.pipe(Layer.fresh)
|
|||
const integrations = Integration.locationLayer.pipe(Layer.provide(events), Layer.provide(connections))
|
||||
const catalog = Catalog.layer.pipe(
|
||||
Layer.provide(
|
||||
Layer.mergeAll(events, locationLayer, Policy.layer.pipe(Layer.provide(locationLayer)), connections, integrations),
|
||||
Layer.mergeAll(
|
||||
events,
|
||||
locationLayer,
|
||||
Policy.layer.pipe(Layer.provide(locationLayer)),
|
||||
connections,
|
||||
integrations,
|
||||
),
|
||||
),
|
||||
)
|
||||
const it = testEffect(
|
||||
|
|
@ -36,21 +42,20 @@ describe("VariantPlugin", () => {
|
|||
const service = yield* Catalog.Service
|
||||
yield* service.transform((catalog) => {
|
||||
catalog.provider.update(ProviderV2.ID.opencode, (provider) => {
|
||||
provider.api = { type: "aisdk", package: "@ai-sdk/openai-compatible" }
|
||||
provider.package = "@ai-sdk/openai-compatible"
|
||||
provider.aisdk = true
|
||||
})
|
||||
catalog.model.update(ProviderV2.ID.opencode, ModelV2.ID.make("glm-5.2"), (model) => {
|
||||
model.api = {
|
||||
id: ModelV2.ID.make("glm-5.2"),
|
||||
type: "aisdk",
|
||||
package: "@ai-sdk/openai-compatible",
|
||||
}
|
||||
model.modelID = ModelV2.ID.make("glm-5.2")
|
||||
model.package = "@ai-sdk/openai-compatible"
|
||||
model.aisdk = true
|
||||
})
|
||||
})
|
||||
yield* VariantPlugin.Plugin.effect(host({ catalog: catalogHost(service) }))
|
||||
|
||||
expect((yield* service.model.get(ProviderV2.ID.opencode, ModelV2.ID.make("glm-5.2")))?.variants).toEqual([
|
||||
expect.objectContaining({ id: "high", body: { reasoning_effort: "high" } }),
|
||||
expect.objectContaining({ id: "max", body: { reasoning_effort: "max" } }),
|
||||
expect.objectContaining({ id: "high", settings: { reasoningEffort: "high" } }),
|
||||
expect.objectContaining({ id: "max", settings: { reasoningEffort: "max" } }),
|
||||
])
|
||||
}),
|
||||
)
|
||||
|
|
@ -60,19 +65,19 @@ describe("VariantPlugin", () => {
|
|||
const service = yield* Catalog.Service
|
||||
yield* service.transform((catalog) => {
|
||||
catalog.model.update(ProviderV2.ID.opencode, ModelV2.ID.make("glm-5.2"), (model) => {
|
||||
model.api = {
|
||||
id: ModelV2.ID.make("glm-5.2"),
|
||||
type: "aisdk",
|
||||
package: "@ai-sdk/openai-compatible",
|
||||
}
|
||||
model.variants = [{ id: ModelV2.VariantID.make("high"), headers: { custom: "true" }, body: {} }]
|
||||
model.modelID = ModelV2.ID.make("glm-5.2")
|
||||
model.package = "@ai-sdk/openai-compatible"
|
||||
model.aisdk = true
|
||||
model.variants = [
|
||||
{ id: ModelV2.VariantID.make("high"), headers: { custom: "true" } },
|
||||
]
|
||||
})
|
||||
})
|
||||
yield* VariantPlugin.Plugin.effect(host({ catalog: catalogHost(service) }))
|
||||
|
||||
expect((yield* service.model.get(ProviderV2.ID.opencode, ModelV2.ID.make("glm-5.2")))?.variants).toEqual([
|
||||
expect.objectContaining({ id: "high", headers: { custom: "true" } }),
|
||||
expect.objectContaining({ id: "max", body: { reasoning_effort: "max" } }),
|
||||
expect.objectContaining({ id: "max", settings: { reasoningEffort: "max" } }),
|
||||
])
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue