fix(core): scope Vertex provider transforms (#31004)
This commit is contained in:
parent
7ebc7ffb87
commit
05d1104ecd
@ -63,7 +63,10 @@ export const GoogleVertexPlugin = PluginV2.define({
|
||||
if (item.provider.api.type !== "aisdk") continue
|
||||
if (
|
||||
item.provider.api.package !== "@ai-sdk/google-vertex" &&
|
||||
!item.provider.api.package.includes("@ai-sdk/openai-compatible")
|
||||
!(
|
||||
item.provider.id === ProviderV2.ID.googleVertex &&
|
||||
item.provider.api.package.includes("@ai-sdk/openai-compatible")
|
||||
)
|
||||
)
|
||||
continue
|
||||
const project = resolveProject(item.provider.request.body)
|
||||
|
||||
@ -35,6 +35,27 @@ void mock.module("google-auth-library", () => ({
|
||||
}))
|
||||
|
||||
describe("GoogleVertexPlugin", () => {
|
||||
it.effect("ignores OpenAI-compatible providers that are not Google Vertex", () =>
|
||||
Effect.gen(function* () {
|
||||
const plugin = yield* PluginV2.Service
|
||||
const catalog = yield* Catalog.Service
|
||||
yield* plugin.add(GoogleVertexPlugin)
|
||||
const transform = yield* catalog.transform()
|
||||
yield* transform((catalog) =>
|
||||
catalog.provider.update(ProviderV2.ID.opencode, (provider) => {
|
||||
provider.api = {
|
||||
type: "aisdk",
|
||||
package: "@ai-sdk/openai-compatible",
|
||||
url: "https://opencode.ai/zen/v1",
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
const provider = yield* catalog.provider.get(ProviderV2.ID.opencode)
|
||||
expect(provider.request.body).toEqual({})
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("resolves project and location from env using legacy precedence", () =>
|
||||
withEnv(
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user