feat: 使用simple node parser

This commit is contained in:
martsforever
2025-09-07 14:37:24 +08:00
parent 510247d927
commit 178d0ddf24
+3 -2
View File
@@ -48,8 +48,9 @@ class MilvusService:
vector_store=vector_store,
embed_model=self.embeddings,
)
from llama_index.core.node_parser import HierarchicalNodeParser
parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
from llama_index.core.node_parser import SimpleNodeParser
# parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
parser = SimpleNodeParser()
# nodes = await parser.aget_nodes_from_documents(documents)
# 使用同步方法并包装在 asyncio.to_thread 中
nodes = await asyncio.to_thread(parser.get_nodes_from_documents, documents)