
    dhn	                     P    S r SSKJrJrJr  SSKJr  SSKJrJ	r	   " S S\\5      r
g)z)Wrapper around text2vec embedding models.    )AnyListOptional)
Embeddings)	BaseModel
ConfigDictc                      ^  \ rS rSr% SrSr\\   \S'   Sr	\
\S'   Sr\\S'   Sr\\   \S	'   Sr\
\S
'   \" SS9rSSS.S
\
S\\   S\
4U 4S jjjrS\\   S\\\      4S jrS\S\\   4S jrSrU =r$ )Text2vecEmbeddings	   a^  text2vec embedding models.

Install text2vec first, run 'pip install -U text2vec'.
The github repository for text2vec is : https://github.com/shibing624/text2vec

Example:
    .. code-block:: python

        from langchain_community.embeddings.text2vec import Text2vecEmbeddings

        embedding = Text2vecEmbeddings()
        embedding.embed_documents([
            "This is a CoSENT(Cosine Sentence) model.",
            "It maps sentences to a 768 dimensional dense vector space.",
        ])
        embedding.embed_query(
            "It can be used for text matching or semantic search."
        )
Nmodel_name_or_pathMEANencoder_type   max_seq_lengthdevicemodel )protected_namespacesr   r   kwargsc                   >  SSK Jn  0 nUb  X&S'   U=(       d
    U" S0 UDUD6n[        TU ]  " SXS.UD6  g ! [         a  n[        S5      UeS nAff = f)Nr   )SentenceModelzIUnable to import text2vec, please install with `pip install -U text2vec`.r   r   r   )text2vecr   ImportErrorsuper__init__)selfr   r   r   r   emodel_kwargs	__class__s          _/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/embeddings/text2vec.pyr   Text2vecEmbeddings.__init__&   sv    	. )1C-.@@@@VuVvV  	- 	s   8 
AAAtextsreturnc                 8    U R                   R                  U5      $ )zEmbed documents using the text2vec embeddings model.

Args:
    texts: The list of texts to embed.

Returns:
    List of embeddings, one for each text.
r   encode)r   r#   s     r!   embed_documents"Text2vecEmbeddings.embed_documents;   s     zz  ''    textc                 8    U R                   R                  U5      $ )z~Embed a query using the text2vec embeddings model.

Args:
    text: The text to embed.

Returns:
    Embeddings for the text.
r&   )r   r+   s     r!   embed_queryText2vecEmbeddings.embed_queryG   s     zz  &&r*   )__name__
__module____qualname____firstlineno____doc__r   r   str__annotations__r   r   r   intr   r   r   model_configr   r   floatr(   r-   __static_attributes____classcell__)r    s   @r!   r
   r
   	   s    ( )-,L#NC FHSM E326L
 ,0	W W %SM	W
 W W*
(T#Y 
(4U3D 
(
' 
'U 
' 
'r*   r
   N)r3   typingr   r   r   langchain_core.embeddingsr   pydanticr   r   r
   r   r*   r!   <module>r>      s$    / & & 0 *H'Y H'r*   