
    g3fi                    X   d Z ddlmZ ddlmZmZ ddlmZ ddlmZ ddl	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mZmZmZmZ  G d
 d      Z e       Z G d d      Z G d de      Z G d de      Z G d de      Zee ed   z  df   Z!	 ed   Z"	  G d de      Z# G d de      Z$ G d de      Z%eez  e%z  e$z  Z&ee'e   z  e'e   z  e'ee df      z  dz  Z( G d de)      Z* G d  d!ed"#      Z+ G d$ d%ed"#      Z, G d& d'e      Z-d,d(Z.	 d-	 	 	 	 	 d.d)Z/ef	 	 	 	 	 d/d*Z0g d+Z1y)0a  Base classes and types for persistent key-value stores.

Stores provide long-term memory that persists across threads and conversations.
Supports hierarchical namespaces, key-value storage, and optional vector search.

Core types:
    - `BaseStore`: Store interface with sync/async operations
    - `Item`: Stored key-value pairs with metadata
    - `Op`: Get/Put/Search/List operations
    )annotations)ABCabstractmethod)Iterable)datetime)AnyLiteral
NamedTuple	TypedDictcast)
Embeddings)override)AEmbeddingsFuncEmbeddingsFuncensure_embeddingsget_text_at_pathtokenize_pathc                  *    e Zd ZdZddZedd       Zy)NotProvidedzSentinel singleton.c                     yNF selfs    [/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langgraph/store/base/__init__.py__bool__zNotProvided.__bool__(   s        c                     y)N	NOT_GIVENr   r   s    r   __repr__zNotProvided.__repr__+   s    r   N)returnzLiteral[False]r!   str)__name__
__module____qualname____doc__r   r   r    r   r   r   r   r   %   s      r   r   c                  P    e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 d	dZd
dZddZddZddZ	y)Itema  Represents a stored item with metadata.

    Args:
        value: The stored data as a dictionary. Keys are filterable.
        key: Unique identifier within the namespace.
        namespace: Hierarchical path defining the collection in which this document resides.
            Represented as a tuple of strings, allowing for nested categorization.
            For example: `("documents", 'user123')`
        created_at: Timestamp of item creation.
        updated_at: Timestamp of last update.
    valuekey	namespace
created_at
updated_atc               4   || _         || _        t        |      | _        t	        |t
              r#t        j                  t        t
        |            n|| _	        t	        |t
              r)t        j                  t        t
        |            | _
        y || _
        y N)r+   r,   tupler-   
isinstancer#   r   fromisoformatr   r.   r/   )r   r+   r,   r-   r.   r/   s         r   __init__zItem.__init__B   s     
 y) *c* ""4Z#89 	 *c* ""4Z#89 	  	r   c                .   t        |t              sy| j                  |j                  k(  xrj | j                  |j                  k(  xrO | j                  |j                  k(  xr4 | j
                  |j
                  k(  xr | j                  |j                  k(  S r   )r3   r)   r+   r,   r-   r.   r/   )r   others     r   __eq__zItem.__eq__[   s    %&JJ%++% 4EII%4%//14 5#3#334 5#3#33	
r   c                D    t        | j                  | j                  f      S r1   )hashr-   r,   r   s    r   __hash__zItem.__hash__f   s    T^^TXX.//r   c                    t        | j                        | j                  | j                  | j                  j                         | j                  j                         dS )N)r-   r,   r+   r.   r/   )listr-   r,   r+   r.   	isoformatr/   r   s    r   dictz	Item.dicti   sF    dnn-88ZZ//335//335
 	
r   c                r    ddj                  d | j                         j                         D               dS )NzItem(z, c              3  0   K   | ]  \  }}| d |  yw)=Nr   ).0kvs      r   	<genexpr>z Item.__repr__.<locals>.<genexpr>s   s      N$!QA3au Ns   ))joinr?   itemsr   s    r   r    zItem.__repr__r   s0    tyy N$))+:K:K:M NNOqQQr   N)
r+   dict[str, Any]r,   r#   r-   tuple[str, ...]r.   r   r/   r   )r7   objectr!   bool)r!   intr!   r?   r"   )
r$   r%   r&   r'   	__slots__r5   r8   r;   r?   r    r   r   r   r)   r)   3   s[    
 JI
 
 	

 #
 
 
