How do kick off two tasks concurrently and based on the first task result cancel the second task? #278
Unanswered
vinodkumars
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
I am investigating how to add guardrails to a LLM app. I came across this very useful OpenAI cookbook. In the cookbook, they use asyncio. They kick off two tasks concurrently: one for guardrail check and one for actual LLM processing. Based on the guardrail task result, they either use or cancel the other task.
I can't figure out how to do them using asyncer? My understading of soonify() in a taskgroup is that both tasks will be done when the code block is exited.
What is the recommended way to implement the guardrails using asyncer?
Operating System
macOS
Operating System Details
No response
asyncer Version
0.0.8
Python Version
3.11.8
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions