feat(ai): type Vertex Messages request options (#39501)
This commit is contained in:
parent
b4ac939537
commit
cb80f47112
2 changed files with 18 additions and 2 deletions
|
|
@ -91,7 +91,7 @@ export const configure = (input: Config = {}) => {
|
||||||
const route = configuredRoute(input)
|
const route = configuredRoute(input)
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
model: (modelID: string | ModelID) => route.model({ id: modelID }),
|
model: (modelID: string | ModelID) => route.model<AnthropicMessages.ProviderOptionsInput>({ id: modelID }),
|
||||||
configure,
|
configure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,10 @@ export const provider = {
|
||||||
configure,
|
configure,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const model: ProviderPackage.Definition<Settings>["model"] = (modelID, settings) => {
|
export const model: ProviderPackage.Definition<Settings, AnthropicMessages.ProviderOptionsInput>["model"] = (
|
||||||
|
modelID,
|
||||||
|
settings,
|
||||||
|
) => {
|
||||||
if (settings.apiKey !== undefined) throw new Error("Google Vertex Messages does not support API keys")
|
if (settings.apiKey !== undefined) throw new Error("Google Vertex Messages does not support API keys")
|
||||||
return configure({
|
return configure({
|
||||||
accessToken: settings.accessToken,
|
accessToken: settings.accessToken,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { LLM } from "../../src"
|
||||||
|
import { GoogleVertexMessages } from "../../src/providers"
|
||||||
|
|
||||||
|
const model = GoogleVertexMessages.configure({ accessToken: "test", project: "project" }).model("claude")
|
||||||
|
|
||||||
|
LLM.request({ model, prompt: "Hello", providerOptions: { anthropic: { effort: "medium" } } })
|
||||||
|
|
||||||
|
LLM.request({
|
||||||
|
model,
|
||||||
|
prompt: "Hello",
|
||||||
|
// @ts-expect-error Vertex Anthropic effort must be a string.
|
||||||
|
providerOptions: { anthropic: { effort: false } },
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue