@@ -62,7 +62,7 @@ def _get_embeddings(self, input_text: str | List[str]):
6262 """
6363 raise NotImplementedError
6464
65- async def _get_embeddings_async (self , input_text : str | List [str ]):
65+ async def _async_get_embeddings (self , input_text : str | List [str ]):
6666 """
6767 Abstract async method to get embeddings from the model.
6868
@@ -104,7 +104,7 @@ def get_embeddings(self, input_text: str | List[str]):
104104 # Return None if all retries failed and raise_exception is False
105105 return None
106106
107- async def get_embeddings_async (self , input_text : str | List [str ]):
107+ async def async_get_embeddings (self , input_text : str | List [str ]):
108108 """
109109 Get embeddings asynchronously with retry logic and error handling.
110110
@@ -120,7 +120,7 @@ async def get_embeddings_async(self, input_text: str | List[str]):
120120 # Retry loop with exponential backoff potential
121121 for i in range (self .max_retries ):
122122 try :
123- return await self ._get_embeddings_async (input_text )
123+ return await self ._async_get_embeddings (input_text )
124124
125125 except Exception as e :
126126 logger .exception (f"embedding model name={ self .model_name } encounter error with e={ e .args } " )
@@ -173,7 +173,7 @@ def get_node_embeddings(self, nodes: VectorNode | List[VectorNode]):
173173 else :
174174 raise TypeError (f"unsupported type={ type (nodes )} " )
175175
176- async def get_node_embeddings_async (self , nodes : VectorNode | List [VectorNode ]):
176+ async def async_get_node_embeddings (self , nodes : VectorNode | List [VectorNode ]):
177177 """
178178 Generate embeddings asynchronously for VectorNode objects and update their vector fields.
179179
@@ -191,7 +191,7 @@ async def get_node_embeddings_async(self, nodes: VectorNode | List[VectorNode]):
191191 """
192192 # Handle single VectorNode
193193 if isinstance (nodes , VectorNode ):
194- nodes .vector = await self .get_embeddings_async (nodes .content )
194+ nodes .vector = await self .async_get_embeddings (nodes .content )
195195 return nodes
196196
197197 # Handle list of VectorNodes with batch processing
@@ -201,7 +201,7 @@ async def get_node_embeddings_async(self, nodes: VectorNode | List[VectorNode]):
201201 for i in range (0 , len (nodes ), self .max_batch_size ):
202202 batch_nodes = nodes [i : i + self .max_batch_size ]
203203 batch_content = [node .content for node in batch_nodes ]
204- batch_tasks .append (self .get_embeddings_async (batch_content ))
204+ batch_tasks .append (self .async_get_embeddings (batch_content ))
205205
206206 # Execute all batch tasks concurrently
207207 batch_results = await asyncio .gather (* batch_tasks )
@@ -220,3 +220,9 @@ async def get_node_embeddings_async(self, nodes: VectorNode | List[VectorNode]):
220220
221221 else :
222222 raise TypeError (f"unsupported type={ type (nodes )} " )
223+
224+ def close (self ):
225+ """Close the client connection or clean up resources."""
226+
227+ async def async_close (self ):
228+ """Asynchronously close the client connection or clean up resources."""
0 commit comments