2	
0
Rr   r)   c                  R     e Zd ZdZdZ	 d	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZd fdZ xZS )
SearchItemzMRepresents an item returned from a search operation with additional metadata.)scorec                <    t         |   |||||       || _        y)a  Initialize a result item.

        Args:
            namespace: Hierarchical path to the item.
            key: Unique identifier within the namespace.
            value: The stored value.
            created_at: When the item was first created.
            updated_at: When the item was last updated.
            score: Relevance/similarity score if from a ranked operation.
        r*   N)superr5   rS   )r   r-   r,   r+   r.   r/   rS   	__class__s          r   r5   zSearchItem.__init__{   s/    & 	!! 	 	
 
r   c                B    t         |          }| j                  |d<   |S )NrS   )rU   r?   rS   )r   resultrV   s     r   r?   zSearchItem.dict   s     **wr   r1   )r-   rK   r,   r#   r+   rJ   r.   r   r/   r   rS   float | Noner!   NonerO   )r$   r%   r&   r'   rP   r5   r?   __classcell__)rV   s   @r   rR   rR   v   sc    WI #"  	
    
8 r   rR   c                  8    e Zd ZU dZded<   	 ded<   	 dZded<   y	)
GetOpa  Operation to retrieve a specific item by its namespace and key.

    This operation allows precise retrieval of stored items using their full path
    (namespace) and unique identifier (key) combination.

    ???+ example "Examples"

        Basic item retrieval:

        ```python
        GetOp(namespace=("users", "profiles"), key="user123")
        GetOp(namespace=("cache", "embeddings"), key="doc456")
        ```
    rK   r-   r#   r,   TrM   refresh_ttlN)r$   r%   r&   r'   __annotations__r^   r   r   r   r]   r]      s1      
H Kr   r]   c                  l    e Zd ZU dZded<   	 dZded<   	 dZded	<   	 d
Zded<   	 dZded<   	 dZ	ded<   y)SearchOpaT  Operation to search for items within a specified namespace hierarchy.

    This operation supports both structured filtering and natural language search
    within a given namespace prefix. It provides pagination through limit and offset
    parameters.

    !!! note

        Natural language search support depends on your store implementation.

    ???+ example "Examples"

        Search with filters and pagination:

        ```python
        SearchOp(
            namespace_prefix=("documents",),
            filter={"type": "report", "status": "active"},
            limit=5,
            offset=10
        )
        ```

        Natural language search:

        ```python
        SearchOp(
            namespace_prefix=("users", "content"),
            query="technical documentation about APIs",
            limit=20
        )
        ```
    rK   namespace_prefixNdict[str, Any] | Nonefilter
   rN   limitr   offset
str | NonequeryTrM   r^   )
r$   r%   r&   r'   r_   rd   rf   rg   ri   r^   r   r   r   ra   ra      sb     D &%	 %)F!("H E3OBFCO:E: Kr   ra   *.)prefixsuffixc                  (    e Zd ZU dZded<   	 ded<   y)MatchConditiona  Represents a pattern for matching namespaces in the store.

    This class combines a match type (prefix or suffix) with a namespace path
    pattern that can include wildcards to flexibly match different namespace
    hierarchies.

    ???+ example "Examples"

        Prefix matching:

        ```python
        MatchCondition(match_type="prefix", path=("users", "profiles"))
        ```

        Suffix matching with wildcard:

        ```python
        MatchCondition(match_type="suffix", path=("cache", "*"))
        ```

        Simple suffix matching:

        ```python
        MatchCondition(match_type="suffix", path=("v1",))
        ```
    NamespaceMatchType
match_typeNamespacePathpathNr$   r%   r&   r'   r_   r   r   r   rn   rn   M  s    6 #"0
<r   rn   c                  P    e Zd ZU dZdZded<   	 dZded<   	 dZded	<   	 d
Zded<   y)ListNamespacesOpa  Operation to list and filter namespaces in the store.

    This operation allows exploring the organization of data, finding specific
    collections, and navigating the namespace hierarchy.

    ???+ example "Examples"

        List all namespaces under the `"documents"` path:

        ```python
        ListNamespacesOp(
            match_conditions=(MatchCondition(match_type="prefix", path=("documents",)),),
            max_depth=2
        )
        ```

        List all namespaces that end with `"v1"`:

        ```python
        ListNamespacesOp(
            match_conditions=(MatchCondition(match_type="suffix", path=("v1",)),),
            limit=50
        )
        ```

    Nz!tuple[MatchCondition, ...] | Nonematch_conditions
int | None	max_depthd   rN   rf   r   rg   )	r$   r%   r&   r'   rv   r_   rx   rf   rg   r   r   r   ru   ru   p  sF    6 ;?7>( !Iz  E31FCO6r   ru   c                  T    e Zd ZU dZded<   	 ded<   	 ded<   	 dZd	ed
<   	 dZded<   y)PutOpzOperation to store, update, or delete an item in the store.

    This class represents a single operation to modify the store's contents,
    whether adding new items, updating existing ones, or removing them.
    rK   r-   r#   r,   rc   r+   N!Literal[False] | list[str] | NoneindexrY   ttl)r$   r%   r&   r'   r_   r}   r~   r   r   r   r{   r{     sQ     4 
H !  04E,3"F Cr   r{   Nc                      e Zd ZdZy)InvalidNamespaceErrorzProvided namespace is invalid.N)r$   r%   r&   r'   r   r   r   r   r     s    (r   r   c                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)		TTLConfigz;Configuration for TTL (time-to-live) behavior in the store.rM   refresh_on_readrY   default_ttlrw   sweep_interval_minutesNrs   r   r   r   r   r   !  s*    E  '&r   r   F)totalc                  4    e Zd ZU dZded<   	 ded<   	 ded<   y)	IndexConfigzConfiguration for indexing documents for semantic search in the store.

    If not provided to the store, the store will not support vector search.
    In that case, all `index` arguments to `put()` and `aput()` operations will be ignored.
    rN   dimsz3Embeddings | EmbeddingsFunc | AEmbeddingsFunc | strembedzlist[str] | NonefieldsNrs   r   r   r   r   r   :  s/     I
 ?>EN "r   r   c                     e Zd ZU dZdZded<   dZded<   dZedd	       Z	edd
       Z
dd	 	 	 	 	 	 	 ddZdddddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 ded	 	 	 	 	 	 	 	 	 	 	 d dZd!dZdddddd	 	 	 	 	 	 	 	 	 	 	 d"dZdd	 	 	 	 	 	 	 ddZdddddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 ded	 	 	 	 	 	 	 	 	 	 	 d dZd!dZdddddd	 	 	 	 	 	 	 	 	 	 	 d"dZy)#	BaseStoreaO  Abstract base class for persistent key-value stores.

    Stores enable persistence and memory that can be shared across threads,
    scoped to user IDs, assistant IDs, or other arbitrary namespaces.
    Some implementations may support semantic search capabilities through
    an optional `index` configuration.

    Note:
        Semantic search capabilities vary by implementation and are typically
        disabled by default. Stores that support this feature can be configured
        by providing an `index` configuration at creation time. Without this
        configuration, semantic search is disabled and any `index` arguments
        to storage operations will have no effect.

        Similarly, TTL (time-to-live) support is disabled by default.
        Subclasses must explicitly set `supports_ttl = True` to enable this feature.
    FrM   supports_ttlNTTLConfig | None
ttl_config)__weakref__c                     y)a@  Execute multiple operations synchronously in a single batch.

        Args:
            ops: An iterable of operations to execute.

        Returns:
            A list of results, where each result corresponds to an operation in the input.
            The order of results matches the order of input operations.
        Nr   r   opss     r   batchzBaseStore.batch  s    r   c                   K   yw)aA  Execute multiple operations asynchronously in a single batch.

        Args:
            ops: An iterable of operations to execute.

        Returns:
            A list of results, where each result corresponds to an operation in the input.
            The order of results matches the order of input operations.
        Nr   r   s     r   abatchzBaseStore.abatch  s     s   )r^   c          
     |    | j                  t        |t        |      t        | j                  |            g      d   S )a  Retrieve a single item.

        Args:
            namespace: Hierarchical path for the item.
            key: Unique identifier within the namespace.
            refresh_ttl: Whether to refresh TTLs for the returned item.
                If `None`, uses the store's default `refresh_ttl` setting.
                If no TTL is specified, this argument is ignored.

        Returns:
            The retrieved item or `None` if not found.
        r   )r   r]   r#   _ensure_refreshr   r   r-   r,   r^   s       r   getzBaseStore.get  s;    & zz9c#h(UVW

 	r   re   r   )ri   rd   rf   rg   r^   c              p    | j                  t        |||||t        | j                  |            g      d   S )aQ  Search for items within a namespace prefix.

        Args:
            namespace_prefix: Hierarchical path prefix to search within.
            query: Optional query for natural language search.
            filter: Key-value pairs to filter results.
            limit: Maximum number of items to return.
            offset: Number of items to skip before returning results.
            refresh_ttl: Whether to refresh TTLs for the returned items.
                If no TTL is specified, this argument is ignored.

        Returns:
            List of items matching the search criteria.

        ???+ example "Examples"

            Basic filtering:

            ```python
            # Search for documents with specific metadata
            results = store.search(
                ("docs",),
                filter={"type": "article", "status": "published"}
            )
            ```

            Natural language search (requires vector store implementation):

            ```python
            # Initialize store with embedding configuration
            store = YourStore( # e.g., InMemoryStore, AsyncPostgresStore
                index={
                    "dims": 1536,  # embedding dimensions
                    "embed": your_embedding_function,  # function to create embeddings
                    "fields": ["text"]  # fields to embed. Defaults to ["$"]
                }
            )

            # Search for semantically similar documents

            results = store.search(
                ("docs",),
                query="machine learning applications in healthcare",
                filter={"type": "research_paper"},
                limit=5
            )
            ```

            !!! note

                Natural language search support depends on your store implementation
                and requires proper embedding configuration.
        r   )r   ra   r   r   r   rb   ri   rd   rf   rg   r^   s          r   searchzBaseStore.search  sJ    @ zz$#DOO[A	
  	r   r~   c                  t        |       |t        dfvr/| j                  s#t        d| j                  j
                   d      | j                  t        |t        |      ||t        | j                  |            g       y)aP
  Store or update an item in the store.

        Args:
            namespace: Hierarchical path for the item, represented as a tuple of strings.
                Example: `("documents", "user123")`
            key: Unique identifier within the namespace. Together with namespace forms
                the complete path to the item.
            value: Dictionary containing the item's data. Must contain string keys
                and JSON-serializable values.
            index: Controls how the item's fields are indexed for search:

                - None (default): Use `fields` you configured when creating the store (if any)
                    If you do not initialize the store with indexing capabilities,
                    the `index` parameter will be ignored
                - False: Disable indexing for this item
                - `list[str]`: List of field paths to index, supporting:
                    - Nested fields: `"metadata.title"`
                    - Array access: `"chapters[*].content"` (each indexed separately)
                    - Specific indices: `"authors[0].name"`
            ttl: Time to live in minutes. Support for this argument depends on your store adapter.
                If specified, the item will expire after this many minutes from when it was last accessed.
                None means no expiration. Expired runs will be deleted opportunistically.
                By default, the expiration timer refreshes on both read operations (get/search)
                and write operations (put/update), whenever the item is included in the operation.

        Note:
            Indexing support depends on your store implementation.
            If you do not initialize the store with indexing capabilities,
            the `index` parameter will be ignored.

            Similarly, TTL support depends on the specific store implementation.
            Some implementations may not support expiration of items.

        ???+ example "Examples"

            Store item. Indexing depends on how you configure the store:

            ```python
            store.put(("docs",), "report", {"memory": "Will likes ai"})
            ```

            Do not index item for semantic search. Still accessible through `get()`
            and `search()` operations but won't have a vector representation.

            ```python
            store.put(("docs",), "report", {"memory": "Will likes ai"}, index=False)
            ```

            Index specific fields for search:

            ```python
            store.put(("docs",), "report", {"memory": "Will likes ai"}, index=["memory"])
            ```
        NTTL is not supported by ?. Use a store implementation that supports TTL or set ttl=None.r}   r~   )_validate_namespaceNOT_PROVIDEDr   NotImplementedErrorrV   r$   r   r{   r#   _ensure_ttlr   r   r-   r,   r+   r}   r~   s         r   putzBaseStore.putP  s    ~ 	I&|T**43D3D%*4>>+B+B*C DP Q  	

H#DOOS9
	
r   c                T    | j                  t        |t        |      dd      g       y)zDelete an item.

        Args:
            namespace: Hierarchical path for the item.
            key: Unique identifier within the namespace.
        Nr   )r   r{   r#   r   r-   r,   s      r   deletezBaseStore.delete  s"     	

E)SXt>?@r   ry   )rk   rl   rx   rf   rg   c                   g }|r|j                  t        d|             |r|j                  t        d|             t        t        |      |||      }| j	                  |g      d   S )a  List and filter namespaces in the store.

        Used to explore the organization of data,
        find specific collections, or navigate the namespace hierarchy.

        Args:
            prefix: Filter namespaces that start with this path.
            suffix: Filter namespaces that end with this path.
            max_depth: Return namespaces up to this depth in the hierarchy.
                Namespaces deeper than this level will be truncated.
            limit: Maximum number of namespaces to return.
            offset: Number of namespaces to skip for pagination.

        Returns:
            A list of namespace tuples that match the criteria. Each tuple represents a
                full namespace path up to `max_depth`.

        ???+ example "Examples":

            Setting `max_depth=3`. Given the namespaces:

            ```python
            # Example if you have the following namespaces:
            # ("a", "b", "c")
            # ("a", "b", "d", "e")
            # ("a", "b", "d", "i")
            # ("a", "b", "f")
            # ("a", "c", "f")
            store.list_namespaces(prefix=("a", "b"), max_depth=3)
            # [("a", "b", "c"), ("a", "b", "d"), ("a", "b", "f")]
            ```
        rk   rp   rr   rl   rv   rx   rf   rg   r   )appendrn   ru   r2   r   r   rk   rl   rx   rf   rg   rv   ops           r   list_namespaceszBaseStore.list_namespaces  so    R ##NhV$TU##NhV$TU"#34	
 zz2$""r   c          
        K   | j                  t        |t        |      t        | j                  |            g       d{   d   S 7 w)zAsynchronously retrieve a single item.

        Args:
            namespace: Hierarchical path for the item.
            key: Unique identifier within the namespace.

        Returns:
            The retrieved item or `None` if not found.
        Nr   )r   r]   r#   r   r   r   s       r   agetzBaseStore.aget  sR     " ++!C'E  
 
	s   >A
 AA
