| gdrive-query-with-mime-type-and-folder | Search query with a specific mime_type and in folder_id         |retriever = GoogleDriveRetriever(    template="gdrive-query", # Search everywhere    num_results=2,  # But take only 2 documents)for doc in retriever.get_relevant_documents("machine learning"):    print("---")    print(doc.page_content.strip()[:60]+"...")Else, you can customize the prompt with a specialized PromptTemplatefrom langchain.prompts import PromptTemplateretriever = GoogleDriveRetriever(    template=PromptTemplate(input_variables=['query'],                            # See https://developers.google.com/drive/api/guides/search-files                            template="(fullText contains '{query}') "                              "and mimeType='application/vnd.google-apps.document' "                              "and modifiedTime > '2000-01-01T00:00:00' "                              "and trashed=false"),    num_results=2,    # See https://developers.google.com/drive/api/v3/reference/files/list    includeItemsFromAllDrives=False,    supportsAllDrives=False,)for doc in retriever.get_relevant_documents("machine learning"):    print(f"{doc.metadata['name']}:")    print("---")    print(doc.page_content.strip()[:60]+"...")Use Google Drive 'description' metadata‚ÄãEach Google Drive has a description field in metadata (see the details of a file).
Use the snippets mode to return the description of selected files.retriever = GoogleDriveRetriever(    template='gdrive-mime-type-in-folder',    folder_id=folder_id,    mime_type='application/vnd.google-apps.document',  # Only Google Docs    num_results=2,    mode='snippets',    includeItemsFromAllDrives=False,    supportsAllDrives=False,)retriever.get_relevant_documents("machine learning")PreviousGoogle Cloud Enterprise SearchNextGoogle Vertex AI SearchPrerequisitesRetrieve the Google DocsUse Google Drive 'description' metadataCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook covers how to retrieve documents from Google Drive.
This notebook covers how to retrieve documents from Google Drive. ->: | gdrive-query-with-mime-type-and-folder | Search query with a specific mime_type and in folder_id         |retriever = GoogleDriveRetriever(    template="gdrive-query", # Search everywhere    num_results=2,  # But take only 2 documents)for doc in retriever.get_relevant_documents("machine learning"):    print("---")    print(doc.page_content.strip()[:60]+"...")Else, you can customize the prompt with a specialized PromptTemplatefrom langchain.prompts import PromptTemplateretriever = GoogleDriveRetriever(    template=PromptTemplate(input_variables=['query'],                            # See https://developers.google.com/drive/api/guides/search-files                            template="(fullText contains '{query}') "                              "and mimeType='application/vnd.google-apps.document' "                              "and modifiedTime > '2000-01-01T00:00:00' "                              "and trashed=false"),    num_results=2,    # See https://developers.google.com/drive/api/v3/reference/files/list    includeItemsFromAllDrives=False,    supportsAllDrives=False,)for doc in retriever.get_relevant_documents("machine learning"):    print(f"{doc.metadata['name']}:")    print("---")    print(doc.page_content.strip()[:60]+"...")Use Google Drive 'description' metadata‚ÄãEach Google Drive has a description field in metadata (see the details of a file).
Use the snippets mode to return the description of selected files.retriever = GoogleDriveRetriever(    template='gdrive-mime-type-in-folder',    folder_id=folder_id,    mime_type='application/vnd.google-apps.document',  # Only Google Docs    num_results=2,    mode='snippets',    includeItemsFromAllDrives=False,    supportsAllDrives=False,)retriever.get_relevant_documents("machine learning")PreviousGoogle Cloud Enterprise SearchNextGoogle Vertex AI SearchPrerequisitesRetrieve the Google DocsUse Google Drive 'description' metadataCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.