feat: 使用simple node parser
This commit is contained in:
@@ -48,8 +48,9 @@ class MilvusService:
|
|||||||
vector_store=vector_store,
|
vector_store=vector_store,
|
||||||
embed_model=self.embeddings,
|
embed_model=self.embeddings,
|
||||||
)
|
)
|
||||||
from llama_index.core.node_parser import HierarchicalNodeParser
|
from llama_index.core.node_parser import SimpleNodeParser
|
||||||
parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
|
# parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
|
||||||
|
parser = SimpleNodeParser()
|
||||||
# nodes = await parser.aget_nodes_from_documents(documents)
|
# nodes = await parser.aget_nodes_from_documents(documents)
|
||||||
# 使用同步方法并包装在 asyncio.to_thread 中
|
# 使用同步方法并包装在 asyncio.to_thread 中
|
||||||
nodes = await asyncio.to_thread(parser.get_nodes_from_documents, documents)
|
nodes = await asyncio.to_thread(parser.get_nodes_from_documents, documents)
|
||||||
|
|||||||
Reference in New Issue
Block a user