langchain-ai / langchain-google

MIT License
76 stars 79 forks source link

[Feature Request] Use Google Auth credentials for login to GoogleDriveLoader #200

Open bastienpo opened 2 months ago

bastienpo commented 2 months ago

Description:

To align with other APIs such as VertexAI and VertexModelGarden, it may be useful in some cases to pass google.auth.Credentials directly to the GoogleDriveLoader constructor instead of passing the service account file.

It should provide more flexibility. It should not change the other log in features.

Proposed solution: Instantiate the credentials in the GoogleDriveLoader attributes. Replace the credentials calls with an attribute reference.

I would be happy to contribute if you validate this feature.

from google.auth.credentials import Credentials

class GoogleDriveLoader(BaseLoader, BaseModel):
    """Load Google Docs from `Google Drive`."""
    credentials : Credentials | None

Reference: https://github.com/langchain-ai/langchain-google/blob/3c9efa1741431e44b0a9b061ba18a4bc51e137a9/libs/community/langchain_google_community/drive.py#L21C7-L21C24

lkuligin commented 1 month ago

I'm sorry, I missed this feature request. If it's not too late, of course, all contributions are welcome!