VertexAIImageQA
Answer questions about images using Google Vertex AI generative models.
Key Features
- Answers natural language questions about image content using Vertex AI generative models.
- Accepts an image as
ByteStreaminput alongside a text question. - Authenticates using Google Cloud Application Default Credentials.
- Returns a list of answers based on the image content.
Configuration
This component authenticates using Google Cloud Application Default Credentials (ADCs). For more information, see the official Google documentation.
Create secrets for GCP_PROJECT_ID and optionally GCP_DEFAULT_REGION. For detailed instructions on creating secrets, see Create Secrets.
- Drag the
VertexAIImageQAcomponent onto the canvas from the Component Library. - Click the component to open the configuration panel.
- On the General tab:
- Enter the model name (for example,
imagetext).
- Enter the model name (for example,
- Go to the Advanced tab to configure the project ID, location, and additional model kwargs.
Connections
VertexAIImageQA accepts an image (image) as ByteStream and a question string (question) as inputs. It outputs a list of answers (replies).
Connect the pipeline's query input to the question input, and connect replies to AnswerBuilder to format the final answer.
Usage Example
This pipeline uses VertexAIImageQA to answer questions about images:
components:
VertexAIImageQA:
type: haystack_integrations.components.generators.google_vertex.question_answering.VertexAIImageQA
init_parameters:
project_id:
model: imagetext
location:
AnswerBuilder:
type: haystack.components.builders.answer_builder.AnswerBuilder
init_parameters:
pattern:
reference_pattern:
connections:
- sender: VertexAIImageQA.replies
receiver: AnswerBuilder.replies
outputs:
answers: AnswerBuilder.answers
max_runs_per_component: 100
metadata: {}
inputs:
query:
- VertexAIImageQA.question
- AnswerBuilder.query
Parameters
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| image | ByteStream | The image to ask the question about. | |
| question | str | The question to ask. |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| replies | List[str] | A list of answers to the question. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| project_id | Optional[str] | None | ID of the GCP project to use. By default, it is set during Google Cloud authentication. |
| model | str | imagetext | Name of the model to use. |
| location | Optional[str] | None | The default location to use when making API calls. If not set, uses us-central-1. |
| kwargs | Any | Additional keyword arguments to pass to the model. See the ImageTextModel.ask_question() documentation. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
| image | ByteStream | The image to ask the question about. | |
| question | str | The question to ask. |
Was this page helpful?