HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/langchain/storage/__pycache__/_lc_store.cpython-310.pyc
o

���g�	�	@sdZddlmZmZddlmZddlmZmZm	Z	ddl
mZmZddl
mZdedefd	d
�Zdedefdd�Zd
edefdd�Zd
edefdd�Zdedefdd�Zdd�dedeeegefdeeeffdd�Zdd�dedeeegefdeeeffdd�ZdS)z?Create a key-value store for any langchain serializable object.�)�Callable�Optional)�Document)�Serializable�dumps�loads)�	BaseStore�	ByteStore)�EncoderBackedStore�obj�returncCst|��d�S)�,Return a bytes representation of a document.�utf-8)r�encode�r�r�F/usr/local/lib/python3.10/dist-packages/langchain/storage/_lc_store.py�_dump_as_bytes�rcCs t|t�s	td��t|��d�S)r
zExpected a Document instancer)�
isinstancer�	TypeErrorrrrrrr�_dump_document_as_bytess
r�
serializedcCs.t|�d��}t|t�stdt|�����|S)�.Return a document from a bytes representation.rz"Expected a Document instance. Got )r�decoderrr�type)rrrrr�_load_document_from_bytess
rcCst|�d��S)rr)rr)rrrr�_load_from_bytes rr�xcCs|S)zReturn the same object.r)rrrr�	_identity%srN)�key_encoder�storer cC�t||pttt�S)aCreate a store for langchain serializable objects from a bytes store.

    Args:
        store: A bytes store to use as the underlying store.
        key_encoder: A function to encode keys; if None uses identity function.

    Returns:
        A key-value store for documents.
    )r
rrr�r!r rrr�create_lc_store-s�r$cCr")auCreate a store for langchain Document objects from a bytes store.

    This store does run time type checking to ensure that the values are
    Document objects.

    Args:
        store: A bytes store to use as the underlying store.
        key_encoder: A function to encode keys; if None uses identity function.

    Returns:
        A key-value store for documents.
    )r
rrrr#rrr�create_kv_docstoreCs�r%)�__doc__�typingrr�langchain_core.documentsr�langchain_core.loadrrr�langchain_core.storesrr	� langchain.storage.encoder_backedr
�bytesrrrr�strrr$r%rrrr�<module>s6���

����
