Ë
    µŒj  ã                   ó\   — d dl Zd dlmZmZmZmZ d dlmZ d dl	m
Z
mZmZ  G d„ de
e«      Zy)é    N)ÚAnyÚDictÚListÚOptional)Ú
Embeddings)Ú	BaseModelÚ
ConfigDictÚmodel_validatorc                   óê   — e Zd ZU dZdZeed<   dZee	   ed<    e
dd¬«      Z ed	¬
«      edede	fd„«       «       Zdee   deee      fd„Z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y)ÚSpacyEmbeddingsa�  Embeddings by spaCy models.

    Attributes:
        model_name (str): Name of a spaCy model.
        nlp (Any): The spaCy model loaded into memory.

    Methods:
        embed_documents(texts: List[str]) -> List[List[float]]:
            Generates embeddings for a list of documents.
        embed_query(text: str) -> List[float]:
            Generates an embedding for a single piece of text.
    Úen_core_web_smÚ
model_nameNÚnlpÚforbid© )ÚextraÚprotected_namespacesÚbefore)ÚmodeÚvaluesÚreturnc                 ó  — |j                  d«      €d|d<   |j                  d«      }t        j                  j                  d«      €t	        d«      ‚	 ddl}|j                  |«      |d<   |S # t        $ r t	        d|› d	|› d
�«      ‚w xY w)aE  
        Validates that the spaCy package and the model are installed.

        Args:
            values (Dict): The values provided to the class constructor.

        Returns:
            The validated values.

        Raises:
            ValueError: If the spaCy package or the
            model are not installed.
        r   Nr   ÚspacyzDSpaCy package not found. Please install it with `pip install spacy`.r   r   zSpaCy model 'z>' not found. Please install it with `python -m spacy download z%`or provide a valid spaCy model name.)ÚgetÚ	importlibÚutilÚ	find_specÚ
ValueErrorr   ÚloadÚOSError)Úclsr   r   r   s       úy/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/embeddings/spacy_embeddings.pyÚvalidate_environmentz$SpacyEmbeddings.validate_environment   s¬   € ð  �:‰:�lÓ#Ð+Ø#3ˆF�<Ñ à—Z‘Z Ó-ˆ
ô �>‰>×#Ñ# GÓ,Ð4ÜØVóð ð	ãà!ŸJ™J zÓ2ˆF�5‰Mð ˆøô ò 	äØ 
˜|ð ,.à.8¨\ð :7ð7óð ð	ús   ÁA- Á-B	Útextsc                 óz   — |D �cg c]+  }| j                  |«      j                  j                  «       ‘Œ- c}S c c}w )zâ
        Generates embeddings for a list of documents.

        Args:
            texts (List[str]): The documents to generate embeddings for.

        Returns:
            A list of embeddings, one for each document.
        ©r   ÚvectorÚtolist)Úselfr$   Útexts      r"   Úembed_documentszSpacyEmbeddings.embed_documentsD   s4   € ñ <AÓA¹5°4�—‘˜“×%Ñ%×,Ñ,Õ.¸5ÑAÐAùÒAs   …08r*   c                 óT   — | j                  |«      j                  j                  «       S )zÌ
        Generates an embedding for a single piece of text.

        Args:
            text (str): The text to generate an embedding for.

        Returns:
            The embedding for the text.
        r&   ©r)   r*   s     r"   Úembed_queryzSpacyEmbeddings.embed_queryP   s!   € ð �x‰x˜‹~×$Ñ$×+Ñ+Ó-Ð-ó    c              ƒ   ó    K  — t        d«      ‚­w)aA  
        Asynchronously generates embeddings for a list of documents.
        This method is not implemented and raises a NotImplementedError.

        Args:
            texts (List[str]): The documents to generate embeddings for.

        Raises:
            NotImplementedError: This method is not implemented.
        ú3Asynchronous embedding generation is not supported.©ÚNotImplementedError)r)   r$   s     r"   Úaembed_documentsz SpacyEmbeddings.aembed_documents\   ó   è ø€ ô "Ð"WÓXÐXùó   ‚c              ƒ   ó    K  — t        d«      ‚­w)a<  
        Asynchronously generates an embedding for a single piece of text.
        This method is not implemented and raises a NotImplementedError.

        Args:
            text (str): The text to generate an embedding for.

        Raises:
            NotImplementedError: This method is not implemented.
        r1   r2   r-   s     r"   Úaembed_queryzSpacyEmbeddings.aembed_queryi   r5   r6   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚ__annotations__r   r   r   r	   Úmodel_configr
   Úclassmethodr   r#   r   Úfloatr+   r.   r4   r8   r   r/   r"   r   r      sÒ   … ñð '€J�Ó&Ø€Cˆ�#‰Óá HÀ2ÔF€Lá˜(Ô#Øð%¨$ð %°3ò %ó ó $ð%ðN
B T¨#¡Yð 
B°4¸¸U¹Ñ3Dó 
Bð
. ð 
.¨¨U©ó 
.ðY¨D°©Ið Y¸$¸tÀE¹{Ñ:Kó YðY sð Y¨t°E©{ô Yr/   r   )Úimportlib.utilr   Útypingr   r   r   r   Úlangchain_core.embeddingsr   Úpydanticr   r	   r
   r   r   r/   r"   Ú<module>rF      s)   ðÛ ß ,Ó ,å 0ß ;Ñ ;ôlY�i õ lYr/   