mirror of
https://github.com/n8n-io/n8n.git
synced 2026-08-28 09:12:12 +08:00
fix(core): Raise AI Assistant model verification token limit (#36787)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -105,7 +105,8 @@ describe('InstanceAiVerificationService', () => {
|
||||
);
|
||||
expect(createModelMock).toHaveBeenCalledWith(modelConfig, expect.any(Function));
|
||||
expect(generateTextMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ prompt: 'Reply with OK.', maxOutputTokens: 8 }),
|
||||
// OpenAI's Responses API rejects max_output_tokens below 16.
|
||||
expect.objectContaining({ prompt: 'Reply with OK.', maxOutputTokens: 16 }),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ const VERIFICATION_TIMEOUT_MS = 30_000;
|
||||
|
||||
const MAX_ERROR_MESSAGE_LENGTH = 512;
|
||||
|
||||
/**
|
||||
* The probe only needs the call to succeed, not its text, but OpenAI's
|
||||
* Responses API rejects `max_output_tokens` below 16.
|
||||
*/
|
||||
const VERIFICATION_MAX_OUTPUT_TOKENS = 16;
|
||||
|
||||
/**
|
||||
* Providers can echo credentials back in error messages. Scrub known secret
|
||||
* shapes (API keys, bearer tokens, key=value pairs), drop URL query strings
|
||||
@@ -135,7 +141,7 @@ export class InstanceAiVerificationService {
|
||||
await generateText({
|
||||
model: createModel(modelConfig, createAiProxyFetch(this.outboundHttp)),
|
||||
prompt: 'Reply with OK.',
|
||||
maxOutputTokens: 8,
|
||||
maxOutputTokens: VERIFICATION_MAX_OUTPUT_TOKENS,
|
||||
abortSignal: AbortSignal.timeout(VERIFICATION_TIMEOUT_MS),
|
||||
});
|
||||
return { ok: true, latencyMs: Math.round(performance.now() - startedAt) };
|
||||
|
||||
Reference in New Issue
Block a user