
    dht                       S r SSKJr  SSKrSSKrSSKrSSKJrJrJ	r	J
r
JrJrJr  SSKrSSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  \" S
/5      rS
rSrSr\R>                  " \R@                  " S5      5      RB                  r"\RF                  " \R@                  " S5      5      RB                  r$\RJ                  RB                  r&SS jr'SS jr(SS jr)SS jr*SS jr+ " S S\5      r,g)z&Wrapper around TileDB vector database.    )annotationsN)AnyDictIterableListMappingOptionalTuple)Document)
Embeddingsguard_import)VectorStore)maximal_marginal_relevance	euclidean	documentsvectorsuint64float32c                 .    [        S5      [        S5      4$ )z@Import tiledb-vector-search if available, otherwise raise error.tiledb.vector_searchtiledbr        _/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/vectorstores/tiledb.pydependable_tiledb_importr      s     	+,X r   c                (    U [            R                  $ ) Get the URI of the vector index.)VECTOR_INDEX_NAMEurigroups    r   get_vector_index_uri_from_groupr#   #   s    "#'''r   c                (    U [            R                  $ )zGet the URI of the documents array from group.

Args:
    group: TileDB group object.

Returns:
    URI of the documents array.
)DOCUMENTS_ARRAY_NAMEr    r!   s    r   "get_documents_array_uri_from_groupr&   (   s     %&***r   c                    U  S[          3$ )r   /)r   r    s    r   get_vector_index_urir*   4   s    U!%&''r   c                    U  S[          3$ )z#Get the URI of the documents array.r(   )r%   r)   s    r   get_documents_array_urir,   9   s    U!()**r   c                     \ rS rSrSrSSSSSS.                 S'S jjr\S(S j5       rS	S\S
.           S)S jjr	S	SSS.           S*S jjr
S	SSS.           S+S jjr   S,           S-S jjr   S,           S.S jjrS	SSSS.             S/S jjr    S0             S1S jjr    S0             S2S jjr\SSS.             S3S jj5       r\SS\SSSS.                       S4S jj5       r S5       S6S jjr   S7           S8S jjr\SS\S SSS4                     S9S! jj5       r\SS\SSSS.                     S:S" jj5       r\\SSS#.             S;S$ jj5       rS<S% jrS&rg)=TileDB>   a  TileDB vector store.

To use, you should have the ``tiledb-vector-search`` python package installed.

Example:
    .. code-block:: python

        from langchain_community import TileDB
        embeddings = OpenAIEmbeddings()
        db = TileDB(embeddings, index_uri, metric)

 NF)vector_index_uridocs_array_uriconfig	timestampallow_dangerous_deserializationc                  U(       d  [        S5      eXl        UR                  U l        X l        X0l        X`l        [        S5      [        S5      pUR                  US9   UR                  U R                  S5      nUS:w  a  UO
[        U5      U l        US:w  a  UO
[        U5      U l        UR                  5         UR                  U R                  S5      nUR                  R!                  S5      U l        UR                  5         Xpl        U R"                  S:X  aD  U
R&                  R(                  " SU R                  U R                  U R$                  S	.U	D6U l        OSU R"                  S
:X  aC  U
R,                  R.                  " SU R                  U R                  U R$                  S	.U	D6U l        SSS5        g! , (       d  f       g= f)aN  Initialize with necessary components.

Args:
    allow_dangerous_deserialization: whether to allow deserialization
        of the data which involves loading data using pickle.
        data can be modified by malicious actors to deliver a
        malicious payload that results in execution of
        arbitrary code on your machine.
a  TileDB relies on pickle for serialization and deserialization. This can be dangerous if the data is intercepted and/or modified by malicious actors prior to being de-serialized. If you are sure that the data is safe from modification, you can  set allow_dangerous_deserialization=True to proceed. Loading of compromised data using pickle can result in execution of arbitrary code on your machine.r   r   ctx_or_configrr0   
index_typeFLAT)r    r3   r4   IVF_FLATNr   )
ValueError	embeddingembed_queryembedding_function	index_urimetricr3   r   	scope_ctxGroupr#   r1   r&   r2   closemetagetr:   r4   
flat_index	FlatIndexvector_indexivf_flat_indexIVFFlatIndex)selfr>   rA   rB   r1   r2   r3   r4   r5   kwargs	tiledb_vsr   index_groupr"   s                 r   __init__TileDB.__init__L   s   , /2  #"+"7"7" /0"  F3 ,,t~~s;K $r) !4[A ! "R' 7D 
 LL!6!6<E#jjnn\:DOKKM&N&($-$8$8$B$B %--;;"nn% 	%! J.$-$<$<$I$I %--;;"nn% 	%!3 433s    EF??
Gc                    U R                   $ N)r>   )rM   s    r   
embeddingsTileDB.embeddings   s    ~~r      )kfilterscore_thresholdc          
       ^ [        S5      n/ nUR                  U R                  SU R                  U R                  S9n[        X5       GH}  u  pU	S:X  a  U
S:X  a  M  U	[        :X  a  U
[        :X  a  M*  X   nUb  [        US   5      S:X  a  [        SU	 SU 35      eUR                  S	5      n[        [        US   S   5      S
9mUbj  [        R                  " [        R                   " UR#                  5       5      R%                  [        R&                  5      R)                  5       5      nUTl        Ub}  UR-                  5        VVs0 sH   u  pU[/        U[0        5      (       d  U/OU_M"     nnn[3        U4S jUR-                  5        5       5      (       a  UR5                  TU
45        GMg  GMj  UR5                  TU
45        GM     UR7                  5         U VV
s/ sH  u  pX::  d  M  X4PM     nnn
USU $ s  snnf s  sn
nf )a  Turns TileDB results into a list of documents and scores.

Args:
    ids: List of indices of the documents in the index.
    scores: List of distances of the documents in the index.
    k: Number of Documents to return. Defaults to 4.
    filter (Optional[Dict[str, Any]]): Filter by metadata. Defaults to None.
    score_threshold: Optional, a floating point value to filter the
        resulting set of retrieved docs
Returns:
    List of Documents and scores.
r   r9   r4   r3   r   NtextzCould not find document for id z, got metadata)page_contentc              3  b   >#    U H%  u  pTR                   R                  U5      U;   v   M'     g 7frT   )r^   rG   ).0keyvalue
result_docs      r   	<genexpr>/TileDB.process_index_results.<locals>.<genexpr>   s0      &4
 ''++C0E9&4s   ,/)r   openr2   r4   r3   zip
MAX_UINT64MAX_FLOAT_32lenr=   rG   r   strpickleloadsnparraytolistastypeuint8tobytesr^   items
isinstancelistallappendrE   )rM   idsscoresrX   rY   rZ   r   docs
docs_arrayidxscoredocpickled_metadatar^   rb   rc   rd   s                   @r   process_index_resultsTileDB.process_index_results   s   * h'[[t{{ ! 

 c*JCaxEQJj Ul%:/C{c#f+.!3 #B3%vcU!STT"wwz2!s3v;q>/BCJ+!<<HH-4467>>rxxHPPR '/
#! '-lln&4
 
5$(?(?%UJ&4    &,lln   KKU 34	 Z/05 +6 	/3Ptu7OtPBQx Qs   
&G>!
H/H   rX   rY   fetch_kc                  SU;   a  UR                  S5      nO[        nU R                  R                  " [        R
                  " [        R
                  " U5      R                  [        R                  5      /5      R                  [        R                  5      4SUc  UOU0UD6u  pxU R                  US   US   X2US9$ )a  Return docs most similar to query.

Args:
    embedding: Embedding vector to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    filter (Optional[Dict[str, Any]]): Filter by metadata. Defaults to None.
    fetch_k: (Optional[int]) Number of Documents to fetch before filtering.
              Defaults to 20.
    **kwargs: kwargs to be passed to similarity search. Can include:
        nprobe: Optional, number of partitions to check if using IVF_FLAT index
        score_threshold: Optional, a floating point value to filter the
            resulting set of retrieved docs

Returns:
    List of documents most similar to the query text and distance
    in float for each. Lower score represents more similarity.
rZ   rX   r   rz   r{   rY   rX   rZ   )	pop	MAX_FLOATrJ   queryro   rp   rr   r   r   )	rM   r>   rX   rY   r   rN   rZ   dis	            r   &similarity_search_with_score_by_vector-TileDB.similarity_search_with_score_by_vector   s    4 &$jj):;O'O  &&HHbhhy)00<=>EEbjjQ
>aw
 

 ))!QqT& * 
 	
r   c               V    U R                  U5      nU R                  " U4UUUS.UD6nU$ )a  Return docs most similar to query.

Args:
    query: Text to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
    fetch_k: (Optional[int]) Number of Documents to fetch before filtering.
              Defaults to 20.

Returns:
    List of documents most similar to the query text with
    Distance as float. Lower score represents more similarity.
r   )r@   r   )rM   r   rX   rY   r   rN   r>   r|   s           r   similarity_search_with_score#TileDB.similarity_search_with_score   sF    , ++E2	::
	

 
 r   c                h    U R                   " U4UUUS.UD6nU VVs/ sH  u  pxUPM	     snn$ s  snnf )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.
    filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
    fetch_k: (Optional[int]) Number of Documents to fetch before filtering.
              Defaults to 20.

Returns:
    List of Documents most similar to the embedding.
r   )r   )	rM   r>   rX   rY   r   rN   docs_and_scoresr   _s	            r   similarity_search_by_vector"TileDB.similarity_search_by_vector  sK    ( EE
	

 
 #22//222s   .c                f    U R                   " U4X#US.UD6nU VVs/ sH  u  pxUPM	     snn$ s  snnf )a  Return docs most similar to query.

Args:
    query: Text to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    filter: (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
    fetch_k: (Optional[int]) Number of Documents to fetch before filtering.
              Defaults to 20.

Returns:
    List of Documents most similar to the query.
r   )r   )	rM   r   rX   rY   r   rN   r   r   r   s	            r   similarity_searchTileDB.similarity_search7  sE    ( ;;
w
:@
 #22//222s   -      ?rX   r   lambda_multrY   c                  SU;   a  UR                  S5      nO[        nU R                  R                  " [        R
                  " [        R
                  " U5      R                  [        R                  5      /5      R                  [        R                  5      4SUc  UOUS-  0UD6u  pU R                  U	S   US   UUc  UOUS-  US9n
U
 VVs/ sH.  u  pU R                  R                  UR                  /5      S   PM0     nnn[        [        R
                  " U/[        R                  S9UUUS9n/ nU H  nUR                  U
U   5        M     U$ s  snnf )a  Return docs and their similarity scores selected using the maximal marginal
    relevance.

Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.

Args:
    embedding: Embedding to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    fetch_k: Number of Documents to fetch before filtering to
             pass to MMR algorithm.
    lambda_mult: Number between 0 and 1 that determines the degree
                of diversity among the results with 0 corresponding
                to maximum diversity and 1 to minimum diversity.
                Defaults to 0.5.
Returns:
    List of Documents and similarity scores selected by maximal marginal
        relevance and score for each.
rZ   rX      r   r   dtype)rX   r   )r   r   rJ   r   ro   rp   rr   r   r   r>   embed_documentsr_   r   ry   )rM   r>   rX   r   r   rY   rN   rZ   r{   indicesresultsr   r   rU   mmr_selectedr   r   s                    r   2max_marginal_relevance_search_with_score_by_vector9TileDB.max_marginal_relevance_search_with_score_by_vectorP  sY   : &$jj):;O'O++11HHbhhy)00<=>EEbjjQ
gWq[
 

 ,,
!9gWq[+ - 
 QX
PWfcDNN**C,<,<+=>qAPW 	 
 2HHi[

3#	
 A""71:. 
s   4Ec                j    U R                   " U4UUUUS.UD6nU VV	s/ sH  u  pUPM	     sn	n$ s  sn	nf )a  Return docs selected using the maximal marginal relevance.

Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.

Args:
    embedding: Embedding to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    fetch_k: Number of Documents to fetch before filtering to
             pass to MMR algorithm.
    lambda_mult: Number between 0 and 1 that determines the degree
                of diversity among the results with 0 corresponding
                to maximum diversity and 1 to minimum diversity.
                Defaults to 0.5.
Returns:
    List of Documents selected by maximal marginal relevance.
r   )r   )
rM   r>   rX   r   r   rY   rN   r   r   r   s
             r   'max_marginal_relevance_search_by_vector.TileDB.max_marginal_relevance_search_by_vector  sN    4 QQ
#
 
 #22//222s   /c                X    U R                  U5      nU R                  " U4UUUUS.UD6nU$ )a  Return docs selected using the maximal marginal relevance.

Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.

Args:
    query: Text to look up documents similar to.
    k: Number of Documents to return. Defaults to 4.
    fetch_k: Number of Documents to fetch before filtering (if needed) to
             pass to MMR algorithm.
    lambda_mult: Number between 0 and 1 that determines the degree
                of diversity among the results with 0 corresponding
                to maximum diversity and 1 to minimum diversity.
                Defaults to 0.5.
Returns:
    List of Documents selected by maximal marginal relevance.
r   )r@   r   )	rM   r   rX   r   r   rY   rN   r>   r|   s	            r   max_marginal_relevance_search$TileDB.max_marginal_relevance_search  sI    4 ++E2	;;
#
 
 r   T)	metadatasr3   c                  [        S5      [        S5      pUR                  US9    UR                  U5        UR	                  US5      n
[        U
R                  5      n[        U
R                  5      nUS:X  a  UR                  R                  UUUUS9  O"US:X  a  UR                  R                  UUUUS9  U
R                  U[        S9  UR                  S	S
[        S-
  4[        R                   " [        R"                  5      S9nUR%                  U5      nUR'                  S[        R                   " S5      SS9nU/nU(       a0  UR'                  S[        R(                  SS9nUR+                  U5        UR-                  USSUS9nUR.                  R                  UU5        U
R                  U[0        S9  U
R3                  5         S S S 5        g ! UR                   a  n	U	eS n	A	ff = f! , (       d  f       g = f)Nr   r   r7   wr;   )r    
dimensionsvector_typer3   r<   )nameidr      )r   domainr   r]   U1T)r   r   varr^   F)r   sparseallows_duplicatesattrs)r   rC   group_createTileDBErrorrD   r*   r    r,   rH   createrK   addr   Dimri   ro   r   r   DomainAttrrs   ry   ArraySchemaArrayr%   rE   )clsrA   r:   r   r   r   r3   rO   r   errr"   r1   docs_uridimdom	text_attrr   metadata_attrschemas                      r   r   TileDB.create  s    /0"  F3##I. LLC0E3EII>.uyy9HV#$$++() +!	 ,  z)((//() +!	 0  II&->I?
 **:>*hhryy)  C
 --$Crxx~4PIKE &288QU V]+''"'	 ( F LL&1IIh%9I:KKM_ 43 %% 	 43s.   G.GFG.G+$G&&G++G..
G<r;   r   )r   rz   rB   r:   r3   index_timestampc               P   U[         ;  a  [        SU S[        [         5       35      e[        S5      [        S5      p[        R
                  " U5      R                  [        R                  5      nU R                  UUUR                  S   UR                  US LU	S9  UR                  U	S9   U(       d  [        S5      e[        U5      n[        U5      nUc6  U Vs/ sH*  n[        [        R                   " S	["        S-
  5      5      PM,     nn[        R
                  " U5      R                  [        R$                  5      nUR&                  R(                  " SUUUUU
S	:w  a  U
OS U	S
.UD6  UR+                  US5       nUcL  [        R,                  " [/        U5      [        R$                  S9n[1        [/        U5      5       H  nUUU'   M
     0 n[        R
                  " U5      US'   Ubr  [        R2                  " [/        U5      /[4        S9nS	nU HB  n[        R6                  " [8        R:                  " U5      [        R<                  S9UU'   US-  nMD     UUS'   UUU'   S S S 5        S S S 5        U " SUUUU	S.UD6$ s  snf ! , (       d  f       N(= f! , (       d  f       N1= f)NzUnsupported distance metric: z. Expected one of r   r   r   )rA   r:   r   r   r   r3   r7   z3embeddings must be provided to build a TileDB indexr   )r:   rA   input_vectorsexternal_idsr   r3   r   r   r]   r^   )r>   rA   rB   r3   r   )INDEX_METRICSr=   rw   r   ro   rp   rr   r   r   shaper   rC   r*   r,   rl   randomrandintri   r   	ingestioningestrg   zerosrk   rangeemptyobject
frombufferrm   dumpsrs   )r   textsrU   r>   rA   r   rz   rB   r:   r3   r   rN   rO   r   r   r1   r   r   r   Ar   datar   r^   s                           r   __fromTileDB.__from  s     &3F8 <''+M':&;=  /0"  ,33BJJ?

!$**1-%++t+ 	 	
 F3 !VWW3I>.y9H{GLMu!s6>>!Z!^<=uM88C=//		:L&& %*+)3Ba3GT  Xs+q'#%88CJbii#HL"3u:.*+Q /!xxV($&HHc)n-=V$LMA$-+-=="LL2"((,a( Q	 %.
 (5D$"&,# ,' 4J  
	

 
 	
= N ,+' 43s8   -0J0JA2J?C%J$JJ
J	J
J%c                    [         R                  " U5      R                  [         R                  5      nU R                  R                  XBS:w  a  UOSS9  g)a-  Delete by vector ID or other criteria.

Args:
    ids: List of ids to delete.
    timestamp: Optional timestamp to delete with.
    **kwargs: Other keyword arguments that subclasses might use.

Returns:
    Optional[bool]: True if deletion is successful,
    False otherwise, None if not implemented.
r   N)r   r4   T)ro   rp   rr   r   rJ   delete_batch)rM   rz   r4   rN   r   s        r   deleteTileDB.deletee  sJ     xx}++BII6&&%1nRV 	' 	
 r   c           
        [        S5      nU R                  R                  [        U5      5      nUc6  U Vs/ sH*  n[	        [
        R                  " S[        S-
  5      5      PM,     nn[        R                  " U5      R                  [        R                  5      n	[        R                  " [        U5      SS9n
[        [        U5      5       H*  n[        R                  " X{   [        R                  S9X'   M,     U R                   R#                  U
U	US:w  a  UOSS9  0 n[        R                  " U5      US'   Ubp  [        R                  " [        U5      /[$        S9nSnU HA  n[        R&                  " [(        R*                  " U5      [        R,                  S9X'   US-  nMC     XS	'   UR/                  U R0                  S
US:w  a  UOSU R2                  S9nXU	'   UR5                  5         U$ s  snf )a  Run more texts through the embeddings and add to the vectorstore.

Args:
    texts: Iterable of strings to add to the vectorstore.
    metadatas: Optional list of metadatas associated with the texts.
    ids: Optional ids of each text object.
    timestamp: Optional timestamp to write new texts with.
    kwargs: vectorstore specific parameters

Returns:
    List of ids from adding the texts into the vectorstore.
r   Nr   r   Or   )r   r   r4   r]   r^   r   r\   )r   r>   r   rw   rl   r   r   ri   ro   rp   rr   r   r   rk   r   r   rJ   update_batchr   r   rm   r   rs   rg   r2   r3   rE   )rM   r   r   rz   r4   rN   r   rU   r   r   r   r   r|   r   r^   r}   s                   r   	add_textsTileDB.add_textsz  s   ( h'^^33DK@
;CHI5a3v~~aa895CIxx}++BII6((C
OC8s:'A*-rzzBGJ (&&%#,>it 	' 	
 xxV HHc)n%5VDMA%#%==h1Grxx#X Q &  -[[#,>it;;	 ! 

 $(< 
= Js   0G1z/tmp/tiledb_arrayc
                b    / nUR                  U5      nU R                  " SUUUUUUUUUU	S.
U
D6$ )a
  Construct a TileDB index from raw documents.

Args:
    texts: List of documents to index.
    embedding: Embedding function to use.
    metadatas: List of metadata dictionaries to associate with documents.
    ids: Optional ids of each text object.
    metric: Metric to use for indexing. Defaults to "euclidean".
    index_uri: The URI to write the TileDB arrays
    index_type: Optional,  Vector index type ("FLAT", IVF_FLAT")
    config: Optional, TileDB config
    index_timestamp: Optional, timestamp to write new texts with.

Example:
    .. code-block:: python

        from langchain_community import TileDB
        from langchain_community.embeddings import OpenAIEmbeddings
        embeddings = OpenAIEmbeddings()
        index = TileDB.from_texts(texts, embeddings)

r   rU   r>   r   rz   rB   rA   r:   r3   r   r   )r   _TileDB__from)r   r   r>   r   rz   rB   rA   r:   r3   r   rN   rU   s               r   
from_textsTileDB.from_texts  sX    F 
..u5
zz 
!!+
 
 	
r   c                   U Vs/ sH  oS   PM	     nnU Vs/ sH  oS   PM	     nnU R                   " SUUUUUUUUUU	S.
U
D6$ s  snf s  snf )a  Construct TileDB index from embeddings.

Args:
    text_embeddings: List of tuples of (text, embedding)
    embedding: Embedding function to use.
    index_uri: The URI to write the TileDB arrays
    metadatas: List of metadata dictionaries to associate with documents.
    metric: Optional, Metric to use for indexing. Defaults to "euclidean".
    index_type: Optional, Vector index type ("FLAT", IVF_FLAT")
    config: Optional, TileDB config
    index_timestamp: Optional, timestamp to write new texts with.

Example:
    .. code-block:: python

        from langchain_community import TileDB
        from langchain_community.embeddings import OpenAIEmbeddings
        embeddings = OpenAIEmbeddings()
        text_embeddings = embeddings.embed_documents(texts)
        text_embedding_pairs = list(zip(texts, text_embeddings))
        db = TileDB.from_embeddings(text_embedding_pairs, embeddings)
r   r   r   r   )r   )r   text_embeddingsr>   rA   r   rz   rB   r:   r3   r   rN   tr   rU   s                 r   from_embeddingsTileDB.from_embeddings  sw    J  //!1/$34OqdO
4zz 
!!+
 
 	
 04s
   AA	)rB   r3   r4   c          	         U " SUUUUUS.UD6$ )aE  Load a TileDB index from a URI.

Args:
    index_uri: The URI of the TileDB vector index.
    embedding: Embeddings to use when generating queries.
    metric: Optional, Metric to use for indexing. Defaults to "euclidean".
    config: Optional, TileDB config
    timestamp: Optional, timestamp to use for opening the arrays.
)r>   rA   rB   r3   r4   r   r   )r   rA   r>   rB   r3   r4   rN   s          r   loadTileDB.load  s/    (  

 
 	
r   c                F    U R                   R                  " S0 UD6U l         g )Nr   )rJ   consolidate_updates)rM   rN   s     r   r   TileDB.consolidate_updates7  s     --AAKFKr   )
r3   r2   r>   r@   r:   rA   rB   r4   rJ   r1   )r>   r   rA   rl   rB   rl   r1   rl   r2   rl   r3   Optional[Mapping[str, Any]]r4   r   r5   boolrN   r   )returnzOptional[Embeddings])rz   z	List[int]r{   List[float]rX   intrY   Optional[Dict[str, Any]]rZ   floatr   List[Tuple[Document, float]])r>   r   rX   r   rY   r  r   r   rN   r   r   r  )r   rl   rX   r   rY   r  r   r   rN   r   r   r  )rW   Nr   )r>   r   rX   r   rY   r  r   r   rN   r   r   List[Document])r   rl   rX   r   rY   r  r   r   rN   r   r   r  )r>   r   rX   r   r   r   r   r  rY   r  rN   r   r   r  )rW   r   r   N)r>   r   rX   r   r   r   r   r  rY   r  rN   r   r   r  )r   rl   rX   r   r   r   r   r  rY   r  rN   r   r   r  )rA   rl   r:   rl   r   r   r   znp.dtyper   r   r3   r   r   None)r   	List[str]rU   zList[List[float]]r>   r   rA   rl   r   Optional[List[dict]]rz   Optional[List[str]]rB   rl   r:   rl   r3   r   r   r   rN   r   r   r.   )Nr   )rz   r  r4   r   rN   r   r   zOptional[bool])NNr   )r   zIterable[str]r   r  rz   r  r4   r   rN   r   r   r  )r   r  r>   r   r   r  rz   r  rB   rl   rA   rl   r:   rl   r3   r   r   r   rN   r   r   r.   )r   zList[Tuple[str, List[float]]]r>   r   rA   rl   r   r  rz   r  rB   rl   r:   rl   r3   r   r   r   rN   r   r   r.   )rA   rl   r>   r   rB   rl   r3   r   r4   r   rN   r   r   r.   )rN   r   r   r  )__name__
__module____qualname____firstlineno____doc__rQ   propertyrU   r   r   r   r   r   r   r   r   r   classmethodr   DEFAULT_METRICr   r   r   r   r   r   r   __static_attributes__r   r   r   r.   r.   >   s-   & !# .205HH H 	H H H ,H H *.H HT   +/!*77 7
 7 )7 7 
&7z +/%
%
 	%

 )%
 %
 %
 
&%
V +/ 	
 )   
&F +/33 3 )	3
 3 3 
3@ +/33 3 )	3
 3 3 
3:  +/99 	9
 9 9 )9 9 
&9|  +/"3"3 "3 	"3
 "3 )"3 "3 
"3N  +/## # 	#
 # )# # 
#J  .2== = 	=
 = = ,= 
= =~  +/#'$ .2 N
N
 &N
 	N

 N
 (N
 !N
 N
 N
 ,N
 N
 N
 
N
 N
b AB&:=MP	0 +/#'55 (5 !	5
 5 5 
5n 
 +/#'$, .2 0
0
 0
 (	0

 !0
 0
 0
 0
 ,0
 0
 0
 
0
 0
d  +/#'$ .2 3
63
 3
 	3
 (3
 !3
 3
 3
 ,3
 3
 3
 
3
 3
j  %.2

 

 
 ,
 
 
 

 
8Lr   r.   )r   r   )r"   r   r   rl   )r    rl   r   rl   )-r  
__future__r   rm   r   systypingr   r   r   r   r   r	   r
   numpyro   langchain_core.documentsr   langchain_core.embeddingsr   langchain_core.utilsr   langchain_core.vectorstoresr   &langchain_community.vectorstores.utilsr   	frozensetr   r  r%   r   iinfor   maxri   finforj   
float_infor   r   r#   r&   r*   r,   r.   r   r   r   <module>r      s    , "   
 F F F  - 0 - 3 M;-("  XXbhhx()--
xx+,00NN	(
	+(
+
zL[ zLr   