koishi-plugin-chatluna-google-gemini-adapter 1.0.0-beta.12 → 1.0.0-beta.13

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/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import { Context } from 'koishi';
1
2
  import { PlatformModelAndEmbeddingsClient } from 'koishi-plugin-chatluna/lib/llm-core/platform/client';
2
3
  import { ClientConfig } from 'koishi-plugin-chatluna/lib/llm-core/platform/config';
3
4
  import { ChatHubBaseEmbeddings, ChatLunaChatModel } from 'koishi-plugin-chatluna/lib/llm-core/platform/model';
4
5
  import { ModelInfo } from 'koishi-plugin-chatluna/lib/llm-core/platform/types';
5
- import { Context } from 'koishi';
6
6
  import { Config } from '.';
7
7
  export declare class GeminiClient extends PlatformModelAndEmbeddingsClient {
8
8
  private _config;
package/lib/client.js CHANGED
@@ -72,6 +72,7 @@ class GeminiClient extends client_1.PlatformModelAndEmbeddingsClient {
72
72
  }
73
73
  return new model_1.ChatLunaEmbeddings({
74
74
  client: this._requester,
75
+ model,
75
76
  maxRetries: this._config.maxRetries
76
77
  });
77
78
  }
package/lib/requester.js CHANGED
@@ -66,8 +66,8 @@ class GeminiRequester extends api_1.ModelRequester {
66
66
  jsonParser.onValue = async ({ value }) => {
67
67
  const transformValue = value;
68
68
  if (transformValue.candidates && transformValue.candidates[0]) {
69
- const parts = transformValue.candidates[0].content.parts;
70
- if (parts.length < 1) {
69
+ const parts = transformValue.candidates[0]?.content?.parts;
70
+ if (parts == null || parts.length < 1) {
71
71
  throw new Error(JSON.stringify(value));
72
72
  }
73
73
  for (const part of parts) {
package/lib/utils.d.ts CHANGED
@@ -6,4 +6,4 @@ export declare function partAsType<T extends ChatPart>(part: ChatPart): T;
6
6
  export declare function formatToolsToGeminiAITools(tools: StructuredTool[]): ChatCompletionFunction[];
7
7
  export declare function formatToolToGeminiAITool(tool: StructuredTool): ChatCompletionFunction;
8
8
  export declare function messageTypeToGeminiRole(type: MessageType): ChatCompletionResponseMessageRoleEnum;
9
- export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum): HumanMessageChunk | AIMessageChunk | SystemMessageChunk | ChatMessageChunk;
9
+ export declare function convertDeltaToMessageChunk(delta: Record<string, any>, defaultRole?: ChatCompletionResponseMessageRoleEnum): AIMessageChunk | HumanMessageChunk | SystemMessageChunk | ChatMessageChunk;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-google-gemini-adapter",
3
3
  "description": "google-gemini adapter for chatluna",
4
- "version": "1.0.0-beta.12",
4
+ "version": "1.0.0-beta.13",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "koishi": "^4.17.0",
52
- "koishi-plugin-chatluna": "^1.0.0-beta.50"
52
+ "koishi-plugin-chatluna": "^1.0.0-beta.51"
53
53
  },
54
54
  "koishi": {
55
55
  "description": {