@intrvls/langchain-google-genai 3.0.0-alpha.0

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.
@@ -0,0 +1,336 @@
1
+ import { GenerateContentConfig, GenerateContentParameters, GenerateContentResponse, SafetySetting, Schema, Tool } from "@google/genai";
2
+ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
3
+ import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
4
+ import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
5
+ import { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams, BindToolsInput, LangSmithParams } from "@langchain/core/language_models/chat_models";
6
+ import { ModelProfile } from "@langchain/core/language_models/profile";
7
+ import { BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
8
+ import { Runnable } from "@langchain/core/runnables";
9
+ import { InteropZodType } from "@langchain/core/utils/types";
10
+ import { SerializableSchema } from "@langchain/core/utils/standard_schema";
11
+ import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings";
12
+
13
+ //#region src/types.d.ts
14
+ /**
15
+ * Tools accepted by `ChatGoogleGenerativeAI`.
16
+ *
17
+ * In `@google/genai` the previously distinct tool shapes
18
+ * (`FunctionDeclarationsTool`, `CodeExecutionTool`,
19
+ * `GoogleSearchRetrievalTool`, ...) have all been folded into a single
20
+ * `Tool` interface whose fields (`functionDeclarations`, `codeExecution`,
21
+ * `googleSearch`/`googleSearchRetrieval`, ...) are individually optional.
22
+ */
23
+ type GoogleGenerativeAIToolType = BindToolsInput | Tool;
24
+ type GoogleGenerativeAIThinkingConfig = {
25
+ /** Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */includeThoughts?: boolean; /** The number of thoughts tokens that the model should generate. */
26
+ thinkingBudget?: number; /** Optional. The level of thoughts tokens that the model should generate. */
27
+ thinkingLevel?: GoogleGenerativeAIThinkingLevel;
28
+ };
29
+ type GoogleGenerativeAIThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
30
+ //#endregion
31
+ //#region src/chat_models.d.ts
32
+ type BaseMessageExamplePair = {
33
+ input: BaseMessage;
34
+ output: BaseMessage;
35
+ };
36
+ interface GoogleGenerativeAIChatCallOptions extends BaseChatModelCallOptions {
37
+ tools?: GoogleGenerativeAIToolType[];
38
+ /**
39
+ * Allowed functions to call when the mode is "any".
40
+ * If empty, any one of the provided functions are called.
41
+ */
42
+ allowedFunctionNames?: string[];
43
+ /**
44
+ * Whether or not to include usage data, like token counts
45
+ * in the streamed response chunks.
46
+ * @default true
47
+ */
48
+ streamUsage?: boolean;
49
+ /**
50
+ * JSON schema to be returned by the model.
51
+ */
52
+ responseSchema?: Schema;
53
+ }
54
+ /**
55
+ * An interface defining the input to the ChatGoogleGenerativeAI class.
56
+ */
57
+ interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<GoogleGenerativeAIChatCallOptions, "streamUsage"> {
58
+ /**
59
+ * Model Name to use
60
+ *
61
+ * Note: The format must follow the pattern - `{model}`
62
+ */
63
+ model: string;
64
+ /**
65
+ * Controls the randomness of the output.
66
+ *
67
+ * Values can range from [0.0,2.0], inclusive. A value closer to 2.0
68
+ * will produce responses that are more varied and creative, while
69
+ * a value closer to 0.0 will typically result in less surprising
70
+ * responses from the model.
71
+ *
72
+ * Note: The default value varies by model
73
+ */
74
+ temperature?: number;
75
+ /**
76
+ * Maximum number of tokens to generate in the completion.
77
+ */
78
+ maxOutputTokens?: number;
79
+ /**
80
+ * Top-p changes how the model selects tokens for output.
81
+ *
82
+ * Tokens are selected from most probable to least until the sum
83
+ * of their probabilities equals the top-p value.
84
+ *
85
+ * For example, if tokens A, B, and C have a probability of
86
+ * .3, .2, and .1 and the top-p value is .5, then the model will
87
+ * select either A or B as the next token (using temperature).
88
+ *
89
+ * Note: The default value varies by model
90
+ */
91
+ topP?: number;
92
+ /**
93
+ * Top-k changes how the model selects tokens for output.
94
+ *
95
+ * A top-k of 1 means the selected token is the most probable among
96
+ * all tokens in the model's vocabulary (also called greedy decoding),
97
+ * while a top-k of 3 means that the next token is selected from
98
+ * among the 3 most probable tokens (using temperature).
99
+ *
100
+ * Note: The default value varies by model
101
+ */
102
+ topK?: number;
103
+ /**
104
+ * The set of character sequences (up to 5) that will stop output generation.
105
+ * If specified, the API will stop at the first appearance of a stop
106
+ * sequence.
107
+ *
108
+ * Note: The stop sequence will not be included as part of the response.
109
+ * Note: stopSequences is only supported for Gemini models
110
+ */
111
+ stopSequences?: string[];
112
+ /**
113
+ * A list of unique `SafetySetting` instances for blocking unsafe content. The API will block
114
+ * any prompts and responses that fail to meet the thresholds set by these settings. If there
115
+ * is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use
116
+ * the default safety setting for that category.
117
+ */
118
+ safetySettings?: SafetySetting[];
119
+ /**
120
+ * Google API key to use
121
+ */
122
+ apiKey?: string;
123
+ /**
124
+ * Google API version to use
125
+ */
126
+ apiVersion?: string;
127
+ /**
128
+ * Google API base URL to use
129
+ */
130
+ baseUrl?: string;
131
+ /**
132
+ * Google API custom headers to use
133
+ */
134
+ customHeaders?: Record<string, string>;
135
+ /** Whether to stream the results or not */
136
+ streaming?: boolean;
137
+ /**
138
+ * Whether or not to force the model to respond with JSON.
139
+ * Available for `gemini-1.5` models and later.
140
+ * @default false
141
+ */
142
+ json?: boolean;
143
+ /**
144
+ * Whether or not model supports system instructions.
145
+ * The following models support system instructions:
146
+ * - All Gemini 1.5 Pro model versions
147
+ * - All Gemini 1.5 Flash model versions
148
+ * - Gemini 1.0 Pro version gemini-1.0-pro-002
149
+ */
150
+ convertSystemMessageToHumanContent?: boolean | undefined;
151
+ /**
152
+ * Optional. Config for thinking features. An error will be returned if this
153
+ * field is set for models that don't support thinking.
154
+ */
155
+ thinkingConfig?: GoogleGenerativeAIThinkingConfig;
156
+ /**
157
+ * Optional. The server-generated resource name of a cached content
158
+ * (e.g. `cachedContents/abc123`) created via the Google GenAI caches API.
159
+ * When set, it is sent as `config.cachedContent` on every request so the
160
+ * model reuses the cached tokens.
161
+ *
162
+ * Create one with the underlying SDK, for example:
163
+ * ```typescript
164
+ * import { GoogleGenAI } from "@google/genai";
165
+ * const ai = new GoogleGenAI({ apiKey });
166
+ * const cache = await ai.caches.create({ model, config: { contents, systemInstruction, ttl: "300s" } });
167
+ * const llm = new ChatGoogleGenerativeAI({ model, cachedContent: cache.name });
168
+ * ```
169
+ */
170
+ cachedContent?: string;
171
+ }
172
+ declare class ChatGoogleGenerativeAI extends BaseChatModel<GoogleGenerativeAIChatCallOptions, AIMessageChunk> implements GoogleGenerativeAIChatInput {
173
+ static lc_name(): string;
174
+ lc_serializable: boolean;
175
+ get lc_secrets(): {
176
+ [key: string]: string;
177
+ } | undefined;
178
+ lc_namespace: string[];
179
+ get lc_aliases(): {
180
+ apiKey: string;
181
+ };
182
+ model: string;
183
+ temperature?: number;
184
+ maxOutputTokens?: number;
185
+ topP?: number;
186
+ topK?: number;
187
+ stopSequences: string[];
188
+ safetySettings?: SafetySetting[];
189
+ apiKey?: string;
190
+ streaming: boolean;
191
+ json?: boolean;
192
+ streamUsage: boolean;
193
+ convertSystemMessageToHumanContent: boolean | undefined;
194
+ thinkingConfig?: GoogleGenerativeAIThinkingConfig;
195
+ cachedContent?: string;
196
+ private client;
197
+ get _isMultimodalModel(): boolean;
198
+ constructor(model: string, fields?: Omit<GoogleGenerativeAIChatInput, "model">);
199
+ constructor(fields: GoogleGenerativeAIChatInput);
200
+ get useSystemInstruction(): boolean;
201
+ get computeUseSystemInstruction(): boolean;
202
+ getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
203
+ _combineLLMOutput(): never[];
204
+ _llmType(): string;
205
+ bindTools(tools: GoogleGenerativeAIToolType[], kwargs?: Partial<GoogleGenerativeAIChatCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleGenerativeAIChatCallOptions>;
206
+ invocationParams(options?: this["ParsedCallOptions"]): GenerateContentConfig;
207
+ private _buildGenerateContentRequest;
208
+ _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
209
+ _streamResponseChunks(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
210
+ completionWithRetry(request: GenerateContentParameters, options?: this["ParsedCallOptions"]): Promise<GenerateContentResponse>;
211
+ /**
212
+ * Return profiling information for the model.
213
+ *
214
+ * Provides information about the model's capabilities and constraints,
215
+ * including token limits, multimodal support, and advanced features like
216
+ * tool calling and structured output.
217
+ *
218
+ * @returns {ModelProfile} An object describing the model's capabilities and constraints
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * const model = new ChatGoogleGenerativeAI({ model: "gemini-2.5-flash" });
223
+ * const profile = model.profile;
224
+ * console.log(profile.maxInputTokens); // 1048576
225
+ * console.log(profile.imageInputs); // true
226
+ * ```
227
+ */
228
+ get profile(): ModelProfile;
229
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput> | SerializableSchema<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
230
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput> | SerializableSchema<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
231
+ raw: BaseMessage;
232
+ parsed: RunOutput;
233
+ }>;
234
+ }
235
+ //#endregion
236
+ //#region src/embeddings.d.ts
237
+ /**
238
+ * Interface that extends EmbeddingsParams and defines additional
239
+ * parameters specific to the GoogleGenerativeAIEmbeddings class.
240
+ */
241
+ interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
242
+ /**
243
+ * Model Name to use
244
+ *
245
+ * Alias for `model`
246
+ *
247
+ * Note: The format must follow the pattern - `{model}`
248
+ */
249
+ modelName?: string;
250
+ /**
251
+ * Model Name to use
252
+ *
253
+ * Note: The format must follow the pattern - `{model}`
254
+ */
255
+ model?: string;
256
+ /**
257
+ * Type of task for which the embedding will be used
258
+ *
259
+ * Note: currently only supported by `embedding-001` model
260
+ */
261
+ taskType?: string;
262
+ /**
263
+ * An optional title for the text. Only applicable when TaskType is
264
+ * `RETRIEVAL_DOCUMENT`
265
+ *
266
+ * Note: currently only supported by `embedding-001` model
267
+ */
268
+ title?: string;
269
+ /**
270
+ * Whether to strip new lines from the input text. Default to true
271
+ */
272
+ stripNewLines?: boolean;
273
+ /**
274
+ * Google API key to use
275
+ */
276
+ apiKey?: string;
277
+ /**
278
+ * Google API base URL to use
279
+ */
280
+ baseUrl?: string;
281
+ }
282
+ /**
283
+ * Class that extends the Embeddings class and provides methods for
284
+ * generating embeddings using the Google Palm API.
285
+ * @example
286
+ * ```typescript
287
+ * const model = new GoogleGenerativeAIEmbeddings({
288
+ * apiKey: "<YOUR API KEY>",
289
+ * modelName: "embedding-001",
290
+ * });
291
+ *
292
+ * // Embed a single query
293
+ * const res = await model.embedQuery(
294
+ * "What would be a good company name for a company that makes colorful socks?"
295
+ * );
296
+ * console.log({ res });
297
+ *
298
+ * // Embed multiple documents
299
+ * const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
300
+ * console.log({ documentRes });
301
+ * ```
302
+ */
303
+ declare class GoogleGenerativeAIEmbeddings extends Embeddings implements GoogleGenerativeAIEmbeddingsParams {
304
+ apiKey?: string;
305
+ modelName: string;
306
+ model: string;
307
+ taskType?: string;
308
+ title?: string;
309
+ stripNewLines: boolean;
310
+ maxBatchSize: number;
311
+ private client;
312
+ constructor(fields?: GoogleGenerativeAIEmbeddingsParams);
313
+ private _cleanText;
314
+ private get _embedConfig();
315
+ protected _embedQueryContent(text: string): Promise<number[]>;
316
+ protected _embedDocumentsContent(documents: string[]): Promise<number[][]>;
317
+ /**
318
+ * Method that takes a document as input and returns a promise that
319
+ * resolves to an embedding for the document. It calls the _embedText
320
+ * method with the document as the input.
321
+ * @param document Document for which to generate an embedding.
322
+ * @returns Promise that resolves to an embedding for the input document.
323
+ */
324
+ embedQuery(document: string): Promise<number[]>;
325
+ /**
326
+ * Method that takes an array of documents as input and returns a promise
327
+ * that resolves to a 2D array of embeddings for each document. It calls
328
+ * the _embedText method for each document in the array.
329
+ * @param documents Array of documents for which to generate embeddings.
330
+ * @returns Promise that resolves to a 2D array of embeddings for each input document.
331
+ */
332
+ embedDocuments(documents: string[]): Promise<number[][]>;
333
+ }
334
+ //#endregion
335
+ export { BaseMessageExamplePair, ChatGoogleGenerativeAI, GoogleGenerativeAIChatCallOptions, GoogleGenerativeAIChatInput, GoogleGenerativeAIEmbeddings, GoogleGenerativeAIEmbeddingsParams };
336
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,336 @@
1
+ import { GenerateContentConfig, GenerateContentParameters, GenerateContentResponse, SafetySetting, Schema, Tool } from "@google/genai";
2
+ import { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams, BindToolsInput, LangSmithParams } from "@langchain/core/language_models/chat_models";
3
+ import { InteropZodType } from "@langchain/core/utils/types";
4
+ import { SerializableSchema } from "@langchain/core/utils/standard_schema";
5
+ import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
6
+ import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
7
+ import { BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
8
+ import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings";
9
+ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
10
+ import { ModelProfile } from "@langchain/core/language_models/profile";
11
+ import { Runnable } from "@langchain/core/runnables";
12
+
13
+ //#region src/types.d.ts
14
+ /**
15
+ * Tools accepted by `ChatGoogleGenerativeAI`.
16
+ *
17
+ * In `@google/genai` the previously distinct tool shapes
18
+ * (`FunctionDeclarationsTool`, `CodeExecutionTool`,
19
+ * `GoogleSearchRetrievalTool`, ...) have all been folded into a single
20
+ * `Tool` interface whose fields (`functionDeclarations`, `codeExecution`,
21
+ * `googleSearch`/`googleSearchRetrieval`, ...) are individually optional.
22
+ */
23
+ type GoogleGenerativeAIToolType = BindToolsInput | Tool;
24
+ type GoogleGenerativeAIThinkingConfig = {
25
+ /** Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */includeThoughts?: boolean; /** The number of thoughts tokens that the model should generate. */
26
+ thinkingBudget?: number; /** Optional. The level of thoughts tokens that the model should generate. */
27
+ thinkingLevel?: GoogleGenerativeAIThinkingLevel;
28
+ };
29
+ type GoogleGenerativeAIThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
30
+ //#endregion
31
+ //#region src/chat_models.d.ts
32
+ type BaseMessageExamplePair = {
33
+ input: BaseMessage;
34
+ output: BaseMessage;
35
+ };
36
+ interface GoogleGenerativeAIChatCallOptions extends BaseChatModelCallOptions {
37
+ tools?: GoogleGenerativeAIToolType[];
38
+ /**
39
+ * Allowed functions to call when the mode is "any".
40
+ * If empty, any one of the provided functions are called.
41
+ */
42
+ allowedFunctionNames?: string[];
43
+ /**
44
+ * Whether or not to include usage data, like token counts
45
+ * in the streamed response chunks.
46
+ * @default true
47
+ */
48
+ streamUsage?: boolean;
49
+ /**
50
+ * JSON schema to be returned by the model.
51
+ */
52
+ responseSchema?: Schema;
53
+ }
54
+ /**
55
+ * An interface defining the input to the ChatGoogleGenerativeAI class.
56
+ */
57
+ interface GoogleGenerativeAIChatInput extends BaseChatModelParams, Pick<GoogleGenerativeAIChatCallOptions, "streamUsage"> {
58
+ /**
59
+ * Model Name to use
60
+ *
61
+ * Note: The format must follow the pattern - `{model}`
62
+ */
63
+ model: string;
64
+ /**
65
+ * Controls the randomness of the output.
66
+ *
67
+ * Values can range from [0.0,2.0], inclusive. A value closer to 2.0
68
+ * will produce responses that are more varied and creative, while
69
+ * a value closer to 0.0 will typically result in less surprising
70
+ * responses from the model.
71
+ *
72
+ * Note: The default value varies by model
73
+ */
74
+ temperature?: number;
75
+ /**
76
+ * Maximum number of tokens to generate in the completion.
77
+ */
78
+ maxOutputTokens?: number;
79
+ /**
80
+ * Top-p changes how the model selects tokens for output.
81
+ *
82
+ * Tokens are selected from most probable to least until the sum
83
+ * of their probabilities equals the top-p value.
84
+ *
85
+ * For example, if tokens A, B, and C have a probability of
86
+ * .3, .2, and .1 and the top-p value is .5, then the model will
87
+ * select either A or B as the next token (using temperature).
88
+ *
89
+ * Note: The default value varies by model
90
+ */
91
+ topP?: number;
92
+ /**
93
+ * Top-k changes how the model selects tokens for output.
94
+ *
95
+ * A top-k of 1 means the selected token is the most probable among
96
+ * all tokens in the model's vocabulary (also called greedy decoding),
97
+ * while a top-k of 3 means that the next token is selected from
98
+ * among the 3 most probable tokens (using temperature).
99
+ *
100
+ * Note: The default value varies by model
101
+ */
102
+ topK?: number;
103
+ /**
104
+ * The set of character sequences (up to 5) that will stop output generation.
105
+ * If specified, the API will stop at the first appearance of a stop
106
+ * sequence.
107
+ *
108
+ * Note: The stop sequence will not be included as part of the response.
109
+ * Note: stopSequences is only supported for Gemini models
110
+ */
111
+ stopSequences?: string[];
112
+ /**
113
+ * A list of unique `SafetySetting` instances for blocking unsafe content. The API will block
114
+ * any prompts and responses that fail to meet the thresholds set by these settings. If there
115
+ * is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use
116
+ * the default safety setting for that category.
117
+ */
118
+ safetySettings?: SafetySetting[];
119
+ /**
120
+ * Google API key to use
121
+ */
122
+ apiKey?: string;
123
+ /**
124
+ * Google API version to use
125
+ */
126
+ apiVersion?: string;
127
+ /**
128
+ * Google API base URL to use
129
+ */
130
+ baseUrl?: string;
131
+ /**
132
+ * Google API custom headers to use
133
+ */
134
+ customHeaders?: Record<string, string>;
135
+ /** Whether to stream the results or not */
136
+ streaming?: boolean;
137
+ /**
138
+ * Whether or not to force the model to respond with JSON.
139
+ * Available for `gemini-1.5` models and later.
140
+ * @default false
141
+ */
142
+ json?: boolean;
143
+ /**
144
+ * Whether or not model supports system instructions.
145
+ * The following models support system instructions:
146
+ * - All Gemini 1.5 Pro model versions
147
+ * - All Gemini 1.5 Flash model versions
148
+ * - Gemini 1.0 Pro version gemini-1.0-pro-002
149
+ */
150
+ convertSystemMessageToHumanContent?: boolean | undefined;
151
+ /**
152
+ * Optional. Config for thinking features. An error will be returned if this
153
+ * field is set for models that don't support thinking.
154
+ */
155
+ thinkingConfig?: GoogleGenerativeAIThinkingConfig;
156
+ /**
157
+ * Optional. The server-generated resource name of a cached content
158
+ * (e.g. `cachedContents/abc123`) created via the Google GenAI caches API.
159
+ * When set, it is sent as `config.cachedContent` on every request so the
160
+ * model reuses the cached tokens.
161
+ *
162
+ * Create one with the underlying SDK, for example:
163
+ * ```typescript
164
+ * import { GoogleGenAI } from "@google/genai";
165
+ * const ai = new GoogleGenAI({ apiKey });
166
+ * const cache = await ai.caches.create({ model, config: { contents, systemInstruction, ttl: "300s" } });
167
+ * const llm = new ChatGoogleGenerativeAI({ model, cachedContent: cache.name });
168
+ * ```
169
+ */
170
+ cachedContent?: string;
171
+ }
172
+ declare class ChatGoogleGenerativeAI extends BaseChatModel<GoogleGenerativeAIChatCallOptions, AIMessageChunk> implements GoogleGenerativeAIChatInput {
173
+ static lc_name(): string;
174
+ lc_serializable: boolean;
175
+ get lc_secrets(): {
176
+ [key: string]: string;
177
+ } | undefined;
178
+ lc_namespace: string[];
179
+ get lc_aliases(): {
180
+ apiKey: string;
181
+ };
182
+ model: string;
183
+ temperature?: number;
184
+ maxOutputTokens?: number;
185
+ topP?: number;
186
+ topK?: number;
187
+ stopSequences: string[];
188
+ safetySettings?: SafetySetting[];
189
+ apiKey?: string;
190
+ streaming: boolean;
191
+ json?: boolean;
192
+ streamUsage: boolean;
193
+ convertSystemMessageToHumanContent: boolean | undefined;
194
+ thinkingConfig?: GoogleGenerativeAIThinkingConfig;
195
+ cachedContent?: string;
196
+ private client;
197
+ get _isMultimodalModel(): boolean;
198
+ constructor(model: string, fields?: Omit<GoogleGenerativeAIChatInput, "model">);
199
+ constructor(fields: GoogleGenerativeAIChatInput);
200
+ get useSystemInstruction(): boolean;
201
+ get computeUseSystemInstruction(): boolean;
202
+ getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
203
+ _combineLLMOutput(): never[];
204
+ _llmType(): string;
205
+ bindTools(tools: GoogleGenerativeAIToolType[], kwargs?: Partial<GoogleGenerativeAIChatCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleGenerativeAIChatCallOptions>;
206
+ invocationParams(options?: this["ParsedCallOptions"]): GenerateContentConfig;
207
+ private _buildGenerateContentRequest;
208
+ _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
209
+ _streamResponseChunks(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
210
+ completionWithRetry(request: GenerateContentParameters, options?: this["ParsedCallOptions"]): Promise<GenerateContentResponse>;
211
+ /**
212
+ * Return profiling information for the model.
213
+ *
214
+ * Provides information about the model's capabilities and constraints,
215
+ * including token limits, multimodal support, and advanced features like
216
+ * tool calling and structured output.
217
+ *
218
+ * @returns {ModelProfile} An object describing the model's capabilities and constraints
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * const model = new ChatGoogleGenerativeAI({ model: "gemini-2.5-flash" });
223
+ * const profile = model.profile;
224
+ * console.log(profile.maxInputTokens); // 1048576
225
+ * console.log(profile.imageInputs); // true
226
+ * ```
227
+ */
228
+ get profile(): ModelProfile;
229
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput> | SerializableSchema<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
230
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput> | SerializableSchema<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
231
+ raw: BaseMessage;
232
+ parsed: RunOutput;
233
+ }>;
234
+ }
235
+ //#endregion
236
+ //#region src/embeddings.d.ts
237
+ /**
238
+ * Interface that extends EmbeddingsParams and defines additional
239
+ * parameters specific to the GoogleGenerativeAIEmbeddings class.
240
+ */
241
+ interface GoogleGenerativeAIEmbeddingsParams extends EmbeddingsParams {
242
+ /**
243
+ * Model Name to use
244
+ *
245
+ * Alias for `model`
246
+ *
247
+ * Note: The format must follow the pattern - `{model}`
248
+ */
249
+ modelName?: string;
250
+ /**
251
+ * Model Name to use
252
+ *
253
+ * Note: The format must follow the pattern - `{model}`
254
+ */
255
+ model?: string;
256
+ /**
257
+ * Type of task for which the embedding will be used
258
+ *
259
+ * Note: currently only supported by `embedding-001` model
260
+ */
261
+ taskType?: string;
262
+ /**
263
+ * An optional title for the text. Only applicable when TaskType is
264
+ * `RETRIEVAL_DOCUMENT`
265
+ *
266
+ * Note: currently only supported by `embedding-001` model
267
+ */
268
+ title?: string;
269
+ /**
270
+ * Whether to strip new lines from the input text. Default to true
271
+ */
272
+ stripNewLines?: boolean;
273
+ /**
274
+ * Google API key to use
275
+ */
276
+ apiKey?: string;
277
+ /**
278
+ * Google API base URL to use
279
+ */
280
+ baseUrl?: string;
281
+ }
282
+ /**
283
+ * Class that extends the Embeddings class and provides methods for
284
+ * generating embeddings using the Google Palm API.
285
+ * @example
286
+ * ```typescript
287
+ * const model = new GoogleGenerativeAIEmbeddings({
288
+ * apiKey: "<YOUR API KEY>",
289
+ * modelName: "embedding-001",
290
+ * });
291
+ *
292
+ * // Embed a single query
293
+ * const res = await model.embedQuery(
294
+ * "What would be a good company name for a company that makes colorful socks?"
295
+ * );
296
+ * console.log({ res });
297
+ *
298
+ * // Embed multiple documents
299
+ * const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
300
+ * console.log({ documentRes });
301
+ * ```
302
+ */
303
+ declare class GoogleGenerativeAIEmbeddings extends Embeddings implements GoogleGenerativeAIEmbeddingsParams {
304
+ apiKey?: string;
305
+ modelName: string;
306
+ model: string;
307
+ taskType?: string;
308
+ title?: string;
309
+ stripNewLines: boolean;
310
+ maxBatchSize: number;
311
+ private client;
312
+ constructor(fields?: GoogleGenerativeAIEmbeddingsParams);
313
+ private _cleanText;
314
+ private get _embedConfig();
315
+ protected _embedQueryContent(text: string): Promise<number[]>;
316
+ protected _embedDocumentsContent(documents: string[]): Promise<number[][]>;
317
+ /**
318
+ * Method that takes a document as input and returns a promise that
319
+ * resolves to an embedding for the document. It calls the _embedText
320
+ * method with the document as the input.
321
+ * @param document Document for which to generate an embedding.
322
+ * @returns Promise that resolves to an embedding for the input document.
323
+ */
324
+ embedQuery(document: string): Promise<number[]>;
325
+ /**
326
+ * Method that takes an array of documents as input and returns a promise
327
+ * that resolves to a 2D array of embeddings for each document. It calls
328
+ * the _embedText method for each document in the array.
329
+ * @param documents Array of documents for which to generate embeddings.
330
+ * @returns Promise that resolves to a 2D array of embeddings for each input document.
331
+ */
332
+ embedDocuments(documents: string[]): Promise<number[][]>;
333
+ }
334
+ //#endregion
335
+ export { BaseMessageExamplePair, ChatGoogleGenerativeAI, GoogleGenerativeAIChatCallOptions, GoogleGenerativeAIChatInput, GoogleGenerativeAIEmbeddings, GoogleGenerativeAIEmbeddingsParams };
336
+ //# sourceMappingURL=index.d.mts.map