koishi-plugin-chatluna-google-gemini-adapter 1.2.10 → 1.2.12
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 +3 -4
- package/lib/index.mjs +3 -4
- package/lib/utils.d.ts +1 -4
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -185,14 +185,13 @@ function extractSystemMessages(messages) {
|
|
|
185
185
|
);
|
|
186
186
|
return [
|
|
187
187
|
{
|
|
188
|
+
role: "user",
|
|
188
189
|
parts: [
|
|
189
190
|
{
|
|
190
191
|
text: systemMessages.reduce((acc, cur) => {
|
|
191
192
|
acc.push(...cur.parts);
|
|
192
193
|
return acc;
|
|
193
|
-
}, []).map((part) =>
|
|
194
|
-
return partAsType(part).text;
|
|
195
|
-
}).join("\n\n\n")
|
|
194
|
+
}, []).map((part) => partAsType(part).text).join("\n\n\n")
|
|
196
195
|
}
|
|
197
196
|
]
|
|
198
197
|
},
|
|
@@ -399,7 +398,7 @@ var GeminiRequester = class extends import_api.ModelRequester {
|
|
|
399
398
|
includeThoughts: this._pluginConfig.includeThoughts
|
|
400
399
|
} : void 0
|
|
401
400
|
},
|
|
402
|
-
|
|
401
|
+
system_instruction: systemInstruction != null ? systemInstruction : void 0,
|
|
403
402
|
tools: params.tools != null || this._pluginConfig.googleSearch || this._pluginConfig.codeExecution || this._pluginConfig.urlContext ? formatToolsToGeminiAITools(
|
|
404
403
|
params.tools ?? [],
|
|
405
404
|
this._pluginConfig,
|
package/lib/index.mjs
CHANGED
|
@@ -168,14 +168,13 @@ function extractSystemMessages(messages) {
|
|
|
168
168
|
);
|
|
169
169
|
return [
|
|
170
170
|
{
|
|
171
|
+
role: "user",
|
|
171
172
|
parts: [
|
|
172
173
|
{
|
|
173
174
|
text: systemMessages.reduce((acc, cur) => {
|
|
174
175
|
acc.push(...cur.parts);
|
|
175
176
|
return acc;
|
|
176
|
-
}, []).map((part) =>
|
|
177
|
-
return partAsType(part).text;
|
|
178
|
-
}).join("\n\n\n")
|
|
177
|
+
}, []).map((part) => partAsType(part).text).join("\n\n\n")
|
|
179
178
|
}
|
|
180
179
|
]
|
|
181
180
|
},
|
|
@@ -382,7 +381,7 @@ var GeminiRequester = class extends ModelRequester {
|
|
|
382
381
|
includeThoughts: this._pluginConfig.includeThoughts
|
|
383
382
|
} : void 0
|
|
384
383
|
},
|
|
385
|
-
|
|
384
|
+
system_instruction: systemInstruction != null ? systemInstruction : void 0,
|
|
386
385
|
tools: params.tools != null || this._pluginConfig.googleSearch || this._pluginConfig.codeExecution || this._pluginConfig.urlContext ? formatToolsToGeminiAITools(
|
|
387
386
|
params.tools ?? [],
|
|
388
387
|
this._pluginConfig,
|
package/lib/utils.d.ts
CHANGED
|
@@ -3,10 +3,7 @@ import { StructuredTool } from '@langchain/core/tools';
|
|
|
3
3
|
import { ChatCompletionFunction, ChatCompletionResponseMessage, ChatCompletionResponseMessageRoleEnum, ChatPart } from './types';
|
|
4
4
|
import { Config } from '.';
|
|
5
5
|
export declare function langchainMessageToGeminiMessage(messages: BaseMessage[], model?: string): Promise<ChatCompletionResponseMessage[]>;
|
|
6
|
-
export declare function extractSystemMessages(messages: ChatCompletionResponseMessage[]): [
|
|
7
|
-
Omit<ChatCompletionResponseMessage, 'role'>,
|
|
8
|
-
ChatCompletionResponseMessage[]
|
|
9
|
-
];
|
|
6
|
+
export declare function extractSystemMessages(messages: ChatCompletionResponseMessage[]): [ChatCompletionResponseMessage, ChatCompletionResponseMessage[]];
|
|
10
7
|
export declare function partAsType<T extends ChatPart>(part: ChatPart): T;
|
|
11
8
|
export declare function partAsTypeCheck<T extends ChatPart>(part: ChatPart, check: (part: ChatPart & unknown) => boolean): T | undefined;
|
|
12
9
|
export declare function formatToolsToGeminiAITools(tools: StructuredTool[], config: Config, model: string): Record<string, any>;
|
package/package.json
CHANGED