VertexAITextGenerator
This component enables text generation using Google Vertex AI generative models.
Basic Information
- Type:
haystack_integrations.components.generators.google_vertex.text_generator.VertexAITextGenerator
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| prompt | str | The prompt to use for text generation. |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| replies | List[str] | A dictionary with the following keys: - replies: A list of generated replies. - safety_attributes: A dictionary with the safety scores of each answer. - citations: A list of citations for each answer. | |
| safety_attributes | Dict[str, float] | A dictionary with the following keys: - replies: A list of generated replies. - safety_attributes: A dictionary with the safety scores of each answer. - citations: A list of citations for each answer. | |
| citations | List[Dict[str, Any]] | A dictionary with the following keys: - replies: A list of generated replies. - safety_attributes: A dictionary with the safety scores of each answer. - citations: A list of citations for each answer. |
Overview
Bear with us while we're working on adding pipeline examples and most common components connections.
This component enables text generation using Google Vertex AI generative models.
VertexAITextGenerator supports text-bison, text-unicorn and text-bison-32k models.
Authenticates using Google Cloud Application Default Credentials (ADCs). For more information see the official Google documentation.
Usage example:
from haystack_integrations.components.generators.google_vertex import VertexAITextGenerator
generator = VertexAITextGenerator()
res = generator.run("Tell me a good interview question for a software engineer.")
print(res["replies"][0])
>>> **Question:**
>>> You are given a list of integers and a target sum.
>>> Find all unique combinations of numbers in the list that add up to the target sum.
>>>
>>> **Example:**
>>>
>>> ```
>>> Input: [1, 2, 3, 4, 5], target = 7
>>> Output: [[1, 2, 4], [3, 4]]
>>> ```
>>>
>>> **Follow-up:** What if the list contains duplicate numbers?
Usage Example
components:
VertexAITextGenerator:
type: google_vertex.src.haystack_integrations.components.generators.google_vertex.text_generator.VertexAITextGenerator
init_parameters:
Parameters
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 | text-bison | 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. For a list of supported arguments see the TextGenerationModel.predict() 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 |
|---|---|---|---|
| prompt | str | The prompt to use for text generation. |
Was this page helpful?