§
    ¦ìNg_	  ã                   óT   — d dl mZmZ d dlmZ d dlmZmZ dZ G d„ dee¦  «        Z	dS )é    )ÚAnyÚList)Ú
Embeddings)Ú	BaseModelÚ
ConfigDictzBhttps://tfhub.dev/google/universal-sentence-encoder-multilingual/3c                   ó²   ‡ — e Zd ZU dZdZeed<   eZe	ed<   	 defˆ fd„Z
 edd¬	¦  «        Zd
ee	         deee                  fd„Zde	dee         fd„Zˆ xZS )ÚTensorflowHubEmbeddingsa  TensorflowHub embedding models.

    To use, you should have the ``tensorflow_text`` python package installed.

    Example:
        .. code-block:: python

            from langchain_community.embeddings import TensorflowHubEmbeddings
            url = "https://tfhub.dev/google/universal-sentence-encoder-multilingual/3"
            tf = TensorflowHubEmbeddings(model_url=url)
    NÚembedÚ	model_urlÚkwargsc                 ó  •—  t          ¦   «         j        di |¤Ž 	 ddl}n# t          $ r t          d¦  «        ‚w xY w	 ddl}n# t          $ r t          d¦  «        ‚w xY w|                     | j        ¦  «        | _        dS )z2Initialize the tensorflow_hub and tensorflow_text.r   NzeCould not import tensorflow-hub python package. Please install it with `pip install tensorflow-hub``.zgCould not import tensorflow_text python package. Please install it with `pip install tensorflow_text``.© )ÚsuperÚ__init__Útensorflow_hubÚImportErrorÚtensorflow_textÚloadr   r
   )Úselfr   r   r   Ú	__class__s       €úi/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/embeddings/tensorflow_hub.pyr   z TensorflowHubEmbeddings.__init__   sË   ø€ à‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"ð	Ø!Ð!Ð!Ð!Ð!øÝð 	ð 	ð 	ÝðHñô ð ð	øøøð
	Ø"Ð"Ð"Ð"Ð"øÝð 	ð 	ð 	ÝðIñô ð ð	øøøð $×(Ò(¨¬Ñ8Ô8ˆŒ
ˆ
ˆ
s   œ! ¡;¿A ÁAÚforbidr   )ÚextraÚprotected_namespacesÚtextsÚreturnc                 ó´   — t          t          d„ |¦  «        ¦  «        }|                      |¦  «                             ¦   «         }|                     ¦   «         S )zÉCompute doc embeddings using a TensorflowHub embedding model.

        Args:
            texts: The list of texts to embed.

        Returns:
            List of embeddings, one for each text.
        c                 ó.   — |                       dd¦  «        S )Nú
ú )Úreplace)Úxs    r   ú<lambda>z9TensorflowHubEmbeddings.embed_documents.<locals>.<lambda><   s   €  1§9¢9¨T°3Ñ#7Ô#7€ ó    )ÚlistÚmapr
   ÚnumpyÚtolist)r   r   Ú
embeddingss      r   Úembed_documentsz'TensorflowHubEmbeddings.embed_documents3   sN   € õ •SÐ7Ð7¸Ñ?Ô?Ñ@Ô@ˆØ—Z’Z Ñ&Ô&×,Ò,Ñ.Ô.ˆ
Ø× Ò Ñ"Ô"Ð"r$   Útextc                 ó²   — |                      dd¦  «        }|                      |g¦  «                             ¦   «         d         }|                     ¦   «         S )z³Compute query embeddings using a TensorflowHub embedding model.

        Args:
            text: The text to embed.

        Returns:
            Embeddings for the text.
        r   r    r   )r!   r
   r'   r(   )r   r+   Ú	embeddings      r   Úembed_queryz#TensorflowHubEmbeddings.embed_query@   sM   € ð |Š|˜D #Ñ&Ô&ˆØ—J’J ˜vÑ&Ô&×,Ò,Ñ.Ô.¨qÔ1ˆ	Ø×ÒÑ!Ô!Ð!r$   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   Ú__annotations__ÚDEFAULT_MODEL_URLr   Ústrr   r   Úmodel_configr   Úfloatr*   r.   Ú__classcell__)r   s   @r   r	   r	   	   sè   ø€ € € € € € ð
ð 
ð €Eˆ3ÐÐÑØ&€IˆsÐ&Ð&Ñ&Øð9 ð 9ð 9ð 9ð 9ð 9ð 9ð( :ØØðñ ô €Lð
# T¨#¤Yð #°4¸¸U¼Ô3Dð #ð #ð #ð #ð" ð "¨¨U¬ð "ð "ð "ð "ð "ð "ð "ð "r$   r	   N)
Útypingr   r   Úlangchain_core.embeddingsr   Úpydanticr   r   r4   r	   r   r$   r   ú<module>r<      s   ðØ Ð Ð Ð Ð Ð Ð Ð à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *àXÐ ðB"ð B"ð B"ð B"ð B"˜i¨ñ B"ô B"ð B"ð B"ð B"r$   