mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 10:53:02 +00:00 
			
		
		
		
	
		
			
	
	
		
			22 lines
		
	
	
		
			631 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			22 lines
		
	
	
		
			631 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|   | from abc import ABC, abstractmethod | ||
|  | 
 | ||
|  | 
 | ||
|  | class Embeddings(ABC): | ||
|  |     """Interface for embedding models.""" | ||
|  | 
 | ||
|  |     @abstractmethod | ||
|  |     def embed_documents(self, texts: list[str]) -> list[list[float]]: | ||
|  |         """Embed search docs.""" | ||
|  | 
 | ||
|  |     @abstractmethod | ||
|  |     def embed_query(self, text: str) -> list[float]: | ||
|  |         """Embed query text.""" | ||
|  | 
 | ||
|  |     async def aembed_documents(self, texts: list[str]) -> list[list[float]]: | ||
|  |         """Asynchronous Embed search docs.""" | ||
|  |         raise NotImplementedError | ||
|  | 
 | ||
|  |     async def aembed_query(self, text: str) -> list[float]: | ||
|  |         """Asynchronous Embed query text.""" | ||
|  |         raise NotImplementedError |