@aigne/ideogram 0.3.0 → 0.3.2
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,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.2](https://github.com/AIGNE-io/aigne-framework/compare/ideogram-v0.3.1...ideogram-v0.3.2) (2025-08-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/core bumped to 1.57.1
|
|
11
|
+
|
|
12
|
+
## [0.3.1](https://github.com/AIGNE-io/aigne-framework/compare/ideogram-v0.3.0...ideogram-v0.3.1) (2025-08-28)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* support gemini-2.0-flash model for image model ([#429](https://github.com/AIGNE-io/aigne-framework/issues/429)) ([5a0bba1](https://github.com/AIGNE-io/aigne-framework/commit/5a0bba197cf8785384b70302f86cf702d04b7fc4))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* The following workspace dependencies were updated
|
|
23
|
+
* dependencies
|
|
24
|
+
* @aigne/core bumped to 1.57.0
|
|
25
|
+
|
|
3
26
|
## [0.3.0](https://github.com/AIGNE-io/aigne-framework/compare/ideogram-v0.2.0...ideogram-v0.3.0) (2025-08-27)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -16,6 +16,7 @@ export interface IdeogramImageModelOutput extends ImageModelOutput {
|
|
|
16
16
|
export interface IdeogramImageModelOptions extends ImageModelOptions<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
17
17
|
apiKey?: string;
|
|
18
18
|
baseURL?: string;
|
|
19
|
+
model?: string;
|
|
19
20
|
modelOptions?: Omit<Partial<IdeogramImageModelInput>, "model">;
|
|
20
21
|
}
|
|
21
22
|
export declare class IdeogramImageModel extends ImageModel<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
@@ -4,12 +4,14 @@ exports.IdeogramImageModel = void 0;
|
|
|
4
4
|
const core_1 = require("@aigne/core");
|
|
5
5
|
const camelize_js_1 = require("@aigne/core/utils/camelize.js");
|
|
6
6
|
const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
|
|
7
|
+
const ufo_1 = require("ufo");
|
|
7
8
|
const zod_1 = require("zod");
|
|
8
|
-
const IDEOGRAM_BASE_URL = "https://api.ideogram.ai
|
|
9
|
+
const IDEOGRAM_BASE_URL = "https://api.ideogram.ai";
|
|
9
10
|
const ideogramImageModelInputSchema = core_1.imageModelInputSchema.extend({});
|
|
10
11
|
const ideogramImageModelOptionsSchema = zod_1.z.object({
|
|
11
12
|
apiKey: zod_1.z.string().optional(),
|
|
12
13
|
baseURL: zod_1.z.string().optional(),
|
|
14
|
+
model: zod_1.z.string().optional(),
|
|
13
15
|
modelOptions: zod_1.z.object({}).optional(),
|
|
14
16
|
});
|
|
15
17
|
class IdeogramImageModel extends core_1.ImageModel {
|
|
@@ -42,6 +44,9 @@ class IdeogramImageModel extends core_1.ImageModel {
|
|
|
42
44
|
async process(input) {
|
|
43
45
|
const model = input.model;
|
|
44
46
|
const formData = new FormData();
|
|
47
|
+
if (model !== "ideogram-v3") {
|
|
48
|
+
throw new Error(`${this.name} only support ideogram-v3`);
|
|
49
|
+
}
|
|
45
50
|
const inputKeys = [
|
|
46
51
|
"prompt",
|
|
47
52
|
"seed",
|
|
@@ -66,7 +71,7 @@ class IdeogramImageModel extends core_1.ImageModel {
|
|
|
66
71
|
const { url, apiKey } = this.credential;
|
|
67
72
|
if (!apiKey)
|
|
68
73
|
throw new Error(`${this.name} requires an API key. Please provide it via \`options.apiKey\`, or set the \`${this.apiKeyEnvName}\` environment variable`);
|
|
69
|
-
const response = await fetch(url, {
|
|
74
|
+
const response = await fetch((0, ufo_1.joinURL)(new URL(url).origin, `/v1/${model}/generate`), {
|
|
70
75
|
method: "POST",
|
|
71
76
|
headers: { "api-key": apiKey },
|
|
72
77
|
body: formData,
|
|
@@ -16,6 +16,7 @@ export interface IdeogramImageModelOutput extends ImageModelOutput {
|
|
|
16
16
|
export interface IdeogramImageModelOptions extends ImageModelOptions<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
17
17
|
apiKey?: string;
|
|
18
18
|
baseURL?: string;
|
|
19
|
+
model?: string;
|
|
19
20
|
modelOptions?: Omit<Partial<IdeogramImageModelInput>, "model">;
|
|
20
21
|
}
|
|
21
22
|
export declare class IdeogramImageModel extends ImageModel<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
@@ -16,6 +16,7 @@ export interface IdeogramImageModelOutput extends ImageModelOutput {
|
|
|
16
16
|
export interface IdeogramImageModelOptions extends ImageModelOptions<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
17
17
|
apiKey?: string;
|
|
18
18
|
baseURL?: string;
|
|
19
|
+
model?: string;
|
|
19
20
|
modelOptions?: Omit<Partial<IdeogramImageModelInput>, "model">;
|
|
20
21
|
}
|
|
21
22
|
export declare class IdeogramImageModel extends ImageModel<IdeogramImageModelInput, IdeogramImageModelOutput> {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ImageModel, imageModelInputSchema, } from "@aigne/core";
|
|
2
2
|
import { snakelize } from "@aigne/core/utils/camelize.js";
|
|
3
3
|
import { checkArguments, pick } from "@aigne/core/utils/type-utils.js";
|
|
4
|
+
import { joinURL } from "ufo";
|
|
4
5
|
import { z } from "zod";
|
|
5
|
-
const IDEOGRAM_BASE_URL = "https://api.ideogram.ai
|
|
6
|
+
const IDEOGRAM_BASE_URL = "https://api.ideogram.ai";
|
|
6
7
|
const ideogramImageModelInputSchema = imageModelInputSchema.extend({});
|
|
7
8
|
const ideogramImageModelOptionsSchema = z.object({
|
|
8
9
|
apiKey: z.string().optional(),
|
|
9
10
|
baseURL: z.string().optional(),
|
|
11
|
+
model: z.string().optional(),
|
|
10
12
|
modelOptions: z.object({}).optional(),
|
|
11
13
|
});
|
|
12
14
|
export class IdeogramImageModel extends ImageModel {
|
|
@@ -39,6 +41,9 @@ export class IdeogramImageModel extends ImageModel {
|
|
|
39
41
|
async process(input) {
|
|
40
42
|
const model = input.model;
|
|
41
43
|
const formData = new FormData();
|
|
44
|
+
if (model !== "ideogram-v3") {
|
|
45
|
+
throw new Error(`${this.name} only support ideogram-v3`);
|
|
46
|
+
}
|
|
42
47
|
const inputKeys = [
|
|
43
48
|
"prompt",
|
|
44
49
|
"seed",
|
|
@@ -63,7 +68,7 @@ export class IdeogramImageModel extends ImageModel {
|
|
|
63
68
|
const { url, apiKey } = this.credential;
|
|
64
69
|
if (!apiKey)
|
|
65
70
|
throw new Error(`${this.name} requires an API key. Please provide it via \`options.apiKey\`, or set the \`${this.apiKeyEnvName}\` environment variable`);
|
|
66
|
-
const response = await fetch(url, {
|
|
71
|
+
const response = await fetch(joinURL(new URL(url).origin, `/v1/${model}/generate`), {
|
|
67
72
|
method: "POST",
|
|
68
73
|
headers: { "api-key": apiKey },
|
|
69
74
|
body: formData,
|
package/package.json
CHANGED
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"
|
|
37
|
+
"ufo": "^1.6.1",
|
|
38
|
+
"@aigne/core": "1.57.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/bun": "^1.2.18",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"typescript": "^5.8.3",
|
|
47
48
|
"zod": "3.25.67"
|
|
48
49
|
},
|
|
49
|
-
"version": "0.3.
|
|
50
|
+
"version": "0.3.2",
|
|
50
51
|
"scripts": {
|
|
51
52
|
"lint": "tsc --noEmit",
|
|
52
53
|
"build": "tsc --build scripts/tsconfig.build.json",
|