GCSDirectoryLoader#
- class langchain_google_community.gcs_directory.GCSDirectoryLoader(project_name: str, bucket: str, prefix: str = '', loader_func: Callable[[str], BaseLoader] | None = None)[source]#
Load from GCS directory.
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 (Callable[[str], BaseLoader] | None) β A loader function that instantiates a loader based on a file_path argument. If nothing is provided, the GCSFileLoader would use its default loader.
Methods
__init__
(project_name,Β bucket[,Β prefix,Β ...])Initialize with bucket and key name.
A lazy loader for Documents.
aload
()Load data into Document objects.
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: Callable[[str], BaseLoader] | None = None)[source]#
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 (Callable[[str], BaseLoader] | None) β A loader function that instantiates a loader based on a file_path argument. If nothing is provided, the GCSFileLoader would use its default loader.
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- load_and_split(text_splitter: TextSplitter | None = 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]