Skip to main content

VertexAIImageQA

This component enables text generation (image captioning) using Google Vertex AI generative models.

Basic Information

  • Type: haystack_integrations.components.generators.google_vertex.question_answering.VertexAIImageQA

Inputs

ParameterTypeDefaultDescription
imageByteStreamThe image to ask the question about.
questionstrThe question to ask.

Outputs

ParameterTypeDefaultDescription
repliesList[str]A dictionary with the following keys: - replies: A list of answers to the question.

Overview

Work in Progress

Bear with us while we're working on adding pipeline examples and most common components connections.

This component enables text generation (image captioning) using Google Vertex AI generative models.

Authenticates using Google Cloud Application Default Credentials (ADCs). For more information see the official Google documentation.

Usage example:

from haystack.dataclasses.byte_stream import ByteStream
from haystack_integrations.components.generators.google_vertex import VertexAIImageQA

qa = VertexAIImageQA()

image = ByteStream.from_file_path("dog.jpg")

res = qa.run(image=image, question="What color is this dog")

print(res["replies"][0])

>>> white

Usage Example

components:
VertexAIImageQA:
type: google_vertex.src.haystack_integrations.components.generators.google_vertex.question_answering.VertexAIImageQA
init_parameters:

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
project_idOptional[str]NoneID of the GCP project to use. By default, it is set during Google Cloud authentication.
modelstrimagetextName of the model to use.
locationOptional[str]NoneThe default location to use when making API calls, if not set uses us-central-1.
kwargsAnyAdditional keyword arguments to pass to the model. For a list of supported arguments 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.

ParameterTypeDefaultDescription
imageByteStreamThe image to ask the question about.
questionstrThe question to ask.