feat(ai): type compatible Responses options (#39506)
This commit is contained in:
parent
ce2c9e7e26
commit
224feff7c4
2 changed files with 18 additions and 2 deletions
|
|
@ -36,7 +36,7 @@ export const configure = (input: Config) => {
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
id: ProviderID.make(provider),
|
id: ProviderID.make(provider),
|
||||||
model: (modelID: string | ModelID) => route.model({ id: modelID }),
|
model: (modelID: string | ModelID) => route.model<OpenResponsesProviderOptionsInput>({ id: modelID }),
|
||||||
configure,
|
configure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,10 @@ export const provider = {
|
||||||
configure,
|
configure,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const model: ProviderPackage.Definition<Settings>["model"] = (modelID, settings) =>
|
export const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"] = (
|
||||||
|
modelID,
|
||||||
|
settings,
|
||||||
|
) =>
|
||||||
configure({
|
configure({
|
||||||
apiKey: settings.apiKey,
|
apiKey: settings.apiKey,
|
||||||
baseURL: settings.baseURL,
|
baseURL: settings.baseURL,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { LLM } from "../../src"
|
||||||
|
import { OpenAICompatibleResponses } from "../../src/providers"
|
||||||
|
|
||||||
|
const model = OpenAICompatibleResponses.configure({ baseURL: "https://example.com" }).model("model")
|
||||||
|
|
||||||
|
LLM.request({ model, prompt: "Hello", providerOptions: { openresponses: { reasoningSummary: "detailed" } } })
|
||||||
|
|
||||||
|
LLM.request({
|
||||||
|
model,
|
||||||
|
prompt: "Hello",
|
||||||
|
// @ts-expect-error Open Responses reasoning summaries use a fixed union.
|
||||||
|
providerOptions: { openresponses: { reasoningSummary: "full" } },
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue