@aigne/openai 0.12.4 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.13.1](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.13.0...openai-v0.13.1) (2025-08-27)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/core bumped to 1.56.0
11
+ * devDependencies
12
+ * @aigne/test-utils bumped to 0.5.37
13
+
14
+ ## [0.13.0](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.12.4...openai-v0.13.0) (2025-08-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * **models:** support gemini and ideogram images models ([#412](https://github.com/AIGNE-io/aigne-framework/issues/412)) ([6534fec](https://github.com/AIGNE-io/aigne-framework/commit/6534fecb0bdfb4b0a4440d44c0e563b9a029a68f))
20
+ * **models:** support gemini and ideogram images models ([#412](https://github.com/AIGNE-io/aigne-framework/issues/412)) ([6534fec](https://github.com/AIGNE-io/aigne-framework/commit/6534fecb0bdfb4b0a4440d44c0e563b9a029a68f))
21
+
3
22
  ## [0.12.4](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.12.3...openai-v0.12.4) (2025-08-26)
4
23
 
5
24
 
@@ -51,5 +51,5 @@ export declare class OpenAIImageModel extends ImageModel<OpenAIImageModelInput,
51
51
  * @param input The input to process
52
52
  * @returns The generated response
53
53
  */
54
- process(input: ImageModelInput): Promise<ImageModelOutput>;
54
+ process(input: OpenAIImageModelInput): Promise<OpenAIImageModelOutput>;
55
55
  }
@@ -12,6 +12,8 @@ const openAIImageModelOptionsSchema = zod_1.z.object({
12
12
  apiKey: zod_1.z.string().optional(),
13
13
  baseURL: zod_1.z.string().optional(),
14
14
  model: zod_1.z.string().optional(),
15
+ modelOptions: zod_1.z.object({}).optional(),
16
+ clientOptions: zod_1.z.object({}).optional(),
15
17
  });
16
18
  class OpenAIImageModel extends core_1.ImageModel {
17
19
  options;
@@ -57,23 +59,27 @@ class OpenAIImageModel extends core_1.ImageModel {
57
59
  */
58
60
  async process(input) {
59
61
  const model = input.model || this.credential.model;
60
- const inputKeys = [
61
- "background",
62
- "moderation",
63
- "output_compression",
64
- "output_format",
65
- "prompt",
66
- "quality",
67
- "size",
68
- "style",
69
- "user",
70
- ];
62
+ const map = {
63
+ "dall-e-2": ["prompt", "size", "n"],
64
+ "dall-e-3": ["prompt", "size", "n", "quality", "style", "user"],
65
+ "gpt-image-1": [
66
+ "prompt",
67
+ "size",
68
+ "background",
69
+ "moderation",
70
+ "outputCompression",
71
+ "outputFormat",
72
+ "quality",
73
+ "user",
74
+ "stream",
75
+ ],
76
+ };
71
77
  let responseFormat;
72
78
  if (model !== "gpt-image-1") {
73
79
  responseFormat = input.responseFormat === "base64" ? "b64_json" : "url";
74
80
  }
75
81
  const body = {
76
- ...(0, camelize_js_1.snakelize)((0, type_utils_js_1.pick)({ ...this.modelOptions, ...input }, inputKeys)),
82
+ ...(0, camelize_js_1.snakelize)((0, type_utils_js_1.pick)({ ...this.modelOptions, ...input }, map[model] || map["dall-e-2"])),
77
83
  response_format: responseFormat,
78
84
  model,
79
85
  };
@@ -51,5 +51,5 @@ export declare class OpenAIImageModel extends ImageModel<OpenAIImageModelInput,
51
51
  * @param input The input to process
52
52
  * @returns The generated response
53
53
  */
54
- process(input: ImageModelInput): Promise<ImageModelOutput>;
54
+ process(input: OpenAIImageModelInput): Promise<OpenAIImageModelOutput>;
55
55
  }
@@ -51,5 +51,5 @@ export declare class OpenAIImageModel extends ImageModel<OpenAIImageModelInput,
51
51
  * @param input The input to process
52
52
  * @returns The generated response
53
53
  */
54
- process(input: ImageModelInput): Promise<ImageModelOutput>;
54
+ process(input: OpenAIImageModelInput): Promise<OpenAIImageModelOutput>;
55
55
  }
@@ -9,6 +9,8 @@ const openAIImageModelOptionsSchema = z.object({
9
9
  apiKey: z.string().optional(),
10
10
  baseURL: z.string().optional(),
11
11
  model: z.string().optional(),
12
+ modelOptions: z.object({}).optional(),
13
+ clientOptions: z.object({}).optional(),
12
14
  });
13
15
  export class OpenAIImageModel extends ImageModel {
14
16
  options;
@@ -54,23 +56,27 @@ export class OpenAIImageModel extends ImageModel {
54
56
  */
55
57
  async process(input) {
56
58
  const model = input.model || this.credential.model;
57
- const inputKeys = [
58
- "background",
59
- "moderation",
60
- "output_compression",
61
- "output_format",
62
- "prompt",
63
- "quality",
64
- "size",
65
- "style",
66
- "user",
67
- ];
59
+ const map = {
60
+ "dall-e-2": ["prompt", "size", "n"],
61
+ "dall-e-3": ["prompt", "size", "n", "quality", "style", "user"],
62
+ "gpt-image-1": [
63
+ "prompt",
64
+ "size",
65
+ "background",
66
+ "moderation",
67
+ "outputCompression",
68
+ "outputFormat",
69
+ "quality",
70
+ "user",
71
+ "stream",
72
+ ],
73
+ };
68
74
  let responseFormat;
69
75
  if (model !== "gpt-image-1") {
70
76
  responseFormat = input.responseFormat === "base64" ? "b64_json" : "url";
71
77
  }
72
78
  const body = {
73
- ...snakelize(pick({ ...this.modelOptions, ...input }, inputKeys)),
79
+ ...snakelize(pick({ ...this.modelOptions, ...input }, map[model] || map["dall-e-2"])),
74
80
  response_format: responseFormat,
75
81
  model,
76
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/openai",
3
- "version": "0.12.4",
3
+ "version": "0.13.1",
4
4
  "description": "AIGNE OpenAI SDK for integrating with OpenAI's GPT models and API services",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,7 +39,7 @@
39
39
  "openai": "^5.8.3",
40
40
  "uuid": "^11.1.0",
41
41
  "zod": "^3.25.67",
42
- "@aigne/core": "^1.55.1"
42
+ "@aigne/core": "^1.56.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/bun": "^1.2.18",
@@ -47,7 +47,7 @@
47
47
  "npm-run-all": "^4.1.5",
48
48
  "rimraf": "^6.0.1",
49
49
  "typescript": "^5.8.3",
50
- "@aigne/test-utils": "^0.5.36"
50
+ "@aigne/test-utils": "^0.5.37"
51
51
  },
52
52
  "scripts": {
53
53
  "lint": "tsc --noEmit",