Skip to content

Commit 2c1e120

Browse files
committed
refactor(core): drop aspect and resolution from image_generate
1 parent a5ed7f2 commit 2c1e120

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

‎packages/core/src/tool/plugin/image-generate.ts‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const EXTENSIONS: Record<string, string> = {
3131
const PREFERRED_FAMILIES = ["gpt-image", "gemini-flash", "gemini-pro", "grok", "flux"]
3232

3333
export const description =
34-
'Generate or edit an image. Pass images to edit them or to guide style and subject. To make several images, call the tool once per image with distinct prompts. Omit model to use the default; to choose one, find image models with the models tool and type: "image". The result is saved as a PNG and shown to you; mention its path to the user. Each call costs money, so don\'t regenerate unless asked or the result is clearly wrong.'
34+
'Generate or edit an image. Pass images to edit them or to guide style and subject. To make several images, call the tool once per image with distinct prompts. Omit model to use the default; to choose one, find image models with the models tool and type: "image". The result is saved as an image file and shown to you; mention its path to the user. Each call costs money, so don\'t regenerate unless asked or the result is clearly wrong.'
3535

3636
export const Input = Schema.Struct({
3737
prompt: Schema.String.check(Schema.isMinLength(1)).annotate({
@@ -44,21 +44,13 @@ export const Input = Schema.Struct({
4444
description:
4545
"Images to edit or use as references, in order. Local file paths (relative to the session directory or absolute) or https URLs. Omit to create a new image.",
4646
}),
47-
aspect: Schema.optionalKey(Schema.Literals(["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"])).annotate({
48-
description:
49-
"Shape of the image. 1:1 for icons and avatars, 16:9 for banners and screenshots, 9:16 for phone screens, 3:2 or 2:3 for photos. Defaults to the model's choice.",
50-
}),
51-
resolution: Schema.optionalKey(Schema.Literals(["1K", "2K"])).annotate({
52-
description:
53-
"Size tier. 1K is about 1024x1024 pixels. Use 2K only when small text or fine detail matters; it is slower and costs more. Defaults to the model's choice.",
54-
}),
5547
model: Schema.optionalKey(Schema.String).annotate({
5648
description:
5749
'NEVER set this unless the user asks for a particular image model. Written as "providerID/modelID". Do not guess the ID: look it up with the models tool using type: "image".',
5850
}),
5951
path: Schema.optionalKey(Schema.String).annotate({
6052
description:
61-
"Where to save the PNG, relative to the session directory or absolute. Never overwrites. Defaults to a new file in the session's temp folder.",
53+
"Where to save the image, relative to the session directory or absolute. Never overwrites. Defaults to a new file in the session's temp folder.",
6254
}),
6355
})
6456

@@ -238,8 +230,6 @@ export const Plugin = {
238230
prompt: input.prompt,
239231
n: 1,
240232
...(images ? { images } : {}),
241-
...(input.aspect ? { aspect: input.aspect } : {}),
242-
...(input.resolution ? { resolution: input.resolution } : {}),
243233
})
244234
.pipe(
245235
Effect.mapError(

‎packages/core/test/tool-image-generate.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe("image_generate", () => {
119119
const { run, directory, session } = yield* setup()
120120
yield* Effect.promise(() => fs.writeFile(path.join(directory, "in.png"), Buffer.from(PNG, "base64")))
121121

122-
const result = yield* run({ prompt: "make it blue", images: ["in.png"], aspect: "16:9", path: "out.png" })
122+
const result = yield* run({ prompt: "make it blue", images: ["in.png"], path: "out.png" })
123123
const file = path.join(directory, "out.png")
124124
expect(result.output).toEqual({ path: file, model: "test/painter", width: 1, height: 1 })
125125
expect(result.content?.[0]).toEqual({
@@ -134,7 +134,6 @@ describe("image_generate", () => {
134134
prompt: "make it blue",
135135
n: 1,
136136
images: [{ data: PNG, mime: "image/png", name: "in.png" }],
137-
aspect: "16:9",
138137
},
139138
])
140139
expect(fixture.assertions.map((item) => [item.action, item.resources])).toEqual([

0 commit comments

Comments
 (0)