You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there. I'm just wondering if the SNS as the "decoupling" mechanism is necessary and/or if there was a specific requirement or reasoning behind it.
Your flow of getting a response from a model is as follows:
front-end connects to a websocket - which, under the hood, invokes the publisher Lambda - but it doesn't do much due to route_key being equal to $connect
then, front-end sends the user prompt to the open websocket (
) - it also triggers the same publisher Lambda. However, this time, it actually pushes the prompt forward to the SNS because the route_key is different.
However, if (instead of being SNS consumer) your websocket Lambda was just a different route on the WS API gateway (lets call it /invoke), then the flow could look as follows:
front-end connects to a websocket - which, under the hood, invokes the publisher Lambda - but it doesn't do much due to route_key being equal to $connect
front-end sends the user prompt to the open websocket as an action /invoke - it triggers the websocket Lambda
Voila, you no longer need the SNS and it still works the same way.
Am I missing something (could be totally wrong above of course)? Is the SNS here necessary? Does it provide any additional value over this alternative method that I've described which would simplify the design?
Other than that - great work. Thanks for providing this excellent blueprint!
The text was updated successfully, but these errors were encountered:
Tomaz, check out the Readme under Architecture. I just happened to read this myself and was wondering the same thing. :-)
[Amazon SNS]: Used to decouple streaming calls between API Gateway and Bedrock because streaming responses can take over 30 seconds in total, exceeding the limitations of HTTP integration (See quota).
@tomaszdudek7
Thank you for your suggestion. We re-verified the behavior of http integration and confirmed that lambda can continue to send message to websocket connection after 30 sec passed although the message Endpoint request timed out sent. So I believe that we can simplify the architecture with front-end implementation which ignore the message saying timed out. We'll modify when we have time (PR is also welcome), thank you!
Hi there. I'm just wondering if the SNS as the "decoupling" mechanism is necessary and/or if there was a specific requirement or reasoning behind it.
Your flow of getting a response from a model is as follows:
route_key
being equal to$connect
bedrock-claude-chat/frontend/src/hooks/usePostMessageStreaming.ts
Line 25 in c2eec81
route_key
is different.However, if (instead of being SNS consumer) your websocket Lambda was just a different route on the WS API gateway (lets call it
/invoke
), then the flow could look as follows:route_key
being equal to$connect
/invoke
- it triggers the websocket LambdaVoila, you no longer need the SNS and it still works the same way.
Am I missing something (could be totally wrong above of course)? Is the SNS here necessary? Does it provide any additional value over this alternative method that I've described which would simplify the design?
Other than that - great work. Thanks for providing this excellent blueprint!
The text was updated successfully, but these errors were encountered: