
    D_i                       % S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  SSK	J
r
JrJrJrJrJr  SSKJr  SSKJr  SSKJr  SS	KJrJr  SS
KJr  \
(       a  SSKJrJrJrJrJ r J!r!  \RD                  " SS9r#\" S5      r$S+S jr%Sq&S\'S'   S,S jr(      S-S jr)      S.S jr*S/S jr+S0S jr,    S1S jr-    S2S jr. " S S\5      r/      S3S jr0      S4S jr1 " S S5      r2      S5S  jr3 " S! S"\5      r4S#SSS$SS%SS&.                     S6S' jjr5S7S( jr6      S5S) jr7S#SSS$SS%SS&.                     S8S* jjr8g)9z@Module contains logic for indexing documents into vector stores.    )annotationsN)islice)TYPE_CHECKINGAnyLiteral	TypedDictTypeVarcast)
BaseLoader)Document)LangChainException)DocumentIndexRecordManager)VectorStore)AsyncIterableAsyncIteratorCallableIterableIteratorSequencei  )intTc                    [         R                  " U R                  S5      SS9R                  5       n[	        [
        R                  " [        U5      5      $ )z3Hashes a string and returns the corresponding UUID.utf-8Fusedforsecurity)hashlibsha1encode	hexdigeststruuiduuid5NAMESPACE_UUID)input_string
hash_values     U/home/james-whalen/.local/lib/python3.13/site-packages/langchain_core/indexing/api.py_hash_string_to_uuidr(   ,   sB    G$eik  tzz.*566    Fbool_WARNED_ABOUT_SHA1c                 T    [         (       d  [        R                  " S[        SS9  Sq gg)z9Emit a one-time warning about SHA-1 collision weaknesses.aU  Using SHA-1 for document hashing. SHA-1 is *not* collision-resistant; a motivated attacker can construct distinct inputs that map to the same fingerprint. If this matters in your threat model, switch to a stronger algorithm such as 'blake2b', 'sha256', or 'sha512' by specifying  `key_encoder` parameter in the `index` or `aindex` function.    )category
stacklevelTN)r+   warningswarnUserWarning r)   r'   _warn_about_sha1r4   7   s1     M !		
 " r)   c               n    US:X  a
  [        5         [        X5      n[        R                  " [        U5      $ )zKHash *input_string* to a deterministic UUID using the configured algorithm.r   )r4   _calculate_hashr"   r#   r$   )r%   	algorithmr&   s      r'   _hash_stringr8   I   s-     F 9J::nj11r)   c               >    [         R                  " U SS9n[        X!S9$ )zBHash a nested dictionary to a UUID using the configured algorithm.T	sort_keysr7   )jsondumpsr8   )datar7   serialized_datas      r'   _hash_nested_dictrA   S   s     jj6O==r)   c              #  f   #    [        U5      n [        [        X 5      5      nU(       d  gUv   M"  7fzUtility batching function.N)iterlistr   )sizeiterableitchunks       r'   _batchrJ   [   s0     	hB
VB%&	 s   /1c                  #    / nU  Sh  vN n[        U5      U :  a  UR                  U5        [        U5      U :  d  M:  U7v   / nMC   N>
 U(       a  U7v   gg7frC   )lenappend)rF   rG   batchelements       r'   _abatchrP   e   sX     E! gu:LL!u:KE  s+   AAA
A.A	A
AAc                   ^  T c  S $ [        T [        5      (       a  U 4S j$ [        T 5      (       a  T $ ST  S[        T 5       S3n[	        U5      e)z$Get the source id from the document.c                    g Nr3   )_docs    r'   <lambda>)_get_source_id_assigner.<locals>.<lambda>y   s    Dr)   c                "   > U R                   T   $ rS   )metadata)docsource_id_keys    r'   rU   rV   {   s    3<<6r)   zAsource_id_key should be either None, a string or a callable. Got z	 of type .)
isinstancer!   callabletype
ValueError)rZ   msgs   ` r'   _get_source_id_assignerra   t   sc       -%%66oYtM':&;1	>  S/r)   c              #     #    [        5       nU  H>  nUR                  U;  d  M  UR                  [        SUR                  5      5        Uv   M@     g7f)z>Deduplicate a list of hashed documents while preserving order.r!   N)setidaddr
   )hashed_documentsseen
hashed_docs      r'   _deduplicate_in_orderri      sC      UD&
==$ HHT%/0 's
   A.Ac                      \ rS rSrSrSrg)IndexingException   z(Raised when an indexing operation fails.r3   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r3   r)   r'   rk   rk      s    2r)   rk   c                0   US:X  aV  [         R                  " U R                  S5      SS9R                  5       n[	        [
        R                  " [        U5      5      $ US:X  a3  [         R                  " U R                  S5      5      R                  5       $ US:X  a3  [         R                  " U R                  S5      5      R                  5       $ US:X  a3  [         R                  " U R                  S5      5      R                  5       $ SU 3n[        U5      e)	z8Return a hexadecimal digest of *text* using *algorithm*.r   r   Fr   blake2bsha256sha512zUnsupported hashing algorithm: )r   r   r   r    r!   r"   r#   r$   rt   ru   rv   r_   )textr7   digestr`   s       r'   r6   r6      s     Fdkk'2EJTTV4::nf566It{{734>>@@H~~dkk'23==??H~~dkk'23==??+I;
7C
S/r)   c               t   [        U R                  =(       d    0 5      n[        U5      (       a	  U" U 5      nO?[        U R                  US9n [
        R                  " USS9n[        XQS9n[        XH-   US9n[        UU R                  U R                  S9$ ! [         a  nSU S3n[        U5      UeSnAff = f)a  Calculate a hash of the document, and assign it to the uid.

When using one of the predefined hashing algorithms, the hash is calculated
by hashing the content and the metadata of the document.

Args:
    document: Document to hash.
    key_encoder: Hashing algorithm to use for hashing the document.
        If not provided, a default encoder using SHA-1 will be used.
        SHA-1 is not collision-resistant, and a motivated attacker
        could craft two different texts that hash to the
        same cache key.

        New applications should use one of the alternative encoders
        or provide a custom and strong key encoder function to avoid this risk.

        When changing the key encoder, you must change the
        index as well to avoid duplicated documents in the cache.

Raises:
    ValueError: If the metadata cannot be serialized using json.

Returns:
    Document with a unique identifier based on the hash of the content and metadata.
r<   Tr:   zFailed to hash metadata: z6. Please use a dict that can be serialized using json.N)rd   page_contentrX   )
dictrX   r]   r6   rz   r=   r>   	Exceptionr_   r   )	documentkey_encoderrX   hash_content_hashserialized_metaer`   metadata_hashs	            r'   _get_document_with_hashr      s    >  $H$5$5$;<HH% 'x'<'<T	)"jjTBO (O <T**""	   	)+A3 /G H  S/q(	)s   B 
B7 B22B7c                      \ rS rSrSS jrSrg)_HashedDocument   c                    Sn[        U5      e)z-Raise an error if this class is instantiated.z_HashedDocument is an internal abstraction that was deprecated in  langchain-core 0.3.63. This abstraction is marked as private and  should not have been used directly. If you are seeing this error, please  update your code appropriately.)NotImplementedError)selfargskwargsr`   s       r'   __init___HashedDocument.__init__   s    / 	 "#&&r)   r3   N)r   r   r   r   returnNone)rm   rn   ro   rp   r   rr   r3   r)   r'   r   r      s    'r)   r   c                8   [        U [        5      (       a(  U R                  U5      nUb  USL a  Sn[        U5      egg[        U [        5      (       a/  U R                  U5      nSU;   a  US   S:  a  Sn[        U5      eggS[        U 5       S3n[        U5      e)	aX  Delete documents from a vector store or document index by their IDs.

Args:
    vector_store: The vector store or document index to delete from.
    ids: List of document IDs to delete.

Raises:
    IndexingException: If the delete operation fails.
    TypeError: If the `vector_store` is neither a `VectorStore` nor a
        `DocumentIndex`.
NF+The delete operation to VectorStore failed.
num_failedr   -The delete operation to DocumentIndex failed.CVectorstore should be either a VectorStore or a DocumentIndex. Got r[   )r\   r   deleterk   r   r^   	TypeErrorvector_storeids	delete_okr`   delete_responses        r'   _deleter      s     ,,, '',	 Y%%7?C#C(( &8  
L-	0	0&--c2?*|/Lq/PAC#C(( 0Q*
%&a) 	 nr)   c                  H    \ rS rSr% SrS\S'    S\S'    S\S'    S\S'   Srg	)
IndexingResulti  zFReturn a detailed a breakdown of the result of the indexing operation.r   	num_addednum_updatednum_deletednum_skippedr3   N)rm   rn   ro   rp   rq   __annotations__rr   r3   r)   r'   r   r     s(    PN$G&Kr)   r   d   i  r   )
batch_sizecleanuprZ   cleanup_batch_sizeforce_updater~   upsert_kwargsc               V
   US:X  a
  [        5         US;  a  SU S3n
[        U
5      eUS;   a  Uc  Sn
[        U
5      eUn[        U[        5      (       ae  SS	/nU H&  n[	        X5      (       a  M  S
U SU 3n
[        U
5      e   [        U5      R                  [        R                  :X  a  Sn
[        U
5      eO0[        U[        5      (       a  OS[        U5       S3n
[        U
5      e[        U [        5      (       a   U R                  5       nO[        U 5      n[        U5      nUR                  5       nSnSnSnSn[!        5       n[#        X>5       GH
  n[%        U5      n['        [)        U Vs/ s H  n[+        UUS9PM     sn5      5      nUU[%        U5      -
  -  nU Vs/ s H  nU" U5      PM     nnUS;   a[  [-        UUSS9 H@  u  nnUc  SUR.                  SS  S3n
[        U
5      eUS:X  d  M/  UR1                  U5        MB     [3        SU5      nUR5                  [3        SU Vs/ s H  nUR6                  PM     sn5      5      n/ n/ n/ n [!        5       n![-        UUSS9 Hq  u  nn"[3        SUR6                  5      n#U"(       a,  U(       a  U!R1                  U#5        OU R9                  U#5        MO  UR9                  U#5        UR9                  U5        Ms     U (       a  UR;                  U US9  U[%        U 5      -  nU(       a  [        U[        5      (       a   UR<                  " U4UUS.U	=(       d    0 D6  O1[        U[        5      (       a  UR>                  " U40 U	=(       d    0 D6  U[%        U5      [%        U!5      -
  -  nU[%        U!5      -  nUR;                  [3        SU Vs/ s H  nUR6                  PM     sn5      UUS9  US:X  d  GM  U H  nUb  M  Sn
[A        U
5      e   [3        SU5      n$URC                  U$UUS9=n%(       d  GM  [E        UU%5        URG                  U%5        U[%        U%5      -  nURC                  U$UUS9=n%(       a  ME  GM     US:X  d  US:X  aw  U(       ap  Sn&US:X  a  ['        U5      n&URC                  U&UUS9=n%(       aE  [E        UU%5        URG                  U%5        U[%        U%5      -  nURC                  U&UUS9=n%(       a  ME  UUUUS.$ ! [         a    [        U R                  5       5      n GNf = fs  snf s  snf s  snf s  snf ) a*  Index data from the loader into the vector store.

Indexing functionality uses a manager to keep track of which documents
are in the vector store.

This allows us to keep track of which documents were updated, and which
documents were deleted, which documents should be skipped.

For the time being, documents are indexed using their hashes, and users
are not able to specify the uid of the document.

!!! warning "Behavior changed in `langchain-core` 0.3.25"

    Added `scoped_full` cleanup mode.

!!! warning

    * In full mode, the loader should be returning
        the entire dataset, and not just a subset of the dataset.
        Otherwise, the auto_cleanup will remove documents that it is not
        supposed to.
    * In incremental mode, if documents associated with a particular
        source id appear across different batches, the indexing API
        will do some redundant work. This will still result in the
        correct end state of the index, but will unfortunately not be
        100% efficient. For example, if a given document is split into 15
        chunks, and we index them using a batch size of 5, we'll have 3 batches
        all with the same source id. In general, to avoid doing too much
        redundant work select as big a batch size as possible.
    * The `scoped_full` mode is suitable if determining an appropriate batch size
        is challenging or if your data loader cannot return the entire dataset at
        once. This mode keeps track of source IDs in memory, which should be fine
        for most use cases. If your dataset is large (10M+ docs), you will likely
        need to parallelize the indexing process regardless.

Args:
    docs_source: Data loader or iterable of documents to index.
    record_manager: Timestamped set to keep track of which documents were
        updated.
    vector_store: `VectorStore` or DocumentIndex to index the documents into.
    batch_size: Batch size to use when indexing.
    cleanup: How to handle clean up of documents.

        - incremental: Cleans up all documents that haven't been updated AND
            that are associated with source IDs that were seen during indexing.
            Clean up is done continuously during indexing helping to minimize the
            probability of users seeing duplicated content.
        - full: Delete all documents that have not been returned by the loader
            during this run of indexing.
            Clean up runs after all documents have been indexed.
            This means that users may see duplicated content during indexing.
        - scoped_full: Similar to Full, but only deletes all documents
            that haven't been updated AND that are associated with
            source IDs that were seen during indexing.
        - None: Do not delete any documents.
    source_id_key: Optional key that helps identify the original source
        of the document.
    cleanup_batch_size: Batch size to use when cleaning up documents.
    force_update: Force update documents even if they are present in the
        record manager. Useful if you are re-indexing with updated embeddings.
    key_encoder: Hashing algorithm to use for hashing the document content and
        metadata. Options include "blake2b", "sha256", and "sha512".

        !!! version-added "Added in `langchain-core` 0.3.66"

    key_encoder: Hashing algorithm to use for hashing the document.
        If not provided, a default encoder using SHA-1 will be used.
        SHA-1 is not collision-resistant, and a motivated attacker
        could craft two different texts that hash to the
        same cache key.

        New applications should use one of the alternative encoders
        or provide a custom and strong key encoder function to avoid this risk.

        When changing the key encoder, you must change the
        index as well to avoid duplicated documents in the cache.
    upsert_kwargs: Additional keyword arguments to pass to the add_documents
        method of the `VectorStore` or the upsert method of the DocumentIndex.
        For example, you can use this to specify a custom vector_field:
        upsert_kwargs={"vector_field": "embedding"}
        !!! version-added "Added in `langchain-core` 0.3.10"

Returns:
    Indexing result which contains information about how many documents
    were added, updated, deleted, or skipped.

Raises:
    ValueError: If cleanup mode is not one of 'incremental', 'full' or None
    ValueError: If cleanup mode is incremental and source_id_key is None.
    ValueError: If `VectorStore` does not have
        "delete" and "add_documents" required methods.
    ValueError: If source_id_key is not None, but is not a string or callable.
    TypeError: If `vectorstore` is not a `VectorStore` or a DocumentIndex.
    AssertionError: If `source_id` is None when cleanup mode is incremental.
        (should be unreachable code).
r   >   Nfullincrementalscoped_fullKcleanup should be one of 'incremental', 'full', 'scoped_full' or None. Got r[   >   r   r   NJSource id key is required when cleanup mode is incremental or scoped_full.r   add_documentsVectorstore  does not have required method z1Vectorstore has not implemented the delete methodr   r   r~   FstrictlSource IDs are required when cleanup mode is incremental or scoped_full. Document that starts with content: r    was not assigned as source id.r   Sequence[str]r!   time_at_leastr   r   	group_idsr   r   Asource_id cannot be None at this point. Reached unreachable code.r   beforelimitr   r   r   r   r   )$r4   r_   r\   r   hasattrr^   r   r   r   r   	lazy_loadr   rD   loadra   get_timerc   rJ   rL   rE   ri   r   ziprz   re   r
   existsrd   rM   updater   upsertAssertionError	list_keysr   delete_keys)'docs_sourcerecord_managerr   r   r   rZ   r   r   r~   r   r`   destinationmethodsmethoddoc_iteratorsource_id_assignerindex_start_dtr   r   r   r   scoped_full_cleanup_source_ids	doc_batchoriginal_batch_sizerY   hashed_docsrh   
source_ids	source_idexists_batchuidsdocs_to_indexuids_to_refresh	seen_docs
doc_exists	hashed_idsource_ids_uids_to_deletedelete_group_idss'                                          r'   indexr   "  s   ` fBB)1 	 o11}7LX 	 oK +{++_-F;//";-/NvhW  !o%  ##{'9'99 FCS/!	 :
 
K	/	/$%Q( 	 n+z**	4&002L K(0? $,,.NIKKK/2u"J5	!)n!  )( ,C[I(
 	*S-=== >I,
=Hzz*[ 	 ,
 44),ZU)S%	:$$ %/$;$;DS$A#B C9:  %S/)m+266yA *T oz:J%,,["A[c366["AB

 !e	&)+|E&R"J
UJMM2IMM),#**95KK	"  , 'S !!/!P3//K +{33))!) %*	 K77""!$*
 ]+c)n<<I3y>)K
 	["A[c366["AB ( 	 	
 m# (	$4  )-- ( 
;K$2$<$<%nDV %= % .   ^4**>:s>22 %3$<$<%nDV %= % .  Q 6b &= %C15m##$BC . 8 8&~EW !9 !
 
n 
 K0&&~63~..K !/ 8 8&~EW !9 !
 
n 
 """	 _ # 	4 0 0 23L	4*,
, #B^ #Bs*    S- 1T%T/T!/T&-#TTc               (   #    U  H  nU7v   M
     g7f)z)Convert an iterable to an async iterator.Nr3   )iteratoritems     r'   _to_async_iteratorr   Y  s     
 s   c                h  #    [        U [        5      (       a0  U R                  U5      I S h  vN nUb  USL a  Sn[        U5      eg g [        U [        5      (       a7  U R                  U5      I S h  vN nSU;   a  US   S:  a  Sn[        U5      eg g S[        U 5       S3n[        U5      e N N>7f)NFr   r   r   r   r   r[   )r\   r   adeleterk   r   r^   r   r   s        r'   _adeleter   _  s      ,,,&..s33	 Y%%7?C#C(( &8  
L-	0	0 , 4 4S 99?*|/Lq/PAC#C(( 0Q*
%&a) 	 n 4
 :s"   *B2B.AB21B02=B20B2c                 #    US:X  a
  [        5         US;  a  SU S3n
[        U
5      eUS;   a  Uc  Sn
[        U
5      eUn[        U[        5      (       a  SS	/nU H&  n[	        X5      (       a  M  S
U SU 3n
[        U
5      e   [        U5      R                  [        R                  :X  a4  [        U5      R                  [        R                  :X  a  Sn
[        U
5      eO0[        U[        5      (       a  OS[        U5       S3n
[        U
5      e[        U [        5      (       a   U R                  5       nO[	        U S5      (       a  U nO[        U 5      n[        U5      nUR!                  5       I Sh  vN nSnSnSnSn[#        5       n[%        X>5        Sh  vN n['        U5      n[)        [+        U Vs/ s H  n[-        UUS9PM     sn5      5      nUU['        U5      -
  -  nU Vs/ s H  nU" U5      PM     nnUS;   a[  [/        UUSS9 H@  u  nnUc  SUR0                  SS  S3n
[        U
5      eUS:X  d  M/  UR3                  U5        MB     [5        SU5      nUR7                  [5        SU Vs/ s H  nUR8                  PM     sn5      5      I Sh  vN n/ n/ n/ n [#        5       n![/        UUSS9 Hq  u  nn"[5        SUR8                  5      n#U"(       a,  U(       a  U!R3                  U#5        OU R;                  U#5        MO  UR;                  U#5        UR;                  U5        Ms     U (       a&  UR=                  U US9I Sh  vN   U['        U 5      -  nU(       a  [        U[        5      (       a(  UR>                  " U4UUS.U	=(       d    0 D6I Sh  vN   O9[        U[        5      (       a$  UR@                  " U40 U	=(       d    0 D6I Sh  vN   U['        U5      ['        U!5      -
  -  nU['        U!5      -  nUR=                  [5        SU Vs/ s H  nUR8                  PM     sn5      UUS9I Sh  vN   US:X  d  GM  U H  nUb  M  Sn
[C        U
5      e   [5        SU5      n$URE                  U$UUS9I Sh  vN =n%(       d  GM  [G        UU%5      I Sh  vN   URI                  U%5      I Sh  vN   U['        U%5      -  nURE                  U$UUS9I Sh  vN =n%(       a  M]  GMZ  ! [         a    [        U R                  5       5      n GNf = f GN GNs  snf s  snf s  snf  GN GN GN GNds  snf  GN N N N Ni
 US:X  d  US:X  a  U(       a  Sn&US:X  a  [)        U5      n&URE                  U&UUS9I Sh  vN  =n%(       a`  [G        UU%5      I Sh  vN    URI                  U%5      I Sh  vN    U['        U%5      -  nURE                  U&UUS9I Sh  vN  =n%(       a  M`  UUUUS .$ 7f)!a@  Async index data from the loader into the vector store.

Indexing functionality uses a manager to keep track of which documents
are in the vector store.

This allows us to keep track of which documents were updated, and which
documents were deleted, which documents should be skipped.

For the time being, documents are indexed using their hashes, and users
are not able to specify the uid of the document.

!!! warning "Behavior changed in `langchain-core` 0.3.25"

    Added `scoped_full` cleanup mode.

!!! warning

    * In full mode, the loader should be returning
        the entire dataset, and not just a subset of the dataset.
        Otherwise, the auto_cleanup will remove documents that it is not
        supposed to.
    * In incremental mode, if documents associated with a particular
        source id appear across different batches, the indexing API
        will do some redundant work. This will still result in the
        correct end state of the index, but will unfortunately not be
        100% efficient. For example, if a given document is split into 15
        chunks, and we index them using a batch size of 5, we'll have 3 batches
        all with the same source id. In general, to avoid doing too much
        redundant work select as big a batch size as possible.
    * The `scoped_full` mode is suitable if determining an appropriate batch size
        is challenging or if your data loader cannot return the entire dataset at
        once. This mode keeps track of source IDs in memory, which should be fine
        for most use cases. If your dataset is large (10M+ docs), you will likely
        need to parallelize the indexing process regardless.

Args:
    docs_source: Data loader or iterable of documents to index.
    record_manager: Timestamped set to keep track of which documents were
        updated.
    vector_store: `VectorStore` or DocumentIndex to index the documents into.
    batch_size: Batch size to use when indexing.
    cleanup: How to handle clean up of documents.

        - incremental: Cleans up all documents that haven't been updated AND
            that are associated with source IDs that were seen during indexing.
            Clean up is done continuously during indexing helping to minimize the
            probability of users seeing duplicated content.
        - full: Delete all documents that have not been returned by the loader
            during this run of indexing.
            Clean up runs after all documents have been indexed.
            This means that users may see duplicated content during indexing.
        - scoped_full: Similar to Full, but only deletes all documents
            that haven't been updated AND that are associated with
            source IDs that were seen during indexing.
        - None: Do not delete any documents.
    source_id_key: Optional key that helps identify the original source
        of the document.
    cleanup_batch_size: Batch size to use when cleaning up documents.
    force_update: Force update documents even if they are present in the
        record manager. Useful if you are re-indexing with updated embeddings.
    key_encoder: Hashing algorithm to use for hashing the document content and
        metadata. Options include "blake2b", "sha256", and "sha512".

        !!! version-added "Added in `langchain-core` 0.3.66"

    key_encoder: Hashing algorithm to use for hashing the document.
        If not provided, a default encoder using SHA-1 will be used.
        SHA-1 is not collision-resistant, and a motivated attacker
        could craft two different texts that hash to the
        same cache key.

        New applications should use one of the alternative encoders
        or provide a custom and strong key encoder function to avoid this risk.

        When changing the key encoder, you must change the
        index as well to avoid duplicated documents in the cache.
    upsert_kwargs: Additional keyword arguments to pass to the add_documents
        method of the `VectorStore` or the upsert method of the DocumentIndex.
        For example, you can use this to specify a custom vector_field:
        upsert_kwargs={"vector_field": "embedding"}
        !!! version-added "Added in `langchain-core` 0.3.10"

Returns:
    Indexing result which contains information about how many documents
    were added, updated, deleted, or skipped.

Raises:
    ValueError: If cleanup mode is not one of 'incremental', 'full' or None
    ValueError: If cleanup mode is incremental and source_id_key is None.
    ValueError: If `VectorStore` does not have
        "adelete" and "aadd_documents" required methods.
    ValueError: If source_id_key is not None, but is not a string or callable.
    TypeError: If `vector_store` is not a `VectorStore` or DocumentIndex.
    AssertionError: If `source_id_key` is None when cleanup mode is
        incremental or `scoped_full` (should be unreachable).
r   >   Nr   r   r   r   r[   >   r   r   Nr   r   aadd_documentsr   r   z<Vectorstore has not implemented the adelete or delete methodr   	__aiter__r   r   Fr   r   r   r   r   r   r!   r   r   r   r   r   r   r   r   )%r4   r_   r\   r   r   r^   r   r   r   r   r   
alazy_loadr   r   r   ra   	aget_timerc   rP   rL   rE   ri   r   r   rz   re   r
   aexistsrd   rM   aupdater   aupsertr   
alist_keysr   adelete_keys)'r   r   r   r   r   rZ   r   r   r~   r   r`   r   r   r   async_doc_iteratorr   r   r   r   r   r   r   r   r   rY   r   r   r   rh   r   r   r   r   r   r   r   r   r   r   s'                                          r'   aindexr   u  s    ` fBB)1 	 o11}7LX 	 oK +{++ ./F;//";-/NvhW  !o%  %%)<)<<[!((K,>,>> QCS/!	K	/	/$%Q( 	 n+z**	H!,!7!7!9 
k	*	*(/<0? *3355NIKKK/2u"":B p3i!)n!  )( ,C[I(
 	*S-=== 0;,
/:s#{ 	 ,
 44),ZU)S%	:$$ %/$;$;DS$A#B C9:  %S/)m+266yA *T oz:J+33["A[c366["AB
 

 (*!e	&)+|E&R"J
UJMM2IMM),#**95KK	"  , 'S  (((WWW3//K +{33!00!) %*	   K77!))!$*   ]+c)n<<I3y>)K
 $$["A[c366["AB ( % 
 	
 	
 m#
 (	$4  )-- ( 
;K*8*C*C%nDV +D + % .   {N;;;$11.AAAs>22 +9*C*C%nDV +D + % .   # 	H "4K4D4D4F!G	H 6p3,
, #B
, X #B	
.% <A%S Cd &= %C15m##$BC&4&?&?&~EW '@ '
 !
 !
 
n 
 ;777 --n===3~..K '5&?&?&~EW '@ '
 !
 !
 
n 
 """	 s  A,W=2B6W=)S3 9>W=7T8!W=UT U!W=;T# W=/T(>W=6W=9T-W=T2B.W=T5AW=T89W=T;AW=T>/W==U>W=W=/W=U	W=W="U#W=;U
<&W="U#W=0W=3#TW=TW= U#W=5W=8W=;W=>W=W=W=
W=W=;W=	V
W=%V(&W=?W 'W='W*(W=6W=)r%   r!   r   r!   )r   r   )r%   r!   r7   .Literal['sha1', 'sha256', 'sha512', 'blake2b']r   	uuid.UUID)r?   zdict[Any, Any]r7   r   r   r   )rF   r   rG   Iterable[T]r   zIterator[list[T]])rF   r   rG   zAsyncIterable[T]r   zAsyncIterator[list[T]])rZ   &str | Callable[[Document], str] | Noner   z Callable[[Document], str | None])rf   zIterable[Document]r   zIterator[Document])rw   r!   r7   r   r   r!   )r}   r   r~   zJCallable[[Document], str] | Literal['sha1', 'sha256', 'sha512', 'blake2b']r   r   )r   VectorStore | DocumentIndexr   z	list[str]r   r   )r   zBaseLoader | Iterable[Document]r   r   r   r   r   r   r   4Literal['incremental', 'full', 'scoped_full'] | NonerZ   r   r   r   r   r*   r~   JLiteral['sha1', 'sha256', 'sha512', 'blake2b'] | Callable[[Document], str]r   dict[str, Any] | Noner   r   )r   r   r   zAsyncIterator[T])r   z9BaseLoader | Iterable[Document] | AsyncIterator[Document]r   r   r   r   r   r   r   r   rZ   r   r   r   r   r*   r~   r  r   r  r   r   )9rq   
__future__r   r   r=   r"   r0   	itertoolsr   typingr   r   r   r   r	   r
   $langchain_core.document_loaders.baser   langchain_core.documentsr   langchain_core.exceptionsr   langchain_core.indexing.baser   r   langchain_core.vectorstoresr   collections.abcr   r   r   r   r   r   UUIDr$   r   r(   r+   r   r4   r8   rA   rJ   rP   ra   ri   rk   r6   r   r   r   r   r   r   r   r   r3   r)   r'   <module>r     s   F "       < - 8 E 3  t$ CL7 ! D  "$22%S22>
>(V>>9%"(3* 3
H$7757
 7x	' 	'-	 
H
LY 
L$ DH<@#"(+/s0s!s .s
 s Bs :s s s s )s sn	-	 
6 DH<@#"(+/J! .
  B :    ) r)   