c                 K   | j                  t        |||||t        | j                  |            g       d{   d   S 7 w)a  Asynchronously search for items within a namespace prefix.

        Args:
            namespace_prefix: Hierarchical path prefix to search within.
            query: Optional query for natural language search.
            filter: Key-value pairs to filter results.
            limit: Maximum number of items to return.
            offset: Number of items to skip before returning results.
            refresh_ttl: Whether to refresh TTLs for the returned items.
                If `None`, uses the store's `TTLConfig.refresh_default` setting.
                If `TTLConfig` is not provided or no TTL is specified, this argument is ignored.

        Returns:
            List of items matching the search criteria.

        ???+ example "Examples"

            Basic filtering:

            ```python
            # Search for documents with specific metadata
            results = await store.asearch(
                ("docs",),
                filter={"type": "article", "status": "published"}
            )
            ```

            Natural language search (requires vector store implementation):

            ```python
            # Initialize store with embedding configuration
            store = YourStore( # e.g., InMemoryStore, AsyncPostgresStore
                index={
                    "dims": 1536,  # embedding dimensions
                    "embed": your_embedding_function,  # function to create embeddings
                    "fields": ["text"]  # fields to embed
                }
            )

            # Search for semantically similar documents

            results = await store.asearch(
                ("docs",),
                query="machine learning applications in healthcare",
                filter={"type": "research_paper"},
                limit=5
            )
            ```

            !!! note

                Natural language search support depends on your store implementation
                and requires proper embedding configuration.
        Nr   )r   ra   r   r   r   s          r   asearchzBaseStore.asearch  sX     D ++('E	   	s   8AAAc               "  K   t        |       |t        dfvr/| j                  s#t        d| j                  j
                   d      | j                  t        |t        |      ||t        | j                  |            g       d{    y7 w)al  Asynchronously store or update an item in the store.

        Args:
            namespace: Hierarchical path for the item, represented as a tuple of strings.
                Example: `("documents", "user123")`
            key: Unique identifier within the namespace. Together with namespace forms
                the complete path to the item.
            value: Dictionary containing the item's data. Must contain string keys
                and JSON-serializable values.
            index: Controls how the item's fields are indexed for search:

                - None (default): Use `fields` you configured when creating the store (if any)
                    If you do not initialize the store with indexing capabilities,
                    the `index` parameter will be ignored
                - False: Disable indexing for this item
                - `list[str]`: List of field paths to index, supporting:
                    - Nested fields: `"metadata.title"`
                    - Array access: `"chapters[*].content"` (each indexed separately)
                    - Specific indices: `"authors[0].name"`
            ttl: Time to live in minutes. Support for this argument depends on your store adapter.
                If specified, the item will expire after this many minutes from when it was last accessed.
                None means no expiration. Expired runs will be deleted opportunistically.
                By default, the expiration timer refreshes on both read operations (get/search)
                and write operations (put/update), whenever the item is included in the operation.

        Note:
            Indexing support depends on your store implementation.
            If you do not initialize the store with indexing capabilities,
            the `index` parameter will be ignored.

            Similarly, TTL support depends on the specific store implementation.
            Some implementations may not support expiration of items.

        ???+ example "Examples"

            Store item. Indexing depends on how you configure the store:

            ```python
            await store.aput(("docs",), "report", {"memory": "Will likes ai"})
            ```

            Do not index item for semantic search. Still accessible through `get()`
            and `search()` operations but won't have a vector representation.

            ```python
            await store.aput(("docs",), "report", {"memory": "Will likes ai"}, index=False)
            ```

            Index specific fields for search (if store configured to index items):

            ```python
            await store.aput(
                ("docs",),
                "report",
                {
                    "memory": "Will likes ai",
                    "context": [{"content": "..."}, {"content": "..."}]
                },
                index=["memory", "context[*].content"]
            )
            ```
        Nr   r   r   )r   r   r   r   rV   r$   r   r{   r#   r   r   r   s         r   aputzBaseStore.aputM  s     N 	I&|T**43D3D%*4>>+B+B*C DP Q  kkH#DOOS9

 
	
 
	
s   BBBBc                l   K   | j                  t        |t        |      d      g       d{    y7 w)zAsynchronously delete an item.

        Args:
            namespace: Hierarchical path for the item.
            key: Unique identifier within the namespace.
        N)r   r{   r#   r   s      r   adeletezBaseStore.adelete  s*      kk5CHd;<===s   *424c                  K   g }|r|j                  t        d|             |r|j                  t        d|             t        t        |      |||      }| j	                  |g       d{   d   S 7 w)a  List and filter namespaces in the store asynchronously.

        Used to explore the organization of data,
        find specific collections, or navigate the namespace hierarchy.

        Args:
            prefix: Filter namespaces that start with this path.
            suffix: Filter namespaces that end with this path.
            max_depth: Return namespaces up to this depth in the hierarchy.
                Namespaces deeper than this level will be truncated to this depth.
            limit: Maximum number of namespaces to return.
            offset: Number of namespaces to skip for pagination.

        Returns:
            A list of namespace tuples that match the criteria. Each tuple represents a
                full namespace path up to `max_depth`.

        ???+ example "Examples"

            Setting `max_depth=3` with existing namespaces:
            ```python
            # Given the following namespaces:
            # ("a", "b", "c")
            # ("a", "b", "d", "e")
            # ("a", "b", "d", "i")
            # ("a", "b", "f")
            # ("a", "c", "f")

            await store.alist_namespaces(prefix=("a", "b"), max_depth=3)
            # Returns: [("a", "b", "c"), ("a", "b", "d"), ("a", "b", "f")]
            ```
        rk   r   rl   r   Nr   )r   rn   ru   r2   r   r   s           r   alist_namespaceszBaseStore.alist_namespaces  sy     R ##NhV$TU##NhV$TU"#34	
 kk2$''++'s   A,A8.A6/A8)r   zIterable[Op]r!   zlist[Result])r-   rK   r,   r#   r^   bool | Noner!   zItem | None)rb   rK   ri   rh   rd   rc   rf   rN   rg   rN   r^   r   r!   zlist[SearchItem]r1   )r-   rK   r,   r#   r+   rJ   r}   r|   r~   float | None | NotProvidedr!   rZ   )r-   rK   r,   r#   r!   rZ   )rk   NamespacePath | Nonerl   r   rx   rw   rf   rN   rg   rN   r!   zlist[tuple[str, ...]])r$   r%   r&   r'   r   r_   r   rP   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s   $ L$#'J ' I	 	 	 	  $(" 
 ! 
