AI / Call a model
Task in alpha phase
This Data Factory task is in phase: it is available on every account, and we keep improving it. Share your feedback with the Product-Live team at contact@product-live.com.
This task sends a prompt to OpenAI, Mistral or Anthropic and returns the answer in the same format for the three providers.
The prompt is given inline (prompt), in a text file (promptFile) or as a conversation (messages). Images and PDF documents can be attached, and the provider's web search can be enabled with tools.
Task name:
Examples
Each example is one entry of a job's tasks array. The API key is read from a global variable, and ${workflow.input.pdfFile} is a job input of type FILE.
Prompts
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "translate_text",
"description": "Translate a text to French",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"prompt": "Translate the following text to French: Hello World"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "extract_attributes",
"description": "Extract product attributes as JSON",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"systemPrompt": "You extract structured product data. Always answer with a JSON object.",
"prompt": "Extract brand, name, color and size from: Red Nike Air Max 90, size 42",
"responseFormat": "json_object"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "classify_product",
"description": "Classify a product from a few examples",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"messages": [
{ "role": "system", "content": "You classify products. Answer with the category only." },
{ "role": "user", "content": "Nike Air Max 90" },
{ "role": "assistant", "content": "Shoes" },
{ "role": "user", "content": "Samsung Galaxy S24" },
{ "role": "assistant", "content": "Smartphones" },
{ "role": "user", "content": "Levi's 501 Original" }
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "describe_product",
"description": "Write a product description from prompt files",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"systemPromptFile": "file://assets/system-prompt.md",
"promptFile": "file://assets/describe-product.md"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
content is always a string, also in JSON mode: parse it in a following task. file://assets/... points to a file in the assets folder of the job.
Web search
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "find_product_facts",
"description": "Look up a product on the web",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"prompt": "What is the declared power consumption of the product with EAN 4718017140447? Answer with the value and the page you read it on.",
"tools": [
{ "type": "web-search" }
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "find_official_facts",
"description": "Look up a product on the manufacturer site only",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "openai",
"model": "gpt-5.6-terra",
"apiKey": "${workflow.globalVariables.openai_api_key}",
"prompt": "What is the declared power consumption of the Asus ZenBook UX561UA-BO049T? Answer with the value and the page you read it on.",
"tools": [
{
"type": "web-search",
"allowedDomains": ["asus.com"]
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
The pages behind the answer are returned in sources.
PDF files and images
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "read_datasheet",
"description": "Extract data from a private PDF",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"prompt": "Extract the EAN and the RAM capacity from this product datasheet.",
"attachments": [
{
"type": "document",
"file": "${workflow.input.pdfFile}",
"filename": "product-datasheet.pdf"
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "read_uploaded_pdf",
"description": "Read a PDF already uploaded to Mistral",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"prompt": "Extract the EAN and the RAM capacity from this product datasheet.",
"attachments": [
{ "type": "document", "fileId": "${upload_pdf.output.response.json.id}" }
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
json
{
"name": "ai-prompt-execute",
"taskReferenceName": "describe_photo",
"description": "Describe a product photo",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "${workflow.globalVariables.mistral_api_key}",
"prompt": "Describe this product photo: product type, brand and main colors.",
"attachments": [
{ "type": "image", "url": "https://example.com/product-photo.jpg" }
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
With file, the task uploads the PDF to the provider, so the PDF needs no public URL. With fileId, the PDF is one the provider already stores, here uploaded by a previous HTTP task with the same API key.
Definition
| Property | Type | Required | Description |
|---|---|---|---|
| The name (or type) of the task | |||
| The unique name of the task in your job. It is used to reference this task in the workflow. | |||
| The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW. | |||
| : | true: the job continues if there is an error on this task. false: the job fails. | ||
| Input parameters of the task. See below |
Inputs Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| : | The AI provider to call. | ||
The provider's model ID, for example mistral-small-latest. See available models. A model name containing another provider's name fails the task, for example gpt-4o-mini with mistral. | |||
The provider's API key. Store it in a protected variable and pass the reference, for example ${workflow.globalVariables.mistral_api_key}. See how to obtain API keys. | |||
The user prompt. One of prompt, promptFile or messages is required. | |||
| or | A text file holding the user prompt: a URL, or a file object with a url, such as a job asset file://assets/prompt.md. | ||
A conversation, for example for few-shot prompting: objects with a role (system, user or assistant) and a content. | |||
| Instructions that set the model's behavior. | |||
| or | A text file holding the system prompt, in the same forms as promptFile. | ||
| Images and PDF documents sent with the prompt. See attachments. | |||
| Server-side tools the provider runs while it writes the answer, such as web search. See tools. | |||
| Request options in the selected provider's own vocabulary, keyed by provider. See provider-specific options. | |||
| : | Enables JSON mode on OpenAI and Mistral. Anthropic ignores it. Ask for JSON in the prompt as well. | ||
Controls response variability. Not sent when unset. Some models reject it, for example claude-opus-5, which fails the task. | |||
Default: 4096. | The maximum number of tokens the model may generate. | ||
Default: true. | Fails the task when the provider refuses to answer. Set to false to continue with stopReason: "refusal" and the content returned, often empty. | ||
Default: false. | Fails the task when stopReason is max_tokens or max_tool_iterations. By default, the partial answer is returned. | ||
Default: false. | Fails the task when the provider reports a tool failure. By default, the answer is returned and the failures are listed in toolErrors. | ||
Saves content as a file with this name and returns it in outputFile. |
Which prompt is used
A non-empty messages array is used instead of prompt and promptFile. Otherwise, promptFile replaces prompt when set, and systemPromptFile replaces systemPrompt. Prompt files are read as text: send a PDF with attachments.
Outputs
| Property | Type | Description |
|---|---|---|
| The text of the answer. It stays a string in JSON mode. | ||
| The provider that was called. | ||
| The model ID returned by the provider, which can be more specific than the input. | ||
or null | The provider's ID for the answer. | |
Why the answer ended: end_turn (complete answer), max_tokens (stopped at maxTokens), refusal, tool_use or max_tool_iterations (the provider stopped its own tool loop before the answer was finished). Other provider values are returned as they are. | ||
Token counts: promptTokens, completionTokens and totalTokens. Anthropic adds cacheReadInputTokens and cacheCreationInputTokens. With tools, toolUse gives the number of tool runs, for example {"web-search": 2}, and on Mistral the tools' own tokens are included in promptTokens. | ||
With tools: the pages behind the answer, as objects with url, title and cited, each page once, the cited ones first. | ||
With tools: the tool failures the provider reported, as objects with type and code. | ||
| Duration of the call to the provider, in milliseconds. | ||
Only with outputFileName: the saved answer, as a file object with a url. |
json
{
"content": "Bonjour le monde",
"provider": "mistral",
"model": "mistral-small-latest",
"responseId": "6f3c2a9e4b1d4c0f8e2a7b5d9c1e3f40",
"stopReason": "end_turn",
"usage": {
"promptTokens": 18,
"completionTokens": 4,
"totalTokens": 22
},
"sources": null,
"toolErrors": null,
"responseTimeMs": 834
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Attachments
Each attachment has a type and exactly one source: url, file or fileId.
| Property | Type | Required | Description |
|---|---|---|---|
| : | image for a picture, document for a PDF. Any other value fails the task. | ||
An HTTP(S) URL, downloaded by the provider, or a base64 data URI such as data:application/pdf;base64,.... The only source for images. | |||
PDF only. A Data Factory file object with a url, such as a job FILE input. The task uploads it to the provider, so it needs no public URL. | |||
| PDF only. The ID of a file already stored by the selected provider, readable with the same API key. | |||
The name sent with the PDF, by default the file's own name. With file, it must end in .pdf: set it when the file's name has no extension, as after an HTTP download. |
Document support per provider
| PDF source | openai | mistral | anthropic |
|---|---|---|---|
HTTP(S) url | |||
Base64 data URI in url | |||
file | |||
fileId |
A file is uploaded to the provider with a 24-hour expiry requested. The task never deletes a file stored by the provider.
Tools
tools enables a server-side tool that the provider runs while it writes the answer. The model decides whether to use it.
| Property | Type | Required | Description |
|---|---|---|---|
| : | web-search is written the same way for the three providers, and is declared once. provider-specific sends the tool definition written in providerOptions for the selected provider. | ||
| The maximum number of tool uses for one answer. | |||
Restricts the search to these sites, as host names without a scheme, such as example.com. An empty array restricts nothing. | |||
Excludes these sites, in the same format. Cannot be combined with allowedDomains. An empty array restricts nothing. | |||
Options of this tool in the selected provider's own vocabulary, keyed by provider. On a provider-specific entry, the whole tool definition: maxUses, allowedDomains and blockedDomains then fail the task. |
With tools, content holds the final answer without the provider's citation markers, and the pages found are in sources.
Web search per provider
openai | mistral | anthropic | |
|---|---|---|---|
maxUses | Counts every tool call of the answer | Fails the task | |
allowedDomains, blockedDomains | Fails the task | ||
toolErrors | failOnToolError: true fails the task | ||
attachments in the same call | Fails the task | Fails the task |
With OpenAI, a messages content written as an array of parts fails the task when tools is set: write the content as a string.
Provider-specific options
providerOptions is keyed by provider: openai, mistral or anthropic. Only the key of the selected provider is read, so one job can hold the options of the three providers. At the root of the inputs, it is added to the request sent to the provider. On a tools entry, it is added to that tool's definition. A key the task already sets from its own inputs fails the task.
The exception is store: with a tool declared, OpenAI and Mistral calls are sent with store: false, and "providerOptions": {"openai": {"store": true}} changes it.
Error handling
When the provider answers with an error, the task fails with a message that names the provider and the HTTP status, followed by the provider's own message, for example [mistral] Authentication failed (HTTP 401). Check your API key. A failed PDF upload gives [openai] File upload failed (HTTP 401).
These inputs fail the task before the provider is called:
| Message | Cause |
|---|---|
Either prompt, promptFile, or messages must be provided | No prompt |
Model "gpt-4o-mini" appears to be an OpenAI model but provider is set to "mistral" | A model name containing another provider's name |
Model claude-opus-5 does not support 'temperature' - remove the temperature input | temperature on a model that rejects it |
Unsupported attachment type 'spreadsheet' | An attachment type other than image or document |
Each attachment must provide exactly one source: url, file or fileId | No source, or several, on one attachment |
file attachments support only PDF documents | A file whose filename does not end in .pdf |
OpenAI does not accept a document attachment passed by URL | A PDF HTTP(S) url with OpenAI |
OpenAI accepts only PDF document attachments | A data URI of another type with OpenAI |
'tools[1]' declares 'web-search' a second time | A second web-search entry |
[mistral] does not support a domain restriction on 'web-search' | allowedDomains or blockedDomains with Mistral |
attachments cannot be combined with tools on this provider | attachments and tools with OpenAI or Mistral |
[openai] messages[0].content is an array of parts | A messages content as an array of parts with OpenAI and tools |
Limits
- The whole task must finish within 600 seconds.
- Each call to the provider times out after 150 seconds without a response.
- The call that generates the answer is retried up to twice on HTTP 408, 429, 500, 502, 503, 504 and 529.
How to obtain API keys
| Provider | API key page | Documentation |
|---|---|---|
| OpenAI | platform.openai.com/api-keys | Quickstart |
| Mistral | console.mistral.ai/api-keys | First API request |
| Anthropic | platform.claude.com/settings/keys | Get started |
Available models
Model names change often: check the provider's models page. With tools, use a model that the provider serves with its web search.
| Provider | Models documentation |
|---|---|
| OpenAI | Models |
| Mistral | Models |
| Anthropic | Models overview |
Provider API references
Without tools, the task calls OpenAI Chat Completions, Mistral Chat Completions and Anthropic Messages.
With tools, it calls OpenAI Responses, Mistral Conversations and Anthropic Messages.