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 @ksachdeva
Thanks for you contribution.
This is a code example, just to show dev how they might use it. People are free to take the code and modify it the way they want.
I understand that it is an example code however you should consider following perspectives -
An experienced programmer -
Since you have used thread they will make an assumption that the underlying framework/library is not truly asynchronous and has blocking calls. Based on my reading of your library you have done a good job of keeping it asynchronous all the way. If my understanding is indeed correct then this example code will mislead the experienced programmers.
A data scientist or junior programmer -
They generally copy/paste the code from examples without considering the implications. Creating a thread for every single request ... this can be disastrous!!
I hope the above perspectives help understand why it is important to worry about even the example code.
Expected Behaviour
minimize or eliminate thread creation if the entire stack is async
Current Behaviour
multi-agent-orchestrator/examples/fast-api-streaming/main.py
Line 119 in da9563f
Above line will spawn a new thread for every request.
Code snippet
Possible Solution
What would be an issue if you do the following -
asyncio.create_task(start_generation(query, user_id, session_id, streamer_queue))
instead of spawning a new thread
Steps to Reproduce
See -
multi-agent-orchestrator/examples/fast-api-streaming/main.py
Line 119 in da9563f
The text was updated successfully, but these errors were encountered: