
    Ngc                        d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZmZmZmZ ddlmZ ddlmZ ddlmZ ddlmZ  ej        e          Z G d	 d
e          ZdZ G d d          ZdS )z,Module providing Infinispan as a VectorStore    )annotationsN)AnyIterableListOptionalTupleTypeUnioncast)Response)Document)
Embeddings)VectorStorec                      e Zd ZdZ	 	 dBdCd	ZdDdZdEdZdFdZdGdZdHdZ	dIdJdZ
dHdZdHdZdKdZdHd ZdHd!Z	 	 dBdLd)Z	 dMdNd.Z	 dMdOd0Z	 dMdPd2Z	 dMdQd3ZdRd5ZdSd8ZdTd9Ze	 	 	 	 dUdVdA            ZdS )WInfinispanVSa  `Infinispan` VectorStore interface.

        This class exposes the method to present Infinispan as a
        VectorStore. It relies on the Infinispan class (below) which takes care
        of the REST interface with the server.

    Example:
        ... code-block:: python
            from langchain_community.vectorstores import InfinispanVS
            from mymodels import RGBEmbeddings
            ...
            vectorDb = InfinispanVS.from_documents(docs,
                            embedding=RGBEmbeddings(),
                            output_fields=["texture", "color"],
                            lambda_key=lambda text,meta: str(meta["_key"]),
                            lambda_content=lambda item: item["color"])

        or an empty InfinispanVS instance can be created if preliminary setup
        is required before populating the store

        ... code-block:: python
            from langchain_community.vectorstores import InfinispanVS
            from mymodels import RGBEmbeddings
            ...
            ispnVS = InfinispanVS()
            # configure Infinispan here
            # i.e. create cache and schema

            # then populate the store
            vectorDb = InfinispanVS.from_documents(docs,
                            embedding=RGBEmbeddings(),
                            output_fields: ["texture", "color"],
                            lambda_key: lambda text,meta: str(meta["_key"]),
                            lambda_content: lambda item: item["color"])
    N	embeddingOptional[Embeddings]idsOptional[List[str]]kwargsr   c                j    t          di | _        | _        t           j                            dd                     _        t           j                            dd                     _        | _         j                            dd           _         j        dk    r! j                            dd           _        nt          j
        dt                      j                            d	d           _         j        dk    r! j                            d
d           _        nt          j
        dt                      j                            d fd           _         j                            d fd           _         j                            d           _        | _        dS )at  
        Parameters
        ----------
        cache_name: str
            Embeddings cache name. Default "vector"
        entity_name: str
            Protobuf entity name for the embeddings. Default "vector"
        text_field: str
            Protobuf field name for text. Default "text"
        vector_field: str
            Protobuf field name for vector. Default "vector"
        lambda_content: lambda
            Lambda returning the content part of an item. Default returns text_field
        lambda_metadata: lambda
            Lambda returning the metadata part of an item. Default returns items
            fields excepts text_field, vector_field, _type
        output_fields: List[str]
            List of fields to be returned from item, if None return all fields.
            Default None
        kwargs: Any
            Rest of arguments passed to Infinispan. See docs
cache_namevectorentity_name	textfield 
text_fieldtextz9`textfield` is deprecated. Please use `text_field` param.vectorfieldvector_fieldz=`vectorfield` is deprecated. Please use `vector_field` param.lambda_contentc                .                         |           S N)_default_contentitemselfs    i/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/vectorstores/infinispanvs.py<lambda>z'InfinispanVS.__init__.<locals>.<lambda>i   s    4+@+@+F+F     lambda_metadatac                .                         |           S r#   )_default_metadatar%   s    r(   r)   z'InfinispanVS.__init__.<locals>.<lambda>l   s    D,B,B4,H,H r*   output_fieldsN )
Infinispanispn_configurationstrget_cache_name_entity_name
_embedding
_textfieldwarningswarnDeprecationWarning_vectorfield_to_content_to_metadata_output_fields_ids)r'   r   r   r   s   `   r(   __init__zInfinispanVS.__init__8   s   6 ((((	$t266|XNNOO 3 7 7x P PQQ#-11+rBB?b  "155lFKKDOOMN"   !/33M2FF"" $ 3 7 7 Q QDMR"    .22FFFF
 
 !/33HHHH
 
 #155oFF			r*   r&   dictreturnc                    t          |          }|                    | j        d            |                    | j        d            |                    dd            |S )N_type)rB   popr<   r8   )r'   r&   metas      r(   r-   zInfinispanVS._default_metadataq   sS    Dzz"D)))$'''$r*   dict[str, Any]c                6    |                     | j                  S r#   )r4   r8   )r'   r&   s     r(   r$   zInfinispanVS._default_contentx   s    xx(((r*   templ	dimensionintr3   c                   d}|| j         || j        fz  }d}|                                D ]!\  }}t          |t                    r|d|z   dz   t	          |          z   dz   z  }nt          |t
                    r|d|z   dz   t	          |          z   dz   z  }nt          |t                    r|d|z   dz   t	          |          z   dz   z  }nzt          |t                    r|d|z   dz   t	          |          z   dz   z  }nFt          |t                    r|d	|z   dz   t	          |          z   dz   z  }nt          d
|z             |dz  }#|dz  }|S )NzV
/**
* @Indexed
*/
message %s {
/**
* @Vector(dimension=%d)
*/
repeated float %s = 1;
   zoptional string z = z;
zoptional int64 zoptional double zoptional bytes zoptional bool zEUnable to build proto schema for metadata. Unhandled type for field:    z}
)
r6   r<   items
isinstancer3   rL   floatbytesbool	Exception)r'   rJ   rK   metadata_proto_tplmetadata_protoidxfvs           r(   schema_builderzInfinispanVS.schema_builder{   s   	 ,/
 

 KKMM 	 	DAq!S!! "4q"85"@3s88"Ke"SSAs## "3a"7%"?#c(("JU"RRAu%% 
"4q"85"@3s88"Ke"SSAu%% "3a"7%"?#c(("JU"RRAt$$ "2Q"6">S"IE"QQ1345   1HCC%r*   protor   c                H    | j                             | j        dz   |          S )zDeploy the schema for the vector db
        Args:
            proto(str): protobuf schema
        Returns:
            An http Response containing the result of the operation
        .proto)r1   schema_postr6   )r'   r\   s     r(   schema_createzInfinispanVS.schema_create   s$     y$$T%6%A5IIIr*   c                F    | j                             | j        dz             S )zDelete the schema for the vector db
        Returns:
            An http Response containing the result of the operation
        r^   )r1   schema_deleter6   r'   s    r(   rb   zInfinispanVS.schema_delete   s"    
 y&&t'88'CDDDr*   r   configc                h    |dk    rd| j         z   dz   }| j                            | j        |          S )zCreate the cache for the vector db
        Args:
            config(str): configuration of the cache.
        Returns:
            An http Response containing the result of the operation
        r   aZ  
            {
  "distributed-cache": {
    "owners": "2",
    "mode": "SYNC",
    "statistics": true,
    "encoding": {
      "media-type": "application/x-protostream"
    },
    "indexing": {
      "enabled": true,
      "storage": "filesystem",
      "startup-mode": "AUTO",
      "indexing-mode": "AUTO",
      "indexed-entities": [
        "z"
      ]
    }
  }
}
)r6   r1   
cache_postr5   )r'   rd   s     r(   cache_createzInfinispanVS.cache_create   sK     R<<  #!$"# 2 y##D$4f===r*   c                @    | j                             | j                  S )zDelete the cache for the vector db
        Returns:
            An http Response containing the result of the operation
        )r1   cache_deleter5   rc   s    r(   ri   zInfinispanVS.cache_delete       
 y%%d&6777r*   c                @    | j                             | j                  S )zClear the cache for the vector db
        Returns:
            An http Response containing the result of the operation
        )r1   cache_clearr5   rc   s    r(   rl   zInfinispanVS.cache_clear       
 y$$T%5666r*   rT   c                @    | j                             | j                  S )zOChecks if the cache exists
        Returns:
            true if exists
        )r1   cache_existsr5   rc   s    r(   ro   zInfinispanVS.cache_exists   rj   r*   c                @    | j                             | j                  S )zClear the index for the vector db
        Returns:
            An http Response containing the result of the operation
        )r1   index_clearr5   rc   s    r(   cache_index_clearzInfinispanVS.cache_index_clear   rm   r*   c                @    | j                             | j                  S )z{Rebuild the for the vector db
        Returns:
            An http Response containing the result of the operation
        )r1   index_reindexr5   rc   s    r(   cache_index_reindexz InfinispanVS.cache_index_reindex   s    
 y&&t'7888r*   textsIterable[str]	metadatasOptional[List[dict]]last_vectorOptional[List[float]]	List[str]c                $   g }t          |          }|r|                                 | j                            |          }|r|                    |           |sd |D             }| j        pd |D             }t          t          |||                    }	|	D ]u\  }
}}d| j        | j        |i}|	                    |
           t          j        |          }| j                            ||| j                   |                    |           v|S )Nc                    g | ]}i S r/   r/   .0_s     r(   
<listcomp>z*InfinispanVS.add_texts.<locals>.<listcomp>  s    ++++++r*   c                N    g | ]"}t          t          j                              #S r/   )r3   uuiduuid4r   s     r(   r   z*InfinispanVS.add_texts.<locals>.<listcomp>  s&    ===!C
--===r*   rE   )listrF   r7   embed_documentsappendr@   zipr6   r<   updatejsondumpsr1   putr5   )r'   rv   rx   rz   r   resulttexts_lembedsr   
data_inputmetadataembedkeydatadata_strs                  r(   	add_textszInfinispanVS.add_texts   s'    u++ 	KKMMM0099 	'MM+&&& 	,++U+++Ii===u===#i5566
$. 	 	 HeST.0A5IDKK!!!z$''HIMM#x)9:::MM#r*      querykList[Document]c                H    |                      ||          }d |D             S )z"Return docs most similar to query.)r   r   c                    g | ]\  }}|S r/   r/   r   docr   s      r(   r   z2InfinispanVS.similarity_search.<locals>.<listcomp>  s    ,,,Q,,,r*   )similarity_search_with_score)r'   r   r   r   	documentss        r(   similarity_searchzInfinispanVS.similarity_search  s0     55EQ5GG	,,),,,,r*   List[Tuple[Document, float]]c                h    | j                             |          }|                     ||          }|S )a  Perform a search on a query string and return results with score.

        Args:
            query (str): The text being searched.
            k (int, optional): The amount of results to return. Defaults to 4.

        Returns:
            List[Tuple[Document, float]]
        )r   r   )r7   embed_query&similarity_search_with_score_by_vector)r'   r   r   r   r   r   s         r(   r   z)InfinispanVS.similarity_search_with_score  s8     ++E22??%ST?UU	r*   List[float]c                F    |                      ||          }d |D             S )Nc                    g | ]\  }}|S r/   r/   r   s      r(   r   z<InfinispanVS.similarity_search_by_vector.<locals>.<listcomp>+  s    &&&Q&&&r*   )r   )r'   r   r   r   ress        r(   similarity_search_by_vectorz(InfinispanVS.similarity_search_by_vector'  s-     99)QGG&&#&&&&r*   c                   | j         Ad| j        z   dz   | j        z   dz   t          j        |          z   dz   t          |          z   }nud}| j         dd         D ]}|dz   |z   d	z   }|dz   | j         d         z   }|d
z   | j        z   dz   | j        z   dz   t          j        |          z   dz   t          |          z   }| j                            || j                  }t          j	        |j
                  }|                     |          S )a$  Return docs most similar to embedding vector.

        Args:
            embedding: Embedding to look up documents similar to.
            k: Number of Documents to return. Defaults to 4.

        Returns:
            List of pair (Documents, score) most similar to the query vector.
        Nzselect v, score(v) from z v where v.z <-> ~zselect zv.,z, score(v) from )r?   r6   r<   r   r   r3   r1   	req_queryr5   loadsr   _query_result_to_docs)r'   r   r   	query_str
query_projfield	query_resr   s           r(   r   z3InfinispanVS.similarity_search_with_score_by_vector-  si    &*#$  #$ 	
 *Y''(  a&& I #J,SbS1 = ='$.6<

#d*T-@-DDJ$%#$    #	$
  *Y''(  a&&  I''	43CDD	IN++))&111r*   r   c                $   g }|d         D ]}|d         pi | j         	d         }nfd| j         D             }t          |                     |          |                     |                    }|                    |d         f           |S )Nhitshit*c                <    i | ]}|                     |          S r/   )r4   )r   r   r   s     r(   
<dictcomp>z6InfinispanVS._query_result_to_docs.<locals>.<dictcomp>a  s%    KKK#swws||KKKr*   )page_contentr   zscore())r?   r   r=   r>   r   )r'   r   r   rowentityr   r   s         @r(   r   z"InfinispanVS._query_result_to_docsX  s     	&> 
	4 
	4Ce*"C"*SKKKKt7JKKK!--f55**622  C c3y>23333r*   r   Nonec                   |                      ||          }|                     |          }|j        | j        j        j        k    s
J d            	 t          j        |j                  d         J | 	                                sO| 
                                }|j        | j        j        j        k    s
J d            	 |                                  d S d S )Nz)Unable to create schema. Already exists? errorz(Unable to create cache. Already exists? )r[   r`   status_coder1   CodesOKr   r   r   ro   rg   rr   )r'   r   rK   schemaoutputs        r(   	configurezInfinispanVS.configurei  s    $$Xy99##F++$)/"44446 544'z&+&&w/777  "" 	%&&((F"dio&88889 988+""$$$$$	% 	%r*   c                V    |                                   |                                  d S r#   )rb   ri   rc   s    r(   config_clearzInfinispanVS.config_clearz  s,    r*   TclsType[InfinispanVS]r   	clear_oldOptional[bool]auto_configc                    | d||d|}|rt          |pg           dk    r|r|                                 |                    |t          |          dz
                     }	t          t          t
                   |          }|                    |d         t          |	                     nA|r|                                 |                    |t          |          dz
                     }	|r|                    |||	           |S )a  Return VectorStore initialized from texts and embeddings.

        In addition to parameters described by the super method, this
        implementation provides other configuration params if different
        configuration from default is needed.

        Parameters
        ----------
        ids : List[str]
            Additional list of keys associated to the embedding. If not
            provided UUIDs will be generated
        clear_old : bool
            Whether old data must be deleted. Default True
        auto_config: bool
            Whether to do a complete server setup (caches,
            protobuf definition...). Default True
        kwargs: Any
            Rest of arguments passed to InfinispanVS. See docs)r   r   r   rO   )r   r/   )	lenr   r   r   r   rB   r   rl   r   )
r   rv   r   rx   r   r   r   r   infinispanvsvecs
             r(   
from_textszInfinispanVS.from_texts~  s   : sBYCBB6BB 		?3yB//!33 ,))+++''c%jj1n(=>>CT$Z33I""9Q<S:::: +((***''c%jj1n(=>>C 	A""5)C"@@@r*   )NN)r   r   r   r   r   r   )r&   rB   rC   rB   )r&   rH   rC   r   )rJ   rB   rK   rL   rC   r3   )r\   r3   rC   r   )rC   r   )r   )rd   r3   rC   r   )rC   rT   )
rv   rw   rx   ry   rz   r{   r   r   rC   r|   )r   )r   r3   r   rL   r   r   rC   r   )r   r3   r   rL   r   r   rC   r   )r   r   r   rL   r   r   rC   r   )r   r   r   rL   rC   r   )r   rH   rC   r   )r   rB   rK   rL   rC   r   )rC   r   )NNTT)r   r   rv   r|   r   r   rx   ry   r   r   r   r   r   r   r   r   rC   r   )__name__
__module____qualname____doc__rA   r-   r$   r[   r`   rb   rg   ri   rl   ro   rr   ru   r   r   r   r   r   r   r   r   classmethodr   r/   r*   r(   r   r      s5       " "L +/#'7 7 7 7 7r   ) ) ) )# # # #JJ J J JE E E E!> !> !> !> !>F8 8 8 87 7 7 78 8 8 87 7 7 79 9 9 9 +/-1	    6 $%- - - - - $%    " 01' ' ' ' ' 01)2 )2 )2 )2 )2V   "% % % %"    
 +/#'$(&*) ) ) ) [) ) )r*   r   
   c            	          e Zd ZdZddddgdddddf	d4dZd5d6dZ	 d5d7dZ	 d5d7d Zd8d#Zd8d$Z	d9d%Z
d:d(Zd;d*Zd<d+Zd<d,Zd=d-Zd>d.Zd?d0Zd=d1Zd=d2Zd3S )@r0   a>  Helper class for `Infinispan` REST interface.

    This class exposes the Infinispan operations needed to
    create and set up a vector db.

    You need a running Infinispan (15+) server without authentication.
    You can easily start one, see:
    https://github.com/rigazilla/infinispan-vector#run-infinispan
    httpr   z127.0.0.1:11222z/rest/v2/cachesz/rest/v2/schemasTr   r3   userpasswordhostsr|   	cache_url
schema_urluse_post_for_queryrT   http2verifyr   r   c
                T   	 ddl }n# t          $ r t          d          w xY w|j        | _        |
| _        || _        || _        || _        |d         | _        | j        dz   | j        z   | _	        || _
        || _        || _        || _        | j        rm| j        rf| j        dk    r"|                    | j        | j                  }n| j        | j        f}|                    | j        | j         ||	          | _        dS |                    | j        | j         |	          | _        dS )	aK  
        Parameters
        ----------
        schema: str
            Schema for HTTP request: "http" or "https". Default "http"
        user, password: str
            User and password if auth is required. Default None
        hosts: List[str]
            List of server addresses. Default ["127.0.0.1:11222"]
        cache_url: str
            URL endpoint for cache API. Default "/rest/v2/caches"
        schema_url: str
            URL endpoint for schema API. Default "/rest/v2/schemas"
        use_post_for_query: bool
            Whether POST method should be used for query. Default True
        http2: bool
            Whether HTTP/2 protocol should be used. `pip install "httpx[http2]"` is
            needed for HTTP/2. Default True
        verify:  bool
            Whether TLS certificate must be verified. Default True
        r   NzCould not import httpx python package. Please install it with `pip install httpx`or `pip install "httpx[http2]"` if you need HTTP/2.z://r   )usernamer   )r   http1authr   )r   r   r   )httpxImportErrorcodesr   r2   _schema_user	_password_host_default_node
_cache_url_schema_url_use_post_for_query_http2
DigestAuthClient_h2c)r'   r   r   r   r   r   r   r   r   r   r   r   r   s                r(   rA   zInfinispan.__init__  se   F	LLLL 	 	 	F  	 [
$
!1X
!\E1DJ>#%#5 : 	$. 	|v%%AFAQAQ!Z$. BR B B 
DN3k+o	 %  DIII k+o %  DIIIs    !Fr   r   localrC   r   c                l    | j         r|                     |||          S |                     |||          S )a  Request a query
        Args:
            query(str): query requested
            cache_name(str): name of the target cache
            local(boolean): whether the query is local to clustered
        Returns:
            An http Response containing the result set or errors
        )r   _query_post
_query_get)r'   r   r   r   s       r(   r   zInfinispan.req_query  s=     # 	>##E:u===uj%888r*   r   c                    | j         | j        z   dz   |z   dz   t          |          z   }d|i}t          j        |          }| j                            ||ddit                    }|S )N/z?action=search&local=r   Content-Typeapplication/jsoncontentheaderstimeout)r   r   r3   r   r   r   postREST_TIMEOUT)r'   r   r   r   api_urlr   	data_jsonresponses           r(   r   zInfinispan._query_post  s     o  &	&
 %jj 	 #Jt$$	9>>#%78 	 " 
 
 r*   c                    | j         | j        z   dz   |z   dz   |z   dz   t          |          z   }| j                            |t
                    }|S )Nr   z?action=search&query=z&local=r  )r   r   r3   r   r4   r  )r'   r   r   r   r  r  s         r(   r   zInfinispan._query_get'  sw     o  &	&
   %jj 	 9==,=??r*   r   r   c                    | j         | j        z   dz   |z   dz   |z   }| j                            ||ddit                    }|S )a  Post an entry
        Args:
            key(str): key of the entry
            data(str): content of the entry in json format
            cache_name(str): target cache
        Returns:
            An http Response containing the result of the operation
        r   r   r   r   r   r   r   r  r  r'   r   r   r   r  r  s         r(   r  zInfinispan.post7  s[     $t6<zICORUU9>>#%78 	 " 
 
 r*   c                    | j         | j        z   dz   |z   dz   |z   }| j                            ||ddit                    }|S )a  Put an entry
        Args:
            key(str): key of the entry
            data(str): content of the entry in json format
            cache_name(str): target cache
        Returns:
            An http Response containing the result of the operation
        r   r   r   r   )r   r   r   r   r  r  s         r(   r   zInfinispan.putI  s[     $t6<zICORUU9==#%78 	 ! 
 
 r*   c                    | j         | j        z   dz   |z   dz   |z   }| j                            |ddit                    }|S )zGet an entry
        Args:
            key(str): key of the entry
            cache_name(str): target cache
        Returns:
            An http Response containing the entry or errors
        r   r   r   )r  r  )r   r   r   r4   r  )r'   r   r   r  r  s        r(   r4   zInfinispan.get[  sV     $t6<zICORUU9==n.@A< ! 
 
 r*   namer\   c                t    | j         | j        z   dz   |z   }| j                            ||t                    }|S )zDeploy a schema
        Args:
            name(str): name of the schema. Will be used as a key
            proto(str): protobuf schema
        Returns:
            An http Response containing the result of the operation
        r   )r  r  )r   r   r   r  r  )r'   r  r\   r  r  s        r(   r_   zInfinispan.schema_posti  s<     $t'77#=D9>>'5,>OOr*   rd   c                z    | j         | j        z   dz   |z   }| j                            ||ddit                    }|S )zCreate a cache
        Args:
            name(str): name of the cache.
            config(str): configuration of the cache.
        Returns:
            An http Response containing the result of the operation
        r   r   r   r   r  )r'   r  rd   r  r  s        r(   rf   zInfinispan.cache_postu  sP     $t6<tC9>>#%78 	 " 
 
 r*   c                r    | j         | j        z   dz   |z   }| j                            |t                    }|S )zDelete a schema
        Args:
            name(str): name of the schema.
        Returns:
            An http Response containing the result of the operation
        r   r
  )r   r   r   deleter  r'   r  r  r  s       r(   rb   zInfinispan.schema_delete  s=     $t'77#=D9##G\#BBr*   c                r    | j         | j        z   dz   |z   }| j                            |t                    }|S )zDelete a cache
        Args:
            name(str): name of the cache.
        Returns:
            An http Response containing the result of the operation
        r   r
  )r   r   r   r  r  r  s       r(   ri   zInfinispan.cache_delete  s<     $t6<tC9##G\#BBr*   c                x    | j         | j        z   dz   |z   dz   }| j                            |t                    }|S )zClear a cache
        Args:
            cache_name(str): name of the cache.
        Returns:
            An http Response containing the result of the operation
        r   ?action=clearr
  r  )r'   r   r  r  s       r(   rl   zInfinispan.cache_clear  sC     036CoU 	 9>>'<>@@r*   c                \    | j         | j        z   dz   |z   dz   }|                     |          S )zCheck if a cache exists
        Args:
            cache_name(str): name of the cache.
        Returns:
            True if cache exists
        r   r  )r   r   resource_existsr'   r   r  s      r(   ro   zInfinispan.cache_exists  s;     036CoU 	 ##G,,,r*   r  c                n    | j                             |t                    }|j        | j        j        k    S )zCheck if a resource exists
        Args:
            api_url(str): url of the resource.
        Returns:
            true if resource exists
        r
  )r   headr  r   r   r   )r'   r  r  s      r(   r  zInfinispan.resource_exists  s-     9>>'<>@@#tz}44r*   c                t    | j         | j        z   dz   |z   dz   }| j                            |t                    S )zClear an index on a cache
        Args:
            cache_name(str): name of the cache.
        Returns:
            An http Response containing the result of the operation
        r   z/search/indexes?action=clearr
  r  r  s      r(   rq   zInfinispan.index_clear  sO     o  -	- 	 y~~g|~<<<r*   c                t    | j         | j        z   dz   |z   dz   }| j                            |t                    S )zRebuild index on a cache
        Args:
            cache_name(str): name of the cache.
        Returns:
            An http Response containing the result of the operation
        r   z/search/indexes?action=reindexr
  r  r  s      r(   rt   zInfinispan.index_reindex  sO     o  /	/ 	 y~~g|~<<<r*   N)r   r3   r   r3   r   r3   r   r|   r   r3   r   r3   r   rT   r   rT   r   rT   r   r   )F)r   r3   r   r3   r   rT   rC   r   )r   r3   r   r3   r   rT   rC   r   )r   r3   r   r3   r   r3   rC   r   )r   r3   r   r3   rC   r   )r  r3   r\   r3   rC   r   )r  r3   rd   r3   rC   r   )r  r3   rC   r   )r   r3   rC   r   )r   r3   rC   rT   )r  r3   rC   rT   )r   r   r   r   rA   r   r   r   r  r   r4   r_   rf   rb   ri   rl   ro   r  rq   rt   r/   r*   r(   r0   r0     s         -.*,#'J J J J JX9 9 9 9 9 >C    , >C        $   $   
 
 
 
   "	 	 	 		 	 	 	   
- 
- 
- 
-5 5 5 5= = = = = = = = = =r*   r0   )r   
__future__r   r   loggingr   r9   typingr   r   r   r   r   r	   r
   r   r   r   langchain_core.documentsr   langchain_core.embeddingsr   langchain_core.vectorstoresr   	getLoggerr   loggerr   r  r0   r/   r*   r(   <module>r(     sM   2 2 " " " " " "     J J J J J J J J J J J J J J J J J J J J       - - - - - - 0 0 0 0 0 0 3 3 3 3 3 3		8	$	$U U U U U; U U Up o= o= o= o= o= o= o= o= o= o=r*   