Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions libs/community/langchain_google_community/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ def import_bigquery() -> Any:


class BigQueryLoader(BaseLoader):
"""Load from the Google Cloud Platform `BigQuery`.
"""Load documents from Google Cloud BigQuery.

Each document represents one row of the result. The `page_content_columns`
are written into the `page_content` of the document. The `metadata_columns`
are written into the `metadata` of the document. By default, all columns
are written into the `page_content` and none into the `metadata`.
Inherits from [`BaseLoader`][langchain_core.document_loaders.BaseLoader].
Each row becomes a document. Columns can be mapped to `page_content` or
`metadata`. By default, all columns map to `page_content`.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[bigquery]
```
"""

def __init__(
Expand All @@ -48,8 +52,8 @@ def __init__(
document.
credentials: Optional. Credentials for accessing Google APIs. Use this
parameter to override default credentials, such as to use Compute Engine
(``google.auth.compute_engine.Credentials``) or Service Account
(``google.oauth2.service_account.Credentials``) credentials directly.
(`google.auth.compute_engine.Credentials`) or Service Account
(`google.oauth2.service_account.Credentials`) credentials directly.
"""
import_bigquery()
self.query = query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class CreateEventSchema(BaseModel):
"""Input for CalendarCreateEvent."""
"""Input schema for `CalendarCreateEvent`."""

summary: str = Field(..., description="The title of the event.")
start_datetime: str = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class CurrentDatetimeSchema(BaseModel):
"""Input for GetCurrentDatetime."""
"""Input schema for `GetCurrentDatetime`."""

calendar_id: Optional[str] = Field(
default="primary", description="The calendar ID. Defaults to 'primary'."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class DeleteEventSchema(BaseModel):
"""Input for CalendarDeleteEvent."""
"""Input schema for `CalendarDeleteEvent`."""

event_id: str = Field(..., description="The event ID to delete.")
calendar_id: Optional[str] = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class MoveEventSchema(BaseModel):
"""Input for CalendarMoveEvent."""
"""Input schema for `CalendarMoveEvent`."""

event_id: str = Field(..., description="The event ID to move.")
origin_calendar_id: str = Field(..., description="The origin calendar ID.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class SearchEventsSchema(BaseModel):
"""Input for CalendarSearchEvents."""
"""Input schema for `CalendarSearchEvents`."""

calendars_info: str = Field(
...,
Expand Down
16 changes: 10 additions & 6 deletions libs/community/langchain_google_community/calendar/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@
class CalendarToolkit(BaseToolkit):
"""Toolkit for interacting with Google Calendar.

*Security Note*: This toolkit contains tools that can read and modify
the state of a service; e.g., by reading, creating, updating, deleting
data associated with this service.
Provides tools for calendar operations including creating, searching,
updating, moving, and deleting events.

For example, this toolkit can be used to create events on behalf of the
associated account.
!!! warning "Security"
This toolkit contains tools that can read and modify the state of a
service. For example, it can create, update, and delete calendar events
on behalf of the associated account.

See https://python.langchain.com/docs/security for more information.
See [Security Best Practices](https://python.langchain.com/docs/security)
Copy link
Collaborator

@mdrxy mdrxy Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update this (and all other links) once the security page is ported (cc @eyurtsev)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added TODO comments in calendar/toolkit.py and
gmail/toolkit.py to update these links once the security page is ported.

for more information.
"""

# TODO: update to site-relative /security/ after docs are ported

api_resource: Resource = Field(default_factory=build_calendar_service)

model_config = ConfigDict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class UpdateEventSchema(BaseModel):
"""Input for CalendarUpdateEvent."""
"""Input schema for `CalendarUpdateEvent`."""

event_id: str = Field(..., description="The event ID to update.")
calendar_id: str = Field(
Expand Down
16 changes: 13 additions & 3 deletions libs/community/langchain_google_community/docai.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,20 @@ class DocAIParsingResults:


class DocAIParser(BaseBlobParser):
"""`Google Cloud Document AI` parser.
"""Google Cloud Document AI parser.

For a detailed explanation of Document AI, refer to the product documentation.
https://cloud.google.com/document-ai/docs/overview
Inherits from [`BaseBlobParser`][langchain_core.document_loaders.BaseBlobParser].
Parses documents using Google Cloud Document AI for text extraction and
layout analysis.

See [Document AI documentation](https://cloud.google.com/document-ai/docs/overview)
for detailed information.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[docai]
```
"""

def __init__(
Expand Down
17 changes: 12 additions & 5 deletions libs/community/langchain_google_community/documentai_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@


class DocumentAIWarehouseRetriever(BaseRetriever):
"""A retriever based on Document AI Warehouse.
"""Retriever for Google Cloud Document AI Warehouse.

Documents should be created and documents should be uploaded
in a separate flow, and this retriever uses only Document AI
schema_id provided to search for relevant documents.
Inherits from [`BaseRetriever`][langchain_core.retrievers.BaseRetriever].
Searches documents using Document AI Warehouse schema. Documents must be
created and uploaded separately before retrieval.

More info: https://cloud.google.com/document-ai-warehouse.
See [Document AI Warehouse documentation](https://cloud.google.com/document-ai-warehouse)
for more information.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[docai]
```
"""

