langchain.document_loaders.googledrive.GoogleDriveLoader¶

class langchain.document_loaders.googledrive.GoogleDriveLoader(*, service_account_key: Path = PosixPath('/home/docs/.credentials/keys.json'), credentials_path: Path = PosixPath('/home/docs/.credentials/credentials.json'), token_path: Path = PosixPath('/home/docs/.credentials/token.json'), folder_id: Optional[str] = None, document_ids: Optional[List[str]] = None, file_ids: Optional[List[str]] = None, recursive: bool = False, file_types: Optional[Sequence[str]] = None, load_trashed_files: bool = False, file_loader_cls: Any = None, file_loader_kwargs: Dict[str, Any] = {})[source]¶

Bases: BaseLoader, BaseModel

Loads Google Docs from Google Drive.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param credentials_path: pathlib.Path = PosixPath('/home/docs/.credentials/credentials.json')¶

Path to the credentials file.

param document_ids: Optional[List[str]] = None¶

The document ids to load from.

param file_ids: Optional[List[str]] = None¶

The file ids to load from.

param file_loader_cls: Any = None¶

The file loader class to use.

param file_loader_kwargs: Dict[str, Any] = {}¶

The file loader kwargs to use.

param file_types: Optional[Sequence[str]] = None¶

The file types to load. Only applies when folder_id is given.

param folder_id: Optional[str] = None¶

The folder id to load from.

param load_trashed_files: bool = False¶

Whether to load trashed files. Only applies when folder_id is given.

param recursive: bool = False¶

Whether to load recursively. Only applies when folder_id is given.

param service_account_key: pathlib.Path = PosixPath('/home/docs/.credentials/keys.json')¶

Path to the service account key file.

param token_path: pathlib.Path = PosixPath('/home/docs/.credentials/token.json')¶

Path to the token file.

lazy_load() Iterator[Document]¶

A lazy loader for Documents.

load() List[Document][source]¶

Load documents.

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

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

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

validator validate_credentials_path  »  credentials_path[source]¶

Validate that credentials_path exists.

validator validate_inputs  »  all fields[source]¶

Validate that either folder_id or document_ids is set, but not both.

Examples using GoogleDriveLoader¶