mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
fix: max output tokens when setting budget thinking tokens (#2056)
Co-authored-by: rekram1-node <aidenpcline@gmail.com>
This commit is contained in:
@@ -98,4 +98,18 @@ export namespace ProviderTransform {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function maxOutputTokens(providerID: string, outputLimit: number, options: Record<string, any>): number {
|
||||
if (providerID === "anthropic") {
|
||||
const thinking = options["thinking"]
|
||||
if (typeof thinking === "object" && thinking !== null) {
|
||||
const type = thinking["type"]
|
||||
const budgetTokens = thinking["budgetTokens"]
|
||||
if (type === "enabled" && typeof budgetTokens === "number" && budgetTokens > 0) {
|
||||
return outputLimit - budgetTokens
|
||||
}
|
||||
}
|
||||
}
|
||||
return outputLimit
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user