Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Service (Drive v3 or Excel V4) added as a parameter #5147

Closed
wants to merge 8 commits into from

Conversation

Yvelo
Copy link

@Yvelo Yvelo commented May 23, 2023

Modify GoogleDriveLoader so that it can accept a Google Service instead of relying on a path to credential files.

I am deploying LangChain in serverless environment where I use Redis for chat memory and security token store. This pull request allows to pass a Google Drive or a Google Sheet Service instead of a path to local files.

I would also consider moving _load_sheet_from_id into a different class than GoogleDriveLoader since it is not based on Google Drive API.

Dear @eyurtsev, please advise,


file = service.files().get(fileId=id, supportsAllDrives=True).execute()
request = service.files().get_media(fileId=id)
file = self._service().files().get(fileId=id, supportsAllDrives=True).execute()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do service = self._service() and then use in both these lines?

Copy link
Author

Choose a reason for hiding this comment

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

I have updated the pull request accordingly. To be noted that I have not been able to test it since I have a poetry installation error on uvtools which claims not to be available on a windows environment. Even though I cannot run the unit tests, I suspect they will fail since googleapiclient must be added to poetry.lock which is something I don't know how to do.

As a workaround to this pull request, I have the rather easy option to create temporary credentials.json and token.json files before calling the GoogleDriveLoader. So really I won't mind if you decide to reject this pull request for simplicity.

I very much enjoy discovering LLM and AI through LangChain and I appreciate it must be quite intense to monitor such a booming community. Thank you for driving this great project!

langchain/document_loaders/googledrive.py Outdated Show resolved Hide resolved
@Yvelo
Copy link
Author

Yvelo commented May 25, 2023

II have further improved this Pool request to add support to Slides and allow load_file_from_ids to check for the appropriate loader.

@eyurtsev
Copy link
Collaborator

cross-referencing: #5135

@pprados
Copy link
Contributor

pprados commented Jun 28, 2023

The pull request 5135 resolve this.

@dosubot dosubot bot added Ɑ: doc loader Related to document loader module (not documentation) 🤖:improvement Medium size change to existing code to handle new use-cases labels Jul 14, 2023
@leo-gan
Copy link
Collaborator

leo-gan commented Sep 13, 2023

#9999 resolves it.

@leo-gan leo-gan closed this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: doc loader Related to document loader module (not documentation) 🤖:improvement Medium size change to existing code to handle new use-cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants