@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.
- package/CHANGELOG.md +346 -0
- package/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/index.cjs +1880 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +336 -0
- package/dist/index.d.mts +336 -0
- package/dist/index.mjs +1878 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# @intrvls/langchain-google-genai
|
|
2
|
+
|
|
3
|
+
## 3.0.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
This is the first release of `@intrvls/langchain-google-genai` on its own independent version line, decoupled from upstream `@langchain/google-genai`. Prior `2.x` releases mirrored upstream patch versions; from `3.0.0` onward this port versions independently.
|
|
8
|
+
|
|
9
|
+
- **Independent versioning.** The port no longer tracks upstream's `2.1.x` numbering. It now follows its own semver, starting at `3.0.0`, so port-specific changes can be released without colliding with upstream version numbers.
|
|
10
|
+
- **Rebased onto the new `@google/genai` SDK.** Built on Google's current unified [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK instead of the deprecated legacy `@google/generative-ai` SDK, restoring access to newer Gemini models and capabilities.
|
|
11
|
+
- **Pinned to n8n's `@langchain/core` line.** Targets `@langchain/core` `1.1.x` (peer `^1.1.30`) — the line n8n's [`@n8n/n8n-nodes-langchain`](https://www.npmjs.com/package/@n8n/n8n-nodes-langchain) ships — so everything resolves to a single core instance at runtime inside a custom n8n community node.
|
|
12
|
+
|
|
13
|
+
The public API (`ChatGoogleGenerativeAI`, `GoogleGenerativeAIEmbeddings`) is unchanged and remains a drop-in replacement.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
The history below is inherited from upstream `@langchain/google-genai`, on which this port is based.
|
|
18
|
+
|
|
19
|
+
## 2.2.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#10924](https://github.com/langchain-ai/langchainjs/pull/10924) [`2e28115`](https://github.com/langchain-ai/langchainjs/commit/2e2811509d75af94f57cedcc3842f178f4c020d1) Thanks [@christian-bromann](https://github.com/christian-bromann)! - feat(google-genai): add native streamEvents event conversion
|
|
24
|
+
|
|
25
|
+
## 2.1.31
|
|
26
|
+
|
|
27
|
+
## 2.1.30
|
|
28
|
+
|
|
29
|
+
## 2.1.29
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [#10776](https://github.com/langchain-ai/langchainjs/pull/10776) [`20a9abe`](https://github.com/langchain-ai/langchainjs/commit/20a9abea23ffacf4ae8dc9a7aeec217143bbdeb6) Thanks [@hntrl](https://github.com/hntrl)! - fix(deps): remediate uuid vulnerability by removing direct uuid usage
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [[`20a9abe`](https://github.com/langchain-ai/langchainjs/commit/20a9abea23ffacf4ae8dc9a7aeec217143bbdeb6)]:
|
|
36
|
+
- @langchain/core@1.1.42
|
|
37
|
+
|
|
38
|
+
## 2.1.28
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`589f29c`](https://github.com/langchain-ai/langchainjs/commit/589f29ce844eb252c2d5e6b0f8d26de37763a0d7), [`2e9e696`](https://github.com/langchain-ai/langchainjs/commit/2e9e6969e248a53ede0659a41d0ac8dbaf291ab4)]:
|
|
43
|
+
- @langchain/core@1.1.41
|
|
44
|
+
|
|
45
|
+
## 2.1.27
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`d3e0809`](https://github.com/langchain-ai/langchainjs/commit/d3e080995bb267bf3797067ab53c96bc2a6c8e3f)]:
|
|
50
|
+
- @langchain/core@1.1.40
|
|
51
|
+
|
|
52
|
+
## 2.1.26
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- [#10415](https://github.com/langchain-ai/langchainjs/pull/10415) [`d7d0bc7`](https://github.com/langchain-ai/langchainjs/commit/d7d0bc70cdb2ea92b365807600fa85ec107ffd0e) Thanks [@pawel-twardziak](https://github.com/pawel-twardziak)! - fix(genai): round-trip thinking content blocks in multi-turn convos
|
|
57
|
+
|
|
58
|
+
- [#9979](https://github.com/langchain-ai/langchainjs/pull/9979) [`6a2da5b`](https://github.com/langchain-ai/langchainjs/commit/6a2da5b63b39bec4b87b6a1d1769810677ad3458) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(google): add support for ContentBlock.Multimodal types in Google providers
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [[`6db417b`](https://github.com/langchain-ai/langchainjs/commit/6db417b03ecb5e2ace413389d982294e0ac88433), [`d69dfcc`](https://github.com/langchain-ai/langchainjs/commit/d69dfcca97503cf1c0b7e70ccf5fb7d507c60982)]:
|
|
61
|
+
- @langchain/core@1.1.33
|
|
62
|
+
|
|
63
|
+
## 2.1.25
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- [#10319](https://github.com/langchain-ai/langchainjs/pull/10319) [`c8c5840`](https://github.com/langchain-ai/langchainjs/commit/c8c58406d71c994d29b25469a9f4db8cc0dfc3ee) Thanks [@budde377](https://github.com/budde377)! - Fix optional chaining for candidateContent in reduce
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`26488b5`](https://github.com/langchain-ai/langchainjs/commit/26488b596f01b7b7fe2f1d97d07164e52365ade5), [`ca826f6`](https://github.com/langchain-ai/langchainjs/commit/ca826f6fecae6087bf0dee7781ee80b587396ec1), [`a602c42`](https://github.com/langchain-ai/langchainjs/commit/a602c42db75d7e7e01cab38b12e0b65b9c0cce95), [`db7d017`](https://github.com/langchain-ai/langchainjs/commit/db7d017f7ce13cb937147aabcbfa3847d80bde9d)]:
|
|
70
|
+
- @langchain/core@1.1.32
|
|
71
|
+
|
|
72
|
+
## 2.1.24
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- [#10209](https://github.com/langchain-ai/langchainjs/pull/10209) [`4b0f205`](https://github.com/langchain-ai/langchainjs/commit/4b0f2053ddbdbbf0cf3375d84485ecd8cc873dd0) Thanks [@colifran](https://github.com/colifran)! - feat(google-genai): implement standard schema support for structured output
|
|
77
|
+
|
|
78
|
+
- Updated dependencies [[`96c630d`](https://github.com/langchain-ai/langchainjs/commit/96c630dfd009f2546d5bc36f5067ff868bb4067f), [`a8b9ccc`](https://github.com/langchain-ai/langchainjs/commit/a8b9ccca5a85984a5a30008acd09f9991e591638), [`a1f22bb`](https://github.com/langchain-ai/langchainjs/commit/a1f22bba907731a18dca23c31cec5333444a3f55)]:
|
|
79
|
+
- @langchain/core@1.1.30
|
|
80
|
+
|
|
81
|
+
## 2.1.23
|
|
82
|
+
|
|
83
|
+
## 2.1.22
|
|
84
|
+
|
|
85
|
+
## 2.1.21
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- [#10106](https://github.com/langchain-ai/langchainjs/pull/10106) [`9f30267`](https://github.com/langchain-ai/langchainjs/commit/9f30267e95a2a42fac71f1d3674b84c5a190dbbc) Thanks [@hntrl](https://github.com/hntrl)! - Add package version metadata to runnable traces. Each package now stamps its version in `this.metadata.versions` at construction time, making version info available in LangSmith trace metadata.
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [[`9f30267`](https://github.com/langchain-ai/langchainjs/commit/9f30267e95a2a42fac71f1d3674b84c5a190dbbc), [`403a99f`](https://github.com/langchain-ai/langchainjs/commit/403a99fd826383f30300809ae077e1c967023520), [`3b1fd54`](https://github.com/langchain-ai/langchainjs/commit/3b1fd5458a4aa29c398122829f383f21b5ac39da), [`77bd982`](https://github.com/langchain-ai/langchainjs/commit/77bd98274a885e947d76f7a9c6dd0b3763453218)]:
|
|
92
|
+
- @langchain/core@1.1.29
|
|
93
|
+
|
|
94
|
+
## 2.1.20
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- [#10080](https://github.com/langchain-ai/langchainjs/pull/10080) [`b583729`](https://github.com/langchain-ai/langchainjs/commit/b583729e99cf0c035630f6b311c4d069a1980cca) Thanks [@hntrl](https://github.com/hntrl)! - Add string-model constructor overloads for chat models (with supporting tests where applicable).
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [[`fb2226e`](https://github.com/langchain-ai/langchainjs/commit/fb2226e6decdaba21e78b3f01877b45fa1eed6d3)]:
|
|
101
|
+
- @langchain/core@1.1.27
|
|
102
|
+
|
|
103
|
+
## 2.1.19
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- [#10078](https://github.com/langchain-ai/langchainjs/pull/10078) [`7be50a7`](https://github.com/langchain-ai/langchainjs/commit/7be50a7014d7622e0ab8d303dfc9c633ebc96333) Thanks [@christian-bromann](https://github.com/christian-bromann)! - chore(\*): update model profiles
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [[`27186c5`](https://github.com/langchain-ai/langchainjs/commit/27186c54884cfe7c2522fa50b42c3ca0ccaefdba), [`05396f7`](https://github.com/langchain-ai/langchainjs/commit/05396f7ce0a91c49a3bae4bbcd3dbdd6cbd18089), [`5a6f26b`](https://github.com/langchain-ai/langchainjs/commit/5a6f26bbaed80195dc538c538b96219a8b03f38f)]:
|
|
110
|
+
- @langchain/core@1.1.25
|
|
111
|
+
|
|
112
|
+
## 2.1.18
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- Updated dependencies [[`71d08c0`](https://github.com/langchain-ai/langchainjs/commit/71d08c0a3a2597bd5a084eb35a7830e5ea1a2b29)]:
|
|
117
|
+
- @langchain/core@1.1.23
|
|
118
|
+
|
|
119
|
+
## 2.1.17
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`d5e3db0`](https://github.com/langchain-ai/langchainjs/commit/d5e3db0d01ab321ec70a875805b2f74aefdadf9d)]:
|
|
124
|
+
- @langchain/core@1.1.21
|
|
125
|
+
|
|
126
|
+
## 2.1.16
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [[`71c3cba`](https://github.com/langchain-ai/langchainjs/commit/71c3cba843ab16d877299d158a1de0c7d22f3fb9)]:
|
|
131
|
+
- @langchain/core@1.1.20
|
|
132
|
+
|
|
133
|
+
## 2.1.15
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- Updated dependencies [[`41bfea5`](https://github.com/langchain-ai/langchainjs/commit/41bfea51cf119573a3b956ee782d2731fe71c681)]:
|
|
138
|
+
- @langchain/core@1.1.19
|
|
139
|
+
|
|
140
|
+
## 2.1.14
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- [#9900](https://github.com/langchain-ai/langchainjs/pull/9900) [`a9b5059`](https://github.com/langchain-ai/langchainjs/commit/a9b50597186002221aaa4585246e569fa44c27c8) Thanks [@hntrl](https://github.com/hntrl)! - Improved abort signal handling for chat models:
|
|
145
|
+
- Added `ModelAbortError` class in `@langchain/core/errors` that contains partial output when a model invocation is aborted mid-stream
|
|
146
|
+
- `invoke()` now throws `ModelAbortError` with accumulated `partialOutput` when aborted during streaming (when using streaming callback handlers)
|
|
147
|
+
- `stream()` throws a regular `AbortError` when aborted (since chunks are already yielded to the caller)
|
|
148
|
+
- All provider implementations now properly check and propagate abort signals in both `_generate()` and `_streamResponseChunks()` methods
|
|
149
|
+
- Added standard tests for abort signal behavior
|
|
150
|
+
|
|
151
|
+
- [#9900](https://github.com/langchain-ai/langchainjs/pull/9900) [`a9b5059`](https://github.com/langchain-ai/langchainjs/commit/a9b50597186002221aaa4585246e569fa44c27c8) Thanks [@hntrl](https://github.com/hntrl)! - fix(providers): add proper abort signal handling for invoke and stream operations
|
|
152
|
+
- Added early abort check (`signal.throwIfAborted()`) at the start of `_generate` methods to immediately throw when signal is already aborted
|
|
153
|
+
- Added abort signal checks inside streaming loops in `_streamResponseChunks` to return early when signal is aborted
|
|
154
|
+
- Propagated abort signals to underlying SDK calls where applicable (Google GenAI, Google Common/VertexAI, Cohere)
|
|
155
|
+
- Added standard tests for abort signal behavior in `@langchain/standard-tests`
|
|
156
|
+
|
|
157
|
+
This enables proper cancellation behavior for both invoke and streaming operations, and allows fallback chains to correctly proceed to the next runnable when the previous one is aborted.
|
|
158
|
+
|
|
159
|
+
- [#9875](https://github.com/langchain-ai/langchainjs/pull/9875) [`a000b0f`](https://github.com/langchain-ai/langchainjs/commit/a000b0f642f24dd6a2159a4fa2c6bda5838a68e1) Thanks [@joeljohn159](https://github.com/joeljohn159)! - Add validation for empty strings in enum values to provide clear error messages instead of cryptic runtime errors from Gemini API
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [[`a9b5059`](https://github.com/langchain-ai/langchainjs/commit/a9b50597186002221aaa4585246e569fa44c27c8), [`a9b5059`](https://github.com/langchain-ai/langchainjs/commit/a9b50597186002221aaa4585246e569fa44c27c8)]:
|
|
162
|
+
- @langchain/core@1.1.18
|
|
163
|
+
|
|
164
|
+
## 2.1.13
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Updated dependencies [[`05a9733`](https://github.com/langchain-ai/langchainjs/commit/05a9733448a10764c0bfd070af859c33e623b998)]:
|
|
169
|
+
- @langchain/core@1.1.17
|
|
170
|
+
|
|
171
|
+
## 2.1.12
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- [#9788](https://github.com/langchain-ai/langchainjs/pull/9788) [`82080b5`](https://github.com/langchain-ai/langchainjs/commit/82080b5e6131e791113b262525ee1e9aa21298db) Thanks [@SkrOYC](https://github.com/SkrOYC)! - fix: handle "tool_call" content blocks in ChatGoogleGenerativeAI with outputVersion: "v1"
|
|
176
|
+
|
|
177
|
+
Previously, using `outputVersion: "v1"` with `ChatGoogleGenerativeAI` would throw an "Unknown content type tool_call" error when processing tool calls generated by LangChain's `AIMessage`. This fix adds a handler for the `tool_call` block type in the conversion utility, ensuring compatibility with standard LangChain tool call blocks.
|
|
178
|
+
|
|
179
|
+
## 2.1.11
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- [#9827](https://github.com/langchain-ai/langchainjs/pull/9827) [`e16c218`](https://github.com/langchain-ai/langchainjs/commit/e16c218b81980a1c576af5192342019975bb95b9) Thanks [@sanjaiyan-dev](https://github.com/sanjaiyan-dev)! - optimize stream chunk aggregation and remove redundant sorting
|
|
184
|
+
|
|
185
|
+
- Updated dependencies [[`70387a1`](https://github.com/langchain-ai/langchainjs/commit/70387a144464539d65a546c8130cf51dfad025a1), [`a7c6ec5`](https://github.com/langchain-ai/langchainjs/commit/a7c6ec51ab9baa186ab5ebf815599c08f5c7e8ab), [`5e04543`](https://github.com/langchain-ai/langchainjs/commit/5e045435a783fdae44bc9a43e01a8e5eb7100db2), [`40b4467`](https://github.com/langchain-ai/langchainjs/commit/40b446762445575844610ee528abc77c247b2c43), [`17e30bd`](https://github.com/langchain-ai/langchainjs/commit/17e30bd7f4c7bdf87c9c30304b3b9e121cc1fbbc)]:
|
|
186
|
+
- @langchain/core@1.1.16
|
|
187
|
+
|
|
188
|
+
## 2.1.10
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies [[`230462d`](https://github.com/langchain-ai/langchainjs/commit/230462d28c3a8b5ccadf433ea2f523eb6e658de6)]:
|
|
193
|
+
- @langchain/core@1.1.15
|
|
194
|
+
|
|
195
|
+
## 2.1.9
|
|
196
|
+
|
|
197
|
+
### Patch Changes
|
|
198
|
+
|
|
199
|
+
- Updated dependencies [[`bd1ab45`](https://github.com/langchain-ai/langchainjs/commit/bd1ab45364391f69ce93ecba36a4a15dafca2b76)]:
|
|
200
|
+
- @langchain/core@1.1.14
|
|
201
|
+
|
|
202
|
+
## 2.1.8
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- [#9777](https://github.com/langchain-ai/langchainjs/pull/9777) [`3efe79c`](https://github.com/langchain-ai/langchainjs/commit/3efe79c62ff2ffe0ada562f7eecd85be074b649a) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(core): properly elevate reasoning tokens
|
|
207
|
+
|
|
208
|
+
- [#9769](https://github.com/langchain-ai/langchainjs/pull/9769) [`6de8ce3`](https://github.com/langchain-ai/langchainjs/commit/6de8ce37ba1fc01552c2d538c5c8bf489abd53b3) Thanks [@hntrl](https://github.com/hntrl)! - separate thinking and text content blocks when includeThoughts is enabled
|
|
209
|
+
|
|
210
|
+
- Updated dependencies [[`3efe79c`](https://github.com/langchain-ai/langchainjs/commit/3efe79c62ff2ffe0ada562f7eecd85be074b649a), [`b8561c1`](https://github.com/langchain-ai/langchainjs/commit/b8561c17556bdf7a3ff8d70bc307422642a9172e)]:
|
|
211
|
+
- @langchain/core@1.1.13
|
|
212
|
+
|
|
213
|
+
## 2.1.7
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- Updated dependencies [[`23be5af`](https://github.com/langchain-ai/langchainjs/commit/23be5afd59b5f4806edef11937ce5e2ba300f7ee)]:
|
|
218
|
+
- @langchain/core@1.1.12
|
|
219
|
+
|
|
220
|
+
## 2.1.6
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- Updated dependencies [[`a46a249`](https://github.com/langchain-ai/langchainjs/commit/a46a24983fd0fea649d950725a2673b3c435275f)]:
|
|
225
|
+
- @langchain/core@1.1.11
|
|
226
|
+
|
|
227
|
+
## 2.1.5
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- Updated dependencies [[`817fc9a`](https://github.com/langchain-ai/langchainjs/commit/817fc9a56d4699f3563a6e153b13eadf7bcc661b)]:
|
|
232
|
+
- @langchain/core@1.1.10
|
|
233
|
+
|
|
234
|
+
## 2.1.4
|
|
235
|
+
|
|
236
|
+
### Patch Changes
|
|
237
|
+
|
|
238
|
+
- Updated dependencies [[`56600b9`](https://github.com/langchain-ai/langchainjs/commit/56600b94f8e185f44d4288b7a9b66c55778938dd), [`dc5c2ac`](https://github.com/langchain-ai/langchainjs/commit/dc5c2ac00f86dd2feeba9843d708926a5f38202e), [`c28d24a`](https://github.com/langchain-ai/langchainjs/commit/c28d24a8770f6d0e543cde116b0e38b3baf21301), [`bfcb87d`](https://github.com/langchain-ai/langchainjs/commit/bfcb87d23c580c7881f650960a448fe2e54a30b3)]:
|
|
239
|
+
- @langchain/core@1.1.9
|
|
240
|
+
|
|
241
|
+
## 2.1.3
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- Updated dependencies [[`e5063f9`](https://github.com/langchain-ai/langchainjs/commit/e5063f9c6e9989ea067dfdff39262b9e7b6aba62), [`8996647`](https://github.com/langchain-ai/langchainjs/commit/89966470e8c0b112ce4f9a326004af6a4173f9e6)]:
|
|
246
|
+
- @langchain/core@1.1.8
|
|
247
|
+
|
|
248
|
+
## 2.1.2
|
|
249
|
+
|
|
250
|
+
### Patch Changes
|
|
251
|
+
|
|
252
|
+
- [#9680](https://github.com/langchain-ai/langchainjs/pull/9680) [`cbd2a96`](https://github.com/langchain-ai/langchainjs/commit/cbd2a96b55e2b772cf54abaea081ba8199df5c8b) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(google-genai): add 'medium' as option for thinkingLevel
|
|
253
|
+
|
|
254
|
+
- Updated dependencies [[`df9c42b`](https://github.com/langchain-ai/langchainjs/commit/df9c42b3ab61b85309ab47256e1d93c3188435ee), [`8d2982b`](https://github.com/langchain-ai/langchainjs/commit/8d2982bb94c0f4e4314ace3cc98a1ae87571b1ed), [`af664be`](https://github.com/langchain-ai/langchainjs/commit/af664becc0245b2315ea2f784c9a6c1d7622dbb4), [`ffb2402`](https://github.com/langchain-ai/langchainjs/commit/ffb24026cd93e58219519ee24c6e23ea57cb5bde)]:
|
|
255
|
+
- @langchain/core@1.1.7
|
|
256
|
+
|
|
257
|
+
## 2.1.1
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- Updated dependencies [[`a7b2a7d`](https://github.com/langchain-ai/langchainjs/commit/a7b2a7db5ef57df3731ae6c9931f4b663e909505), [`a496c5f`](https://github.com/langchain-ai/langchainjs/commit/a496c5fc64d94cc0809216325b0f1bfde3f92c45), [`1da1325`](https://github.com/langchain-ai/langchainjs/commit/1da1325aea044fb37af54a9de1f4ae0b9f47d4a2)]:
|
|
262
|
+
- @langchain/core@1.1.6
|
|
263
|
+
|
|
264
|
+
## 2.1.0
|
|
265
|
+
|
|
266
|
+
### Patch Changes
|
|
267
|
+
|
|
268
|
+
- [#8327](https://github.com/langchain-ai/langchainjs/pull/8327) [`89a7909`](https://github.com/langchain-ai/langchainjs/commit/89a79097acea196ee379eba1d0cc8beeeaefa810) Thanks [@caspherola](https://github.com/caspherola)! - support of adding custom headers on ChatGoogleGenerativeAI #6648
|
|
269
|
+
|
|
270
|
+
- [#9584](https://github.com/langchain-ai/langchainjs/pull/9584) [`f4ef9a1`](https://github.com/langchain-ai/langchainjs/commit/f4ef9a1dc9ee975c0f87caf4fc6d25535ca760f2) Thanks [@encodedz](https://github.com/encodedz)! - safe access around custom content parts
|
|
271
|
+
|
|
272
|
+
- [#9583](https://github.com/langchain-ai/langchainjs/pull/9583) [`5b27f38`](https://github.com/langchain-ai/langchainjs/commit/5b27f38581b9105a83b0a9ad7d9c76ae2a720927) Thanks [@maslo55555](https://github.com/maslo55555)! - fix(google-genai): support custom agent names in createAgent
|
|
273
|
+
|
|
274
|
+
- Updated dependencies [[`005c729`](https://github.com/langchain-ai/langchainjs/commit/005c72903bcdf090e0f4c58960c8c243481f9874), [`ab78246`](https://github.com/langchain-ai/langchainjs/commit/ab782462753e6c3ae5d55c0c251f795af32929d5), [`8cc81c7`](https://github.com/langchain-ai/langchainjs/commit/8cc81c7cee69530f7a6296c69123edbe227b2fce), [`f32e499`](https://github.com/langchain-ai/langchainjs/commit/f32e4991d0e707324e3f6af287a1ee87ab833b7e), [`a28d83d`](https://github.com/langchain-ai/langchainjs/commit/a28d83d49dd1fd31e67b52a44abc70f2cc2a2026), [`2e5ad70`](https://github.com/langchain-ai/langchainjs/commit/2e5ad70d16c1f13eaaea95336bbe2ec4a4a4954a), [`e456c66`](https://github.com/langchain-ai/langchainjs/commit/e456c661aa1ab8f1ed4a98c40616f5a13270e88e), [`1cfe603`](https://github.com/langchain-ai/langchainjs/commit/1cfe603e97d8711343ae5f1f5a75648e7bd2a16e)]:
|
|
275
|
+
- @langchain/core@1.1.5
|
|
276
|
+
|
|
277
|
+
## 2.0.4
|
|
278
|
+
|
|
279
|
+
### Patch Changes
|
|
280
|
+
|
|
281
|
+
- Updated dependencies [[`0bade90`](https://github.com/langchain-ai/langchainjs/commit/0bade90ed47c7988ed86f1e695a28273c7b3df50), [`6c40d00`](https://github.com/langchain-ai/langchainjs/commit/6c40d00e926f377d249c2919549381522eac8ed1)]:
|
|
282
|
+
- @langchain/core@1.1.4
|
|
283
|
+
|
|
284
|
+
## 2.0.3
|
|
285
|
+
|
|
286
|
+
### Patch Changes
|
|
287
|
+
|
|
288
|
+
- Updated dependencies [[`bd2c46e`](https://github.com/langchain-ai/langchainjs/commit/bd2c46e09e661d9ac766c09e71bc6687d6fc811c), [`487378b`](https://github.com/langchain-ai/langchainjs/commit/487378bf14277659c8ca0ef06ea0f9836b818ff4), [`138e7fb`](https://github.com/langchain-ai/langchainjs/commit/138e7fb6280705457079863bedb238b16b322032)]:
|
|
289
|
+
- @langchain/core@1.1.3
|
|
290
|
+
|
|
291
|
+
## 2.0.2
|
|
292
|
+
|
|
293
|
+
### Patch Changes
|
|
294
|
+
|
|
295
|
+
- Updated dependencies [[`833f578`](https://github.com/langchain-ai/langchainjs/commit/833f57834dc3aa64e4cfdd7499f865b2ab41462a)]:
|
|
296
|
+
- @langchain/core@1.1.2
|
|
297
|
+
|
|
298
|
+
## 2.0.1
|
|
299
|
+
|
|
300
|
+
### Patch Changes
|
|
301
|
+
|
|
302
|
+
- Updated dependencies [[`636b994`](https://github.com/langchain-ai/langchainjs/commit/636b99459bf843362298866211c63a7a15c2a319), [`38f0162`](https://github.com/langchain-ai/langchainjs/commit/38f0162b7b2db2be2c3a75ae468728adcb49fdfb)]:
|
|
303
|
+
- @langchain/core@1.1.1
|
|
304
|
+
|
|
305
|
+
## 2.0.0
|
|
306
|
+
|
|
307
|
+
### Patch Changes
|
|
308
|
+
|
|
309
|
+
- [#9416](https://github.com/langchain-ai/langchainjs/pull/9416) [`0fe9beb`](https://github.com/langchain-ai/langchainjs/commit/0fe9bebee6710f719e47f913eec1ec4f638e4de4) Thanks [@hntrl](https://github.com/hntrl)! - fix 'moduleResultion: "node"' compatibility
|
|
310
|
+
|
|
311
|
+
- Updated dependencies [[`708d360`](https://github.com/langchain-ai/langchainjs/commit/708d360df1869def7e4caaa5995d6e907bbf54cd), [`0fe9beb`](https://github.com/langchain-ai/langchainjs/commit/0fe9bebee6710f719e47f913eec1ec4f638e4de4), [`10fa2af`](https://github.com/langchain-ai/langchainjs/commit/10fa2afec0b81efd3467e61b59ba5c82e1043de5)]:
|
|
312
|
+
- @langchain/core@1.1.0
|
|
313
|
+
|
|
314
|
+
## 1.0.3
|
|
315
|
+
|
|
316
|
+
### Patch Changes
|
|
317
|
+
|
|
318
|
+
- [#9444](https://github.com/langchain-ai/langchainjs/pull/9444) [`39404ac`](https://github.com/langchain-ai/langchainjs/commit/39404acf76e81360054910f417d01df02981a4e6) Thanks [@hntrl](https://github.com/hntrl)! - add tier based usage metadata token count
|
|
319
|
+
|
|
320
|
+
- [#9444](https://github.com/langchain-ai/langchainjs/pull/9444) [`39404ac`](https://github.com/langchain-ai/langchainjs/commit/39404acf76e81360054910f417d01df02981a4e6) Thanks [@hntrl](https://github.com/hntrl)! - fix streaming thought signature bug
|
|
321
|
+
|
|
322
|
+
- [#9444](https://github.com/langchain-ai/langchainjs/pull/9444) [`39404ac`](https://github.com/langchain-ai/langchainjs/commit/39404acf76e81360054910f417d01df02981a4e6) Thanks [@hntrl](https://github.com/hntrl)! - add thinkingConfig support in ChatGoogleGenerativeAI
|
|
323
|
+
|
|
324
|
+
- [#9444](https://github.com/langchain-ai/langchainjs/pull/9444) [`39404ac`](https://github.com/langchain-ai/langchainjs/commit/39404acf76e81360054910f417d01df02981a4e6) Thanks [@hntrl](https://github.com/hntrl)! - add cached token counts to usage metadata
|
|
325
|
+
|
|
326
|
+
## 1.0.2
|
|
327
|
+
|
|
328
|
+
### Patch Changes
|
|
329
|
+
|
|
330
|
+
- [#9441](https://github.com/langchain-ai/langchainjs/pull/9441) [`269e5ba`](https://github.com/langchain-ai/langchainjs/commit/269e5bae04c76fdfbd42df66a97061bb0b93a834) Thanks [@hntrl](https://github.com/hntrl)! - add function calling thought signature support
|
|
331
|
+
|
|
332
|
+
## 1.0.1
|
|
333
|
+
|
|
334
|
+
### Patch Changes
|
|
335
|
+
|
|
336
|
+
- [#9387](https://github.com/langchain-ai/langchainjs/pull/9387) [`ac0d4fe`](https://github.com/langchain-ai/langchainjs/commit/ac0d4fe3807e05eb2185ae8a36da69498e6163d4) Thanks [@hntrl](https://github.com/hntrl)! - Add `ModelProfile` and `.profile` properties to ChatModel
|
|
337
|
+
|
|
338
|
+
## 1.0.0
|
|
339
|
+
|
|
340
|
+
This release updates the package for compatibility with LangChain v1.0. See the v1.0 [release notes](https://docs.langchain.com/oss/javascript/releases/langchain-v1) for details on what's new.
|
|
341
|
+
|
|
342
|
+
## 0.2.18
|
|
343
|
+
|
|
344
|
+
### Patch Changes
|
|
345
|
+
|
|
346
|
+
- 0092a79: compute per-chunk token deltas while streaming
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) LangChain, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# @intrvls/langchain-google-genai
|
|
2
|
+
|
|
3
|
+
This package contains LangChain.js integrations for Google's Gemini models.
|
|
4
|
+
|
|
5
|
+
## Why this port exists
|
|
6
|
+
|
|
7
|
+
This is a standalone port of the official [`@langchain/google-genai`](https://www.npmjs.com/package/@langchain/google-genai) package at version **2.1.24**, with three key differences:
|
|
8
|
+
|
|
9
|
+
1. **New SDK.** It is built on Google's current [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK rather than the legacy `@google/generative-ai` SDK, which Google has deprecated in favor of the unified GenAI SDK (see Google's [migration guide](https://ai.google.dev/gemini-api/docs/migrate)). The legacy SDK no longer receives new Gemini features, so staying on it blocks access to newer models and capabilities.
|
|
10
|
+
2. **Standalone.** The upstream package lives inside the LangChain.js monorepo and depends on workspace-only tooling (`@langchain/build`, `@langchain/tsconfig`, `@langchain/standard-tests`). This port removes those couplings so it can be installed, built, and tested on its own, published under the `@intrvls` scope.
|
|
11
|
+
3. **Pinned to n8n's `@langchain/core` line.** This is intended for use inside a custom n8n community node. n8n's [`@n8n/n8n-nodes-langchain`](https://www.npmjs.com/package/@n8n/n8n-nodes-langchain) pins `@langchain/core` to `1.1.41`, and at runtime everything must resolve to that single core instance. We therefore re-base on upstream **2.1.24** — the last line that targets `@langchain/core` 1.1.x (peer `^1.1.30`) — rather than 2.2.0+, which requires core ≥1.2.0 APIs n8n does not ship. `@langchain/core` stays a `peerDependency` so the host (n8n) supplies the instance.
|
|
12
|
+
|
|
13
|
+
It keeps the same public API (`ChatGoogleGenerativeAI`, `GoogleGenerativeAIEmbeddings`) so it can be used as a drop-in replacement.
|
|
14
|
+
|
|
15
|
+
## Version compatibility
|
|
16
|
+
|
|
17
|
+
This port follows its own version line as of **3.0.0** and no longer mirrors upstream's `2.1.x` numbering. The table below describes the current release.
|
|
18
|
+
|
|
19
|
+
| | Version | Notes |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| **This package** | `3.0.0-alpha.0` | Independent version line (see [CHANGELOG](./CHANGELOG.md)). |
|
|
22
|
+
| **Mirrors upstream** | `@langchain/google-genai` **2.1.24** | The upstream release this port is rebased from — the last line targeting `@langchain/core` 1.1.x. Not the version you install. |
|
|
23
|
+
| **`@langchain/core`** | peer `^1.1.30` | Supplied by the host as a `peerDependency`. Tested against **1.1.41**, the version n8n's [`@n8n/n8n-nodes-langchain`](https://www.npmjs.com/package/@n8n/n8n-nodes-langchain) ships. Must resolve to a single instance at runtime. Do **not** use core `≥1.2.0` — upstream `2.2.0+` requires APIs n8n does not ship. |
|
|
24
|
+
| **`@google/genai`** | `^2.8.0` | Google's current unified GenAI SDK (replaces the deprecated `@google/generative-ai`). Bundled dependency. |
|
|
25
|
+
| **Node.js** | `>=20` | |
|
|
26
|
+
|
|
27
|
+
> **Why pinned to core 1.1.x?** This is built for use inside a custom n8n community node, and everything in an n8n process must resolve to the one `@langchain/core` instance n8n provides (1.1.41). Rebasing on upstream 2.1.24 — rather than 2.2.0+ — keeps the port on the core 1.1.x line so it stays compatible.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash npm2yarn
|
|
32
|
+
npm install @intrvls/langchain-google-genai @langchain/core
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The current release is an alpha. To install it, use the `alpha` tag:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @intrvls/langchain-google-genai@alpha @langchain/core
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This package, along with the main LangChain package, depends on [`@langchain/core`](https://npmjs.com/package/@langchain/core/).
|
|
42
|
+
If you are using this package with other LangChain packages, you should make sure that all of the packages depend on the same instance of @langchain/core.
|
|
43
|
+
You can do so by adding appropriate field to your project's `package.json` like this:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"name": "your-project",
|
|
48
|
+
"version": "0.0.0",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@langchain/core": "^1.1.30",
|
|
51
|
+
"@intrvls/langchain-google-genai": "^3.0.0-alpha.0"
|
|
52
|
+
},
|
|
53
|
+
"resolutions": {
|
|
54
|
+
"@langchain/core": "^1.1.30"
|
|
55
|
+
},
|
|
56
|
+
"overrides": {
|
|
57
|
+
"@langchain/core": "^1.1.30"
|
|
58
|
+
},
|
|
59
|
+
"pnpm": {
|
|
60
|
+
"overrides": {
|
|
61
|
+
"@langchain/core": "^1.1.30"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The field you need depends on the package manager you're using, but we recommend adding a field for the common `yarn`, `npm`, and `pnpm` to maximize compatibility.
|
|
68
|
+
|
|
69
|
+
## Chat Models
|
|
70
|
+
|
|
71
|
+
This package contains the `ChatGoogleGenerativeAI` class, which is the recommended way to interface with the Google Gemini series of models.
|
|
72
|
+
|
|
73
|
+
To use, install the requirements, and configure your environment.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export GOOGLE_API_KEY=your-api-key
|
|
77
|
+
# or, equivalently:
|
|
78
|
+
export GEMINI_API_KEY=your-api-key
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`GOOGLE_API_KEY` takes precedence; `GEMINI_API_KEY` is used as a fallback. You can also pass the key directly via the `apiKey` constructor field. This applies to both `ChatGoogleGenerativeAI` and `GoogleGenerativeAIEmbeddings`.
|
|
82
|
+
|
|
83
|
+
Then initialize
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { ChatGoogleGenerativeAI } from "@intrvls/langchain-google-genai";
|
|
87
|
+
import { HumanMessage } from "@langchain/core/messages";
|
|
88
|
+
|
|
89
|
+
const model = new ChatGoogleGenerativeAI({
|
|
90
|
+
model: "gemini-3.5-flash",
|
|
91
|
+
maxOutputTokens: 2048,
|
|
92
|
+
});
|
|
93
|
+
const response = await model.invoke(new HumanMessage("Hello world!"));
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Multimodal inputs
|
|
97
|
+
|
|
98
|
+
Gemini models support image inputs when providing a single chat message. Example:
|
|
99
|
+
|
|
100
|
+
```bash npm2yarn
|
|
101
|
+
pnpm install @langchain/core
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import fs from "fs";
|
|
106
|
+
import { ChatGoogleGenerativeAI } from "@intrvls/langchain-google-genai";
|
|
107
|
+
import { HumanMessage } from "@langchain/core/messages";
|
|
108
|
+
|
|
109
|
+
const vision = new ChatGoogleGenerativeAI({
|
|
110
|
+
model: "gemini-3.5-flash",
|
|
111
|
+
maxOutputTokens: 2048,
|
|
112
|
+
});
|
|
113
|
+
const image = fs.readFileSync("./hotdog.jpg").toString("base64");
|
|
114
|
+
const input = [
|
|
115
|
+
new HumanMessage({
|
|
116
|
+
content: [
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
text: "Describe the following image.",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: "image_url",
|
|
123
|
+
image_url: `data:image/png;base64,${image}`,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const res = await vision.invoke(input);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The value of `image_url` can be any of the following:
|
|
133
|
+
|
|
134
|
+
- A public image URL
|
|
135
|
+
- An accessible gcs file (e.g., "gcs://path/to/file.png")
|
|
136
|
+
- A base64 encoded image (e.g., `data:image/png;base64,abcd124`)
|
|
137
|
+
- A PIL image
|
|
138
|
+
|
|
139
|
+
## Embeddings
|
|
140
|
+
|
|
141
|
+
This package also adds support for google's embeddings models.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { GoogleGenerativeAIEmbeddings } from "@intrvls/langchain-google-genai";
|
|
145
|
+
|
|
146
|
+
const embeddings = new GoogleGenerativeAIEmbeddings({
|
|
147
|
+
model: "gemini-embedding-001", // current default; the legacy `embedding-001` is retired
|
|
148
|
+
taskType: "RETRIEVAL_DOCUMENT",
|
|
149
|
+
title: "Document title",
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const res = await embeddings.embedQuery("OK Google");
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Behavior notes
|
|
156
|
+
|
|
157
|
+
A few conveniences this port applies on top of the upstream behavior:
|
|
158
|
+
|
|
159
|
+
- **Gemini 3+ default temperature.** For Gemini 3 and later models, if you don't set `temperature` explicitly it defaults to `1.0`. These models can loop or degrade at `temperature < 1.0`; explicit values are always respected, and older models are unaffected.
|
|
160
|
+
- **Google Search tool.** The legacy `googleSearchRetrieval` tool shape is automatically rewritten to `googleSearch`, which is required by current Gemini models — existing calling code keeps working.
|
|
161
|
+
- **API key fallback.** `GEMINI_API_KEY` is honored as a fallback to `GOOGLE_API_KEY` (see above).
|
|
162
|
+
- **Reasoning content.** When `thinkingConfig.includeThoughts` is enabled, thinking is surfaced as standard `reasoning` content blocks via `message.contentBlocks` on both `invoke` and `stream`.
|
|
163
|
+
|
|
164
|
+
## Development
|
|
165
|
+
|
|
166
|
+
To develop the Google GenAI package, you'll need to follow these instructions:
|
|
167
|
+
|
|
168
|
+
### Install dependencies
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
pnpm install
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Build the package
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
pnpm build
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Run tests
|
|
181
|
+
|
|
182
|
+
Test files should live within a `tests/` file in the `src/` folder. Unit tests should end in `.test.ts` and integration tests should
|
|
183
|
+
end in `.int.test.ts`:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
$ pnpm test
|
|
187
|
+
$ pnpm test:int
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Lint & Format
|
|
191
|
+
|
|
192
|
+
Run the linter & formatter to ensure your code is up to standard:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pnpm lint && pnpm format
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Adding new entrypoints
|
|
199
|
+
|
|
200
|
+
If you add a new file to be exported, either import & re-export from `src/index.ts`, or add it to the `exports` field in the `package.json` file and run `pnpm build` to generate the new entrypoint.
|
|
201
|
+
|