Skip to main content

PromptVertexAI

Description

Sends a prompt to VertexAI, writing the response either as a FlowFile attribute or to the contents of the incoming FlowFile. The prompt may consist of pure text interaction or may include multimedia.

Tags

ai, chat, cloud, gcp, google, image, pdf, prompt, text, video

Properties

In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
GCP Credentials Service *GCP Credentials ServiceController Service:
GCPCredentialsService

Implementations:
GCPCredentialsControllerService
The Controller Service used to obtain Google Cloud Platform credentials.
GCP Location *GCP LocationThe location to configure the Vertex client with

Supports Expression Language, using Environment variables.
GCP Project ID *GCP Project IDThe project ID to configure the Vertex client with

Supports Expression Language, using Environment variables.
Prompt Type *Prompt TypeText
  • Text
  • Media
The type of prompt to send to Vertex. Text to send a simple prompt. Media to send a multimedia type first followed by a text prompt.
Media MIME TypeMedia MIME Type${mime.type}The MIME type of the media in the FlowFile content. Supported media types are listed here: https://firebase.google.com/docs/vertex-ai/input-file-requirements

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Prompt Type has a value of Media
Model Name *Model Namegemini-1.5-flashThe name of the Vertex model

Supports Expression Language, using FlowFile attributes and Environment variables.
System MessageSystem MessageThe system message to send to Vertex. FlowFile attributes may be referenced via Expression Language, and the contents of the FlowFile may be referenced via the flowfile_content variable. E.g., ${flowfile_content}

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Prompt Type has a value of Media or Text
User Message *User MessageThe user message to send to Vertex. FlowFile attributes may be referenced via Expression Language, and the contents of the FlowFile may be referenced via the flowfile_content variable. E.g., ${flowfile_content}. The user message is added first, unless an image is present.

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Prompt Type has a value of Media or Text
Response Format *Response FormatPlain Text
  • JSON
  • Plain Text
The format of the response from Vertex
Stop SequencesStop SequencesA comma delimited list of strings act as stop sequences. The model will halt after encountering one of the stop sequences.

Supports Expression Language, using FlowFile attributes and Environment variables.
Max File SizeMax File Size10 MBThe maximum size of a FlowFile that can be sent to Vertex as an image. If the FlowFile is larger than this, it will be routed to 'failure'.

This property is only considered if:
  • the property Prompt Type has a value of Media
TemperatureTemperatureThe temperature to use for generating the response. Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.

Supports Expression Language, using FlowFile attributes and Environment variables.
Top KTop KThe top K value to use for generating the response. Only sample from the top K options for each subsequent token. Recommended for advanced use cases only. You usually only need to use temperature.

Supports Expression Language, using FlowFile attributes and Environment variables.
Top PTop PThe top P value to use for generating the response. Top P is for nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p.Recommended for advanced use cases only. You usually only need to use temperature.

Supports Expression Language, using FlowFile attributes and Environment variables.
Max Tokens *Max Tokens1000The maximum number of tokens to generate

Supports Expression Language, using FlowFile attributes and Environment variables.
Output Strategy *Output StrategyFlowFile
  • FlowFile
  • Attribute
Determines response output destination
Results Attribute *Results AttributeThe name of the attribute to write the response to.

This property is only considered if:
  • the property Output Strategy has a value of Attribute

Dynamic Properties

This component does not support dynamic properties.

Relationships

NameDescription
failureIf unable to obtain a valid response from Vertex, the original FlowFile will be routed to this relationship
successThe response from Vertex is routed to this relationship

Reads Attributes

This processor does not read attributes.

Writes Attributes

NameDescription
filenameAn updated filename for the response.
mime.typeThe mime type of the response.
vertex.chat.completion.idA unique id assigned to the conversation
vertex.usage.inputTokensThe number of input tokens read in the request.
vertex.usage.outputTokensThe number of output tokens generated in the response.

State Management

This component does not store state.

Restricted

This component is not restricted.

Input Requirement

Input requirements are not specified for this component.

System Resource Considerations

This component does not specify system resource considerations.

See Also