<ms-aichain:image-read
doc:name="Image read"
doc:id="16cac2ce-def9-41e2-aaff-0f9c33d622f1"
config-ref="MuleSoft_AI_Chain_Config"
contextURL="#[payload.imageUrl]">
<ms-aichain:data><![CDATA[#[payload.prompt]]]></ms-aichain:data>
</ms-aichain:image-read>
Configuring Image Generation Operations
Configure the Image Read Operation
The Image read operation reads and interprets an image based on a prompt. Currently, MuleSoft AI Chain Connector supports only OpenAI Image Models.
To configure the Image read operation:
-
Select the operation on the Anypoint Code Builder or Studio canvas.
-
In the General properties tab for the operation, enter these values:
-
Data
Contains the prompt for the operation.
-
ContextUrl
Contains the URL to the image file to read.
-
This is the XML configuration for this operation:
Output Configuration
This operation responds with a JSON payload containing the main LLM response. Additionally, attributes such as token usage are included as part of the metadata (attributes), but not within the main payload.
This is an example response of the JSON payload:
{
"response": "The image depicts a group of men in what appears to be a stadium or arena setting. They are standing in the stands, with some looking agitated or engaged in a discussion."
}
Along with the JSON payload, the operation also returns attributes, which include information about token usage, for example:
{
"attributes": {
"tokenUsage": {
"outputCount": 87,
"totalCount": 187,
"inputCount": 100
},
"additionalAttributes": {}
}
}
Configure the Image Generate Operation
The Image generate operation generates an image based on a prompt sent to the LLM. Currently, MuleSoft AI Chain Connector supports only OpenAI Image Models.
To configure the Image generate operation:
-
Select the operation on the Studio canvas.
-
In the General properties section, configure the Data field with the prompt for generating the image, for example,
payload.prompt
.
This is the XML configuration for this operation:
<ms-aichain:image-generate
doc:name="Image generate"
doc:id="a057ad09-533f-42e9-bfd6-00014db6cec8"
config-ref="MuleSoft_AI_Chain_Config">
<ms-aichain:data><![CDATA[#[payload.prompt]]]></ms-aichain:data>
</ms-aichain:image-generate>