mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-29 21:33:54 +00:00
wip: zen
This commit is contained in:
parent
2e0d5d2308
commit
9b805e1cc4
@ -20,6 +20,7 @@ export const anthropicHelper: ProviderHelper = ({ reqModel, providerModel }) =>
|
|||||||
const isBedrockModelArn = providerModel.startsWith("arn:aws:bedrock:")
|
const isBedrockModelArn = providerModel.startsWith("arn:aws:bedrock:")
|
||||||
const isBedrockModelID = providerModel.startsWith("global.anthropic.")
|
const isBedrockModelID = providerModel.startsWith("global.anthropic.")
|
||||||
const isBedrock = isBedrockModelArn || isBedrockModelID
|
const isBedrock = isBedrockModelArn || isBedrockModelID
|
||||||
|
const isDatabricks = providerModel.startsWith("databricks-claude-")
|
||||||
const supports1m = reqModel.includes("sonnet") || reqModel.includes("opus-4-6")
|
const supports1m = reqModel.includes("sonnet") || reqModel.includes("opus-4-6")
|
||||||
return {
|
return {
|
||||||
format: "anthropic",
|
format: "anthropic",
|
||||||
@ -28,7 +29,7 @@ export const anthropicHelper: ProviderHelper = ({ reqModel, providerModel }) =>
|
|||||||
? `${providerApi}/model/${isBedrockModelArn ? encodeURIComponent(providerModel) : providerModel}/${isStream ? "invoke-with-response-stream" : "invoke"}`
|
? `${providerApi}/model/${isBedrockModelArn ? encodeURIComponent(providerModel) : providerModel}/${isStream ? "invoke-with-response-stream" : "invoke"}`
|
||||||
: providerApi + "/messages",
|
: providerApi + "/messages",
|
||||||
modifyHeaders: (headers: Headers, body: Record<string, any>, apiKey: string) => {
|
modifyHeaders: (headers: Headers, body: Record<string, any>, apiKey: string) => {
|
||||||
if (isBedrock) {
|
if (isBedrock || isDatabricks) {
|
||||||
headers.set("Authorization", `Bearer ${apiKey}`)
|
headers.set("Authorization", `Bearer ${apiKey}`)
|
||||||
} else {
|
} else {
|
||||||
headers.set("x-api-key", apiKey)
|
headers.set("x-api-key", apiKey)
|
||||||
@ -47,9 +48,14 @@ export const anthropicHelper: ProviderHelper = ({ reqModel, providerModel }) =>
|
|||||||
model: undefined,
|
model: undefined,
|
||||||
stream: undefined,
|
stream: undefined,
|
||||||
}
|
}
|
||||||
: {
|
: isDatabricks
|
||||||
service_tier: "standard_only",
|
? {
|
||||||
}),
|
anthropic_version: "bedrock-2023-05-31",
|
||||||
|
anthropic_beta: supports1m ? ["context-1m-2025-08-07"] : undefined,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
service_tier: "standard_only",
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
createBinaryStreamDecoder: () => {
|
createBinaryStreamDecoder: () => {
|
||||||
if (!isBedrock) return undefined
|
if (!isBedrock) return undefined
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user