fix(core): scope Vertex provider transforms (#31004)
This commit is contained in:
parent
7ebc7ffb87
commit
05d1104ecd
2 changed files with 25 additions and 1 deletions
|
|
@ -63,7 +63,10 @@ export const GoogleVertexPlugin = PluginV2.define({
|
||||||
if (item.provider.api.type !== "aisdk") continue
|
if (item.provider.api.type !== "aisdk") continue
|
||||||
if (
|
if (
|
||||||
item.provider.api.package !== "@ai-sdk/google-vertex" &&
|
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
|
continue
|
||||||
const project = resolveProject(item.provider.request.body)
|
const project = resolveProject(item.provider.request.body)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,27 @@ void mock.module("google-auth-library", () => ({
|
||||||
}))
|
}))
|
||||||
|
|
||||||
describe("GoogleVertexPlugin", () => {
|
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", () =>
|
it.effect("resolves project and location from env using legacy precedence", () =>
|
||||||
withEnv(
|
withEnv(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue