Spaces:
Configuration error
Configuration error
Update agent.py
Browse files
agent.py
CHANGED
@@ -371,17 +371,9 @@ class DynamicQueryEngineManager:
|
|
371 |
|
372 |
# Process text documents with UnstructuredElementNodeParser
|
373 |
if text_documents:
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
nodes.extend(final_nodes)
|
378 |
-
except Exception as e:
|
379 |
-
print(f"Error parsing text documents with UnstructuredElementNodeParser: {e}")
|
380 |
-
# Fallback to simple parsing if UnstructuredElementNodeParser fails
|
381 |
-
from llama_index.core.node_parser import SimpleNodeParser
|
382 |
-
simple_parser = SimpleNodeParser.from_defaults(chunk_size=1024, chunk_overlap=200)
|
383 |
-
text_nodes = simple_parser.get_nodes_from_documents(text_documents)
|
384 |
-
nodes.extend(text_nodes)
|
385 |
|
386 |
# Process image documents as ImageNodes
|
387 |
if image_documents:
|
|
|
371 |
|
372 |
# Process text documents with UnstructuredElementNodeParser
|
373 |
if text_documents:
|
374 |
+
initial_nodes = element_parser.get_nodes_from_documents(text_documents)
|
375 |
+
final_nodes = splitter.get_nodes_from_documents(initial_nodes)
|
376 |
+
nodes.extend(final_nodes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
|
378 |
# Process image documents as ImageNodes
|
379 |
if image_documents:
|