mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
fix: max tokens when using models like opus with providers other than anthropic (#4307)
This commit is contained in:
@@ -176,7 +176,7 @@ export namespace ProviderTransform {
|
||||
}
|
||||
|
||||
export function maxOutputTokens(
|
||||
providerID: string,
|
||||
npm: string,
|
||||
options: Record<string, any>,
|
||||
modelLimit: number,
|
||||
globalLimit: number,
|
||||
@@ -184,7 +184,7 @@ export namespace ProviderTransform {
|
||||
const modelCap = modelLimit || globalLimit
|
||||
const standardLimit = Math.min(modelCap, globalLimit)
|
||||
|
||||
if (providerID === "anthropic") {
|
||||
if (npm === "@ai-sdk/anthropic") {
|
||||
const thinking = options?.["thinking"]
|
||||
const budgetTokens = typeof thinking?.["budgetTokens"] === "number" ? thinking["budgetTokens"] : 0
|
||||
const enabled = thinking?.["type"] === "enabled"
|
||||
|
||||
@@ -345,7 +345,7 @@ export namespace SessionPrompt {
|
||||
maxRetries: 0,
|
||||
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
||||
maxOutputTokens: ProviderTransform.maxOutputTokens(
|
||||
model.providerID,
|
||||
model.npm ?? "",
|
||||
params.options,
|
||||
model.info.limit.output,
|
||||
OUTPUT_TOKEN_MAX,
|
||||
|
||||
Reference in New Issue
Block a user