from contextvars import ContextVar # This variable will store the FULL prompt (User + RAG) for the current request # It is async-safe, so multiple users won't mix up their data. rag_prompt_var = ContextVar("rag_prompt_var", default="")