mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-22 04:13:26 +00:00
fix(core): route Vertex Gemini through native provider (#43433)
Signed-off-by: Major Hayden <major@mhtx.net>
This commit is contained in:
parent
dcc7de2e47
commit
3edcb3ca2b
2 changed files with 36 additions and 0 deletions
|
|
@ -51,6 +51,19 @@ export function map(input: MapInput): Mapping | undefined {
|
|||
...mapGoogleOptions(input.settings),
|
||||
},
|
||||
}
|
||||
case "@ai-sdk/google-vertex":
|
||||
return {
|
||||
package: "@opencode-ai/ai/providers/google-vertex",
|
||||
settings: {
|
||||
...baseSettings,
|
||||
...(typeof input.settings.accessToken === "string" ? { accessToken: input.settings.accessToken } : {}),
|
||||
...mapAPIKey(input.settings),
|
||||
...(typeof input.settings.location === "string" ? { location: input.settings.location } : {}),
|
||||
...(typeof input.settings.project === "string" ? { project: input.settings.project } : {}),
|
||||
...mapGoogleOptions(input.settings),
|
||||
},
|
||||
...(isStringRecord(input.settings.headers) ? { headers: input.settings.headers } : {}),
|
||||
}
|
||||
case "@ai-sdk/google-vertex/anthropic":
|
||||
return {
|
||||
package: "@opencode-ai/ai/providers/google-vertex/messages",
|
||||
|
|
|
|||
|
|
@ -273,6 +273,29 @@ describe("AISDKNative", () => {
|
|||
})
|
||||
})
|
||||
|
||||
test("maps Vertex Gemini settings to the native Gemini route", () => {
|
||||
expect(
|
||||
map("@ai-sdk/google-vertex", {
|
||||
accessToken: "vertex-token",
|
||||
baseURL: "https://vertex.example/v1",
|
||||
headers: { "x-test": "value" },
|
||||
location: "eu",
|
||||
project: "vertex-project",
|
||||
thinkingConfig: { thinkingLevel: "high" },
|
||||
}),
|
||||
).toEqual({
|
||||
package: "@opencode-ai/ai/providers/google-vertex",
|
||||
settings: {
|
||||
accessToken: "vertex-token",
|
||||
baseURL: "https://vertex.example/v1",
|
||||
location: "eu",
|
||||
project: "vertex-project",
|
||||
providerOptions: { gemini: { thinkingConfig: { thinkingLevel: "high" } } },
|
||||
},
|
||||
headers: { "x-test": "value" },
|
||||
})
|
||||
})
|
||||
|
||||
test("maps Vertex Anthropic settings to native Messages", () => {
|
||||
expect(
|
||||
map("@ai-sdk/google-vertex/anthropic", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue