You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
667 B
24 lines
667 B
2 years ago
|
"""Interface for embedding models."""
|
||
|
from abc import ABC, abstractmethod
|
||
|
from typing import List
|
||
|
|
||
|
|
||
|
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]]:
|
||
|
"""Embed search docs."""
|
||
|
raise NotImplementedError
|
||
|
|
||
|
async def aembed_query(self, text: str) -> List[float]:
|
||
|
"""Embed query text."""
|
||
1 year ago
|
raise NotImplementedError
|