This project provides an example of how to create a Rust websocket endpoint which streams responses from Python workers through Redis.
- A local Redis server running on the default port
websocatfor a terminal based websocket client
- Setup
OPENAI_API_KEYenvironment variable. If you don't have/want one, use slow_verbose_echo_worker.py instead of chatgpt_worker.py. cd workers/- Create & activate a venv
pip install -r requirements.txtpython3 chatgpt_worker.py
cd apicargo run
websocat --no-line ws://127.0.0.1:8080/ws- type a prompt, press enter
- The Rust server logging that it writes to the task queue
- The Python worker picking up a task
- Websocat writing the ChatGPT response as it comes back