INNER CODE UNIT · Python
display_sources
mfmezger/conversational-agent-langchain · frontend/assistant.py:47
def display_sources(documents: list[dict]) -> None:
"""Display the sources."""
if documents:
with st.expander("Sources"):
for doc in documents:
st.markdown(f"**Page {doc.get('page', 'Unknown')}**")
st.markdown(doc.get("text", ""))
st.markdown("---")
async def process_rag_stream(
stream: AsyncGenerator[str, None],
status_container: st.delta_generator.DeltaGenerator,
message_placeholder: st.delta_generator.DeltaGenerator,
) -> tuple[str, list]:
"""Process the RAG stream response."""
full_response = ""
documents = []