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)