Image Operations
Image | Read
The Image read
operation reads and interprets an image based on a prompt. Currently, the MuleSoft AI Chain connector supports only OpenAI Image Models.
Input Configuration
Module Configuration
This refers to the MuleSoft AI Chain LLM Configuration set up in the Getting Started section.
General Operation Fields
- Data: Contains the prompt for the operation.
- ContextUrl: Contains the URL to the image file that will be read.
XML Configuration
Below is the XML configuration for this operation:
<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>
Output Configuration
Response Payload
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.
Example Response 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."
}
Attributes
Along with the JSON payload, the operation also returns attributes, which include information about token usage:
{
"attributes": {
"tokenUsage": {
"outputCount": 87,
"totalCount": 187,
"inputCount": 100
},
"additionalAttributes": {}
}
}
Example Use Cases
This operation is particularly useful in scenarios where you need to interpret or describe an image, such as:
- Image Analysis: Analyzing images in business reports, presentations, or customer service scenarios.
- Content Generation: Describing images for blog posts, articles, or social media.
- Visual Insights: Extracting insights from images in research or design projects.
Image | Generate
The Image generate
operation generates an image based on a prompt sent to the LLM. Currently, the MuleSoft AI Chain connector supports only OpenAI Image Models.
Input Configuration
Module Configuration
This refers to the MuleSoft AI Chain LLM Configuration set up in the Getting Started section.
General Operation Fields
- Data: Contains the prompt for generating the image.
XML Configuration
Below 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>
Output Configuration
Response Payload
This operation responds with a json
payload containing the URL of the generated image.
Example Response Payload
{
"response": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-dP8odnP25FlwTi1fOMr1X7vO/user-Jyi0vNlYu4mjEBZl9Mu1lXBW/img-bEO12CWIRI7CkGUjfz5ajAlS.png"
}
Attributes
Image operations do not return any TokenUsage
attributes.
Example Use Cases
This operation is particularly useful in scenarios where you need to generate an image based on a plain text prompt, such as:
- Marketing and Advertising: Creating visuals for campaigns based on specific descriptions.
- Content Creation: Generating images for blog posts, articles, or social media based on given prompts.
- Prototyping and Design: Quickly generating concept images from textual descriptions.