§
    æ˜ºhI  ã                   óT   — d dl mZmZmZ d dlmZ d dlmZmZ  G d„ dee¦  «        Z	dS )é    )ÚAnyÚDictÚList)Ú
Embeddings)Ú	BaseModelÚroot_validatorc                   ó¼   — e Zd ZU dZeed<   dZeed<    e¦   «         de	de	fd„¦   «         Z
dedd	fd
„Zdee         deee                  fd„Zdedee         fd„Zd	S )ÚAwaEmbeddingszÍEmbedding documents and queries with Awa DB.

    Attributes:
        client: The AwaEmbedding client.
        model: The name of the model used for embedding.
         Default is "all-mpnet-base-v2".
    Úclientzall-mpnet-base-v2ÚmodelÚvaluesÚreturnc                 ót   — 	 ddl m} n"# t          $ r}t          d¦  «        |‚d}~ww xY w |¦   «         |d<   |S )z)Validate that awadb library is installed.r   )ÚAwaEmbeddingzJCould not import awadb library. Please install it with `pip install awadb`Nr   )Úawadbr   ÚImportError)Úclsr   r   Úexcs       új/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/langchain_community/embeddings/awa.pyÚvalidate_environmentz"AwaEmbeddings.validate_environment   sn   € ð	Ø*Ð*Ð*Ð*Ð*Ð*Ð*øÝð 	ð 	ð 	Ýð=ñô ð ðøøøøð	øøøð
 (˜<™>œ>ˆˆxÑØˆs   ‚	 ‰
(“#£(Ú
model_nameNc                 ó,   — || _         || j        _        dS )z²Set the model used for embedding.
        The default model used is all-mpnet-base-v2

        Args:
            model_name: A string which represents the name of model.
        N)r   r   r   )Úselfr   s     r   Ú	set_modelzAwaEmbeddings.set_model!   s   € ð  ˆŒ
Ø!+ˆŒÔÐÐó    Útextsc                 ó6   — | j                              |¦  «        S )zÃEmbed a list of documents using AwaEmbedding.

        Args:
            texts: The list of texts need to be embedded

        Returns:
            List of embeddings, one for each text.
        )r   ÚEmbeddingBatch)r   r   s     r   Úembed_documentszAwaEmbeddings.embed_documents+   s   € ð Œ{×)Ò)¨%Ñ0Ô0Ð0r   Útextc                 ó6   — | j                              |¦  «        S )z Compute query embeddings using AwaEmbedding.

        Args:
            text: The text to embed.

        Returns:
            Embeddings for the text.
        )r   Ú	Embedding)r   r    s     r   Úembed_queryzAwaEmbeddings.embed_query6   s   € ð Œ{×$Ò$ TÑ*Ô*Ð*r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   Ústrr   r   r   r   r   Úfloatr   r#   © r   r   r
   r
      sç   € € € € € € ðð ð €K€K�KØ$€Eˆ3Ð$Ð$Ñ$à€^ÑÔð¨$ð °4ð ð ð ñ Ôðð, Cð ,¨Dð ,ð ,ð ,ð ,ð	1 T¨#¤Yð 	1°4¸¸U¼Ô3Dð 	1ð 	1ð 	1ð 	1ð	+ ð 	+¨¨U¬ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+r   r
   N)
Útypingr   r   r   Úlangchain_core.embeddingsr   Úlangchain_core.pydantic_v1r   r   r
   r+   r   r   ú<module>r/      sƒ   ðØ "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @ð8+ð 8+ð 8+ð 8+ð 8+�I˜zñ 8+ô 8+ð 8+ð 8+ð 8+r   