mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-30 22:43:32 +00:00
feat(ai): type Vertex request options (#39499)
This commit is contained in:
parent
d72b428061
commit
9554f9a16e
2 changed files with 23 additions and 2 deletions
|
|
@ -77,7 +77,8 @@ const configuredRoute = (input: Config, modelID: string | ModelID) => {
|
|||
export const configure = (input: Config = {}) => {
|
||||
return {
|
||||
id,
|
||||
model: (modelID: string | ModelID) => configuredRoute(input, modelID).model({ id: modelID }),
|
||||
model: (modelID: string | ModelID) =>
|
||||
configuredRoute(input, modelID).model<Gemini.ProviderOptionsInput>({ id: modelID }),
|
||||
configure,
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +87,10 @@ export const provider = {
|
|||
id,
|
||||
configure,
|
||||
}
|
||||
export const model: ProviderPackage.Definition<Settings>["model"] = (modelID, settings) => {
|
||||
export const model: ProviderPackage.Definition<Settings, Gemini.ProviderOptionsInput>["model"] = (
|
||||
modelID,
|
||||
settings,
|
||||
) => {
|
||||
if (settings.apiKey !== undefined && settings.accessToken !== undefined)
|
||||
throw new Error("Google Vertex apiKey cannot be combined with accessToken or auth")
|
||||
return configure({
|
||||
|
|
|
|||
17
packages/ai/test/provider-options/google-vertex.types.ts
Normal file
17
packages/ai/test/provider-options/google-vertex.types.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { LLM } from "../../src"
|
||||
import { GoogleVertex } from "../../src/providers"
|
||||
|
||||
const model = GoogleVertex.provider.configure({ apiKey: "test" }).model("gemini-2.5-pro")
|
||||
|
||||
LLM.request({
|
||||
model,
|
||||
prompt: "Hello",
|
||||
providerOptions: { gemini: { thinkingConfig: { includeThoughts: true } } },
|
||||
})
|
||||
|
||||
LLM.request({
|
||||
model,
|
||||
prompt: "Hello",
|
||||
// @ts-expect-error Vertex Gemini includeThoughts must be boolean.
|
||||
providerOptions: { gemini: { thinkingConfig: { includeThoughts: "yes" } } },
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue