Skip to content

Commit 6d044a9

Browse files
authored
feat(image-generator): add gpt-image-2 model support (#4437)
* feat(image-generator): add gpt-image-2 model support * docs
1 parent ae20d1c commit 6d044a9

8 files changed

Lines changed: 197 additions & 36 deletions

File tree

apps/docs/content/docs/en/tools/image_generator.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ In Sim, the DALL-E integration enables your agents to generate images programmat
2929

3030
## Usage Instructions
3131

32-
Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.
32+
Integrate Image Generator into the workflow. Can generate images using DALL-E 3, GPT Image 1, or GPT Image 2.
3333

3434

3535

@@ -43,12 +43,14 @@ Generate images using OpenAI
4343

4444
| Parameter | Type | Required | Description |
4545
| --------- | ---- | -------- | ----------- |
46-
| `model` | string | Yes | The model to use \(gpt-image-1 or dall-e-3\) |
46+
| `model` | string | Yes | The model to use \(dall-e-3, gpt-image-1, or gpt-image-2\) |
4747
| `prompt` | string | Yes | A text description of the desired image |
48-
| `size` | string | Yes | The size of the generated images \(1024x1024, 1024x1792, or 1792x1024\) |
49-
| `quality` | string | No | The quality of the image \(standard or hd\) |
50-
| `style` | string | No | The style of the image \(vivid or natural\) |
51-
| `background` | string | No | The background color, only for gpt-image-1 |
48+
| `size` | string | Yes | Image size. dall-e-3: 1024x1024, 1024x1792, or 1792x1024. gpt-image-1: auto, 1024x1024, 1536x1024, or 1024x1536. gpt-image-2: auto or any size with edges ≤3840px and multiples of 16 \(e.g. 1024x1024, 1536x1024, 1024x1536, 2560x1440, 3840x2160\). |
49+
| `quality` | string | No | Quality. dall-e-3: standard\|hd. gpt-image-1/gpt-image-2: auto\|low\|medium\|high |
50+
| `style` | string | No | The style of the image \(vivid or natural\), only for dall-e-3 |
51+
| `background` | string | No | Background. gpt-image-1: auto\|transparent\|opaque. gpt-image-2: auto\|opaque \(transparent not supported\) |
52+
| `outputFormat` | string | No | Output image format \(png, jpeg, webp\), only for gpt-image-1 and gpt-image-2 |
53+
| `moderation` | string | No | Moderation level \(auto or low\), only for gpt-image-1 and gpt-image-2 |
5254
| `n` | number | No | The number of images to generate \(1-10\) |
5355
| `apiKey` | string | Yes | Your OpenAI API key |
5456

apps/docs/content/docs/en/tools/knowledge.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Search for similar content in a knowledge base using vector similarity
4949
| `tagValue` | string | No | No description |
5050
| `rerankerEnabled` | boolean | No | Whether to apply Cohere reranking to vector search results |
5151
| `rerankerModel` | string | No | Cohere rerank model to use \(one of: rerank-v4.0-pro, rerank-v4.0-fast, rerank-v3.5\) |
52+
| `rerankerInputCount` | number | No | Number of vector results sent to the Cohere reranker \(1–100\). Defaults to topK × 4 capped at 100. |
53+
| `apiKey` | string | No | Cohere API key for reranker \(self-hosted deployments only\) |
5254
| `tagFilters` | string | No | No description |
5355

5456
#### Output

apps/docs/content/docs/en/tools/mem0.mdx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ Add memories to Mem0 for persistent storage and retrieval
5050

5151
| Parameter | Type | Description |
5252
| --------- | ---- | ----------- |
53-
| `ids` | array | Array of memory IDs that were created |
54-
| `memories` | array | Array of memory objects that were created |
55-
|`id` | string | Unique identifier for the memory |
56-
|`memory` | string | The content of the memory |
57-
|`event` | string | Event type indicating operation performed \(ADD, UPDATE, DELETE, NOOP\) |
58-
|`metadata` | json | Custom metadata associated with the memory |
53+
| `message` | string | Status message for the queued memory processing job |
54+
| `status` | string | Processing status returned by Mem0 |
55+
| `event_id` | string | Event ID for polling memory processing status |
5956

6057
### `mem0_search_memories`
6158

@@ -102,6 +99,7 @@ Retrieve memories from Mem0 by ID or filter criteria
10299
| `startDate` | string | No | Start date for filtering by created_at \(e.g., "2024-01-15"\) |
103100
| `endDate` | string | No | End date for filtering by created_at \(e.g., "2024-12-31"\) |
104101
| `limit` | number | No | Maximum number of results to return \(e.g., 10, 50, 100\) |
102+
| `page` | number | No | Page number to retrieve for paginated list results |
105103
| `apiKey` | string | Yes | Your Mem0 API key |
106104

107105
#### Output
@@ -120,10 +118,9 @@ Retrieve memories from Mem0 by ID or filter criteria
120118
|`categories` | json | Auto-assigned categories for the memory |
121119
|`created_at` | string | ISO 8601 timestamp when the memory was created |
122120
|`updated_at` | string | ISO 8601 timestamp when the memory was last updated |
123-
|`owner` | string | Owner of the memory |
124-
|`organization` | string | Organization associated with the memory |
125-
|`immutable` | boolean | Whether the memory can be modified |
126-
|`expiration_date` | string | Expiration date after which memory is not retrieved |
127121
| `ids` | array | Array of memory IDs that were retrieved |
122+
| `count` | number | Total number of memories matching the filters |
123+
| `next` | string | URL for the next page of results |
124+
| `previous` | string | URL for the previous page of results |
128125

129126

apps/docs/content/docs/en/triggers/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"servicenow",
4040
"slack",
4141
"stripe",
42+
"table",
4243
"telegram",
4344
"twilio_voice",
4445
"typeform",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Table
3+
description: Available Table triggers for automating workflows
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="table"
10+
color="#10B981"
11+
/>
12+
13+
Table provides 1 trigger for automating workflows based on events.
14+
15+
## Triggers
16+
17+
### Table Trigger
18+
19+
Triggers when rows are inserted or updated in a table
20+
21+
#### Configuration
22+
23+
| Parameter | Type | Required | Description |
24+
| --------- | ---- | -------- | ----------- |
25+
| `tableSelector` | table-selector | Yes | The table to monitor. |
26+
| `manualTableId` | string | Yes | The table to monitor. |
27+
| `eventType` | string | Yes | The type of event to trigger on. |
28+
| `watchColumns` | string | No | Only fire when these columns change. Leave empty to fire on any update. |
29+
| `includeHeaders` | boolean | No | When enabled, each row is returned as a key-value object mapped to column names. |
30+
31+
#### Output
32+
33+
| Parameter | Type | Description |
34+
| --------- | ---- | ----------- |
35+
| `row` | json | Row data mapped to column names \(when header mapping is enabled\) |
36+
| `rawRow` | json | Raw row data object |
37+
| `previousRow` | json | Previous row data before the update \(null for inserts\) |
38+
| `changedColumns` | json | List of column names that changed \(empty for inserts\) |
39+
| `rowId` | string | The unique row ID |
40+
| `headers` | json | Column names from the table schema |
41+
| `rowNumber` | number | The position of the row in the table |
42+
| `tableId` | string | The table ID |
43+
| `tableName` | string | The table name |
44+
| `timestamp` | string | Event timestamp in ISO format |
45+

apps/sim/app/(landing)/integrations/data/integrations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6496,7 +6496,7 @@
64966496
"slug": "image-generator",
64976497
"name": "Image Generator",
64986498
"description": "Generate images",
6499-
"longDescription": "Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.",
6499+
"longDescription": "Integrate Image Generator into the workflow. Can generate images using DALL-E 3, GPT Image 1, or GPT Image 2.",
65006500
"bgColor": "#4D5FFF",
65016501
"iconName": "ImageIcon",
65026502
"docsUrl": "https://docs.sim.ai/tools/image_generator",
@@ -7540,7 +7540,7 @@
75407540
"operationCount": 14,
75417541
"triggers": [],
75427542
"triggerCount": 0,
7543-
"authType": "none",
7543+
"authType": "api-key",
75447544
"category": "blocks"
75457545
},
75467546
{

apps/sim/blocks/blocks/image_generator.ts

Lines changed: 107 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
88
description: 'Generate images',
99
authMode: AuthMode.ApiKey,
1010
longDescription:
11-
'Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.',
11+
'Integrate Image Generator into the workflow. Can generate images using DALL-E 3, GPT Image 1, or GPT Image 2.',
1212
docsLink: 'https://docs.sim.ai/tools/image_generator',
1313
category: 'tools',
1414
integrationType: IntegrationType.AI,
@@ -22,7 +22,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
2222
type: 'dropdown',
2323
options: [
2424
{ label: 'DALL-E 3', id: 'dall-e-3' },
25-
{ label: 'GPT Image', id: 'gpt-image-1' },
25+
{ label: 'GPT Image 1', id: 'gpt-image-1' },
26+
{ label: 'GPT Image 2', id: 'gpt-image-2' },
2627
],
2728
value: () => 'dall-e-3',
2829
},
@@ -60,6 +61,22 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
6061
condition: { field: 'model', value: 'gpt-image-1' },
6162
dependsOn: ['model'],
6263
},
64+
{
65+
id: 'size',
66+
title: 'Size',
67+
type: 'dropdown',
68+
options: [
69+
{ label: 'Auto', id: 'auto' },
70+
{ label: 'Square (1024x1024)', id: '1024x1024' },
71+
{ label: 'Portrait (1024x1536)', id: '1024x1536' },
72+
{ label: 'Landscape (1536x1024)', id: '1536x1024' },
73+
{ label: '2K (2560x1440)', id: '2560x1440' },
74+
{ label: '4K (3840x2160)', id: '3840x2160' },
75+
],
76+
value: () => 'auto',
77+
condition: { field: 'model', value: 'gpt-image-2' },
78+
dependsOn: ['model'],
79+
},
6380
{
6481
id: 'quality',
6582
title: 'Quality',
@@ -72,6 +89,20 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
7289
condition: { field: 'model', value: 'dall-e-3' },
7390
dependsOn: ['model'],
7491
},
92+
{
93+
id: 'quality',
94+
title: 'Quality',
95+
type: 'dropdown',
96+
options: [
97+
{ label: 'Auto', id: 'auto' },
98+
{ label: 'Low', id: 'low' },
99+
{ label: 'Medium', id: 'medium' },
100+
{ label: 'High', id: 'high' },
101+
],
102+
value: () => 'auto',
103+
condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] },
104+
dependsOn: ['model'],
105+
},
75106
{
76107
id: 'style',
77108
title: 'Style',
@@ -97,6 +128,43 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
97128
condition: { field: 'model', value: 'gpt-image-1' },
98129
dependsOn: ['model'],
99130
},
131+
{
132+
id: 'background',
133+
title: 'Background',
134+
type: 'dropdown',
135+
options: [
136+
{ label: 'Auto', id: 'auto' },
137+
{ label: 'Opaque', id: 'opaque' },
138+
],
139+
value: () => 'auto',
140+
condition: { field: 'model', value: 'gpt-image-2' },
141+
dependsOn: ['model'],
142+
},
143+
{
144+
id: 'outputFormat',
145+
title: 'Output Format',
146+
type: 'dropdown',
147+
options: [
148+
{ label: 'PNG', id: 'png' },
149+
{ label: 'JPEG', id: 'jpeg' },
150+
{ label: 'WebP', id: 'webp' },
151+
],
152+
value: () => 'png',
153+
condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] },
154+
dependsOn: ['model'],
155+
},
156+
{
157+
id: 'moderation',
158+
title: 'Moderation',
159+
type: 'dropdown',
160+
options: [
161+
{ label: 'Auto', id: 'auto' },
162+
{ label: 'Low', id: 'low' },
163+
],
164+
value: () => 'auto',
165+
condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] },
166+
dependsOn: ['model'],
167+
},
100168
{
101169
id: 'apiKey',
102170
title: 'API Key',
@@ -120,7 +188,25 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
120188
}
121189

122190
const model = params.model || 'dall-e-3'
123-
const size = params.size || (model === 'gpt-image-1' ? 'auto' : '1024x1024')
191+
192+
const ALLOWED_SIZES: Record<string, string[]> = {
193+
'dall-e-3': ['1024x1024', '1024x1792', '1792x1024'],
194+
'gpt-image-1': ['auto', '1024x1024', '1536x1024', '1024x1536'],
195+
'gpt-image-2': ['auto', '1024x1024', '1536x1024', '1024x1536', '2560x1440', '3840x2160'],
196+
}
197+
const ALLOWED_QUALITIES: Record<string, string[]> = {
198+
'dall-e-3': ['standard', 'hd'],
199+
'gpt-image-1': ['auto', 'low', 'medium', 'high'],
200+
'gpt-image-2': ['auto', 'low', 'medium', 'high'],
201+
}
202+
const ALLOWED_BACKGROUNDS: Record<string, string[]> = {
203+
'gpt-image-1': ['auto', 'transparent', 'opaque'],
204+
'gpt-image-2': ['auto', 'opaque'],
205+
}
206+
207+
const defaultSize = model === 'dall-e-3' ? '1024x1024' : 'auto'
208+
const size = ALLOWED_SIZES[model]?.includes(params.size) ? params.size : defaultSize
209+
124210
const baseParams = {
125211
prompt: params.prompt,
126212
model,
@@ -129,16 +215,25 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
129215
}
130216

131217
if (model === 'dall-e-3') {
132-
return {
133-
...baseParams,
134-
quality: params.quality || 'standard',
135-
style: params.style || 'vivid',
136-
}
218+
const quality = ALLOWED_QUALITIES['dall-e-3'].includes(params.quality)
219+
? params.quality
220+
: 'standard'
221+
const style = ['vivid', 'natural'].includes(params.style) ? params.style : 'vivid'
222+
return { ...baseParams, quality, style }
137223
}
138-
if (model === 'gpt-image-1') {
224+
if (model === 'gpt-image-1' || model === 'gpt-image-2') {
225+
const quality = ALLOWED_QUALITIES[model].includes(params.quality)
226+
? params.quality
227+
: undefined
228+
const background = ALLOWED_BACKGROUNDS[model].includes(params.background)
229+
? params.background
230+
: undefined
139231
return {
140232
...baseParams,
141-
...(params.background && { background: params.background }),
233+
...(quality && { quality }),
234+
...(background && { background }),
235+
...(params.outputFormat && { outputFormat: params.outputFormat }),
236+
...(params.moderation && { moderation: params.moderation }),
142237
}
143238
}
144239

@@ -153,6 +248,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
153248
quality: { type: 'string', description: 'Image quality level' },
154249
style: { type: 'string', description: 'Image style' },
155250
background: { type: 'string', description: 'Background type' },
251+
outputFormat: { type: 'string', description: 'Output image format (png, jpeg, webp)' },
252+
moderation: { type: 'string', description: 'Moderation level (auto or low)' },
156253
apiKey: { type: 'string', description: 'OpenAI API key' },
157254
},
158255
outputs: {

0 commit comments

Comments
 (0)