@aigne/gemini 0.14.3 → 0.14.4-beta.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,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.4-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.14.4-beta...gemini-v0.14.4-beta.1) (2025-10-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **gemini:** use StructuredOutputError to trigger retry for missing JSON response ([#660](https://github.com/AIGNE-io/aigne-framework/issues/660)) ([e8826ed](https://github.com/AIGNE-io/aigne-framework/commit/e8826ed96db57bfcce0b577881bf0d2fd828c269))
|
|
9
|
+
|
|
10
|
+
## [0.14.4-beta](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.14.3...gemini-v0.14.4-beta) (2025-10-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **models:** improve message structure handling and enable auto-message options ([#657](https://github.com/AIGNE-io/aigne-framework/issues/657)) ([233d70c](https://github.com/AIGNE-io/aigne-framework/commit/233d70cb292b937200fada8434f33d957d766ad6))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* dependencies
|
|
22
|
+
* @aigne/core bumped to 1.64.1-beta
|
|
23
|
+
* devDependencies
|
|
24
|
+
* @aigne/test-utils bumped to 0.5.57-beta
|
|
25
|
+
|
|
3
26
|
## [0.14.3](https://github.com/AIGNE-io/aigne-framework/compare/gemini-v0.14.3-beta.1...gemini-v0.14.3) (2025-10-22)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -151,7 +151,7 @@ class GeminiChatModel extends core_1.ChatModel {
|
|
|
151
151
|
yield { delta: { json: { json: (0, core_1.safeParseJSON)(text) } } };
|
|
152
152
|
}
|
|
153
153
|
else if (!toolCalls.length) {
|
|
154
|
-
throw new
|
|
154
|
+
throw new core_1.StructuredOutputError("No JSON response from the model");
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
else if (!toolCalls.length) {
|
|
@@ -342,17 +342,26 @@ class GeminiChatModel extends core_1.ChatModel {
|
|
|
342
342
|
}
|
|
343
343
|
return content;
|
|
344
344
|
}))).filter(type_utils_js_1.isNonNullable);
|
|
345
|
-
|
|
346
|
-
const system = systemParts.pop();
|
|
347
|
-
if (system) {
|
|
348
|
-
result.contents.push({ role: "user", parts: [system] });
|
|
349
|
-
}
|
|
350
|
-
}
|
|
345
|
+
this.ensureMessagesHasUserMessage(systemParts, result.contents);
|
|
351
346
|
if (systemParts.length) {
|
|
352
347
|
result.config ??= {};
|
|
353
348
|
result.config.systemInstruction = systemParts;
|
|
354
349
|
}
|
|
355
350
|
return result;
|
|
356
351
|
}
|
|
352
|
+
ensureMessagesHasUserMessage(systems, contents) {
|
|
353
|
+
// no messages but system messages
|
|
354
|
+
if (!contents.length && systems.length) {
|
|
355
|
+
const system = systems.pop();
|
|
356
|
+
if (system)
|
|
357
|
+
contents.push({ role: "user", parts: [system] });
|
|
358
|
+
}
|
|
359
|
+
// first message is from model
|
|
360
|
+
if (contents[0]?.role === "model") {
|
|
361
|
+
const system = systems.pop();
|
|
362
|
+
if (system)
|
|
363
|
+
contents.unshift({ role: "user", parts: [system] });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
357
366
|
}
|
|
358
367
|
exports.GeminiChatModel = GeminiChatModel;
|
|
@@ -148,7 +148,7 @@ export class GeminiChatModel extends ChatModel {
|
|
|
148
148
|
yield { delta: { json: { json: safeParseJSON(text) } } };
|
|
149
149
|
}
|
|
150
150
|
else if (!toolCalls.length) {
|
|
151
|
-
throw new
|
|
151
|
+
throw new StructuredOutputError("No JSON response from the model");
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
else if (!toolCalls.length) {
|
|
@@ -339,16 +339,25 @@ export class GeminiChatModel extends ChatModel {
|
|
|
339
339
|
}
|
|
340
340
|
return content;
|
|
341
341
|
}))).filter(isNonNullable);
|
|
342
|
-
|
|
343
|
-
const system = systemParts.pop();
|
|
344
|
-
if (system) {
|
|
345
|
-
result.contents.push({ role: "user", parts: [system] });
|
|
346
|
-
}
|
|
347
|
-
}
|
|
342
|
+
this.ensureMessagesHasUserMessage(systemParts, result.contents);
|
|
348
343
|
if (systemParts.length) {
|
|
349
344
|
result.config ??= {};
|
|
350
345
|
result.config.systemInstruction = systemParts;
|
|
351
346
|
}
|
|
352
347
|
return result;
|
|
353
348
|
}
|
|
349
|
+
ensureMessagesHasUserMessage(systems, contents) {
|
|
350
|
+
// no messages but system messages
|
|
351
|
+
if (!contents.length && systems.length) {
|
|
352
|
+
const system = systems.pop();
|
|
353
|
+
if (system)
|
|
354
|
+
contents.push({ role: "user", parts: [system] });
|
|
355
|
+
}
|
|
356
|
+
// first message is from model
|
|
357
|
+
if (contents[0]?.role === "model") {
|
|
358
|
+
const system = systems.pop();
|
|
359
|
+
if (system)
|
|
360
|
+
contents.unshift({ role: "user", parts: [system] });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
354
363
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/gemini",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4-beta.1",
|
|
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
|
"@google/genai": "^1.24.0",
|
|
40
40
|
"zod": "^3.25.67",
|
|
41
41
|
"zod-to-json-schema": "^3.24.6",
|
|
42
|
-
"@aigne/core": "^1.64.
|
|
42
|
+
"@aigne/core": "^1.64.1-beta",
|
|
43
43
|
"@aigne/platform-helpers": "^0.6.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"npm-run-all": "^4.1.5",
|
|
49
49
|
"rimraf": "^6.0.1",
|
|
50
50
|
"typescript": "^5.9.2",
|
|
51
|
-
"@aigne/test-utils": "^0.5.
|
|
51
|
+
"@aigne/test-utils": "^0.5.57-beta"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"lint": "tsc --noEmit",
|