amazon-nova-samples icon indicating copy to clipboard operation
amazon-nova-samples copied to clipboard

I am getting a model timeout

Open bcatalin opened this issue 5 months ago • 10 comments

After 8 minutes (more or less) I am getting a model timeout like this one.

Error processing response stream for session j7WimTYOfJYKQw4VAAAD: ModelTimeoutException: Model has timed out in processing the request. Try your request again. at de_ModelTimeoutExceptionRes (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js:1632:21) at de_ModelTimeoutException_event (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js:1940:10) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async /home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js:1819:32 at async Object.deserializer (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/node_modules/@smithy/eventstream-serde-universal/dist-cjs/index.js:127:37) at async SmithyMessageDecoderStream.asyncIterator (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/node_modules/@smithy/eventstream-codec/dist-cjs/index.js:438:28) at async NovaSonicBidirectionalStreamClient.processResponseStream (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/dist/client.js:403:30) at async NovaSonicBidirectionalStreamClient.initiateSession (/home/ubuntu/PROJECTS/AI/VOICE/websocket-nodejs/dist/client.js:270:13) { '$fault': 'client', '$metadata': { httpStatusCode: undefined, requestId: undefined, extendedRequestId: undefined, cfId: undefined } } Error in session: { source: 'responseStream', message: 'Error processing response stream', details: 'Model has timed out in processing the request. Try your request again.' }

How can I overcome this? My application will need like minimum one hour.

bcatalin avatar Jul 04 '25 07:07 bcatalin

from documentation, but I also didn't find how to reconnect

Image

tokarev-artem avatar Jul 21 '25 16:07 tokarev-artem

Here's example on bedrock session restart with nova-sonic : https://github.com/aws-samples/amazon-nova-samples/tree/main/speech-to-speech/repeatable-patterns/resume-conversation You can customize it to have a fresh session or pass in previous session details and data for session continuity.

SciTechDude avatar Jul 24 '25 22:07 SciTechDude

Here's example on bedrock session restart with nova-sonic : https://github.com/aws-samples/amazon-nova-samples/tree/main/speech-to-speech/repeatable-patterns/resume-conversation You can customize it to have a fresh session or pass in previous session details and data for session continuity.

I've tested this and is working fine, I was thinking how to make this totally transparent to the user.

bcatalin avatar Jul 25 '25 07:07 bcatalin

@bcatalin is it not transparent at the moment?

tokarev-artem avatar Jul 25 '25 08:07 tokarev-artem

@tokarev-artem by transparent I mean to start a timer for 8 minute and before expire create a new socket connection and pass the history in setupHistoryForConversationResumtion and move to the new connection, without the user to notify it

bcatalin avatar Jul 25 '25 09:07 bcatalin

Any update on this? I have similar scenario, where after more or less 8 minutes of conversation the model timeout error comes. I am storing the chathistory in dynamodb and able to retrieve it in correct sequence. I want to handles this error in the backend and without disconnecting the session want to continue with the conversation. Right now I am passing the chat history but it is not consistent always.

anikm1987 avatar Jul 27 '25 23:07 anikm1987

@anikm1987 It is design intend like also @tokarev-artem mentioned. My plan is to start a timer for each session and when is about to expire to start another one and pass the current content to it, dropping the old one. If I will have time I will do it this week.

bcatalin avatar Jul 29 '25 06:07 bcatalin

@bcatalin, but what would be if the "restart" timer were when Sonic "speaks" ? Will it be interrupted?

tokarev-artem avatar Jul 29 '25 20:07 tokarev-artem

@tokarev-artem Good question, will see. We know when there is activity and when not, so it is about finding the right moment.

bcatalin avatar Jul 30 '25 07:07 bcatalin

@tokarev-artem Good question, will see. We know when there is activity and when not, so it is about finding the right moment.

Did you manage to test it? I'm still struggling with adding and it stops responding after 8 minutes

tokarev-artem avatar Jul 30 '25 08:07 tokarev-artem