Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hold all the status containers generated during retrieving? #40

Open
Tsukumizu opened this issue Sep 15, 2023 · 0 comments
Open

Comments

@Tsukumizu
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant