Coool2 commited on
Commit
40c30ca
·
1 Parent(s): a8a67ee

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +3 -11
agent.py CHANGED
@@ -371,17 +371,9 @@ class DynamicQueryEngineManager:
371
 
372
  # Process text documents with UnstructuredElementNodeParser
373
  if text_documents:
374
- try:
375
- initial_nodes = element_parser.get_nodes_from_documents(text_documents)
376
- final_nodes = splitter.get_nodes_from_documents(initial_nodes)
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: