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