@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,153 +1,99 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleGenerativeAIEmbeddings = void 0;
4
- const generative_ai_1 = require("@google/generative-ai");
5
- const env_1 = require("@langchain/core/utils/env");
6
- const embeddings_1 = require("@langchain/core/embeddings");
7
- const chunk_array_1 = require("@langchain/core/utils/chunk_array");
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const __google_generative_ai = require_rolldown_runtime.__toESM(require("@google/generative-ai"));
3
+ const __langchain_core_utils_env = require_rolldown_runtime.__toESM(require("@langchain/core/utils/env"));
4
+ const __langchain_core_embeddings = require_rolldown_runtime.__toESM(require("@langchain/core/embeddings"));
5
+ const __langchain_core_utils_chunk_array = require_rolldown_runtime.__toESM(require("@langchain/core/utils/chunk_array"));
6
+
7
+ //#region src/embeddings.ts
8
8
  /**
9
- * Class that extends the Embeddings class and provides methods for
10
- * generating embeddings using the Google Palm API.
11
- * @example
12
- * ```typescript
13
- * const model = new GoogleGenerativeAIEmbeddings({
14
- * apiKey: "<YOUR API KEY>",
15
- * modelName: "embedding-001",
16
- * });
17
- *
18
- * // Embed a single query
19
- * const res = await model.embedQuery(
20
- * "What would be a good company name for a company that makes colorful socks?"
21
- * );
22
- * console.log({ res });
23
- *
24
- * // Embed multiple documents
25
- * const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
26
- * console.log({ documentRes });
27
- * ```
28
- */
29
- class GoogleGenerativeAIEmbeddings extends embeddings_1.Embeddings {
30
- constructor(fields) {
31
- super(fields ?? {});
32
- Object.defineProperty(this, "apiKey", {
33
- enumerable: true,
34
- configurable: true,
35
- writable: true,
36
- value: void 0
37
- });
38
- Object.defineProperty(this, "modelName", {
39
- enumerable: true,
40
- configurable: true,
41
- writable: true,
42
- value: "embedding-001"
43
- });
44
- Object.defineProperty(this, "model", {
45
- enumerable: true,
46
- configurable: true,
47
- writable: true,
48
- value: "embedding-001"
49
- });
50
- Object.defineProperty(this, "taskType", {
51
- enumerable: true,
52
- configurable: true,
53
- writable: true,
54
- value: void 0
55
- });
56
- Object.defineProperty(this, "title", {
57
- enumerable: true,
58
- configurable: true,
59
- writable: true,
60
- value: void 0
61
- });
62
- Object.defineProperty(this, "stripNewLines", {
63
- enumerable: true,
64
- configurable: true,
65
- writable: true,
66
- value: true
67
- });
68
- Object.defineProperty(this, "maxBatchSize", {
69
- enumerable: true,
70
- configurable: true,
71
- writable: true,
72
- value: 100
73
- }); // Max batch size for embedDocuments set by GenerativeModel client's batchEmbedContents call
74
- Object.defineProperty(this, "client", {
75
- enumerable: true,
76
- configurable: true,
77
- writable: true,
78
- value: void 0
79
- });
80
- this.modelName =
81
- fields?.model?.replace(/^models\//, "") ??
82
- fields?.modelName?.replace(/^models\//, "") ??
83
- this.modelName;
84
- this.model = this.modelName;
85
- this.taskType = fields?.taskType ?? this.taskType;
86
- this.title = fields?.title ?? this.title;
87
- if (this.title && this.taskType !== "RETRIEVAL_DOCUMENT") {
88
- throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");
89
- }
90
- this.apiKey = fields?.apiKey ?? (0, env_1.getEnvironmentVariable)("GOOGLE_API_KEY");
91
- if (!this.apiKey) {
92
- throw new Error("Please set an API key for Google GenerativeAI " +
93
- "in the environmentb variable GOOGLE_API_KEY " +
94
- "or in the `apiKey` field of the " +
95
- "GoogleGenerativeAIEmbeddings constructor");
96
- }
97
- this.client = new generative_ai_1.GoogleGenerativeAI(this.apiKey).getGenerativeModel({
98
- model: this.model,
99
- }, {
100
- baseUrl: fields?.baseUrl,
101
- });
102
- }
103
- _convertToContent(text) {
104
- const cleanedText = this.stripNewLines ? text.replace(/\n/g, " ") : text;
105
- return {
106
- content: { role: "user", parts: [{ text: cleanedText }] },
107
- taskType: this.taskType,
108
- title: this.title,
109
- };
110
- }
111
- async _embedQueryContent(text) {
112
- const req = this._convertToContent(text);
113
- const res = await this.client.embedContent(req);
114
- return res.embedding.values ?? [];
115
- }
116
- async _embedDocumentsContent(documents) {
117
- const batchEmbedChunks = (0, chunk_array_1.chunkArray)(documents, this.maxBatchSize);
118
- const batchEmbedRequests = batchEmbedChunks.map((chunk) => ({
119
- requests: chunk.map((doc) => this._convertToContent(doc)),
120
- }));
121
- const responses = await Promise.allSettled(batchEmbedRequests.map((req) => this.client.batchEmbedContents(req)));
122
- const embeddings = responses.flatMap((res, idx) => {
123
- if (res.status === "fulfilled") {
124
- return res.value.embeddings.map((e) => e.values || []);
125
- }
126
- else {
127
- return Array(batchEmbedChunks[idx].length).fill([]);
128
- }
129
- });
130
- return embeddings;
131
- }
132
- /**
133
- * Method that takes a document as input and returns a promise that
134
- * resolves to an embedding for the document. It calls the _embedText
135
- * method with the document as the input.
136
- * @param document Document for which to generate an embedding.
137
- * @returns Promise that resolves to an embedding for the input document.
138
- */
139
- embedQuery(document) {
140
- return this.caller.call(this._embedQueryContent.bind(this), document);
141
- }
142
- /**
143
- * Method that takes an array of documents as input and returns a promise
144
- * that resolves to a 2D array of embeddings for each document. It calls
145
- * the _embedText method for each document in the array.
146
- * @param documents Array of documents for which to generate embeddings.
147
- * @returns Promise that resolves to a 2D array of embeddings for each input document.
148
- */
149
- embedDocuments(documents) {
150
- return this.caller.call(this._embedDocumentsContent.bind(this), documents);
151
- }
152
- }
9
+ * Class that extends the Embeddings class and provides methods for
10
+ * generating embeddings using the Google Palm API.
11
+ * @example
12
+ * ```typescript
13
+ * const model = new GoogleGenerativeAIEmbeddings({
14
+ * apiKey: "<YOUR API KEY>",
15
+ * modelName: "embedding-001",
16
+ * });
17
+ *
18
+ * // Embed a single query
19
+ * const res = await model.embedQuery(
20
+ * "What would be a good company name for a company that makes colorful socks?"
21
+ * );
22
+ * console.log({ res });
23
+ *
24
+ * // Embed multiple documents
25
+ * const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
26
+ * console.log({ documentRes });
27
+ * ```
28
+ */
29
+ var GoogleGenerativeAIEmbeddings = class extends __langchain_core_embeddings.Embeddings {
30
+ apiKey;
31
+ modelName = "embedding-001";
32
+ model = "embedding-001";
33
+ taskType;
34
+ title;
35
+ stripNewLines = true;
36
+ maxBatchSize = 100;
37
+ client;
38
+ constructor(fields) {
39
+ super(fields ?? {});
40
+ this.modelName = fields?.model?.replace(/^models\//, "") ?? fields?.modelName?.replace(/^models\//, "") ?? this.modelName;
41
+ this.model = this.modelName;
42
+ this.taskType = fields?.taskType ?? this.taskType;
43
+ this.title = fields?.title ?? this.title;
44
+ if (this.title && this.taskType !== "RETRIEVAL_DOCUMENT") throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");
45
+ this.apiKey = fields?.apiKey ?? (0, __langchain_core_utils_env.getEnvironmentVariable)("GOOGLE_API_KEY");
46
+ if (!this.apiKey) throw new Error("Please set an API key for Google GenerativeAI in the environmentb variable GOOGLE_API_KEY or in the `apiKey` field of the GoogleGenerativeAIEmbeddings constructor");
47
+ this.client = new __google_generative_ai.GoogleGenerativeAI(this.apiKey).getGenerativeModel({ model: this.model }, { baseUrl: fields?.baseUrl });
48
+ }
49
+ _convertToContent(text) {
50
+ const cleanedText = this.stripNewLines ? text.replace(/\n/g, " ") : text;
51
+ return {
52
+ content: {
53
+ role: "user",
54
+ parts: [{ text: cleanedText }]
55
+ },
56
+ taskType: this.taskType,
57
+ title: this.title
58
+ };
59
+ }
60
+ async _embedQueryContent(text) {
61
+ const req = this._convertToContent(text);
62
+ const res = await this.client.embedContent(req);
63
+ return res.embedding.values ?? [];
64
+ }
65
+ async _embedDocumentsContent(documents) {
66
+ const batchEmbedChunks = (0, __langchain_core_utils_chunk_array.chunkArray)(documents, this.maxBatchSize);
67
+ const batchEmbedRequests = batchEmbedChunks.map((chunk) => ({ requests: chunk.map((doc) => this._convertToContent(doc)) }));
68
+ const responses = await Promise.allSettled(batchEmbedRequests.map((req) => this.client.batchEmbedContents(req)));
69
+ const embeddings = responses.flatMap((res, idx) => {
70
+ if (res.status === "fulfilled") return res.value.embeddings.map((e) => e.values || []);
71
+ else return Array(batchEmbedChunks[idx].length).fill([]);
72
+ });
73
+ return embeddings;
74
+ }
75
+ /**
76
+ * Method that takes a document as input and returns a promise that
77
+ * resolves to an embedding for the document. It calls the _embedText
78
+ * method with the document as the input.
79
+ * @param document Document for which to generate an embedding.
80
+ * @returns Promise that resolves to an embedding for the input document.
81
+ */
82
+ embedQuery(document) {
83
+ return this.caller.call(this._embedQueryContent.bind(this), document);
84
+ }
85
+ /**
86
+ * Method that takes an array of documents as input and returns a promise
87
+ * that resolves to a 2D array of embeddings for each document. It calls
88
+ * the _embedText method for each document in the array.
89
+ * @param documents Array of documents for which to generate embeddings.
90
+ * @returns Promise that resolves to a 2D array of embeddings for each input document.
91
+ */
92
+ embedDocuments(documents) {
93
+ return this.caller.call(this._embedDocumentsContent.bind(this), documents);
94
+ }
95
+ };
96
+
97
+ //#endregion
153
98
  exports.GoogleGenerativeAIEmbeddings = GoogleGenerativeAIEmbeddings;
99
+ //# sourceMappingURL=embeddings.cjs.map
@@ -0,0 +1,104 @@
1
+ import { TaskType } from "@google/generative-ai";
2
+ import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings";
3
+
4
+ //#region src/embeddings.d.ts
5
+
6
+ /**
7
+ * Interface that extends EmbeddingsParams and defines additional
8
+ * parameters specific to the GoogleGenerativeAIEmbeddings class.
9
+ */
10
+ interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
11
+ /**
12
+ * Model Name to use
13
+ *
14
+ * Alias for `model`
15
+ *
16
+ * Note: The format must follow the pattern - `{model}`
17
+ */
18
+ modelName?: string;
19
+ /**
20
+ * Model Name to use
21
+ *
22
+ * Note: The format must follow the pattern - `{model}`
23
+ */
24
+ model?: string;
25
+ /**
26
+ * Type of task for which the embedding will be used
27
+ *
28
+ * Note: currently only supported by `embedding-001` model
29
+ */
30
+ taskType?: TaskType;
31
+ /**
32
+ * An optional title for the text. Only applicable when TaskType is
33
+ * `RETRIEVAL_DOCUMENT`
34
+ *
35
+ * Note: currently only supported by `embedding-001` model
36
+ */
37
+ title?: string;
38
+ /**
39
+ * Whether to strip new lines from the input text. Default to true
40
+ */
41
+ stripNewLines?: boolean;
42
+ /**
43
+ * Google API key to use
44
+ */
45
+ apiKey?: string;
46
+ /**
47
+ * Google API base URL to use
48
+ */
49
+ baseUrl?: string;
50
+ }
51
+ /**
52
+ * Class that extends the Embeddings class and provides methods for
53
+ * generating embeddings using the Google Palm API.
54
+ * @example
55
+ * ```typescript
56
+ * const model = new GoogleGenerativeAIEmbeddings({
57
+ * apiKey: "<YOUR API KEY>",
58
+ * modelName: "embedding-001",
59
+ * });
60
+ *
61
+ * // Embed a single query
62
+ * const res = await model.embedQuery(
63
+ * "What would be a good company name for a company that makes colorful socks?"
64
+ * );
65
+ * console.log({ res });
66
+ *
67
+ * // Embed multiple documents
68
+ * const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
69
+ * console.log({ documentRes });
70
+ * ```
71
+ */
72
+ declare class GoogleGenerativeAIEmbeddings extends Embeddings implements GoogleGenerativeAIEmbeddingsParams {
73
+ apiKey?: string;
74
+ modelName: string;
75
+ model: string;
76
+ taskType?: TaskType;
77
+ title?: string;
78
+ stripNewLines: boolean;
79
+ maxBatchSize: number; // Max batch size for embedDocuments set by GenerativeModel client's batchEmbedContents call
80
+ private client;
81
+ constructor(fields?: GoogleGenerativeAIEmbeddingsParams);
82
+ private _convertToContent;
83
+ protected _embedQueryContent(text: string): Promise<number[]>;
84
+ protected _embedDocumentsContent(documents: string[]): Promise<number[][]>;
85
+ /**
86
+ * Method that takes a document as input and returns a promise that
87
+ * resolves to an embedding for the document. It calls the _embedText
88
+ * method with the document as the input.
89
+ * @param document Document for which to generate an embedding.
90
+ * @returns Promise that resolves to an embedding for the input document.
91
+ */
92
+ embedQuery(document: string): Promise<number[]>;
93
+ /**
94
+ * Method that takes an array of documents as input and returns a promise
95
+ * that resolves to a 2D array of embeddings for each document. It calls
96
+ * the _embedText method for each document in the array.
97
+ * @param documents Array of documents for which to generate embeddings.
98
+ * @returns Promise that resolves to a 2D array of embeddings for each input document.
99
+ */
100
+ embedDocuments(documents: string[]): Promise<number[][]>;
101
+ }
102
+ //#endregion
103
+ export { GoogleGenerativeAIEmbeddings, GoogleGenerativeAIEmbeddingsParams };
104
+ //# sourceMappingURL=embeddings.d.cts.map
@@ -1,49 +1,52 @@
1
- import type { TaskType } from "@google/generative-ai";
1
+ import { TaskType } from "@google/generative-ai";
2
2
  import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings";
3
+
4
+ //#region src/embeddings.d.ts
5
+
3
6
  /**
4
7
  * Interface that extends EmbeddingsParams and defines additional
5
8
  * parameters specific to the GoogleGenerativeAIEmbeddings class.
6
9
  */
7
- export interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
8
- /**
9
- * Model Name to use
10
- *
11
- * Alias for `model`
12
- *
13
- * Note: The format must follow the pattern - `{model}`
14
- */
15
- modelName?: string;
16
- /**
17
- * Model Name to use
18
- *
19
- * Note: The format must follow the pattern - `{model}`
20
- */
21
- model?: string;
22
- /**
23
- * Type of task for which the embedding will be used
24
- *
25
- * Note: currently only supported by `embedding-001` model
26
- */
27
- taskType?: TaskType;
28
- /**
29
- * An optional title for the text. Only applicable when TaskType is
30
- * `RETRIEVAL_DOCUMENT`
31
- *
32
- * Note: currently only supported by `embedding-001` model
33
- */
34
- title?: string;
35
- /**
36
- * Whether to strip new lines from the input text. Default to true
37
- */
38
- stripNewLines?: boolean;
39
- /**
40
- * Google API key to use
41
- */
42
- apiKey?: string;
43
- /**
44
- * Google API base URL to use
45
- */
46
- baseUrl?: string;
10
+ interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
11
+ /**
12
+ * Model Name to use
13
+ *
14
+ * Alias for `model`
15
+ *
16
+ * Note: The format must follow the pattern - `{model}`
17
+ */
18
+ modelName?: string;
19
+ /**
20
+ * Model Name to use
21
+ *
22
+ * Note: The format must follow the pattern - `{model}`
23
+ */
24
+ model?: string;
25
+ /**
26
+ * Type of task for which the embedding will be used
27
+ *
28
+ * Note: currently only supported by `embedding-001` model
29
+ */
30
+ taskType?: TaskType;
31
+ /**
32
+ * An optional title for the text. Only applicable when TaskType is
33
+ * `RETRIEVAL_DOCUMENT`
34
+ *
35
+ * Note: currently only supported by `embedding-001` model
36
+ */
37
+ title?: string;
38
+ /**
39
+ * Whether to strip new lines from the input text. Default to true
40
+ */
41
+ stripNewLines?: boolean;
42
+ /**
43
+ * Google API key to use
44
+ */
45
+ apiKey?: string;
46
+ /**
47
+ * Google API base URL to use
48
+ */
49
+ baseUrl?: string;
47
50
  }
48
51
  /**
49
52
  * Class that extends the Embeddings class and provides methods for
@@ -66,33 +69,36 @@ export interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
66
69
  * console.log({ documentRes });
67
70
  * ```
68
71
  */
69
- export declare class GoogleGenerativeAIEmbeddings extends Embeddings implements GoogleGenerativeAIEmbeddingsParams {
70
- apiKey?: string;
71
- modelName: string;
72
- model: string;
73
- taskType?: TaskType;
74
- title?: string;
75
- stripNewLines: boolean;
76
- maxBatchSize: number;
77
- private client;
78
- constructor(fields?: GoogleGenerativeAIEmbeddingsParams);
79
- private _convertToContent;
80
- protected _embedQueryContent(text: string): Promise<number[]>;
81
- protected _embedDocumentsContent(documents: string[]): Promise<number[][]>;
82
- /**
83
- * Method that takes a document as input and returns a promise that
84
- * resolves to an embedding for the document. It calls the _embedText
85
- * method with the document as the input.
86
- * @param document Document for which to generate an embedding.
87
- * @returns Promise that resolves to an embedding for the input document.
88
- */
89
- embedQuery(document: string): Promise<number[]>;
90
- /**
91
- * Method that takes an array of documents as input and returns a promise
92
- * that resolves to a 2D array of embeddings for each document. It calls
93
- * the _embedText method for each document in the array.
94
- * @param documents Array of documents for which to generate embeddings.
95
- * @returns Promise that resolves to a 2D array of embeddings for each input document.
96
- */
97
- embedDocuments(documents: string[]): Promise<number[][]>;
72
+ declare class GoogleGenerativeAIEmbeddings extends Embeddings implements GoogleGenerativeAIEmbeddingsParams {
73
+ apiKey?: string;
74
+ modelName: string;
75
+ model: string;
76
+ taskType?: TaskType;
77
+ title?: string;
78
+ stripNewLines: boolean;
79
+ maxBatchSize: number; // Max batch size for embedDocuments set by GenerativeModel client's batchEmbedContents call
80
+ private client;
81
+ constructor(fields?: GoogleGenerativeAIEmbeddingsParams);
82
+ private _convertToContent;
83
+ protected _embedQueryContent(text: string): Promise<number[]>;
84
+ protected _embedDocumentsContent(documents: string[]): Promise<number[][]>;
85
+ /**
86
+ * Method that takes a document as input and returns a promise that
87
+ * resolves to an embedding for the document. It calls the _embedText
88
+ * method with the document as the input.
89
+ * @param document Document for which to generate an embedding.
90
+ * @returns Promise that resolves to an embedding for the input document.
91
+ */
92
+ embedQuery(document: string): Promise<number[]>;
93
+ /**
94
+ * Method that takes an array of documents as input and returns a promise
95
+ * that resolves to a 2D array of embeddings for each document. It calls
96
+ * the _embedText method for each document in the array.
97
+ * @param documents Array of documents for which to generate embeddings.
98
+ * @returns Promise that resolves to a 2D array of embeddings for each input document.
99
+ */
100
+ embedDocuments(documents: string[]): Promise<number[][]>;
98
101
  }
102
+ //#endregion
103
+ export { GoogleGenerativeAIEmbeddings, GoogleGenerativeAIEmbeddingsParams };
104
+ //# sourceMappingURL=embeddings.d.ts.map