Skip to content

Commit ba4deda

Browse files
authored
Update google-vertex-ai.md (#324)
1 parent e20abaf commit ba4deda

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

integrations/google-vertex-ai.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ toc: true
2323
- [Installation](#installation)
2424
- [Usage](#usage)
2525
- [Gemini API models](#gemini-api-models)
26+
- [Text Embedder API models](#text-embedder-api-models)
2627
- [PaLM API models](#palm-api-models)
2728
- [Codey API models](#codey-api-models)
2829
- [Imagen API models](#imagen-api-models)
2930

3031
## Overview
3132

32-
[Vertex AI](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview) is a machine learning (ML) platform that lets you train and deploy ML models and AI applications, and customize large language models (LLMs) for use in your AI-powered applications. This integration enables the usage of [models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models) through Vertex AI API on Google Cloud Platform (GCP).
33+
[Vertex AI](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview) is a machine learning (ML) platform that lets you train and deploy ML models and AI applications, and customize large language models (LLMs) for use in your AI-powered applications. This integration enables the usage of [generative models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models) and [embedding models](https://cloud.google.com/vertex-ai/generative-ai/docs/models#embeddings-models) through Vertex AI API on Google Cloud Platform (GCP).
3334

34-
Haystack supports [Gemini API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#gemini-models), [PaLM API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#palm-models), [Codey APIs models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#codey-models), and [Imagen API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#imagen-models) for task such as **text generation**, **function calling**, **image generation**, **visual question answering**, **code generation**, and **image captioning**.
35+
Haystack supports [Gemini API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#gemini-models), [PaLM API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#palm-models), [Codey APIs models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#codey-models), and [Imagen API models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#imagen-models) and [](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api) for task such as **text generation**, **function calling**, **image generation**, **visual question answering**, **code generation**, and **image captioning** as well as **embedding generation**.
3536

3637
> To learn more about the use cases and test Vertex AI models with Haystack, follow this [Notebook](https://haystack.deepset.ai/cookbook/vertexai-gemini-examples).
3738
@@ -46,14 +47,16 @@ pip install google-vertex-haystack
4647

4748
## Usage
4849

49-
Once installed, you will have access to various Haystack Generators:
50-
- [`VertexAIGeminiGenerator`](https://docs.haystack.deepset.ai/docs/vertexaigeminigenerator): Use this component with Gemini models '**gemini-1.5-pro**', '**gemini-1.5-flash**', '**gemini-2.0-flash**' for text generation and multimodal prompts.
51-
- [`VertexAIGeminiChatGenerator`](https://docs.haystack.deepset.ai/docs/vertexaigeminichatgenerator): Use this component with Gemini models '**gemini-1.5-pro**', '**gemini-1.5-flash**', '**gemini-2.0-flash**' for text generation, multimodal prompts and function calling in chat completion setting.
52-
- `VertexAITextGenerator`: Use this component with PaLM models for text generation.
53-
- `VertexAICodeGenerator`: Use this component with Codey model for code generation and code completion.
54-
- `VertexAIImageGenerator`: Use this component with Imagen model '**imagegeneration**' for image generation.
55-
- [`VertexAIImageCaptioner`](https://docs.haystack.deepset.ai/docs/vertexaiimagecaptioner): Use this component with Imagen model '**imagetext**' for image captioning.
56-
- `VertexAIImageQA`: Use this component with Imagen model '**imagetext**' for visual question answering.
50+
Once installed, you will have access to various Haystack Generators and Embedders:
51+
- [VertexAIGeminiGenerator](https://docs.haystack.deepset.ai/docs/vertexaigeminigenerator): Use this component with Gemini models '**gemini-1.5-pro**', '**gemini-1.5-flash**', '**gemini-2.0-flash**' for text generation and multimodal prompts.
52+
- [VertexAIGeminiChatGenerator](https://docs.haystack.deepset.ai/docs/vertexaigeminichatgenerator): Use this component with Gemini models '**gemini-1.5-pro**', '**gemini-1.5-flash**', '**gemini-2.0-flash**' for text generation, multimodal prompts and function calling in chat completion setting.
53+
- [VertexAITextGenerator](https://docs.haystack.deepset.ai/docs/vertexaitextgenerator): Use this component with PaLM models for text generation.
54+
- [VertexAICodeGenerator](https://docs.haystack.deepset.ai/docs/vertexaicodegenerator): Use this component with Codey model for code generation and code completion.
55+
- [VertexAIImageGenerator](https://docs.haystack.deepset.ai/docs/vertexaiimagegenerator): Use this component with Imagen model '**imagegeneration**' for image generation.
56+
- [VertexAIImageCaptioner](https://docs.haystack.deepset.ai/docs/vertexaiimagecaptioner): Use this component with Imagen model '**imagetext**' for image captioning.
57+
- [VertexAIImageQA](https://docs.haystack.deepset.ai/docs/vertexaiimageqa): Use this component with Imagen model '**imagetext**' for visual question answering.
58+
- `VertexAITextEmbedder`: Use this component to create embeddings for text data using Vertex AI Text Embedder API.
59+
- `VertexAIDocumentEmbedder`: Use this component to create embeddings for Document using Vertex AI Text Embedder API.
5760

5861
To use Vertex AI models, you need to have a Google Cloud Platform account and be logged in using Application Default Credentials (ADCs). For more info see the [official documentation](https://colab.research.google.com/corgiredirector?site=https%3A%2F%2Fcloud.google.com%2Fdocs%2Fauthentication%2Fprovide-credentials-adc).
5962
`VertexAIGeminiGenerator` and `VertexAIGeminiChatGenerator` support both `gemini-1.5-pro` and `gemini-1.5-flash`/ `gemini-2.0-flash` models.
@@ -117,6 +120,21 @@ The fourth image is of Marvin from the 1977 film The Hitchhiker's Guide to the G
117120
118121
*For function calling with `gemini-1.5-pro`, refer to the [Notebook](https://haystack.deepset.ai/cookbook/vertexai-gemini-examples).*
119122
123+
### Text Embedder API models
124+
125+
You can leverage Text Embedder API models `text-embedding-005`, `text-multilingual-embedding-002`, `text-embedding-large-exp-03-07`, `text-embedding-004`, and `textembedding-gecko-multilingual@001`.
126+
127+
```python
128+
from haystack_integrations.components.embedders.google_vertex import VertexAITextEmbedder
129+
130+
text_to_embed = "I love pizza!"
131+
132+
text_embedder = VertexAITextEmbedder(model="text-embedding-005")
133+
134+
print(text_embedder.run(text_to_embed))
135+
# {'embedding': [-0.08127457648515701, 0.03399784862995148, -0.05116401985287666, ...]
136+
```
137+
120138
### PaLM API Models
121139
122140
You can leverage PaLM API models `text-bison`, `text-unicorn` and `text-bison-32k` through `VertexAITextGenerator` for task generation. To use PaLM models, initialize a `VertexAITextGenerator` with model name.

0 commit comments

Comments
 (0)