diff --git a/app/utils/LLamaIndexEmbeddings.py b/app/utils/LLamaIndexEmbeddings.py index 0b0977f..79a8794 100644 --- a/app/utils/LLamaIndexEmbeddings.py +++ b/app/utils/LLamaIndexEmbeddings.py @@ -47,3 +47,6 @@ class LLamaIndexEmbeddings(BaseEmbedding): def _get_text_embedding(self, text: str) -> Embedding: return self.embed_query(text) + # 下面的方法没有用,不论如何都会走_get_text_embedding + # async def _aget_text_embedding(self, text: str) -> Embedding: + # return await self.aembed_query(text) diff --git a/app/utils/milvus_utils.py b/app/utils/milvus_utils.py index 85b7df1..9aa0be5 100644 --- a/app/utils/milvus_utils.py +++ b/app/utils/milvus_utils.py @@ -45,7 +45,7 @@ class MilvusService: ) from llama_index.core.node_parser import HierarchicalNodeParser parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128]) - nodes = parser.get_nodes_from_documents(documents) + nodes = await parser.aget_nodes_from_documents(documents) await vector_index.ainsert_nodes(nodes) return vector_index