fix: separate Anthropic output and context limits
Direct Anthropic connections reused the configured context window as max_tokens, which could impose an unintended output value or send a provider-invalid request. Anthropic connections now expose an independent per-response maximum output setting, defaulting to 32K for the protocol-required field, while OpenAI direct requests remain without an added output token cap and direct tool rounds remain unmetered. Release note: Anthropic 直连模型现在可单独配置单次最大输出,不再复用上下文窗口;OpenAI 直连请求和工具调用轮次不增加额外配额。
This commit is contained in:
@@ -568,6 +568,9 @@ export {
|
||||
minimumModelContextWindowTokens
|
||||
} from './context-window'
|
||||
|
||||
export const defaultAnthropicMaximumOutputTokens = 32_000
|
||||
export const maximumModelOutputTokens = 10_000_000
|
||||
|
||||
const modelProfileInputSchema = z
|
||||
.object({
|
||||
id: modelProfileIdSchema,
|
||||
@@ -588,6 +591,12 @@ const modelProfileInputSchema = z
|
||||
.min(minimumModelContextWindowTokens)
|
||||
.max(maximumModelContextWindowTokens)
|
||||
.optional(),
|
||||
maximumOutputTokens: z
|
||||
.number()
|
||||
.int()
|
||||
.min(1)
|
||||
.max(maximumModelOutputTokens)
|
||||
.optional(),
|
||||
imageGenerationQuality: imageGenerationQualitySchema,
|
||||
apiKey: modelApiKeyUpdateSchema
|
||||
})
|
||||
@@ -968,6 +977,7 @@ export type ModelConnectionSettings = {
|
||||
authentication: ModelAuthentication
|
||||
supportsImageInput?: boolean
|
||||
contextWindowTokens?: number
|
||||
maximumOutputTokens?: number
|
||||
imageGenerationQuality: ImageGenerationQuality
|
||||
apiKeyConfigured: boolean
|
||||
credentialSource: 'none' | 'encrypted' | 'environment' | 'unreadable'
|
||||
|
||||
Reference in New Issue
Block a user