(files)
| 100 | # Cache the result to avoid recomputation |
| 101 | @st.cache_resource(show_spinner="Indexing documents...Please have patience") |
| 102 | def build_index(files): |
| 103 | documents = SimpleDirectoryReader(input_files=files).load_data() |
| 104 | index = VectorStoreIndex.from_documents(documents) |
| 105 | return index |
| 106 | |
| 107 | # Handle streaming responses |
| 108 | def handle_stream(root, stream: StreamingAgentChatResponse): |