Toggle Menu
Prev Up Next

# `langchain_community.document_loaders.gcs_directory`.GCSDirectoryLoader

class langchain_community.document_loaders.gcs_directory.GCSDirectoryLoader(project_name: str, bucket: str, prefix: str = '', loader_func: Optional[Callable[[str], BaseLoader]] = None, continue_on_failure: bool = False)

  [Deprecated] Load from GCS directory.

  Notes

  Deprecated since version 0.0.32.

  Initialize with bucket and key name.

  Parameters

    - project_name (str) – The ID of the project for the GCS bucket.

    - bucket (str) – The name of the GCS bucket.

    - prefix (str) – The prefix of the GCS bucket.

    - loader_func (Optional[Callable[[str], BaseLoader]]) – A loader function that instantiates a loader based on a file_path argument. If nothing is provided, the GCSFileLoader would use its default loader.

    - continue_on_failure (bool) – To use try-except block for each file within the GCS directory. If set to True, then failure to process a file will not cause an error.

  Methods

  `__init__`(project_name, bucket[, prefix, ...]) | Initialize with bucket and key name.
  `alazy_load`() | A lazy loader for Documents.
  `aload`() | Load data into Document objects.
  `lazy_load`() | A lazy loader for Documents.
  `load`() | Load documents.
  `load_and_split`([text_splitter]) | Load Documents and split into chunks.

  __init__(project_name: str, bucket: str, prefix: str = '', loader_func: Optional[Callable[[str], BaseLoader]] = None, continue_on_failure: bool = False)

    Initialize with bucket and key name.

    Parameters

      - project_name (str) – The ID of the project for the GCS bucket.

      - bucket (str) – The name of the GCS bucket.

      - prefix (str) – The prefix of the GCS bucket.

      - loader_func (Optional[Callable[[str], BaseLoader]]) – A loader function that instantiates a loader based on a file_path argument. If nothing is provided, the GCSFileLoader would use its default loader.

      - continue_on_failure (bool) – To use try-except block for each file within the GCS directory. If set to True, then failure to process a file will not cause an error.

  async alazy_load() → AsyncIterator[Document]

    A lazy loader for Documents.

    Return type

      AsyncIterator[Document]

  async aload() → List[Document]

    Load data into Document objects.

    Return type

      List[Document]

  lazy_load() → Iterator[Document]

    A lazy loader for Documents.

    Return type

      Iterator[Document]

  load() → List[Document]

    Load documents.

    Return type

      List[Document]

  load_and_split(text_splitter: Optional[TextSplitter] = None) → List[Document]

    Load Documents and split into chunks. Chunks are returned as Documents.

    Do not override this method. It should be considered to be deprecated!

    Parameters

      text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

    Returns

      List of Documents.

    Return type

      List[Document]

# Examples using GCSDirectoryLoader

- Google

- google_cloud_storage_directory.md