@aigne/gemini 0.14.0-beta → 0.14.0-beta.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 +31 -0
- package/lib/cjs/gemini-image-model.js +9 -9
- package/lib/esm/gemini-image-model.js +10 -10
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.0-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.14.0-beta.1...gemini-v0.14.0-beta.2) (2025-09-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* standardize file parameter naming across models ([#534](https://github.com/AIGNE-io/aigne-framework/issues/534)) ([f159a9d](https://github.com/AIGNE-io/aigne-framework/commit/f159a9d6af21ec0e99641996b150560929845845))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/openai bumped to 0.16.0-beta.2
|
|
16
|
+
* devDependencies
|
|
17
|
+
* @aigne/core bumped to 1.61.0-beta.1
|
|
18
|
+
* @aigne/test-utils bumped to 0.5.53-beta.1
|
|
19
|
+
|
|
20
|
+
## [0.14.0-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.14.0-beta...gemini-v0.14.0-beta.1) (2025-09-23)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* improve image model parameters ([#530](https://github.com/AIGNE-io/aigne-framework/issues/530)) ([d66b5ca](https://github.com/AIGNE-io/aigne-framework/commit/d66b5ca01e14baad2712cc1a84930cdb63703232))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* The following workspace dependencies were updated
|
|
31
|
+
* dependencies
|
|
32
|
+
* @aigne/openai bumped to 0.16.0-beta.1
|
|
33
|
+
|
|
3
34
|
## [0.14.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.13.5...gemini-v0.14.0-beta) (2025-09-22)
|
|
4
35
|
|
|
5
36
|
|
|
@@ -53,7 +53,7 @@ class GeminiImageModel extends core_1.ImageModel {
|
|
|
53
53
|
* @returns The generated response
|
|
54
54
|
*/
|
|
55
55
|
async process(input, options) {
|
|
56
|
-
const model = input.model || this.credential.model;
|
|
56
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
57
57
|
const responseFormat = input.responseFormat || "base64";
|
|
58
58
|
if (responseFormat === "url") {
|
|
59
59
|
throw new Error("Gemini image models currently only support base64 format");
|
|
@@ -64,8 +64,8 @@ class GeminiImageModel extends core_1.ImageModel {
|
|
|
64
64
|
return this.generateImageByGeminiModel(input, options);
|
|
65
65
|
}
|
|
66
66
|
async generateImageByImagenModel(input) {
|
|
67
|
-
const model = input.model || this.credential.model;
|
|
68
|
-
const mergedInput = { ...this.modelOptions, ...input };
|
|
67
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
68
|
+
const mergedInput = { ...this.modelOptions, ...input.modelOptions, ...input };
|
|
69
69
|
const inputKeys = [
|
|
70
70
|
"seed",
|
|
71
71
|
"safetyFilterLevel",
|
|
@@ -83,7 +83,7 @@ class GeminiImageModel extends core_1.ImageModel {
|
|
|
83
83
|
"addWatermark",
|
|
84
84
|
];
|
|
85
85
|
const response = await this.client.models.generateImages({
|
|
86
|
-
model
|
|
86
|
+
model,
|
|
87
87
|
prompt: mergedInput.prompt,
|
|
88
88
|
config: { numberOfImages: mergedInput.n || 1, ...(0, type_utils_js_1.pick)(mergedInput, inputKeys) },
|
|
89
89
|
});
|
|
@@ -101,8 +101,8 @@ class GeminiImageModel extends core_1.ImageModel {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
async generateImageByGeminiModel(input, options) {
|
|
104
|
-
const model = input.model || this.credential.model;
|
|
105
|
-
const mergedInput = { ...this.modelOptions, ...input };
|
|
104
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
105
|
+
const mergedInput = { ...this.modelOptions, ...input.modelOptions, ...input };
|
|
106
106
|
const inputKeys = [
|
|
107
107
|
"abortSignal",
|
|
108
108
|
"audioTimestamp",
|
|
@@ -134,14 +134,14 @@ class GeminiImageModel extends core_1.ImageModel {
|
|
|
134
134
|
"topP",
|
|
135
135
|
];
|
|
136
136
|
const images = await Promise.all((0, type_utils_js_1.flat)(input.image).map(async (image) => {
|
|
137
|
-
const { data, mimeType } = await this.
|
|
137
|
+
const { data, mimeType } = await this.transformFileType("file", image, options);
|
|
138
138
|
return { inlineData: { data, mimeType } };
|
|
139
139
|
}));
|
|
140
140
|
const response = await this.client.models.generateContent({
|
|
141
|
-
model
|
|
141
|
+
model,
|
|
142
142
|
contents: [{ text: input.prompt }, ...images],
|
|
143
143
|
config: {
|
|
144
|
-
responseModalities: [genai_1.Modality.IMAGE],
|
|
144
|
+
responseModalities: [genai_1.Modality.TEXT, genai_1.Modality.IMAGE],
|
|
145
145
|
candidateCount: input.n || 1,
|
|
146
146
|
...(0, type_utils_js_1.pick)(mergedInput, inputKeys),
|
|
147
147
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImageModel, imageModelInputSchema, } from "@aigne/core";
|
|
2
2
|
import { checkArguments, flat, isNonNullable, pick } from "@aigne/core/utils/type-utils.js";
|
|
3
3
|
import { GoogleGenAI, Modality, } from "@google/genai";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -50,7 +50,7 @@ export class GeminiImageModel extends ImageModel {
|
|
|
50
50
|
* @returns The generated response
|
|
51
51
|
*/
|
|
52
52
|
async process(input, options) {
|
|
53
|
-
const model = input.model || this.credential.model;
|
|
53
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
54
54
|
const responseFormat = input.responseFormat || "base64";
|
|
55
55
|
if (responseFormat === "url") {
|
|
56
56
|
throw new Error("Gemini image models currently only support base64 format");
|
|
@@ -61,8 +61,8 @@ export class GeminiImageModel extends ImageModel {
|
|
|
61
61
|
return this.generateImageByGeminiModel(input, options);
|
|
62
62
|
}
|
|
63
63
|
async generateImageByImagenModel(input) {
|
|
64
|
-
const model = input.model || this.credential.model;
|
|
65
|
-
const mergedInput = { ...this.modelOptions, ...input };
|
|
64
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
65
|
+
const mergedInput = { ...this.modelOptions, ...input.modelOptions, ...input };
|
|
66
66
|
const inputKeys = [
|
|
67
67
|
"seed",
|
|
68
68
|
"safetyFilterLevel",
|
|
@@ -80,7 +80,7 @@ export class GeminiImageModel extends ImageModel {
|
|
|
80
80
|
"addWatermark",
|
|
81
81
|
];
|
|
82
82
|
const response = await this.client.models.generateImages({
|
|
83
|
-
model
|
|
83
|
+
model,
|
|
84
84
|
prompt: mergedInput.prompt,
|
|
85
85
|
config: { numberOfImages: mergedInput.n || 1, ...pick(mergedInput, inputKeys) },
|
|
86
86
|
});
|
|
@@ -98,8 +98,8 @@ export class GeminiImageModel extends ImageModel {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
async generateImageByGeminiModel(input, options) {
|
|
101
|
-
const model = input.model || this.credential.model;
|
|
102
|
-
const mergedInput = { ...this.modelOptions, ...input };
|
|
101
|
+
const model = input.modelOptions?.model || this.credential.model;
|
|
102
|
+
const mergedInput = { ...this.modelOptions, ...input.modelOptions, ...input };
|
|
103
103
|
const inputKeys = [
|
|
104
104
|
"abortSignal",
|
|
105
105
|
"audioTimestamp",
|
|
@@ -131,14 +131,14 @@ export class GeminiImageModel extends ImageModel {
|
|
|
131
131
|
"topP",
|
|
132
132
|
];
|
|
133
133
|
const images = await Promise.all(flat(input.image).map(async (image) => {
|
|
134
|
-
const { data, mimeType } = await this.
|
|
134
|
+
const { data, mimeType } = await this.transformFileType("file", image, options);
|
|
135
135
|
return { inlineData: { data, mimeType } };
|
|
136
136
|
}));
|
|
137
137
|
const response = await this.client.models.generateContent({
|
|
138
|
-
model
|
|
138
|
+
model,
|
|
139
139
|
contents: [{ text: input.prompt }, ...images],
|
|
140
140
|
config: {
|
|
141
|
-
responseModalities: [Modality.IMAGE],
|
|
141
|
+
responseModalities: [Modality.TEXT, Modality.IMAGE],
|
|
142
142
|
candidateCount: input.n || 1,
|
|
143
143
|
...pick(mergedInput, inputKeys),
|
|
144
144
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/gemini",
|
|
3
|
-
"version": "0.14.0-beta",
|
|
3
|
+
"version": "0.14.0-beta.2",
|
|
4
4
|
"description": "AIGNE Gemini SDK for integrating with Google's Gemini AI models",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"uuid": "^13.0.0",
|
|
40
40
|
"zod": "^3.25.67",
|
|
41
41
|
"@aigne/platform-helpers": "^0.6.3-beta",
|
|
42
|
-
"@aigne/openai": "^0.16.0-beta"
|
|
42
|
+
"@aigne/openai": "^0.16.0-beta.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/bun": "^1.2.22",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"npm-run-all": "^4.1.5",
|
|
48
48
|
"rimraf": "^6.0.1",
|
|
49
49
|
"typescript": "^5.9.2",
|
|
50
|
-
"@aigne/
|
|
51
|
-
"@aigne/
|
|
50
|
+
"@aigne/core": "^1.61.0-beta.1",
|
|
51
|
+
"@aigne/test-utils": "^0.5.53-beta.1"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"lint": "tsc --noEmit",
|