@nocobase/plugin-ai 2.0.0-beta.6 → 2.0.0-beta.7
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/dist/client/6a4c1ee12f864e38.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/collections/ai-employees.d.ts +1 -0
- package/dist/collections/ai-employees.js +4 -0
- package/dist/externalVersion.js +11 -11
- package/dist/locale/en-US.json +2 -0
- package/dist/locale/zh-CN.json +2 -0
- package/dist/node_modules/@langchain/anthropic/package.json +1 -1
- package/dist/node_modules/@langchain/core/package.json +1 -1
- package/dist/node_modules/@langchain/deepseek/package.json +1 -1
- package/dist/node_modules/@langchain/google-genai/LICENSE +6 -6
- package/dist/node_modules/@langchain/google-genai/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/node_modules/@langchain/google-genai/dist/chat_models.cjs +680 -842
- package/dist/node_modules/@langchain/google-genai/dist/chat_models.d.cts +581 -0
- package/dist/node_modules/@langchain/google-genai/dist/chat_models.d.ts +196 -157
- package/dist/node_modules/@langchain/google-genai/dist/chat_models.js +678 -837
- package/dist/node_modules/@langchain/google-genai/dist/embeddings.cjs +97 -151
- package/dist/node_modules/@langchain/google-genai/dist/embeddings.d.cts +104 -0
- package/dist/node_modules/@langchain/google-genai/dist/embeddings.d.ts +76 -70
- package/dist/node_modules/@langchain/google-genai/dist/embeddings.js +93 -144
- package/dist/node_modules/@langchain/google-genai/dist/index.cjs +252 -18
- package/dist/node_modules/@langchain/google-genai/dist/index.d.cts +3 -0
- package/dist/node_modules/@langchain/google-genai/dist/index.d.ts +3 -2
- package/dist/node_modules/@langchain/google-genai/dist/index.js +4 -2
- package/dist/node_modules/@langchain/google-genai/dist/output_parsers.cjs +47 -75
- package/dist/node_modules/@langchain/google-genai/dist/output_parsers.js +47 -72
- package/dist/node_modules/@langchain/google-genai/dist/profiles.cjs +345 -0
- package/dist/node_modules/@langchain/google-genai/dist/profiles.js +344 -0
- package/dist/node_modules/@langchain/google-genai/dist/types.d.cts +17 -0
- package/dist/node_modules/@langchain/google-genai/dist/types.d.ts +16 -2
- package/dist/node_modules/@langchain/google-genai/dist/utils/common.cjs +419 -551
- package/dist/node_modules/@langchain/google-genai/dist/utils/common.js +417 -545
- package/dist/node_modules/@langchain/google-genai/dist/utils/tools.cjs +65 -102
- package/dist/node_modules/@langchain/google-genai/dist/utils/tools.js +64 -99
- package/dist/node_modules/@langchain/google-genai/dist/utils/zod_to_genai_parameters.cjs +31 -49
- package/dist/node_modules/@langchain/google-genai/dist/utils/zod_to_genai_parameters.js +29 -45
- package/dist/node_modules/@langchain/google-genai/package.json +1 -1
- package/dist/node_modules/@langchain/ollama/package.json +1 -1
- package/dist/node_modules/@langchain/openai/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/node_modules/zod-to-json-schema/package.json +1 -1
- package/dist/server/ai-employees/ai-employee.js +5 -2
- package/dist/server/llm-providers/anthropic.js +4 -5
- package/dist/server/llm-providers/provider.js +5 -1
- package/dist/server/manager/ai-chat-conversation.js +3 -2
- package/dist/server/manager/built-in-manager.js +3 -3
- package/dist/server/migrations/20260107000000-reset-builtin-about.d.ts +14 -0
- package/dist/server/migrations/20260107000000-reset-builtin-about.js +48 -0
- package/dist/server/resource/ai.js +8 -2
- package/dist/server/resource/aiEmployees.d.ts +0 -1
- package/dist/server/resource/aiEmployees.js +0 -15
- package/dist/server/types/ai-message.type.d.ts +2 -0
- package/package.json +3 -3
- package/dist/client/a7f0550514128d80.js +0 -10
- package/dist/node_modules/@langchain/google-genai/dist/output_parsers.d.ts +0 -20
- package/dist/node_modules/@langchain/google-genai/dist/types.cjs +0 -2
- package/dist/node_modules/@langchain/google-genai/dist/types.js +0 -1
- package/dist/node_modules/@langchain/google-genai/dist/utils/common.d.ts +0 -22
- package/dist/node_modules/@langchain/google-genai/dist/utils/tools.d.ts +0 -10
- package/dist/node_modules/@langchain/google-genai/dist/utils/zod_to_genai_parameters.d.ts +0 -14
- package/dist/node_modules/@langchain/google-genai/index.cjs +0 -252
- package/dist/node_modules/@langchain/google-genai/index.d.cts +0 -1
- package/dist/node_modules/@langchain/google-genai/index.d.ts +0 -1
- package/dist/node_modules/@langchain/google-genai/index.js +0 -1
|
@@ -1,127 +1,136 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { GoogleGenerativeAIThinkingConfig, GoogleGenerativeAIToolType } from "./types.js";
|
|
2
|
+
import * as _google_generative_ai0 from "@google/generative-ai";
|
|
3
|
+
import { CachedContent, GenerateContentRequest, ModelParams, Part, RequestOptions, SafetySetting, Schema } from "@google/generative-ai";
|
|
4
|
+
import { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams, LangSmithParams } from "@langchain/core/language_models/chat_models";
|
|
5
|
+
import { Runnable } from "@langchain/core/runnables";
|
|
6
|
+
import { InteropZodType } from "@langchain/core/utils/types";
|
|
3
7
|
import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
|
|
4
8
|
import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
|
|
5
|
-
import { BaseChatModel, type BaseChatModelCallOptions, type LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
6
9
|
import { BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
11
|
+
import { ModelProfile } from "@langchain/core/language_models/profile";
|
|
12
|
+
|
|
13
|
+
//#region src/chat_models.d.ts
|
|
14
|
+
type BaseMessageExamplePair = {
|
|
15
|
+
input: BaseMessage;
|
|
16
|
+
output: BaseMessage;
|
|
13
17
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
interface GoogleGenerativeAIChatCallOptions extends BaseChatModelCallOptions {
|
|
19
|
+
tools?: GoogleGenerativeAIToolType[];
|
|
20
|
+
/**
|
|
21
|
+
* Allowed functions to call when the mode is "any".
|
|
22
|
+
* If empty, any one of the provided functions are called.
|
|
23
|
+
*/
|
|
24
|
+
allowedFunctionNames?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not to include usage data, like token counts
|
|
27
|
+
* in the streamed response chunks.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
streamUsage?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* JSON schema to be returned by the model.
|
|
33
|
+
*/
|
|
34
|
+
responseSchema?: Schema;
|
|
31
35
|
}
|
|
32
36
|
/**
|
|
33
37
|
* An interface defining the input to the ChatGoogleGenerativeAI class.
|
|
34
38
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
39
|
+
interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<GoogleGenerativeAIChatCallOptions, "streamUsage"> {
|
|
40
|
+
/**
|
|
41
|
+
* Model Name to use
|
|
42
|
+
*
|
|
43
|
+
* Note: The format must follow the pattern - `{model}`
|
|
44
|
+
*/
|
|
45
|
+
model: string;
|
|
46
|
+
/**
|
|
47
|
+
* Controls the randomness of the output.
|
|
48
|
+
*
|
|
49
|
+
* Values can range from [0.0,2.0], inclusive. A value closer to 2.0
|
|
50
|
+
* will produce responses that are more varied and creative, while
|
|
51
|
+
* a value closer to 0.0 will typically result in less surprising
|
|
52
|
+
* responses from the model.
|
|
53
|
+
*
|
|
54
|
+
* Note: The default value varies by model
|
|
55
|
+
*/
|
|
56
|
+
temperature?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Maximum number of tokens to generate in the completion.
|
|
59
|
+
*/
|
|
60
|
+
maxOutputTokens?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Top-p changes how the model selects tokens for output.
|
|
63
|
+
*
|
|
64
|
+
* Tokens are selected from most probable to least until the sum
|
|
65
|
+
* of their probabilities equals the top-p value.
|
|
66
|
+
*
|
|
67
|
+
* For example, if tokens A, B, and C have a probability of
|
|
68
|
+
* .3, .2, and .1 and the top-p value is .5, then the model will
|
|
69
|
+
* select either A or B as the next token (using temperature).
|
|
70
|
+
*
|
|
71
|
+
* Note: The default value varies by model
|
|
72
|
+
*/
|
|
73
|
+
topP?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Top-k changes how the model selects tokens for output.
|
|
76
|
+
*
|
|
77
|
+
* A top-k of 1 means the selected token is the most probable among
|
|
78
|
+
* all tokens in the model's vocabulary (also called greedy decoding),
|
|
79
|
+
* while a top-k of 3 means that the next token is selected from
|
|
80
|
+
* among the 3 most probable tokens (using temperature).
|
|
81
|
+
*
|
|
82
|
+
* Note: The default value varies by model
|
|
83
|
+
*/
|
|
84
|
+
topK?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The set of character sequences (up to 5) that will stop output generation.
|
|
87
|
+
* If specified, the API will stop at the first appearance of a stop
|
|
88
|
+
* sequence.
|
|
89
|
+
*
|
|
90
|
+
* Note: The stop sequence will not be included as part of the response.
|
|
91
|
+
* Note: stopSequences is only supported for Gemini models
|
|
92
|
+
*/
|
|
93
|
+
stopSequences?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* A list of unique `SafetySetting` instances for blocking unsafe content. The API will block
|
|
96
|
+
* any prompts and responses that fail to meet the thresholds set by these settings. If there
|
|
97
|
+
* is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use
|
|
98
|
+
* the default safety setting for that category.
|
|
99
|
+
*/
|
|
100
|
+
safetySettings?: SafetySetting[];
|
|
101
|
+
/**
|
|
102
|
+
* Google API key to use
|
|
103
|
+
*/
|
|
104
|
+
apiKey?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Google API version to use
|
|
107
|
+
*/
|
|
108
|
+
apiVersion?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Google API base URL to use
|
|
111
|
+
*/
|
|
112
|
+
baseUrl?: string;
|
|
113
|
+
/** Whether to stream the results or not */
|
|
114
|
+
streaming?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether or not to force the model to respond with JSON.
|
|
117
|
+
* Available for `gemini-1.5` models and later.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
json?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether or not model supports system instructions.
|
|
123
|
+
* The following models support system instructions:
|
|
124
|
+
* - All Gemini 1.5 Pro model versions
|
|
125
|
+
* - All Gemini 1.5 Flash model versions
|
|
126
|
+
* - Gemini 1.0 Pro version gemini-1.0-pro-002
|
|
127
|
+
*/
|
|
128
|
+
convertSystemMessageToHumanContent?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Optional. Config for thinking features. An error will be returned if this
|
|
131
|
+
* field is set for models that don't support thinking.
|
|
132
|
+
*/
|
|
133
|
+
thinkingConfig?: GoogleGenerativeAIThinkingConfig;
|
|
125
134
|
}
|
|
126
135
|
/**
|
|
127
136
|
* Google Generative AI chat model integration.
|
|
@@ -498,45 +507,75 @@ export interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<G
|
|
|
498
507
|
*
|
|
499
508
|
* <br />
|
|
500
509
|
*/
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
510
|
+
declare class ChatGoogleGenerativeAI extends BaseChatModel<GoogleGenerativeAIChatCallOptions, AIMessageChunk> implements GoogleGenerativeAIChatInput {
|
|
511
|
+
static lc_name(): string;
|
|
512
|
+
lc_serializable: boolean;
|
|
513
|
+
get lc_secrets(): {
|
|
514
|
+
[key: string]: string;
|
|
515
|
+
} | undefined;
|
|
516
|
+
lc_namespace: string[];
|
|
517
|
+
get lc_aliases(): {
|
|
518
|
+
apiKey: string;
|
|
519
|
+
};
|
|
520
|
+
model: string;
|
|
521
|
+
temperature?: number; // default value chosen based on model
|
|
522
|
+
maxOutputTokens?: number;
|
|
523
|
+
topP?: number; // default value chosen based on model
|
|
524
|
+
topK?: number; // default value chosen based on model
|
|
525
|
+
stopSequences: string[];
|
|
526
|
+
safetySettings?: SafetySetting[];
|
|
527
|
+
apiKey?: string;
|
|
528
|
+
streaming: boolean;
|
|
529
|
+
json?: boolean;
|
|
530
|
+
streamUsage: boolean;
|
|
531
|
+
convertSystemMessageToHumanContent: boolean | undefined;
|
|
532
|
+
thinkingConfig?: GoogleGenerativeAIThinkingConfig;
|
|
533
|
+
private client;
|
|
534
|
+
get _isMultimodalModel(): boolean;
|
|
535
|
+
constructor(fields: GoogleGenerativeAIChatInput);
|
|
536
|
+
useCachedContent(cachedContent: CachedContent, modelParams?: ModelParams, requestOptions?: RequestOptions): void;
|
|
537
|
+
get useSystemInstruction(): boolean;
|
|
538
|
+
get computeUseSystemInstruction(): boolean;
|
|
539
|
+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
540
|
+
_combineLLMOutput(): never[];
|
|
541
|
+
_llmType(): string;
|
|
542
|
+
bindTools(tools: GoogleGenerativeAIToolType[], kwargs?: Partial<GoogleGenerativeAIChatCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleGenerativeAIChatCallOptions>;
|
|
543
|
+
invocationParams(options?: this["ParsedCallOptions"]): Omit<GenerateContentRequest, "contents">;
|
|
544
|
+
_generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
545
|
+
_streamResponseChunks(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
546
|
+
completionWithRetry(request: string | GenerateContentRequest | (string | Part)[], options?: this["ParsedCallOptions"]): Promise<_google_generative_ai0.GenerateContentResult>;
|
|
547
|
+
/**
|
|
548
|
+
* Return profiling information for the model.
|
|
549
|
+
*
|
|
550
|
+
* Provides information about the model's capabilities and constraints,
|
|
551
|
+
* including token limits, multimodal support, and advanced features like
|
|
552
|
+
* tool calling and structured output.
|
|
553
|
+
*
|
|
554
|
+
* @returns {ModelProfile} An object describing the model's capabilities and constraints
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
* const model = new ChatGoogleGenerativeAI({ model: "gemini-1.5-flash" });
|
|
559
|
+
* const profile = model.profile;
|
|
560
|
+
* console.log(profile.maxInputTokens); // 2000000
|
|
561
|
+
* console.log(profile.imageInputs); // true
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
get profile(): ModelProfile;
|
|
565
|
+
withStructuredOutput<
|
|
566
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
567
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
568
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
569
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
570
|
+
withStructuredOutput<
|
|
571
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
572
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
573
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
574
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
575
|
+
raw: BaseMessage;
|
|
576
|
+
parsed: RunOutput;
|
|
577
|
+
}>;
|
|
542
578
|
}
|
|
579
|
+
//#endregion
|
|
580
|
+
export { BaseMessageExamplePair, ChatGoogleGenerativeAI, GoogleGenerativeAIChatCallOptions, GoogleGenerativeAIChatInput };
|
|
581
|
+
//# sourceMappingURL=chat_models.d.ts.map
|