
    ghe	                     B    d Z ddlmZmZ ddlmZ  G d de          ZdS )z**Embeddings** interface.    )ABCabstractmethod)run_in_executorc                       e Zd ZdZedee         deee                  fd            Zededee         fd            Z	dee         deee                  fdZ
dedee         fdZd	S )

Embeddingsa  Interface for embedding models.

    This is an interface meant for implementing text embedding models.

    Text embedding models are used to map text to a vector (a point in n-dimensional
    space).

    Texts that are similar will usually be mapped to points that are close to each
    other in this space. The exact details of what's considered "similar" and how
    "distance" is measured in this space are dependent on the specific embedding model.

    This abstraction contains a method for embedding a list of documents and a method
    for embedding a query text. The embedding of a query text is expected to be a single
    vector, while the embedding of a list of documents is expected to be a list of
    vectors.

    Usually the query embedding is identical to the document embedding, but the
    abstraction allows treating them independently.

    In addition to the synchronous methods, this interface also provides asynchronous
    versions of the methods.

    By default, the asynchronous methods are implemented using the synchronous methods;
    however, implementations may choose to override the asynchronous methods with
    an async native implementation for performance reasons.
    textsreturnc                     dS )zEmbed search docs.

        Args:
            texts: List of text to embed.

        Returns:
            List of embeddings.
        N selfr   s     a/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/langchain_core/embeddings/embeddings.pyembed_documentszEmbeddings.embed_documents$             textc                     dS )zsEmbed query text.

        Args:
            text: Text to embed.

        Returns:
            Embedding.
        Nr   r   r   s     r   embed_queryzEmbeddings.embed_query/   r   r   c                 >   K   t          d| j        |           d{V S )zAsynchronous Embed search docs.

        Args:
            texts: List of text to embed.

        Returns:
            List of embeddings.
        N)r   r   r   s     r   aembed_documentszEmbeddings.aembed_documents:   s/       %T4+?GGGGGGGGGr   c                 >   K   t          d| j        |           d{V S )zAsynchronous Embed query text.

        Args:
            text: Text to embed.

        Returns:
            Embedding.
        N)r   r   r   s     r   aembed_queryzEmbeddings.aembed_queryE   s/       %T4+;TBBBBBBBBBr   N)__name__
__module____qualname____doc__r   liststrfloatr   r   r   r   r   r   r   r   r      s         6 T#Y 4U3D    ^  U    ^	HDI 	H$tE{:K 	H 	H 	H 	H	Cs 	CtE{ 	C 	C 	C 	C 	C 	Cr   r   N)r   abcr   r   langchain_core.runnables.configr   r   r   r   r   <module>r#      s}      # # # # # # # # ; ; ; ; ; ;FC FC FC FC FC FC FC FC FC FCr   