koishi-plugin-chatluna-google-gemini-adapter 1.3.0-alpha.20 → 1.3.0-alpha.22

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/lib/index.cjs CHANGED
@@ -63,10 +63,10 @@ var import_sse = require("koishi-plugin-chatluna/utils/sse");
63
63
  var import_stream = require("koishi-plugin-chatluna/utils/stream");
64
64
 
65
65
  // src/utils.ts
66
- var import_zod_to_json_schema = require("zod-to-json-schema");
67
66
  var import_v1_shared_adapter = require("@chatluna/v1-shared-adapter");
68
67
  var import_string = require("koishi-plugin-chatluna/utils/string");
69
68
  var import_types = require("@langchain/core/utils/types");
69
+ var import_zod_openapi = require("@anatine/zod-openapi");
70
70
  async function langchainMessageToGeminiMessage(messages, plugin, model) {
71
71
  return Promise.all(
72
72
  messages.map(async (message) => {
@@ -287,9 +287,7 @@ function formatToolsToGeminiAITools(tools, config, model) {
287
287
  __name(formatToolsToGeminiAITools, "formatToolsToGeminiAITools");
288
288
  function formatToolToGeminiAITool(tool) {
289
289
  const parameters = (0, import_v1_shared_adapter.removeAdditionalProperties)(
290
- (0, import_types.isZodSchemaV3)(tool.schema) ? (0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema, {
291
- allowedAdditionalProperties: void 0
292
- }) : tool.schema
290
+ (0, import_types.isZodSchemaV3)(tool.schema) ? (0, import_zod_openapi.generateSchema)(tool.schema, true, "3.0") : tool.schema
293
291
  );
294
292
  return {
295
293
  name: tool.name,
package/lib/index.mjs CHANGED
@@ -54,7 +54,6 @@ import { checkResponse, sseIterable } from "koishi-plugin-chatluna/utils/sse";
54
54
  import { readableStreamToAsyncIterable } from "koishi-plugin-chatluna/utils/stream";
55
55
 
56
56
  // src/utils.ts
57
- import { zodToJsonSchema } from "zod-to-json-schema";
58
57
  import {
59
58
  fetchImageUrl,
60
59
  removeAdditionalProperties
@@ -64,6 +63,7 @@ import {
64
63
  isMessageContentText
65
64
  } from "koishi-plugin-chatluna/utils/string";
66
65
  import { isZodSchemaV3 } from "@langchain/core/utils/types";
66
+ import { generateSchema } from "@anatine/zod-openapi";
67
67
  async function langchainMessageToGeminiMessage(messages, plugin, model) {
68
68
  return Promise.all(
69
69
  messages.map(async (message) => {
@@ -284,9 +284,7 @@ function formatToolsToGeminiAITools(tools, config, model) {
284
284
  __name(formatToolsToGeminiAITools, "formatToolsToGeminiAITools");
285
285
  function formatToolToGeminiAITool(tool) {
286
286
  const parameters = removeAdditionalProperties(
287
- isZodSchemaV3(tool.schema) ? zodToJsonSchema(tool.schema, {
288
- allowedAdditionalProperties: void 0
289
- }) : tool.schema
287
+ isZodSchemaV3(tool.schema) ? generateSchema(tool.schema, true, "3.0") : tool.schema
290
288
  );
291
289
  return {
292
290
  name: tool.name,
package/package.json CHANGED
@@ -1,95 +1,97 @@
1
1
  {
2
- "name": "koishi-plugin-chatluna-google-gemini-adapter",
3
- "description": "google-gemini adapter for chatluna",
4
- "version": "1.3.0-alpha.20",
5
- "main": "lib/index.cjs",
6
- "module": "lib/index.mjs",
7
- "typings": "lib/index.d.ts",
8
- "files": [
9
- "lib",
10
- "dist"
11
- ],
12
- "exports": {
13
- ".": {
14
- "types": "./lib/index.d.ts",
15
- "import": "./lib/index.mjs",
16
- "require": "./lib/index.cjs"
2
+ "name": "koishi-plugin-chatluna-google-gemini-adapter",
3
+ "description": "google-gemini adapter for chatluna",
4
+ "version": "1.3.0-alpha.22",
5
+ "main": "lib/index.cjs",
6
+ "module": "lib/index.mjs",
7
+ "typings": "lib/index.d.ts",
8
+ "files": [
9
+ "lib",
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./lib/index.d.ts",
15
+ "import": "./lib/index.mjs",
16
+ "require": "./lib/index.cjs"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "type": "module",
21
+ "author": "dingyi222666 <dingyi222666@foxmail.com>",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/ChatLunaLab/chatluna.git",
25
+ "directory": "packages/adapter-gemini"
26
+ },
27
+ "license": "AGPL-3.0",
28
+ "bugs": {
29
+ "url": "https://github.com/ChatLunaLab/chatluna/issues"
30
+ },
31
+ "homepage": "https://github.com/ChatLunaLab/chatluna/tree/v1-dev/packages/adapter-gemini#readme",
32
+ "scripts": {
33
+ "build": "atsc -b"
34
+ },
35
+ "resolutions": {
36
+ "@langchain/core": "0.3.62",
37
+ "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
17
38
  },
18
- "./package.json": "./package.json"
19
- },
20
- "type": "module",
21
- "author": "dingyi222666 <dingyi222666@foxmail.com>",
22
- "repository": {
23
- "type": "git",
24
- "url": "https://github.com/ChatLunaLab/chatluna.git",
25
- "directory": "packages/adapter-gemini"
26
- },
27
- "license": "AGPL-3.0",
28
- "bugs": {
29
- "url": "https://github.com/ChatLunaLab/chatluna/issues"
30
- },
31
- "homepage": "https://github.com/ChatLunaLab/chatluna/tree/v1-dev/packages/adapter-gemini#readme",
32
- "scripts": {
33
- "build": "atsc -b"
34
- },
35
- "resolutions": {
36
- "@langchain/core": "0.3.62",
37
- "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
38
- },
39
- "overrides": {
40
- "@langchain/core": "0.3.62",
41
- "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
42
- },
43
- "pnpm": {
44
39
  "overrides": {
45
- "@langchain/core": "0.3.62",
46
- "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
47
- }
48
- },
49
- "engines": {
50
- "node": ">=18.0.0"
51
- },
52
- "keywords": [
53
- "chatbot",
54
- "koishi",
55
- "plugin",
56
- "service",
57
- "chatgpt",
58
- "gpt",
59
- "google",
60
- "gemini",
61
- "chatluna",
62
- "adapter"
63
- ],
64
- "dependencies": {
65
- "@chatluna/v1-shared-adapter": "^1.0.14",
66
- "@langchain/core": "0.3.62",
67
- "zod": "3.25.76",
68
- "zod-to-json-schema": "^3.24.6"
69
- },
70
- "devDependencies": {
71
- "atsc": "^2.1.0",
72
- "koishi": "^4.18.9"
73
- },
74
- "peerDependencies": {
75
- "koishi": "^4.18.9",
76
- "koishi-plugin-chatluna": "^1.3.0-alpha.68",
77
- "koishi-plugin-chatluna-storage-service": "^0.0.11"
78
- },
79
- "peerDependenciesMeta": {
80
- "koishi-plugin-chatluna-storage-service": {
81
- "optional": true
82
- }
83
- },
84
- "koishi": {
85
- "description": {
86
- "zh": "ChatLuna 的 Google Gemini 适配器",
87
- "en": "Google Gemini adapter for ChatLuna"
40
+ "@langchain/core": "0.3.62",
41
+ "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
42
+ },
43
+ "pnpm": {
44
+ "overrides": {
45
+ "@langchain/core": "0.3.62",
46
+ "js-tiktoken": "npm:@dingyi222666/js-tiktoken@^1.0.21"
47
+ }
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
52
+ "keywords": [
53
+ "chatbot",
54
+ "koishi",
55
+ "plugin",
56
+ "service",
57
+ "chatgpt",
58
+ "gpt",
59
+ "google",
60
+ "gemini",
61
+ "chatluna",
62
+ "adapter"
63
+ ],
64
+ "dependencies": {
65
+ "@anatine/zod-openapi": "^2.2.8",
66
+ "@chatluna/v1-shared-adapter": "^1.0.15",
67
+ "@langchain/core": "0.3.62",
68
+ "openapi3-ts": "^4.5.0",
69
+ "zod": "3.25.76",
70
+ "zod-to-json-schema": "^3.24.6"
71
+ },
72
+ "devDependencies": {
73
+ "atsc": "^2.1.0",
74
+ "koishi": "^4.18.9"
75
+ },
76
+ "peerDependencies": {
77
+ "koishi": "^4.18.9",
78
+ "koishi-plugin-chatluna": "^1.3.0-alpha.76",
79
+ "koishi-plugin-chatluna-storage-service": "^0.0.11"
80
+ },
81
+ "peerDependenciesMeta": {
82
+ "koishi-plugin-chatluna-storage-service": {
83
+ "optional": true
84
+ }
88
85
  },
89
- "service": {
90
- "required": [
91
- "chatluna"
92
- ]
86
+ "koishi": {
87
+ "description": {
88
+ "zh": "ChatLuna 的 Google Gemini 适配器",
89
+ "en": "Google Gemini adapter for ChatLuna"
90
+ },
91
+ "service": {
92
+ "required": [
93
+ "chatluna"
94
+ ]
95
+ }
93
96
  }
94
- }
95
- }
97
+ }