mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-01 02:43:37 +00:00
updated integrations/providers/google
(#12226)
Added missed integrations. Updated formats. --------- Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
2e2b9c76d9
commit
e112b2f2e6
@ -9,9 +9,9 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Note: This is separate from the Google PaLM integration. Google has chosen to offer an enterprise version of PaLM through GCP, and this supports the models made available through there. \n",
|
"Note: This is separate from the Google PaLM integration. Google has chosen to offer an enterprise version of PaLM through GCP, and this supports the models made available through there. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"By default, Google Cloud [does not use](https://cloud.google.com/vertex-ai/docs/generative-ai/data-governance#foundation_model_development) Customer Data to train its foundation models as part of Google Cloud`s AI/ML Privacy Commitment. More details about how Google processes data can also be found in [Google's Customer Data Processing Addendum (CDPA)](https://cloud.google.com/terms/data-processing-addendum).\n",
|
"By default, Google Cloud [does not use](https://cloud.google.com/vertex-ai/docs/generative-ai/data-governance#foundation_model_development) customer data to train its foundation models as part of Google Cloud`s AI/ML Privacy Commitment. More details about how Google processes data can also be found in [Google's Customer Data Processing Addendum (CDPA)](https://cloud.google.com/terms/data-processing-addendum).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"To use Vertex AI PaLM you must have the `google-cloud-aiplatform` Python package installed and either:\n",
|
"To use `Google Cloud Vertex AI` PaLM you must have the `google-cloud-aiplatform` Python package installed and either:\n",
|
||||||
"- Have credentials configured for your environment (gcloud, workload identity, etc...)\n",
|
"- Have credentials configured for your environment (gcloud, workload identity, etc...)\n",
|
||||||
"- Store the path to a service account JSON file as the GOOGLE_APPLICATION_CREDENTIALS environment variable\n",
|
"- Store the path to a service account JSON file as the GOOGLE_APPLICATION_CREDENTIALS environment variable\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -411,9 +411,9 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "poetry-venv",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "poetry-venv"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
@ -425,7 +425,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.1"
|
"version": "3.10.12"
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
# Google
|
# Google
|
||||||
|
|
||||||
All functionality related to [Google Cloud Platform](https://cloud.google.com/)
|
All functionality related to [Google Cloud Platform](https://cloud.google.com/) and other `Google` products.
|
||||||
|
|
||||||
## LLMs
|
## LLMs
|
||||||
|
|
||||||
### Vertex AI
|
### Vertex AI
|
||||||
|
|
||||||
Access PaLM LLMs like `text-bison` and `code-bison` via Google Cloud.
|
Access `PaLM` LLMs like `text-bison` and `code-bison` via `Google Vertex AI`.
|
||||||
|
|
||||||
|
We need to install `google-cloud-aiplatform` python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-cloud-aiplatform
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example](/docs/integrations/llms/google_vertex_ai_palm).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.llms import VertexAI
|
from langchain.llms import VertexAI
|
||||||
@ -14,7 +22,15 @@ from langchain.llms import VertexAI
|
|||||||
|
|
||||||
### Model Garden
|
### Model Garden
|
||||||
|
|
||||||
Access PaLM and hundreds of OSS models via Vertex AI Model Garden.
|
Access PaLM and hundreds of OSS models via `Vertex AI Model Garden`.
|
||||||
|
|
||||||
|
We need to install `google-cloud-aiplatform` python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-cloud-aiplatform
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example](/docs/integrations/llms/google_vertex_ai_palm#vertex-model-garden).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.llms import VertexAIModelGarden
|
from langchain.llms import VertexAIModelGarden
|
||||||
@ -26,17 +42,26 @@ from langchain.llms import VertexAIModelGarden
|
|||||||
|
|
||||||
Access PaLM chat models like `chat-bison` and `codechat-bison` via Google Cloud.
|
Access PaLM chat models like `chat-bison` and `codechat-bison` via Google Cloud.
|
||||||
|
|
||||||
|
We need to install `google-cloud-aiplatform` python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-cloud-aiplatform
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example](/docs/integrations/chat/google_vertex_ai_palm).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.chat_models import ChatVertexAI
|
from langchain.chat_models import ChatVertexAI
|
||||||
```
|
```
|
||||||
|
|
||||||
## Document Loader
|
|
||||||
|
## Document Loaders
|
||||||
### Google BigQuery
|
### Google BigQuery
|
||||||
|
|
||||||
> [Google BigQuery](https://cloud.google.com/bigquery) is a serverless and cost-effective enterprise data warehouse that works across clouds and scales with your data.
|
> [Google BigQuery](https://cloud.google.com/bigquery) is a serverless and cost-effective enterprise data warehouse that works across clouds and scales with your data.
|
||||||
`BigQuery` is a part of the `Google Cloud Platform`.
|
`BigQuery` is a part of the `Google Cloud Platform`.
|
||||||
|
|
||||||
First, we need to install `google-cloud-bigquery` python package.
|
We need to install `google-cloud-bigquery` python package.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install google-cloud-bigquery
|
pip install google-cloud-bigquery
|
||||||
@ -50,9 +75,9 @@ from langchain.document_loaders import BigQueryLoader
|
|||||||
|
|
||||||
### Google Cloud Storage
|
### Google Cloud Storage
|
||||||
|
|
||||||
> [Google Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data.
|
>[Google Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data.
|
||||||
|
|
||||||
First, we need to install `google-cloud-storage` python package.
|
We need to install `google-cloud-storage` python package.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install google-cloud-storage
|
pip install google-cloud-storage
|
||||||
@ -73,11 +98,11 @@ from langchain.document_loaders import GCSFileLoader
|
|||||||
|
|
||||||
### Google Drive
|
### Google Drive
|
||||||
|
|
||||||
> [Google Drive](https://en.wikipedia.org/wiki/Google_Drive) is a file storage and synchronization service developed by Google.
|
>[Google Drive](https://en.wikipedia.org/wiki/Google_Drive) is a file storage and synchronization service developed by Google.
|
||||||
|
|
||||||
Currently, only `Google Docs` are supported.
|
Currently, only `Google Docs` are supported.
|
||||||
|
|
||||||
First, we need to install several python packages.
|
We need to install several python packages.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
||||||
@ -107,11 +132,14 @@ See a [usage example and authorization instructions](/docs/integrations/document
|
|||||||
from langchain.document_loaders import GoogleSpeechToTextLoader
|
from langchain.document_loaders import GoogleSpeechToTextLoader
|
||||||
```
|
```
|
||||||
|
|
||||||
## Vector Store
|
|
||||||
### Vertex AI Vector Search
|
|
||||||
|
|
||||||
> [Vertex AI Vector Search](https://cloud.google.com/vertex-ai/docs/matching-engine/overview),
|
|
||||||
> formerly known as Vertex AI Matching Engine, provides the industry's leading high-scale
|
## Vector Stores
|
||||||
|
|
||||||
|
### Google Vertex AI Vector Search
|
||||||
|
|
||||||
|
> [Google Vertex AI Vector Search](https://cloud.google.com/vertex-ai/docs/matching-engine/overview),
|
||||||
|
> formerly known as `Vertex AI Matching Engine`, provides the industry's leading high-scale
|
||||||
> low latency vector database. These vector databases are commonly
|
> low latency vector database. These vector databases are commonly
|
||||||
> referred to as vector similarity-matching or an approximate nearest neighbor (ANN) service.
|
> referred to as vector similarity-matching or an approximate nearest neighbor (ANN) service.
|
||||||
|
|
||||||
@ -153,12 +181,28 @@ from langchain.vectorstores import ScaNN
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Retrievers
|
## Retrievers
|
||||||
|
|
||||||
|
### Google Drive
|
||||||
|
|
||||||
|
We need to install several python packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/retrievers/google_drive).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain_googledrive.retrievers import GoogleDriveRetriever
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Vertex AI Search
|
### Vertex AI Search
|
||||||
|
|
||||||
> [Google Cloud Vertex AI Search](https://cloud.google.com/generative-ai-app-builder/docs/introduction)
|
> [Google Cloud Vertex AI Search](https://cloud.google.com/generative-ai-app-builder/docs/introduction)
|
||||||
> allows developers to quickly build generative AI powered search engines for customers and employees.
|
> allows developers to quickly build generative AI powered search engines for customers and employees.
|
||||||
|
|
||||||
First, you need to install the `google-cloud-discoveryengine` Python package.
|
We need to install the `google-cloud-discoveryengine` python package.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install google-cloud-discoveryengine
|
pip install google-cloud-discoveryengine
|
||||||
@ -173,7 +217,7 @@ from langchain.retrievers import GoogleVertexAISearchRetriever
|
|||||||
### Document AI Warehouse
|
### Document AI Warehouse
|
||||||
> [Google Cloud Document AI Warehouse](https://cloud.google.com/document-ai-warehouse)
|
> [Google Cloud Document AI Warehouse](https://cloud.google.com/document-ai-warehouse)
|
||||||
> allows enterprises to search, store, govern, and manage documents and their AI-extracted
|
> allows enterprises to search, store, govern, and manage documents and their AI-extracted
|
||||||
> data and metadata in a single platform. Documents should be uploaded outside of Langchain,
|
> data and metadata in a single platform.
|
||||||
>
|
>
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -188,14 +232,47 @@ documents = docai_wh_retriever.get_relevant_documents(
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
|
### Google Drive
|
||||||
|
|
||||||
|
We need to install several python packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/tools/google_drive).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain.utilities.google_drive import GoogleDriveAPIWrapper
|
||||||
|
from langchain.tools.google_drive.tool import GoogleDriveSearchTool
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Places
|
||||||
|
|
||||||
|
We need to install a python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install googlemaps
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/tools/google_places).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain.tools import GooglePlacesTool
|
||||||
|
```
|
||||||
|
|
||||||
### Google Search
|
### Google Search
|
||||||
|
|
||||||
- Install requirements with `pip install google-api-python-client`
|
We need to install a python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-api-python-client
|
||||||
|
```
|
||||||
|
|
||||||
- Set up a Custom Search Engine, following [these instructions](https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search)
|
- Set up a Custom Search Engine, following [these instructions](https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search)
|
||||||
- Get an API Key and Custom Search Engine ID from the previous step, and set them as environment variables `GOOGLE_API_KEY` and `GOOGLE_CSE_ID` respectively
|
- Get an API Key and Custom Search Engine ID from the previous step, and set them as environment variables `GOOGLE_API_KEY` and `GOOGLE_CSE_ID` respectively
|
||||||
|
|
||||||
There exists a `GoogleSearchAPIWrapper` utility which wraps this API. To import this utility:
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.utilities import GoogleSearchAPIWrapper
|
from langchain.utilities import GoogleSearchAPIWrapper
|
||||||
```
|
```
|
||||||
@ -209,25 +286,14 @@ from langchain.agents import load_tools
|
|||||||
tools = load_tools(["google-search"])
|
tools = load_tools(["google-search"])
|
||||||
```
|
```
|
||||||
|
|
||||||
### Google Places
|
|
||||||
|
|
||||||
See a [usage example](/docs/integrations/tools/google_places).
|
|
||||||
|
|
||||||
```
|
|
||||||
pip install googlemaps
|
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
from langchain.tools import GooglePlacesTool
|
|
||||||
```
|
|
||||||
|
|
||||||
## Document Transformers
|
## Document Transformers
|
||||||
|
|
||||||
### Google Document AI
|
### Google Document AI
|
||||||
|
|
||||||
>[Document AI](https://cloud.google.com/document-ai/docs/overview) is a `Google Cloud Platform`
|
>[Document AI](https://cloud.google.com/document-ai/docs/overview) is a `Google Cloud Platform`
|
||||||
> service to transform unstructured data from documents into structured data, making it easier
|
> service that transforms unstructured data from documents into structured data, making it easier
|
||||||
> to understand, analyze, and consume.
|
> to understand, analyze, and consume.
|
||||||
|
|
||||||
We need to set up a [`GCS` bucket and create your own OCR processor](https://cloud.google.com/document-ai/docs/create-processor)
|
We need to set up a [`GCS` bucket and create your own OCR processor](https://cloud.google.com/document-ai/docs/create-processor)
|
||||||
The `GCS_OUTPUT_PATH` should be a path to a folder on GCS (starting with `gs://`)
|
The `GCS_OUTPUT_PATH` should be a path to a folder on GCS (starting with `gs://`)
|
||||||
@ -269,15 +335,54 @@ See a [usage example and authorization instructions](/docs/integrations/document
|
|||||||
from langchain.document_transformers import GoogleTranslateTransformer
|
from langchain.document_transformers import GoogleTranslateTransformer
|
||||||
```
|
```
|
||||||
|
|
||||||
## Chat loaders
|
## Toolkits
|
||||||
### Gmail
|
|
||||||
|
### GMail
|
||||||
|
|
||||||
> [Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google.
|
> [Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google.
|
||||||
|
This toolkit works with emails through the `Gmail API`.
|
||||||
|
|
||||||
First, we need to install several python packages.
|
We need to install several python packages.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install --upgrade google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
|
pip install google-api-python-client google-auth-oauthlib google-auth-httplib2
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/toolkits/gmail).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain.agents.agent_toolkits import GmailToolkit
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Google Drive
|
||||||
|
|
||||||
|
This toolkit uses the `Google Drive API`.
|
||||||
|
|
||||||
|
We need to install several python packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/toolkits/google_drive).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain_googledrive.utilities.google_drive import GoogleDriveAPIWrapper
|
||||||
|
from langchain_googledrive.tools.google_drive.tool import GoogleDriveSearchTool
|
||||||
|
```
|
||||||
|
|
||||||
|
## Chat Loaders
|
||||||
|
|
||||||
|
### GMail
|
||||||
|
|
||||||
|
> [Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google.
|
||||||
|
This loader works with emails through the `Gmail API`.
|
||||||
|
|
||||||
|
We need to install several python packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install google-api-python-client google-auth-oauthlib google-auth-httplib2
|
||||||
```
|
```
|
||||||
|
|
||||||
See a [usage example and authorization instructions](/docs/integrations/chat_loaders/gmail).
|
See a [usage example and authorization instructions](/docs/integrations/chat_loaders/gmail).
|
||||||
@ -286,22 +391,69 @@ See a [usage example and authorization instructions](/docs/integrations/chat_loa
|
|||||||
from langchain.chat_loaders.gmail import GMailLoader
|
from langchain.chat_loaders.gmail import GMailLoader
|
||||||
```
|
```
|
||||||
|
|
||||||
## Agents and Toolkits
|
## 3rd Party Integrations
|
||||||
### Gmail
|
|
||||||
|
|
||||||
See a [usage example and authorization instructions](/docs/integrations/toolkits/gmail).
|
### SerpAPI
|
||||||
|
|
||||||
|
>[SerpApi](https://serpapi.com/) provides a 3rd-party API to access Google search results.
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/tools/google_serper).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.agents.agent_toolkits import GmailToolkit
|
from langchain.utilities import GoogleSerperAPIWrapper
|
||||||
|
|
||||||
toolkit = GmailToolkit()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Google Drive
|
### YouTube
|
||||||
|
|
||||||
See a [usage example and authorization instructions](/docs/integrations/toolkits/google_drive).
|
>[YouTube Search](https://github.com/joetats/youtube_search) package searches `YouTube` videos avoiding using their heavily rate-limited API.
|
||||||
|
>
|
||||||
|
>It uses the form on the YouTube homepage and scrapes the resulting page.
|
||||||
|
|
||||||
|
We need to install a python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install youtube_search
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example](/docs/integrations/tools/youtube).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain_googledrive.utilities.google_drive import GoogleDriveAPIWrapper
|
from langchain.tools import YouTubeSearchTool
|
||||||
from langchain_googledrive.tools.google_drive.tool import GoogleDriveSearchTool
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### YouTube audio
|
||||||
|
|
||||||
|
>[YouTube](https://www.youtube.com/) is an online video sharing and social media platform created by `Google`.
|
||||||
|
|
||||||
|
Use `YoutubeAudioLoader` to fetch / download the audio files.
|
||||||
|
|
||||||
|
Then, use `OpenAIWhisperParser` to transcribe them to text.
|
||||||
|
|
||||||
|
We need to install several python packages.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install yt_dlp pydub librosa
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example and authorization instructions](/docs/integrations/document_loaders/youtube_audio).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader
|
||||||
|
from langchain.document_loaders.parsers import OpenAIWhisperParser, OpenAIWhisperParserLocal
|
||||||
|
```
|
||||||
|
|
||||||
|
### YouTube transcripts
|
||||||
|
|
||||||
|
>[YouTube](https://www.youtube.com/) is an online video sharing and social media platform created by `Google`.
|
||||||
|
|
||||||
|
We need to install `youtube-transcript-api` python package.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install youtube-transcript-api
|
||||||
|
```
|
||||||
|
|
||||||
|
See a [usage example](/docs/integrations/document_loaders/youtube_transcript).
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain.document_loaders import YoutubeLoader
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user