-
Notifications
You must be signed in to change notification settings - Fork 620
Description
Is your feature request related to a problem? Please describe.
For large requests that take the LLM over 5 mins, a timeout error occurs. It appears that there is a 300000 ms timeout hardcoded in the JS library.
This is a real world issue where you may have a background running job doing deep analysis on a long document and the LLM may take over 5 mins to process (especially so if using a model like Gemini 3 Pro).
Describe the solution you'd like
Expose the client timeout option as a config option.
Describe alternatives you've considered
It's possible to chunk the request into smaller ones manually, but the reality is that sometimes if you want to attach a large PDF and ask for deeper analysis, chances are it may take longer than 5 mins for the LLM to return.
Additional context
I'm using Genkit with the Google Gen AI model plugin.
Here's the example error if the request doesn't come back after 5 mins:
> [cause]: HeadersTimeoutError: Headers Timeout Error
> at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:7041:32)
> at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:686:17)
> at listOnTimeout (node:internal/timers:605:17)
> at process.processTimers (node:internal/timers:541:7) {
> code: 'UND_ERR_HEADERS_TIMEOUT'
Additional error:
Failed to fetch from https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent: fetch failed\n at makeRequest (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/google-genai/lib/googleai/client.js:242:11)\n at async generateContent (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/google-genai/lib/googleai/client.js:62:20)\n at async callGemini (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/google-genai/lib/googleai/gemini.js:518:22)\n at async /home/abc/Projects/xyz-app/node_modules/@genkit-ai/google-genai/lib/googleai/gemini.js:571:11\n at async /home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/action.js:148:27\n at async /home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:91:24\n at async runInNewSpan (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/tracing/instrumentation.js:63:10)\n at async actionFn.run (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/action.js:104:18)\n at async dispatch (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/action.js:55:24)\n at async wrapped.run (/home/abc/Projects/xyz-app/node_modules/@genkit-ai/core/lib/action.js:76:22) {\n traceId: 'b8c4ecd0610eaef2a9fca6e09f47f2af',\n ignoreFailedSpan: true\n}"}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status