mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-30 12:13:30 +00:00
feat(ai): type Anthropic request options (#39502)
This commit is contained in:
parent
224feff7c4
commit
f5cdf0f056
2 changed files with 17 additions and 1 deletions
|
|
@ -52,7 +52,10 @@ export const configure = (input: Config = {}) => {
|
|||
}
|
||||
|
||||
export const provider = 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 && settings.authToken !== undefined)
|
||||
throw new Error("Anthropic apiKey cannot be combined with authToken")
|
||||
return configure({
|
||||
|
|
|
|||
13
packages/ai/test/provider-options/anthropic.types.ts
Normal file
13
packages/ai/test/provider-options/anthropic.types.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { LLM } from "../../src"
|
||||
import { Anthropic } from "../../src/providers"
|
||||
|
||||
const model = Anthropic.provider.model("claude-sonnet-4-5")
|
||||
|
||||
LLM.request({ model, prompt: "Hello", providerOptions: { anthropic: { thinking: { type: "adaptive" } } } })
|
||||
|
||||
LLM.request({
|
||||
model,
|
||||
prompt: "Hello",
|
||||
// @ts-expect-error Anthropic thinking modes are a fixed union.
|
||||
providerOptions: { anthropic: { thinking: { type: "automatic" } } },
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue