Source code for langchain_core.embeddings.embeddings

""" **塌ε…₯** ζŽ₯口。"""
from abc import ABC, abstractmethod
from typing import List

from langchain_core.runnables.config import run_in_executor


[docs]class Embeddings(ABC): """η”¨δΊŽε΅Œε…₯ζ¨‘εž‹ηš„ζŽ₯口。"""
[docs] @abstractmethod def embed_documents(self, texts: List[str]) -> List[List[float]]: """塌ε…₯ζœη΄’ζ–‡ζ‘£γ€‚"""
[docs] @abstractmethod def embed_query(self, text: str) -> List[float]: """塌ε…₯ζŸ₯θ―’ζ–‡ζœ¬γ€‚"""
[docs] async def aembed_documents(self, texts: List[str]) -> List[List[float]]: """Asynchronous 塌ε…₯ζœη΄’ζ–‡ζ‘£γ€‚""" return await run_in_executor(None, self.embed_documents, texts)
[docs] async def aembed_query(self, text: str) -> List[float]: """Asynchronous 塌ε…₯ζŸ₯θ―’ζ–‡ζœ¬γ€‚""" return await run_in_executor(None, self.embed_query, text)