From ffbc64c72a8f46067fb5322198e3e162ffe73868 Mon Sep 17 00:00:00 2001 From: Philipp Schmid <32632186+philschmid@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:58:46 +0200 Subject: [PATCH] Documentation: Improve structure of Google integrations page (#30992) This PR restructures the main Google integrations documentation page (`docs/docs/integrations/providers/google.mdx`) for better clarity and updates content. **Key changes:** * **Separated Sections:** Divided integrations into distinct `Google Generative AI (Gemini API & AI Studio)`, `Google Cloud`, and `Other Google Products` sections. * **Updated Generative AI:** Refreshed the introduction and the `Google Generative AI` section with current information and quickstart examples for the Gemini API via `langchain-google-genai`. * **Reorganized Content:** Moved non-Cloud Platform specific integrations (e.g., Drive, GMail, Search tools, ScaNN) to the `Other Google Products` section. * **Cleaned Up:** Minor improvements to descriptions and code snippets. This aims to make it easier for users to find the relevant Google integrations based on whether they are using the Gemini API directly or Google Cloud services. | Before | After | |-----------------------|------------| | ![Screenshot 2025-04-24 at 14 56 23](https://github.com/user-attachments/assets/ff967ec8-a833-4e8f-8015-61af8a4fac8b) | ![Screenshot 2025-04-24 at 14 56 15](https://github.com/user-attachments/assets/179163f1-e805-484a-bbf6-99f05e117b36) | --------- Co-authored-by: Chester Curme --- docs/docs/integrations/providers/google.mdx | 1132 ++++++++++--------- 1 file changed, 587 insertions(+), 545 deletions(-) diff --git a/docs/docs/integrations/providers/google.mdx b/docs/docs/integrations/providers/google.mdx index 179d2726bd7..e81e81afcf0 100644 --- a/docs/docs/integrations/providers/google.mdx +++ b/docs/docs/integrations/providers/google.mdx @@ -1,84 +1,119 @@ # Google -All functionality related to [Google Cloud Platform](https://cloud.google.com/) and other `Google` products. +All functionality related to [Google Cloud](https://cloud.google.com/), [Google Gemini](https://ai.google.dev/gemini-api/docs) and other Google products. -Integration packages for Gemini models and the VertexAI platform are maintained in +1. **Google Generative AI (Gemini API & AI Studio)**: Access Google Gemini models directly via the Gemini API. Use [Google AI Studio](https://aistudio.google.com/) for rapid prototyping and get started quickly with the `langchain-google-genai` package. This is often the best starting point for individual developers. +2. **Google Cloud (Vertex AI & other services)**: Access Gemini models, Vertex AI Model Garden and a wide range of cloud services (databases, storage, document AI, etc.) via the [Google Cloud Platform](https://cloud.google.com/). Use the `langchain-google-vertexai` package for Vertex AI models and specific packages (e.g., `langchain-google-cloud-sql-pg`, `langchain-google-community`) for other cloud services. This is ideal for developers already using Google Cloud or needing enterprise features like MLOps, specific model tuning or enterprise support. + +See Google's guide on [migrating from the Gemini API to Vertex AI](https://ai.google.dev/gemini-api/docs/migrate-to-cloud) for more details on the differences. + +Integration packages for Gemini models and the Vertex AI platform are maintained in the [langchain-google](https://github.com/langchain-ai/langchain-google) repository. -You can find a host of LangChain integrations with other Google APIs in the +You can find a host of LangChain integrations with other Google APIs and services in the [googleapis](https://github.com/googleapis?q=langchain-&type=all&language=&sort=) -Github organization. +Github organization and the `langchain-google-community` package. -## Chat models +## Google Generative AI (Gemini API & AI Studio) -We recommend individual developers to start with Gemini API (`langchain-google-genai`) and move to Vertex AI (`langchain-google-vertexai`) when they need access to commercial support and higher rate limits. If you’re already Cloud-friendly or Cloud-native, then you can get started in Vertex AI straight away. -Please see [here](https://ai.google.dev/gemini-api/docs/migrate-to-cloud) for more information. - -### Google Generative AI - -Access GoogleAI `Gemini` models such as `gemini-pro` and `gemini-pro-vision` through the `ChatGoogleGenerativeAI` class. +Access Google Gemini models directly using the Gemini API, best suited for rapid development and experimentation. Gemini models are available in [Google AI Studio](https://aistudio.google.com/). ```bash pip install -U langchain-google-genai ``` -Configure your API key. +Start for free and get your API key from [Google AI Studio](https://aistudio.google.com/app/apikey). ```bash -export GOOGLE_API_KEY=your-api-key +export GOOGLE_API_KEY="YOUR_API_KEY" ``` +### Chat Models + +Use the `ChatGoogleGenerativeAI` class to interact with Gemini 2.0 and 2.5 models. See +details in [this guide](/docs/integrations/chat/google_generative_ai). + ```python from langchain_google_genai import ChatGoogleGenerativeAI - -llm = ChatGoogleGenerativeAI(model="gemini-pro") -llm.invoke("Sing a ballad of LangChain.") -``` - -Gemini vision model supports image inputs when providing a single chat message. - -```python from langchain_core.messages import HumanMessage -from langchain_google_genai import ChatGoogleGenerativeAI -llm = ChatGoogleGenerativeAI(model="gemini-pro-vision") +llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash") +# Simple text invocation +result = llm.invoke("Sing a ballad of LangChain.") +print(result.content) + +# Multimodal invocation with gemini-pro-vision message = HumanMessage( content=[ { "type": "text", "text": "What's in this image?", - }, # You can optionally provide text parts + }, {"type": "image_url", "image_url": "https://picsum.photos/seed/picsum/200/300"}, ] ) -llm.invoke([message]) +result = llm.invoke([message]) +print(result.content) ``` -The value of image_url can be any of the following: +The `image_url` can be a public URL, a GCS URI (`gs://...`), a local file path, a base64 encoded image string (`data:image/png;base64,...`), or a PIL Image object. -- A public image URL -- A gcs file (e.g., "gcs://path/to/file.png") -- A local file path -- A base64 encoded image (e.g., data:image/png;base64,abcd124) -- A PIL image -### Vertex AI +### Embedding Models -Access chat models like `Gemini` via Google Cloud. +Generate text embeddings using models like `gemini-embedding-exp-03-07` with the `GoogleGenerativeAIEmbeddings` class. -We need to install `langchain-google-vertexai` python package. +See a [usage example](/docs/integrations/text_embedding/google_generative_ai). + +```python +from langchain_google_genai import GoogleGenerativeAIEmbeddings + +embeddings = GoogleGenerativeAIEmbeddings(model="models/gemini-embedding-exp-03-07") +vector = embeddings.embed_query("What are embeddings?") +print(vector[:5]) +``` + +### LLMs + +Access the same Gemini models using the ([legacy](/docs/concepts/text_llms)) LLM +interface with the `GoogleGenerativeAI` class. + +See a [usage example](/docs/integrations/llms/google_ai). + +```python +from langchain_google_genai import GoogleGenerativeAI + +llm = GoogleGenerativeAI(model="gemini-2.0-flash") +result = llm.invoke("Sing a ballad of LangChain.") +print(result) +``` + +## Google Cloud + +Access Gemini models, Vertex AI Model Garden and other Google Cloud services via Vertex AI and specific cloud integrations. + +Vertex AI models require the `langchain-google-vertexai` package. Other services might require additional packages like `langchain-google-community`, `langchain-google-cloud-sql-pg`, etc. ```bash pip install langchain-google-vertexai +# pip install langchain-google-community[...] # For other services ``` +Google Cloud integrations typically use Application Default Credentials (ADC). Refer to the [Google Cloud authentication documentation](https://cloud.google.com/docs/authentication) for setup instructions (e.g., using `gcloud auth application-default login`). + +### Chat Models + +#### Vertex AI + +Access chat models like `Gemini` via the Vertex AI platform. + See a [usage example](/docs/integrations/chat/google_vertex_ai_palm). ```python from langchain_google_vertexai import ChatVertexAI ``` -### Anthropic on Vertex AI Model Garden +#### Anthropic on Vertex AI Model Garden See a [usage example](/docs/integrations/llms/google_vertex_ai_palm). @@ -86,141 +121,82 @@ See a [usage example](/docs/integrations/llms/google_vertex_ai_palm). from langchain_google_vertexai.model_garden import ChatAnthropicVertex ``` -### Llama on Vertex AI Model Garden +#### Llama on Vertex AI Model Garden ```python from langchain_google_vertexai.model_garden_maas.llama import VertexModelGardenLlama ``` -### Mistral on Vertex AI Model Garden +#### Mistral on Vertex AI Model Garden ```python from langchain_google_vertexai.model_garden_maas.mistral import VertexModelGardenMistral ``` -### Gemma local from Hugging Face +#### Gemma local from Hugging Face ->Local `Gemma` model loaded from `HuggingFace`. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Local `Gemma` model loaded from `HuggingFace`. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaChatLocalHF ``` -### Gemma local from Kaggle +#### Gemma local from Kaggle ->Local `Gemma` model loaded from `Kaggle`. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Local `Gemma` model loaded from `Kaggle`. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaChatLocalKaggle ``` -### Gemma on Vertex AI Model Garden +#### Gemma on Vertex AI Model Garden -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaChatVertexAIModelGarden ``` -### Vertex AI image captioning +#### Vertex AI image captioning ->Implementation of the `Image Captioning model` as a chat. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Implementation of the `Image Captioning model` as a chat. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.vision_models import VertexAIImageCaptioningChat ``` -### Vertex AI image editor +#### Vertex AI image editor ->Given an image and a prompt, edit the image. Currently only supports mask-free editing. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Given an image and a prompt, edit the image. Currently only supports mask-free editing. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.vision_models import VertexAIImageEditorChat ``` -### Vertex AI image generator +#### Vertex AI image generator ->Generates an image from a prompt. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Generates an image from a prompt. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.vision_models import VertexAIImageGeneratorChat ``` -### Vertex AI visual QnA +#### Vertex AI visual QnA ->Chat implementation of a visual QnA model - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Chat implementation of a visual QnA model. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.vision_models import VertexAIVisualQnAChat ``` -## LLMs +### LLMs -### Google Generative AI +You can also use the ([legacy](/docs/concepts/text_llms)) string-in, string-out LLM +interface. -Access GoogleAI `Gemini` models such as `gemini-pro` and `gemini-pro-vision` through the `GoogleGenerativeAI` class. +#### Vertex AI Model Garden -Install python package. - -```bash -pip install langchain-google-genai -``` - -See a [usage example](/docs/integrations/llms/google_ai). - -```python -from langchain_google_genai import GoogleGenerativeAI -``` - -### Vertex AI Model Garden - -Access `PaLM` and hundreds of OSS models via `Vertex AI Model Garden` service. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +Access `Gemini`, and hundreds of OSS models via `Vertex AI Model Garden` service. Requires `langchain-google-vertexai`. See a [usage example](/docs/integrations/llms/google_vertex_ai_palm#vertex-model-garden). @@ -228,99 +204,43 @@ See a [usage example](/docs/integrations/llms/google_vertex_ai_palm#vertex-model from langchain_google_vertexai import VertexAIModelGarden ``` -### Gemma local from Hugging Face +#### Gemma local from Hugging Face ->Local `Gemma` model loaded from `HuggingFace`. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Local `Gemma` model loaded from `HuggingFace`. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaLocalHF ``` -### Gemma local from Kaggle +#### Gemma local from Kaggle ->Local `Gemma` model loaded from `Kaggle`. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Local `Gemma` model loaded from `Kaggle`. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaLocalKaggle ``` -### Gemma on Vertex AI Model Garden +#### Gemma on Vertex AI Model Garden -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.gemma import GemmaVertexAIModelGarden ``` -### Vertex AI image captioning +#### Vertex AI image captioning ->Implementation of the `Image Captioning model` as an LLM. - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +>Implementation of the `Image Captioning model` as an LLM. Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.vision_models import VertexAIImageCaptioning ``` -## Embedding models +### Embedding Models -### Google Generative AI embedding +#### Vertex AI -See a [usage example](/docs/integrations/text_embedding/google_generative_ai). - -```bash -pip install -U langchain-google-genai -``` - -Configure your API key. - -```bash -export GOOGLE_API_KEY=your-api-key -``` - -```python -from langchain_google_genai import GoogleGenerativeAIEmbeddings -``` - -### Google Generative AI server-side embedding - -Install the python package: - -```bash -pip install langchain-google-genai -``` - -```python -from langchain_google_genai.google_vector_store import ServerSideEmbedding -``` - -### Vertex AI - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` +Generate embeddings using models deployed on Vertex AI. Requires `langchain-google-vertexai`. See a [usage example](/docs/integrations/text_embedding/google_vertex_ai_palm). @@ -328,23 +248,13 @@ See a [usage example](/docs/integrations/text_embedding/google_vertex_ai_palm). from langchain_google_vertexai import VertexAIEmbeddings ``` -### Palm embedding -We need to install `langchain-community` python package. +### Document Loaders -```bash -pip install langchain-community -``` +Load documents from various Google Cloud sources. +#### AlloyDB for PostgreSQL -```python -from langchain_community.embeddings.google_palm import GooglePalmEmbeddings -``` - -## Document Loaders - -### AlloyDB for PostgreSQL - -> [Google Cloud AlloyDB](https://cloud.google.com/alloydb) is a fully managed relational database service that offers high performance, seamless integration, and impressive scalability on Google Cloud. AlloyDB is 100% compatible with PostgreSQL. +> [Google Cloud AlloyDB](https://cloud.google.com/alloydb) is a fully managed PostgreSQL-compatible database service. Install the python package: @@ -355,14 +265,14 @@ pip install langchain-google-alloydb-pg See [usage example](/docs/integrations/document_loaders/google_alloydb). ```python -from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBLoader +from langchain_google_alloydb_pg import AlloyDBLoader # AlloyDBEngine also available ``` -### BigQuery +#### BigQuery -> [Google Cloud BigQuery](https://cloud.google.com/bigquery) is a serverless and cost-effective enterprise data warehouse that works across clouds and scales with your data in Google Cloud. +> [Google Cloud BigQuery](https://cloud.google.com/bigquery) is a serverless data warehouse. -We need to install `langchain-google-community` with Big Query dependencies: +Install with BigQuery dependencies: ```bash pip install langchain-google-community[bigquery] @@ -374,9 +284,9 @@ See a [usage example](/docs/integrations/document_loaders/google_bigquery). from langchain_google_community import BigQueryLoader ``` -### Bigtable +#### Bigtable -> [Google Cloud Bigtable](https://cloud.google.com/bigtable/docs) is Google's fully managed NoSQL Big Data database service in Google Cloud. +> [Google Cloud Bigtable](https://cloud.google.com/bigtable/docs) is a fully managed NoSQL Big Data database service. Install the python package: @@ -384,15 +294,15 @@ Install the python package: pip install langchain-google-bigtable ``` -See [Googel Cloud usage example](/docs/integrations/document_loaders/google_bigtable). +See [usage example](/docs/integrations/document_loaders/google_bigtable). ```python from langchain_google_bigtable import BigtableLoader ``` -### Cloud SQL for MySQL +#### Cloud SQL for MySQL -> [Google Cloud SQL for MySQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your MySQL relational databases on Google Cloud. +> [Google Cloud SQL for MySQL](https://cloud.google.com/sql) is a fully-managed MySQL database service. Install the python package: @@ -403,12 +313,12 @@ pip install langchain-google-cloud-sql-mysql See [usage example](/docs/integrations/document_loaders/google_cloud_sql_mysql). ```python -from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLLoader +from langchain_google_cloud_sql_mysql import MySQLLoader # MySQLEngine also available ``` -### Cloud SQL for SQL Server +#### Cloud SQL for SQL Server -> [Google Cloud SQL for SQL Server](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your SQL Server databases on Google Cloud. +> [Google Cloud SQL for SQL Server](https://cloud.google.com/sql) is a fully-managed SQL Server database service. Install the python package: @@ -419,12 +329,12 @@ pip install langchain-google-cloud-sql-mssql See [usage example](/docs/integrations/document_loaders/google_cloud_sql_mssql). ```python -from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLLoader +from langchain_google_cloud_sql_mssql import MSSQLLoader # MSSQLEngine also available ``` -### Cloud SQL for PostgreSQL +#### Cloud SQL for PostgreSQL -> [Google Cloud SQL for PostgreSQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud. +> [Google Cloud SQL for PostgreSQL](https://cloud.google.com/sql) is a fully-managed PostgreSQL database service. Install the python package: @@ -435,35 +345,36 @@ pip install langchain-google-cloud-sql-pg See [usage example](/docs/integrations/document_loaders/google_cloud_sql_pg). ```python -from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader +from langchain_google_cloud_sql_pg import PostgresLoader # PostgresEngine also available ``` -### Cloud Storage +#### Cloud Storage ->[Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data in Google Cloud. +>[Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data. -We need to install `langchain-google-community` with Google Cloud Storage dependencies. +Install with GCS dependencies: ```bash pip install langchain-google-community[gcs] ``` -There are two loaders for the `Google Cloud Storage`: the `Directory` and the `File` loaders. - -See a [usage example](/docs/integrations/document_loaders/google_cloud_storage_directory). +Load from a directory or a specific file: +See [directory usage example](/docs/integrations/document_loaders/google_cloud_storage_directory). ```python from langchain_google_community import GCSDirectoryLoader ``` -See a [usage example](/docs/integrations/document_loaders/google_cloud_storage_file). +See [file usage example](/docs/integrations/document_loaders/google_cloud_storage_file). ```python from langchain_google_community import GCSFileLoader ``` -### Cloud Vision loader +#### Cloud Vision loader -Install the python package: +Load data using Google Cloud Vision API. + +Install with Vision dependencies: ```bash pip install langchain-google-community[vision] @@ -473,11 +384,11 @@ pip install langchain-google-community[vision] from langchain_google_community.vision import CloudVisionLoader ``` -### El Carro for Oracle Workloads +#### El Carro for Oracle Workloads -> Google [El Carro Oracle Operator](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator) -offers a way to run Oracle databases in Kubernetes as a portable, open source, -community driven, no vendor lock-in container orchestration system. +> Google [El Carro Oracle Operator](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator) runs Oracle databases in Kubernetes. + +Install the python package: ```bash pip install langchain-google-el-carro @@ -489,27 +400,9 @@ See [usage example](/docs/integrations/document_loaders/google_el_carro). from langchain_google_el_carro import ElCarroLoader ``` -### Google Drive +#### Firestore (Native Mode) ->[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. - -We need to install `langchain-google-community` with Google Drive dependencies. - -```bash -pip install langchain-google-community[drive] -``` - -See a [usage example and authorization instructions](/docs/integrations/document_loaders/google_drive). - -```python -from langchain_google_community import GoogleDriveLoader -``` - -### Firestore (Native Mode) - -> [Google Cloud Firestore](https://cloud.google.com/firestore/docs/) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. +> [Google Cloud Firestore](https://cloud.google.com/firestore/docs/) is a NoSQL document database. Install the python package: @@ -523,10 +416,9 @@ See [usage example](/docs/integrations/document_loaders/google_firestore). from langchain_google_firestore import FirestoreLoader ``` -### Firestore (Datastore Mode) +#### Firestore (Datastore Mode) -> [Google Cloud Firestore in Datastore mode](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. -> Firestore is the newest version of Datastore and introduces several improvements over Datastore. +> [Google Cloud Firestore in Datastore mode](https://cloud.google.com/datastore/docs). Install the python package: @@ -540,9 +432,9 @@ See [usage example](/docs/integrations/document_loaders/google_datastore). from langchain_google_datastore import DatastoreLoader ``` -### Memorystore for Redis +#### Memorystore for Redis -> [Google Cloud Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis) is a fully managed Redis service for Google Cloud. Applications running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, secure Redis service without the burden of managing complex Redis deployments. +> [Google Cloud Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis) is a fully managed Redis service. Install the python package: @@ -556,9 +448,9 @@ See [usage example](/docs/integrations/document_loaders/google_memorystore_redis from langchain_google_memorystore_redis import MemorystoreDocumentLoader ``` -### Spanner +#### Spanner -> [Google Cloud Spanner](https://cloud.google.com/spanner/docs) is a fully managed, mission-critical, relational database service on Google Cloud that offers transactional consistency at global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: GoogleSQL (ANSI 2011 with extensions) and PostgreSQL. +> [Google Cloud Spanner](https://cloud.google.com/spanner/docs) is a fully managed, globally distributed relational database service. Install the python package: @@ -572,27 +464,27 @@ See [usage example](/docs/integrations/document_loaders/google_spanner). from langchain_google_spanner import SpannerLoader ``` -### Speech-to-Text +#### Speech-to-Text -> [Google Cloud Speech-to-Text](https://cloud.google.com/speech-to-text) is an audio transcription API powered by Google's speech recognition models in Google Cloud. +> [Google Cloud Speech-to-Text](https://cloud.google.com/speech-to-text) transcribes audio files. -This document loader transcribes audio files and outputs the text results as Documents. - -First, we need to install `langchain-google-community` with speech-to-text dependencies. +Install with Speech-to-Text dependencies: ```bash pip install langchain-google-community[speech] ``` -See a [usage example and authorization instructions](/docs/integrations/document_loaders/google_speech_to_text). +See [usage example and authorization instructions](/docs/integrations/document_loaders/google_speech_to_text). ```python from langchain_google_community import SpeechToTextLoader ``` -## Document Transformers +### Document Transformers -### Document AI +Transform documents using Google Cloud services. + +#### Document AI >[Google Cloud Document AI](https://cloud.google.com/document-ai/docs/overview) is a Google Cloud > service that transforms unstructured data from documents into structured data, making it easier @@ -615,7 +507,7 @@ from langchain_core.document_loaders.blob_loaders import Blob from langchain_google_community import DocAIParser ``` -### Google Translate +#### Google Translate > [Google Translate](https://translate.google.com/) is a multilingual neural machine > translation service developed by Google to translate text, documents and websites @@ -629,15 +521,17 @@ First, we need to install the `langchain-google-community` with translate depend pip install langchain-google-community[translate] ``` -See a [usage example and authorization instructions](/docs/integrations/document_transformers/google_translate). +See [usage example and authorization instructions](/docs/integrations/document_transformers/google_translate). ```python from langchain_google_community import GoogleTranslateTransformer ``` -## Vector Stores +### Vector Stores -### AlloyDB for PostgreSQL +Store and search vectors using Google Cloud databases and Vertex AI Vector Search. + +#### AlloyDB for PostgreSQL > [Google Cloud AlloyDB](https://cloud.google.com/alloydb) is a fully managed relational database service that offers high performance, seamless integration, and impressive scalability on Google Cloud. AlloyDB is 100% compatible with PostgreSQL. @@ -650,10 +544,10 @@ pip install langchain-google-alloydb-pg See [usage example](/docs/integrations/vectorstores/google_alloydb). ```python -from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBVectorStore +from langchain_google_alloydb_pg import AlloyDBVectorStore # AlloyDBEngine also available ``` -### BigQuery Vector Search +#### BigQuery Vector Search > [Google Cloud BigQuery](https://cloud.google.com/bigquery), > BigQuery is a serverless and cost-effective enterprise data warehouse in Google Cloud. @@ -669,15 +563,17 @@ We need to install several python packages. pip install google-cloud-bigquery ``` -See a [usage example](/docs/integrations/vectorstores/google_bigquery_vector_search). +See [usage example](/docs/integrations/vectorstores/google_bigquery_vector_search). ```python -from langchain.vectorstores import BigQueryVectorSearch +# Note: BigQueryVectorSearch might be in langchain or langchain_community depending on version +# Check imports in the usage example. +from langchain.vectorstores import BigQueryVectorSearch # Or langchain_community.vectorstores ``` -### Memorystore for Redis +#### Memorystore for Redis -> [Google Cloud Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis) is a fully managed Redis service for Google Cloud. Applications running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, secure Redis service without the burden of managing complex Redis deployments. +> Vector store using [Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis). Install the python package: @@ -691,9 +587,9 @@ See [usage example](/docs/integrations/vectorstores/google_memorystore_redis). from langchain_google_memorystore_redis import RedisVectorStore ``` -### Spanner +#### Spanner -> [Google Cloud Spanner](https://cloud.google.com/spanner/docs) is a fully managed, mission-critical, relational database service on Google Cloud that offers transactional consistency at global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: GoogleSQL (ANSI 2011 with extensions) and PostgreSQL. +> Vector store using [Cloud Spanner](https://cloud.google.com/spanner/docs). Install the python package: @@ -707,9 +603,9 @@ See [usage example](/docs/integrations/vectorstores/google_spanner). from langchain_google_spanner import SpannerVectorStore ``` -### Firestore (Native Mode) +#### Firestore (Native Mode) -> [Google Cloud Firestore](https://cloud.google.com/firestore/docs/) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. +> Vector store using [Firestore](https://cloud.google.com/firestore/docs/). Install the python package: @@ -723,9 +619,9 @@ See [usage example](/docs/integrations/vectorstores/google_firestore). from langchain_google_firestore import FirestoreVectorStore ``` -### Cloud SQL for MySQL +#### Cloud SQL for MySQL -> [Google Cloud SQL for MySQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your MySQL relational databases on Google Cloud. +> Vector store using [Cloud SQL for MySQL](https://cloud.google.com/sql). Install the python package: @@ -736,12 +632,12 @@ pip install langchain-google-cloud-sql-mysql See [usage example](/docs/integrations/vectorstores/google_cloud_sql_mysql). ```python -from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLVectorStore +from langchain_google_cloud_sql_mysql import MySQLVectorStore # MySQLEngine also available ``` -### Cloud SQL for PostgreSQL +#### Cloud SQL for PostgreSQL -> [Google Cloud SQL for PostgreSQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud. +> Vector store using [Cloud SQL for PostgreSQL](https://cloud.google.com/sql). Install the python package: @@ -752,10 +648,10 @@ pip install langchain-google-cloud-sql-pg See [usage example](/docs/integrations/vectorstores/google_cloud_sql_pg). ```python -from langchain_google_cloud_sql_pg import PostgresEngine, PostgresVectorStore +from langchain_google_cloud_sql_pg import PostgresVectorStore # PostgresEngine also available ``` -### Vertex AI Vector Search +#### Vertex AI Vector Search > [Google Cloud Vertex AI Vector Search](https://cloud.google.com/vertex-ai/docs/vector-search/overview) from Google Cloud, > formerly known as `Vertex AI Matching Engine`, provides the industry's leading high-scale @@ -774,334 +670,258 @@ See a [usage example](/docs/integrations/vectorstores/google_vertex_ai_vector_se from langchain_google_vertexai import VectorSearchVectorStore ``` -### Vertex AI Vector Search with DataStore +##### With DataStore Backend -> VectorSearch with DatasTore document storage. +> Vector search using Datastore for document storage. -Install the python package: - -```bash -pip install langchain-google-vertexai -``` - -See a [usage example](/docs/integrations/vectorstores/google_vertex_ai_vector_search/#optional--you-can-also-create-vectore-and-store-chunks-in-a-datastore). +See [usage example](/docs/integrations/vectorstores/google_vertex_ai_vector_search/#optional--you-can-also-create-vectore-and-store-chunks-in-a-datastore). ```python from langchain_google_vertexai import VectorSearchVectorStoreDatastore ``` -### VectorSearchVectorStoreGCS +##### With GCS Backend -> Alias of `VectorSearchVectorStore` for consistency -> with the rest of vector stores with different document storage backends. - -Install the python package: - -```bash -pip install langchain-google-vertexai -``` +> Alias for `VectorSearchVectorStore` storing documents/index in GCS. ```python from langchain_google_vertexai import VectorSearchVectorStoreGCS ``` -### Google Generative AI Vector Store +### Retrievers -> Currently, it computes the embedding vectors on the server side. -> For more information visit [Guide](https://developers.generativeai.google/guide). +Retrieve information using Google Cloud services. -Install the python package: +#### Vertex AI Search -```bash -pip install langchain-google-genai -``` - -```python -from langchain_google_genai.google_vector_store import GoogleVectorStore -``` - -### ScaNN - ->[Google ScaNN](https://github.com/google-research/google-research/tree/master/scann) -> (Scalable Nearest Neighbors) is a python package. -> ->`ScaNN` is a method for efficient vector similarity search at scale. - ->`ScaNN` includes search space pruning and quantization for Maximum Inner -> Product Search and also supports other distance functions such as -> Euclidean distance. The implementation is optimized for x86 processors -> with AVX2 support. See its [Google Research github](https://github.com/google-research/google-research/tree/master/scann) -> for more details. - -We need to install `scann` python package. - -```bash -pip install scann -``` - -See a [usage example](/docs/integrations/vectorstores/scann). - -```python -from langchain_community.vectorstores import ScaNN -``` - -## Retrievers - -### Google Drive - -We need to install several python packages. - -```bash -pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib langchain-googledrive -``` - -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](https://cloud.google.com/generative-ai-app-builder/docs/introduction) +> Build generative AI powered search engines using [Vertex AI Search](https://cloud.google.com/generative-ai-app-builder/docs/introduction). > from Google Cloud allows developers to quickly build generative AI powered search engines for customers and employees. See a [usage example](/docs/integrations/retrievers/google_vertex_ai_search). -Note: `GoogleVertexAISearchRetriever` is deprecated, use `VertexAIMultiTurnSearchRetriever`, -`VertexAISearchSummaryTool`, and `VertexAISearchRetriever` (see below). +Note: `GoogleVertexAISearchRetriever` is deprecated. Use the components below from `langchain-google-community`. -#### GoogleVertexAISearchRetriever - -We need to install the `google-cloud-discoveryengine` python package. +Install the `google-cloud-discoveryengine` package for underlying access. ```bash -pip install google-cloud-discoveryengine +pip install google-cloud-discoveryengine langchain-google-community ``` -```python -from langchain_community.retrievers import GoogleVertexAISearchRetriever -``` - -#### VertexAIMultiTurnSearchRetriever - -```python -from langchain_google_community import VertexAIMultiTurnSearchRetriever -``` -#### VertexAISearchRetriever +##### VertexAIMultiTurnSearchRetriever ```python from langchain_google_community import VertexAIMultiTurnSearchRetriever ``` -#### VertexAISearchSummaryTool +##### VertexAISearchRetriever + +```python +# Note: The example code shows VertexAIMultiTurnSearchRetriever, confirm if VertexAISearchRetriever is separate or related. +# Assuming it might be related or a typo in the original doc: +from langchain_google_community import VertexAISearchRetriever # Verify class name if needed +``` + +##### VertexAISearchSummaryTool ```python from langchain_google_community import VertexAISearchSummaryTool ``` -### Document AI Warehouse +#### Document AI Warehouse -> [Document AI Warehouse](https://cloud.google.com/document-ai-warehouse) -> from Google Cloud allows enterprises to search, store, govern, and manage documents and their AI-extracted -> data and metadata in a single platform. +> Search, store, and manage documents using [Document AI Warehouse](https://cloud.google.com/document-ai-warehouse). -Note: `GoogleDocumentAIWarehouseRetriever` is deprecated, use `DocumentAIWarehouseRetriever` (see below). -```python -from langchain.retrievers import GoogleDocumentAIWarehouseRetriever -docai_wh_retriever = GoogleDocumentAIWarehouseRetriever( - project_number=... -) -query = ... -documents = docai_wh_retriever.invoke( - query, user_ldap=... -) +Note: `GoogleDocumentAIWarehouseRetriever` (from `langchain`) is deprecated. Use `DocumentAIWarehouseRetriever` from `langchain-google-community`. + +Requires installation of relevant Document AI packages (check specific docs). + +```bash +pip install langchain-google-community # Add specific docai dependencies if needed ``` ```python from langchain_google_community.documentai_warehouse import DocumentAIWarehouseRetriever ``` -## Tools +### Tools -### Text-to-Speech +Integrate agents with various Google services. + +#### Text-to-Speech >[Google Cloud Text-to-Speech](https://cloud.google.com/text-to-speech) is a Google Cloud service that enables developers to > synthesize natural-sounding speech with 100+ voices, available in multiple languages and variants. -> It applies DeepMind’s groundbreaking research in WaveNet and Google’s powerful neural networks +> It applies DeepMind's groundbreaking research in WaveNet and Google's powerful neural networks > to deliver the highest fidelity possible. -We need to install python packages. +Install required packages: ```bash pip install google-cloud-text-to-speech langchain-google-community ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_cloud_texttospeech). +See [usage example and authorization instructions](/docs/integrations/tools/google_cloud_texttospeech). ```python from langchain_google_community import TextToSpeechTool ``` -### Google Drive +#### Google Drive -We need to install several python packages. +Tools for interacting with Google Drive. + +Install required packages: ```bash -pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib -pip install langchain-googledrive +pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib langchain-googledrive ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_drive). +See [usage example and authorization instructions](/docs/integrations/tools/google_drive). ```python from langchain_googledrive.utilities.google_drive import GoogleDriveAPIWrapper from langchain_googledrive.tools.google_drive.tool import GoogleDriveSearchTool ``` -### Google Finance +#### Google Finance -We need to install a python package. +Query financial data. Requires `google-search-results` package and SerpApi key. ```bash -pip install google-search-results +pip install google-search-results langchain-community # Requires langchain-community ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_finance). +See [usage example and authorization instructions](/docs/integrations/tools/google_finance). ```python from langchain_community.tools.google_finance import GoogleFinanceQueryRun from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper ``` -### Google Jobs +#### Google Jobs -We need to install a python package. +Query job listings. Requires `google-search-results` package and SerpApi key. ```bash -pip install google-search-results +pip install google-search-results langchain-community # Requires langchain-community ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_jobs). +See [usage example and authorization instructions](/docs/integrations/tools/google_jobs). ```python from langchain_community.tools.google_jobs import GoogleJobsQueryRun -from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper +# Note: Utilities might be shared, e.g., GoogleFinanceAPIWrapper was listed, verify correct utility +# from langchain_community.utilities.google_jobs import GoogleJobsAPIWrapper # If exists ``` -### Google Lens +#### Google Lens -See a [usage example and authorization instructions](/docs/integrations/tools/google_lens). +Perform visual searches. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_lens). ```python from langchain_community.tools.google_lens import GoogleLensQueryRun from langchain_community.utilities.google_lens import GoogleLensAPIWrapper ``` -### Google Places +#### Google Places -We need to install a python package. +Search for places information. Requires `googlemaps` package and a Google Maps API key. ```bash -pip install googlemaps +pip install googlemaps langchain # Requires base langchain ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_places). +See [usage example and authorization instructions](/docs/integrations/tools/google_places). ```python -from langchain.tools import GooglePlacesTool +# Note: GooglePlacesTool might be in langchain or langchain_community depending on version +from langchain.tools import GooglePlacesTool # Or langchain_community.tools ``` -### Google Scholar +#### Google Scholar -We need to install a python package. +Search academic papers. Requires `google-search-results` package and SerpApi key. ```bash -pip install google-search-results +pip install google-search-results langchain-community # Requires langchain-community ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_scholar). +See [usage example and authorization instructions](/docs/integrations/tools/google_scholar). ```python from langchain_community.tools.google_scholar import GoogleScholarQueryRun from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper ``` -### Google Search +#### Google 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. +Perform web searches using Google Custom Search Engine (CSE). Requires `GOOGLE_API_KEY` and `GOOGLE_CSE_ID`. +Install `langchain-google-community`: +```bash +pip install langchain-google-community +``` + +Wrapper: ```python from langchain_google_community import GoogleSearchAPIWrapper ``` -For a more detailed walkthrough of this wrapper, see [this notebook](/docs/integrations/tools/google_search). - -We can easily load this wrapper as a Tool (to use with an Agent). We can do this with: +Tools: +```python +from langchain_community.tools import GoogleSearchRun, GoogleSearchResults +``` +Agent Loading: ```python from langchain.agents import load_tools tools = load_tools(["google-search"]) ``` -#### GoogleSearchResults +See [detailed notebook](/docs/integrations/tools/google_search). -Tool that queries the `Google Search` API (via `GoogleSearchAPIWrapper`) and gets back JSON. +#### Google Trends -```python -from langchain_community.tools import GoogleSearchResults -``` - -#### GoogleSearchRun - -Tool that queries the `Google Search` API (via `GoogleSearchAPIWrapper`). - -```python -from langchain_community.tools import GoogleSearchRun -``` - - -### Google Trends - -We need to install a python package. +Query Google Trends data. Requires `google-search-results` package and SerpApi key. ```bash -pip install google-search-results +pip install google-search-results langchain-community # Requires langchain-community ``` -See a [usage example and authorization instructions](/docs/integrations/tools/google_trends). +See [usage example and authorization instructions](/docs/integrations/tools/google_trends). ```python from langchain_community.tools.google_trends import GoogleTrendsQueryRun from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper ``` -## Toolkits +### Toolkits + +Collections of tools for specific Google services. + +#### GMail -### GMail > [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`. -We need to install `langchain-google-community` with required dependencies: - ```bash pip install langchain-google-community[gmail] ``` -See a [usage example and authorization instructions](/docs/integrations/tools/gmail). +See [usage example and authorization instructions](/docs/integrations/tools/gmail). ```python +# Load the whole toolkit from langchain_google_community import GmailToolkit -``` -#### GMail individual tools - -You can use individual tools from GMail Toolkit. - -```python +# Or use individual tools from langchain_google_community.gmail.create_draft import GmailCreateDraft from langchain_google_community.gmail.get_message import GmailGetMessage from langchain_google_community.gmail.get_thread import GmailGetThread @@ -1109,11 +929,13 @@ from langchain_google_community.gmail.search import GmailSearch from langchain_google_community.gmail.send_message import GmailSendMessage ``` -## Memory +### Memory -### AlloyDB for PostgreSQL +Store conversation history using Google Cloud databases. -> [AlloyDB for PostgreSQL](https://cloud.google.com/alloydb) is a fully managed relational database service that offers high performance, seamless integration, and impressive scalability on Google Cloud. AlloyDB is 100% compatible with PostgreSQL. +#### AlloyDB for PostgreSQL + +> Chat memory using [AlloyDB](https://cloud.google.com/alloydb). Install the python package: @@ -1124,12 +946,12 @@ pip install langchain-google-alloydb-pg See [usage example](/docs/integrations/memory/google_alloydb). ```python -from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBChatMessageHistory +from langchain_google_alloydb_pg import AlloyDBChatMessageHistory # AlloyDBEngine also available ``` -### Cloud SQL for PostgreSQL +#### Cloud SQL for PostgreSQL -> [Cloud SQL for PostgreSQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud. +> Chat memory using [Cloud SQL for PostgreSQL](https://cloud.google.com/sql). Install the python package: @@ -1139,14 +961,13 @@ pip install langchain-google-cloud-sql-pg See [usage example](/docs/integrations/memory/google_sql_pg). - ```python -from langchain_google_cloud_sql_pg import PostgresEngine, PostgresChatMessageHistory +from langchain_google_cloud_sql_pg import PostgresChatMessageHistory # PostgresEngine also available ``` -### Cloud SQL for MySQL +#### Cloud SQL for MySQL -> [Cloud SQL for MySQL](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your MySQL relational databases on Google Cloud. +> Chat memory using [Cloud SQL for MySQL](https://cloud.google.com/sql). Install the python package: @@ -1157,12 +978,12 @@ pip install langchain-google-cloud-sql-mysql See [usage example](/docs/integrations/memory/google_sql_mysql). ```python -from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLChatMessageHistory +from langchain_google_cloud_sql_mysql import MySQLChatMessageHistory # MySQLEngine also available ``` -### Cloud SQL for SQL Server +#### Cloud SQL for SQL Server -> [Cloud SQL for SQL Server](https://cloud.google.com/sql) is a fully-managed database service that helps you set up, maintain, manage, and administer your SQL Server databases on Google Cloud. +> Chat memory using [Cloud SQL for SQL Server](https://cloud.google.com/sql). Install the python package: @@ -1173,12 +994,12 @@ pip install langchain-google-cloud-sql-mssql See [usage example](/docs/integrations/memory/google_sql_mssql). ```python -from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLChatMessageHistory +from langchain_google_cloud_sql_mssql import MSSQLChatMessageHistory # MSSQLEngine also available ``` -### Spanner +#### Spanner -> [Google Cloud Spanner](https://cloud.google.com/spanner/docs) is a fully managed, mission-critical, relational database service on Google Cloud that offers transactional consistency at global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: GoogleSQL (ANSI 2011 with extensions) and PostgreSQL. +> Chat memory using [Cloud Spanner](https://cloud.google.com/spanner/docs). Install the python package: @@ -1192,9 +1013,9 @@ See [usage example](/docs/integrations/memory/google_spanner). from langchain_google_spanner import SpannerChatMessageHistory ``` -### Memorystore for Redis +#### Memorystore for Redis -> [Google Cloud Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis) is a fully managed Redis service for Google Cloud. Applications running on Google Cloud can achieve extreme performance by leveraging the highly scalable, available, secure Redis service without the burden of managing complex Redis deployments. +> Chat memory using [Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis). Install the python package: @@ -1202,15 +1023,15 @@ Install the python package: pip install langchain-google-memorystore-redis ``` -See [usage example](/docs/integrations/document_loaders/google_memorystore_redis). +See [usage example](/docs/integrations/memory/google_memorystore_redis). ```python from langchain_google_memorystore_redis import MemorystoreChatMessageHistory ``` -### Bigtable +#### Bigtable -> [Google Cloud Bigtable](https://cloud.google.com/bigtable/docs) is Google's fully managed NoSQL Big Data database service in Google Cloud. +> Chat memory using [Cloud Bigtable](https://cloud.google.com/bigtable/docs). Install the python package: @@ -1224,9 +1045,9 @@ See [usage example](/docs/integrations/memory/google_bigtable). from langchain_google_bigtable import BigtableChatMessageHistory ``` -### Firestore (Native Mode) +#### Firestore (Native Mode) -> [Google Cloud Firestore](https://cloud.google.com/firestore/docs/) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. +> Chat memory using [Firestore](https://cloud.google.com/firestore/docs/). Install the python package: @@ -1240,10 +1061,9 @@ See [usage example](/docs/integrations/memory/google_firestore). from langchain_google_firestore import FirestoreChatMessageHistory ``` -### Firestore (Datastore Mode) +#### Firestore (Datastore Mode) -> [Google Cloud Firestore in Datastore mode](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. -> Firestore is the newest version of Datastore and introduces several improvements over Datastore. +> Chat memory using [Firestore in Datastore mode](https://cloud.google.com/datastore/docs). Install the python package: @@ -1257,11 +1077,11 @@ See [usage example](/docs/integrations/memory/google_firestore_datastore). from langchain_google_datastore import DatastoreChatMessageHistory ``` -### El Carro: The Oracle Operator for Kubernetes +#### El Carro: The Oracle Operator for Kubernetes -> Google [El Carro Oracle Operator for Kubernetes](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator) -offers a way to run `Oracle` databases in `Kubernetes` as a portable, open source, -community driven, no vendor lock-in container orchestration system. +> Chat memory using Oracle databases run via [El Carro](https://github.com/GoogleCloudPlatform/elcarro-oracle-operator). + +Install the python package: ```bash pip install langchain-google-el-carro @@ -1273,70 +1093,298 @@ See [usage example](/docs/integrations/memory/google_el_carro). from langchain_google_el_carro import ElCarroChatMessageHistory ``` -## Callbacks +### Callbacks -### Vertex AI callback handler +Track LLM/Chat model usage. ->Callback Handler that tracks `VertexAI` info. +#### Vertex AI callback handler -We need to install `langchain-google-vertexai` python package. +>Callback Handler that tracks `VertexAI` usage info. -```bash -pip install langchain-google-vertexai -``` +Requires `langchain-google-vertexai`. ```python from langchain_google_vertexai.callbacks import VertexAICallbackHandler ``` -## Chat Loaders +### Evaluators -### GMail +Evaluate model outputs using Vertex AI. -> [Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google. -This loader works with emails through the `Gmail API`. +Requires `langchain-google-vertexai`. -We need to install `langchain-google-community` with underlying dependencies. +#### VertexPairWiseStringEvaluator + +>Pair-wise evaluation using Vertex AI models. + +```python +from langchain_google_vertexai.evaluators.evaluation import VertexPairWiseStringEvaluator +``` + +#### VertexStringEvaluator + +>Evaluate a single prediction string using Vertex AI models. + +```python +# Note: Original doc listed VertexPairWiseStringEvaluator twice. Assuming this class exists. +from langchain_google_vertexai.evaluators.evaluation import VertexStringEvaluator # Verify class name if needed +``` + +## Other Google Products + +Integrations with various Google services beyond the core Cloud Platform. + +### Document Loaders + +#### Google Drive + +>[Google Drive](https://en.wikipedia.org/wiki/Google_Drive) file storage. Currently supports `Google Docs`. + +Install with Drive dependencies: + +```bash +pip install langchain-google-community[drive] +``` + +See [usage example and authorization instructions](/docs/integrations/document_loaders/google_drive). + +```python +from langchain_google_community import GoogleDriveLoader +``` + +### Vector Stores + +#### ScaNN (Local Index) + +>[Google ScaNN](https://github.com/google-research/google-research/tree/master/scann) +> (Scalable Nearest Neighbors) is a python package. +> +>`ScaNN` is a method for efficient vector similarity search at scale. + +>`ScaNN` includes search space pruning and quantization for Maximum Inner +> Product Search and also supports other distance functions such as +> Euclidean distance. The implementation is optimized for x86 processors +> with AVX2 support. See its [Google Research github](https://github.com/google-research/google-research/tree/master/scann) +> for more details. + +Install the `scann` package: + +```bash +pip install scann langchain-community # Requires langchain-community +``` + +See a [usage example](/docs/integrations/vectorstores/scann). + +```python +from langchain_community.vectorstores import ScaNN +``` + +### Retrievers + +#### Google Drive + +Retrieve documents from Google Drive. + +Install required packages: + +```bash +pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib langchain-googledrive +``` + +See [usage example and authorization instructions](/docs/integrations/retrievers/google_drive). + +```python +from langchain_googledrive.retrievers import GoogleDriveRetriever +``` + +### Tools + +#### Google Drive + +Tools for interacting with Google Drive. + +Install required packages: + +```bash +pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib langchain-googledrive +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_drive). + +```python +from langchain_googledrive.utilities.google_drive import GoogleDriveAPIWrapper +from langchain_googledrive.tools.google_drive.tool import GoogleDriveSearchTool +``` + +#### Google Finance + +Query financial data. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_finance). + +```python +from langchain_community.tools.google_finance import GoogleFinanceQueryRun +from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper +``` + +#### Google Jobs + +Query job listings. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_jobs). + +```python +from langchain_community.tools.google_jobs import GoogleJobsQueryRun +# Note: Utilities might be shared, e.g., GoogleFinanceAPIWrapper was listed, verify correct utility +# from langchain_community.utilities.google_jobs import GoogleJobsAPIWrapper # If exists +``` + +#### Google Lens + +Perform visual searches. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_lens). + +```python +from langchain_community.tools.google_lens import GoogleLensQueryRun +from langchain_community.utilities.google_lens import GoogleLensAPIWrapper +``` + +#### Google Places + +Search for places information. Requires `googlemaps` package and a Google Maps API key. + +```bash +pip install googlemaps langchain # Requires base langchain +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_places). + +```python +# Note: GooglePlacesTool might be in langchain or langchain_community depending on version +from langchain.tools import GooglePlacesTool # Or langchain_community.tools +``` + +#### Google Scholar + +Search academic papers. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_scholar). + +```python +from langchain_community.tools.google_scholar import GoogleScholarQueryRun +from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper +``` + +#### Google Search + +Perform web searches using Google Custom Search Engine (CSE). Requires `GOOGLE_API_KEY` and `GOOGLE_CSE_ID`. + +Install `langchain-google-community`: +```bash +pip install langchain-google-community +``` + +Wrapper: +```python +from langchain_google_community import GoogleSearchAPIWrapper +``` + +Tools: +```python +from langchain_community.tools import GoogleSearchRun, GoogleSearchResults +``` + +Agent Loading: +```python +from langchain.agents import load_tools +tools = load_tools(["google-search"]) +``` + +See [detailed notebook](/docs/integrations/tools/google_search). + +#### Google Trends + +Query Google Trends data. Requires `google-search-results` package and SerpApi key. + +```bash +pip install google-search-results langchain-community # Requires langchain-community +``` + +See [usage example and authorization instructions](/docs/integrations/tools/google_trends). + +```python +from langchain_community.tools.google_trends import GoogleTrendsQueryRun +from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper +``` + +### Toolkits + +#### GMail + + +> [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`. ```bash pip install langchain-google-community[gmail] ``` -See a [usage example and authorization instructions](/docs/integrations/chat_loaders/gmail). +See [usage example and authorization instructions](/docs/integrations/tools/gmail). + +```python +# Load the whole toolkit +from langchain_google_community import GmailToolkit + +# Or use individual tools +from langchain_google_community.gmail.create_draft import GmailCreateDraft +from langchain_google_community.gmail.get_message import GmailGetMessage +from langchain_google_community.gmail.get_thread import GmailGetThread +from langchain_google_community.gmail.search import GmailSearch +from langchain_google_community.gmail.send_message import GmailSendMessage +``` + +### Chat Loaders + +#### GMail + +> Load chat history from Gmail threads. + +Install with GMail dependencies: + +```bash +pip install langchain-google-community[gmail] +``` + +See [usage example and authorization instructions](/docs/integrations/chat_loaders/gmail). ```python from langchain_google_community import GMailLoader ``` -## Evaluators - -We need to install `langchain-google-vertexai` python package. - -```bash -pip install langchain-google-vertexai -``` - -### VertexPairWiseStringEvaluator - ->Pair-wise evaluation of the perplexity of a predicted string. - -```python -from langchain_google_vertexai.evaluators.evaluation import VertexPairWiseStringEvaluator -``` - -### VertexStringEvaluator - ->Evaluate the perplexity of a predicted string. - -```python -from langchain_google_vertexai.evaluators.evaluation import VertexPairWiseStringEvaluator -``` - ## 3rd Party Integrations +Access Google services via third-party APIs. + ### SearchApi ->[SearchApi](https://www.searchapi.io/) provides a 3rd-party API to access Google search results, YouTube search & transcripts, and other Google-related engines. +>[SearchApi](https://www.searchapi.io/) provides API access to Google search, YouTube, etc. Requires `langchain-community`. See [usage examples and authorization instructions](/docs/integrations/tools/searchapi). @@ -1346,7 +1394,7 @@ from langchain_community.utilities import SearchApiAPIWrapper ### SerpApi ->[SerpApi](https://serpapi.com/) provides a 3rd-party API to access Google search results. +>[SerpApi](https://serpapi.com/) provides API access to Google search results. Requires `langchain-community`. See a [usage example and authorization instructions](/docs/integrations/tools/serpapi). @@ -1356,6 +1404,8 @@ from langchain_community.utilities import SerpAPIWrapper ### Serper.dev +>[Google Serper](https://serper.dev/) provides API access to Google search results. Requires `langchain-community`. + See a [usage example and authorization instructions](/docs/integrations/tools/google_serper). ```python @@ -1364,51 +1414,43 @@ from langchain_community.utilities import GoogleSerperAPIWrapper ### YouTube ->[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. +#### YouTube Search Tool -We need to install a python package. +>Search `YouTube` videos without the official API. Requires `youtube_search` package. ```bash -pip install youtube_search +pip install youtube_search langchain # Requires base langchain ``` See a [usage example](/docs/integrations/tools/youtube). ```python -from langchain.tools import YouTubeSearchTool +# Note: YouTubeSearchTool might be in langchain or langchain_community +from langchain.tools import YouTubeSearchTool # Or langchain_community.tools ``` -### YouTube audio +#### YouTube Audio Loader ->[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. +>Download audio from YouTube videos. Requires `yt_dlp`, `pydub`, `librosa`. ```bash -pip install yt_dlp pydub librosa +pip install yt_dlp pydub librosa langchain-community # Requires langchain-community ``` -See a [usage example and authorization instructions](/docs/integrations/document_loaders/youtube_audio). +See [usage example and authorization instructions](/docs/integrations/document_loaders/youtube_audio). ```python from langchain_community.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader -from langchain_community.document_loaders.parsers import OpenAIWhisperParser, OpenAIWhisperParserLocal +# Often used with whisper parsers: +# from langchain_community.document_loaders.parsers import OpenAIWhisperParser, OpenAIWhisperParserLocal ``` -### YouTube transcripts +#### YouTube Transcripts Loader ->[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. +>Load video transcripts. Requires `youtube-transcript-api`. ```bash -pip install youtube-transcript-api +pip install youtube-transcript-api langchain-community # Requires langchain-community ``` See a [usage example](/docs/integrations/document_loaders/youtube_transcript).