8 !(,#'K)K
 K &K K K !K 
Kd 48O
 +7O
"O
 O
 	O

 1O
 (O
 
O
bA (,'+ $5# %5# %	5#
 5# 5# 5# 
5#x $(" 
 ! 
B !(,#'N)N
 N &N N N !N 
Nj 48W
 +7W
"W
 W
 	W

 1W
 (W
 
W
r> (,'+ $5, %5, %	5,
 5, 5, 5, 
5,r   r   c                   | st        d      | D ]c  }t        |t              s(t        d| d|  dt        |      j                   d      d|v rt        d| d|  d      |rTt        d| d|         | d	   d
k(  rt        d|        y )NzNamespace cannot be empty.zInvalid namespace label 'z' found in z,. Namespace labels must be strings, but got .z0. Namespace labels cannot contain periods ('.').z.Namespace labels cannot be empty strings. Got z in r   	langgraphz5Root label for namespace cannot be "langgraph". Got: )r   r3   r#   typer$   )r-   labels     r   r   r     s    #$@AA %%'+E7+i[ I--1%[-A-A,B!E  %<'+E7+i[Hxy  '@tI;W  |{"#CI;O
 	
 #r   c                4    ||S | | j                  dd      S y)Nr   T)r   )r   r^   s     r   r   r     s+     ~~/66r   c                >    |t         u r| r| j                  d      S y |S )Nr   )r   r   )r   r~   s     r   r   r     s&     l>>-00Jr   )r   r)   Opr{   r]   ra   ru   rn   rq   ro   r   r   r   r   )r-   rK   r!   rZ   r1   )r   r   r^   r   r!   rM   )r   r   r~   r   r!   rY   )2r'   
__future__r   abcr   r   collections.abcr   r   typingr   r	   r
   r   r   langchain_core.embeddingsr   typing_extensionsr   langgraph.store.base.embedr   r   r   r   r   r   r   r)   rR   r]   ra   r2   r#   rq   ro   rn   ru   r{   r   r=   Result
ValueErrorr   r   r   r   r   r   r   __all__r   r   r   <module>r      s  	 # # $   1 &   }@R @RF$ $N+J +\hz hX cGCL(#-.	 /0  =Z  =F<7z <7~gJ gT X 00	T
	T*-	-U38_0E	E	L)J )	 2)5 Dh, h,V
0 >B /:	 '3 	# r   