Canner / WrenAI

🚀 An open-source SQL AI (Text-to-SQL) Agent that empowers data, product teams to chat with their data. 🤘
https://getwren.ai/oss
GNU Affero General Public License v3.0
2.04k stars 211 forks source link

Feature: WrenAI API endpoint as UserPromptText-to-SQL_Query converter tool: Web Socket #331

Open qdrddr opened 5 months ago

qdrddr commented 5 months ago

Is your feature request related to a problem? Please describe. WrenAi can serve as WrenAI API endpoint as UserPromptText-to-SQL_Query converter tool. Currently, web socket is not supported, you have to keep pooling to check the status of askingTask.

Describe the solution you'd like Add support of the web socket so the WrenAI can push the result once it is ready to my webhook.

Describe alternatives you've considered you have to keep pooling to check the status of askingTask.

Additional context Previous issue: https://github.com/Canner/wren-engine/issues/566

Guides on how to trace the API work in the Discord channel (without websocket) https://discord.com/channels/1227143286951514152/1238353430985179208/1240650085474369617

cyyeh commented 5 months ago

@qdrddr Thanks for raising this feature request. I am also considering use Server-Sent-Events to do the job. In this use case, when users ask questions, underneath they are normal http requests. For getting the response, the server(wren-ai-service) would send the response spontaneously once there is new result. I am curious what's your thought here?

reference: WebSockets vs Server-Sent-Events vs Long-Polling vs WebRTC vs WebTransport

qdrddr commented 5 months ago

I do not have experience with SSE, bit it looks promising. In addition to SSE you might want to also consider adding a URL with the initial request to WrenAI, that is used as a web-hook once the response is ready. So users would have choice between more advanced streaming SSE and simple web hook. @cyyeh