location: str = "us"
Expand Down
12 changes: 11 additions & 1 deletion libs/community/langchain_google_community/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@


class GoogleDriveLoader(BaseLoader, BaseModel):
"""Load Google Docs from `Google Drive`."""
"""Load documents from Google Drive.

Inherits from [`BaseLoader`][langchain_core.document_loaders.BaseLoader].
Supports loading from folders, specific documents, or file IDs with authentication.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[drive]
```
"""

# Generated from https://developers.google.com/drive/api/guides/api-specific-auth
# limiting to the scopes that are required to read the files
Expand Down
12 changes: 11 additions & 1 deletion libs/community/langchain_google_community/gcs_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@


class GCSDirectoryLoader(BaseLoader):
"""Load from GCS directory."""
"""Load documents from Google Cloud Storage directory.

Inherits from [`BaseLoader`][langchain_core.document_loaders.BaseLoader].
Loads all files from a GCS bucket with optional prefix filtering.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[gcs]
```
"""

def __init__(
self,
Expand Down
32 changes: 24 additions & 8 deletions libs/community/langchain_google_community/gcs_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@


class GCSFileLoader(BaseLoader):
"""Load from GCS file."""
"""Load documents from Google Cloud Storage file.

Inherits from [`BaseLoader`][langchain_core.document_loaders.BaseLoader].
Downloads and loads a single file from GCS bucket using configurable loader.

!!! note "Installation"
Requires additional dependencies:
```bash
pip install langchain-google-community[gcs]
```
"""

def __init__(
self,
Expand All @@ -28,15 +38,21 @@ def __init__(
file_path argument. If nothing is provided, the
UnstructuredFileLoader is used.

Examples:
To use an alternative PDF loader:
>> from from langchain_community.document_loaders import PyPDFLoader
>> loader = GCSFileLoader(..., loader_func=PyPDFLoader)
??? example "Using Alternative PDF Loader"
```python
from langchain_community.document_loaders import PyPDFLoader

To use UnstructuredFileLoader with additional arguments:
>> loader = GCSFileLoader(...,
>> loader_func=lambda x: UnstructuredFileLoader(x, mode="elements"))
loader = GCSFileLoader(..., loader_func=PyPDFLoader)
```

??? example "Using UnstructuredFileLoader with Custom Arguments"
```python
from langchain_community.document_loaders import UnstructuredFileLoader

loader = GCSFileLoader(
..., loader_func=lambda x: UnstructuredFileLoader(x, mode="elements")
)
```
"""
self.bucket = bucket
self.blob = blob
Expand Down
Loading