Skip to main content

PromptAzureOpenAI

Description

Sends a prompt to Azure's OpenAI service, 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 images. In the case of images, a URL may be provided, or the contents of the FlowFile may be used, depending on the provided configuration

Tags

ai, azure, chat, image, openai, prompt, text

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
Web Client Service *Web Client ServiceController Service:
WebClientServiceProvider

Implementations:
StandardWebClientServiceProvider
The Web Client Service to use for communicating with OpenAI
OpenAI Service Name *OpenAI Service NameThe name of the OpenAI service to use
Deployment Name *Deployment NameThe name of the OpenAI model deployment
API Key *API KeyThe API key for authenticating to the Azure OpenAI service
Prompt Type *Prompt TypeText
  • Text
  • Image
The type of prompt to send to OpenAI
System MessageSystem MessageThe system message to send to OpenAI. 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.
User Message *User MessageThe user message to send to OpenAI. 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.
Image URLImage URLThe URL of the image to send to OpenAI. If not specified, the contents of the FlowFile will be used as the image.

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Prompt Type has a value of Image
Image MIME TypeImage MIME Type${mime.type}The MIME type of the image

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Prompt Type has a value of Image
Detail Level *Detail LevelAuto
  • Low
  • High
  • Auto
The image detail level that OpenAI should use for processing the image. Low detail will be less expensive and lower latency, while a high level may provide better results.

This property is only considered if:
  • the property Prompt Type has a value of Image
Max File SizeMax File Size10 MBThe maximum size of a FlowFile that can be sent to OpenAI 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 Image
Response Format *Response FormatPlain Text
  • JSON
  • Plain Text
The format of the response from OpenAI

This property is only considered if:
  • the property Prompt Type has a value of Text
UserUserYour end user, sent to OpenAI for monitoring and detection of abuse

Supports Expression Language, using FlowFile attributes and Environment variables.
TemperatureTemperatureThe temperature to use for generating the response.

Supports Expression Language, using FlowFile attributes and Environment variables.
Top PTop PThe top P value to use for generating the response

Supports Expression Language, using FlowFile attributes and Environment variables.
SeedSeedThe seed to use for generating the response

Supports Expression Language, using FlowFile attributes and Environment variables.
Max TokensMax TokensThe maximum number of tokens to generate

Supports Expression Language, using FlowFile attributes and Environment variables.
Results AttributeResults AttributeThe name of the attribute to write the response to. If unset, the response will be written to the FlowFile content.

Dynamic Properties

This component does not support dynamic properties.

Relationships

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

Reads Attributes

This processor does not read attributes.

Writes Attributes

This processor does not write attributes.

State Management

This component does not store state.

Restricted

This component is not restricted.

Input Requirement

This component requires an incoming relationship.

System Resource Considerations

This component does not specify system resource considerations.

See Also

CreateAzureOpenAiEmbeddings, PromptOpenAI