Ë
    ‚3fi³  ã                   óV   — d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
  G d„ de«      Zy)é    )ÚCallableÚDictÚIteratorÚOptional)ÚDocument)Ú
BaseLoader)ÚTensorflowDatasetsc                   óX   — e Zd ZdZ	 	 d
dededee   deeege	f      fd„Z
dee	   fd	„Zy)ÚTensorflowDatasetLoaderaõ  Load from `TensorFlow Dataset`.

    Attributes:
        dataset_name: the name of the dataset to load
        split_name: the name of the split to load.
        load_max_docs: a limit to the number of loaded documents. Defaults to 100.
        sample_to_document_function: a function that converts a dataset sample
          into a Document

    Example:
        .. code-block:: python

            from langchain_community.document_loaders import TensorflowDatasetLoader

            def mlqaen_example_to_document(example: dict) -> Document:
                return Document(
                    page_content=decode_to_str(example["context"]),
                    metadata={
                        "id": decode_to_str(example["id"]),
                        "title": decode_to_str(example["title"]),
                        "question": decode_to_str(example["question"]),
                        "answer": decode_to_str(example["answers"]["text"][0]),
                    },
                )

            tsds_client = TensorflowDatasetLoader(
                    dataset_name="mlqa/en",
                    split_name="test",
                    load_max_docs=100,
                    sample_to_document_function=mlqaen_example_to_document,
                )

    NÚdataset_nameÚ
split_nameÚload_max_docsÚsample_to_document_functionc                 ó¸   — || _         || _        || _        	 || _        	 t	        | j                   | j                  | j                  | j                  ¬«      | _        y)a{  Initialize the TensorflowDatasetLoader.

        Args:
            dataset_name: the name of the dataset to load
            split_name: the name of the split to load.
            load_max_docs: a limit to the number of loaded documents. Defaults to 100.
            sample_to_document_function: a function that converts a dataset sample
                into a Document.
        )r   r   r   r   N)r   r   r   r   r	   Ú_tfds_client)Úselfr   r   r   r   s        úv/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_community/document_loaders/tensorflow_datasets.pyÚ__init__z TensorflowDatasetLoader.__init__,   s^   € ð  ".ˆÔØ)ˆŒØ*ˆÔØ6à'ð 	Ô(ð 	Oä.Ø×*Ñ*Ø—‘Ø×,Ñ,Ø(,×(HÑ(Hô	
ˆÕó    Úreturnc              #   óT   K  — | j                   j                  «       E d {  –—†  y 7 Œ­w)N)r   Ú	lazy_load)r   s    r   r   z!TensorflowDatasetLoader.lazy_loadL   s   è ø€ Ø×$Ñ$×.Ñ.Ó0×0Ò0ús   ‚( &¡()éd   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   Úintr   r   r   r   r   r   © r   r   r   r   	   sb   „ ñ ðL (+ØLPñ
àð
ð ð
ð   ‘}ð	
ð
 &.¨h¸°v¸xÐ7GÑ.HÑ%Ió
ð@1˜8 HÑ-ô 1r   r   N)Útypingr   r   r   r   Úlangchain_core.documentsr   Ú)langchain_community.document_loaders.baser   Ú1langchain_community.utilities.tensorflow_datasetsr	   r   r    r   r   ú<module>r%      s"   ðß 5Ó 5å -å @Ý PôD1˜jõ D1r   