Thanks for your amazing work.
`class PrintRetrievalHandler(BaseCallbackHandler):
def init(self, container):
self.status = container.status("Context Retrieval")
def on_retriever_start(self, serialized: dict, query: str, **kwargs):
self.status.write(f"**Question:** {query}")
self.status.update(label=f"**Context Retrieval:** {query}")
def on_retriever_end(self, documents, **kwargs):
for idx, doc in enumerate(documents):
source = os.path.basename(doc.metadata["source"])
self.status.write(f"**Document {idx} from {source}**")
self.status.markdown(doc.page_content)
self.status.update(state="complete")`
Here a status container is initialized. But the last one will disappear when starting a new retrieval. I know in streamlit, the session_state is used to store the objects, but I am new in streamlit, and I failed to implement.
Thanks for your attention. I appreciate it a lot.