@langchain/google 0.1.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 +11 -0
- package/LICENSE +21 -0
- package/README.md +97 -0
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/chat_models/api-types.d.cts +1506 -0
- package/dist/chat_models/api-types.d.ts +1506 -0
- package/dist/chat_models/base.cjs +445 -0
- package/dist/chat_models/base.cjs.map +1 -0
- package/dist/chat_models/base.d.cts +319 -0
- package/dist/chat_models/base.d.ts +319 -0
- package/dist/chat_models/base.js +442 -0
- package/dist/chat_models/base.js.map +1 -0
- package/dist/chat_models/index.cjs +23 -0
- package/dist/chat_models/index.cjs.map +1 -0
- package/dist/chat_models/index.d.cts +39 -0
- package/dist/chat_models/index.d.ts +39 -0
- package/dist/chat_models/index.js +22 -0
- package/dist/chat_models/index.js.map +1 -0
- package/dist/chat_models/node.cjs +35 -0
- package/dist/chat_models/node.cjs.map +1 -0
- package/dist/chat_models/node.d.cts +13 -0
- package/dist/chat_models/node.d.ts +13 -0
- package/dist/chat_models/node.js +34 -0
- package/dist/chat_models/node.js.map +1 -0
- package/dist/chat_models/profiles.cjs +373 -0
- package/dist/chat_models/profiles.cjs.map +1 -0
- package/dist/chat_models/profiles.js +372 -0
- package/dist/chat_models/profiles.js.map +1 -0
- package/dist/chat_models/types.d.cts +250 -0
- package/dist/chat_models/types.d.ts +250 -0
- package/dist/clients/index.cjs +219 -0
- package/dist/clients/index.cjs.map +1 -0
- package/dist/clients/index.d.cts +49 -0
- package/dist/clients/index.d.ts +49 -0
- package/dist/clients/index.js +217 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/node.cjs +327 -0
- package/dist/clients/node.cjs.map +1 -0
- package/dist/clients/node.d.cts +59 -0
- package/dist/clients/node.d.ts +59 -0
- package/dist/clients/node.js +325 -0
- package/dist/clients/node.js.map +1 -0
- package/dist/const.cjs +13 -0
- package/dist/const.cjs.map +1 -0
- package/dist/const.js +9 -0
- package/dist/const.js.map +1 -0
- package/dist/converters/messages.cjs +697 -0
- package/dist/converters/messages.cjs.map +1 -0
- package/dist/converters/messages.js +691 -0
- package/dist/converters/messages.js.map +1 -0
- package/dist/converters/params.cjs +205 -0
- package/dist/converters/params.cjs.map +1 -0
- package/dist/converters/params.js +202 -0
- package/dist/converters/params.js.map +1 -0
- package/dist/converters/tools.cjs +356 -0
- package/dist/converters/tools.cjs.map +1 -0
- package/dist/converters/tools.js +353 -0
- package/dist/converters/tools.js.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/node.cjs +7 -0
- package/dist/node.d.cts +3 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.js +4 -0
- package/dist/utils/errors.cjs +543 -0
- package/dist/utils/errors.cjs.map +1 -0
- package/dist/utils/errors.js +535 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/gcp-auth.cjs +188 -0
- package/dist/utils/gcp-auth.cjs.map +1 -0
- package/dist/utils/gcp-auth.d.cts +43 -0
- package/dist/utils/gcp-auth.d.ts +43 -0
- package/dist/utils/gcp-auth.js +186 -0
- package/dist/utils/gcp-auth.js.map +1 -0
- package/dist/utils/handler.cjs +67 -0
- package/dist/utils/handler.cjs.map +1 -0
- package/dist/utils/handler.d.cts +34 -0
- package/dist/utils/handler.d.ts +34 -0
- package/dist/utils/handler.js +64 -0
- package/dist/utils/handler.js.map +1 -0
- package/dist/utils/misc.cjs +10 -0
- package/dist/utils/misc.cjs.map +1 -0
- package/dist/utils/misc.d.cts +14 -0
- package/dist/utils/misc.d.ts +14 -0
- package/dist/utils/misc.js +9 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/stream.cjs +26 -0
- package/dist/utils/stream.cjs.map +1 -0
- package/dist/utils/stream.js +25 -0
- package/dist/utils/stream.js.map +1 -0
- package/package.json +96 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @langchain/google
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#10000](https://github.com/langchain-ai/langchainjs/pull/10000) [`71d08c0`](https://github.com/langchain-ai/langchainjs/commit/71d08c0a3a2597bd5a084eb35a7830e5ea1a2b29) Thanks [@hntrl](https://github.com/hntrl)! - feat(google): add `@langchain/google` -- unified Google/Gemini integration
|
|
8
|
+
|
|
9
|
+
New package that replaces the fragmented `@langchain/google-genai` / `@langchain/google-common` / Vertex AI package stack with a single integration.
|
|
10
|
+
|
|
11
|
+
Published as 0.1.0 (early release). Existing Google packages will continue to receive maintenance updates.
|
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,97 @@
|
|
|
1
|
+
# @langchain/google
|
|
2
|
+
|
|
3
|
+
This package supports access to a variety of Google's models, including the Gemini
|
|
4
|
+
family of models and their Nano Banana image generation model. You can access these
|
|
5
|
+
models through either Google's [Google AI](https://ai.google.dev/) API (sometimes also
|
|
6
|
+
called the Generative AI API or the AI Studio API) or through the Google Cloud Platform
|
|
7
|
+
[Vertex AI](https://cloud.google.com/vertex-ai) service. It does not rely
|
|
8
|
+
on the "genai" library from Google, but rather uses direct REST calls.
|
|
9
|
+
|
|
10
|
+
This package will be replacing the [ChatGoogleGenerativeAI](google_generative_ai)
|
|
11
|
+
and [ChatVertex](google_vertex_ai) libraries.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm install @langchain/core @langchain/google
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This package, along with the main LangChain package, depends on [`@langchain/core`](https://npmjs.com/package/@langchain/core/).
|
|
20
|
+
If you are using this package with other LangChain packages, you should make sure that
|
|
21
|
+
all the packages depend on the same instance of @langchain/core.
|
|
22
|
+
|
|
23
|
+
## Chat Models
|
|
24
|
+
|
|
25
|
+
This package contains the `ChatGoogle` class, which is the recommended way
|
|
26
|
+
to interface with Google's models.
|
|
27
|
+
|
|
28
|
+
For detailed configuration and use, including how to get credentials, see the
|
|
29
|
+
[LangChain.js documentation](https://docs.langchain.com/oss/javascript/integrations/chat/google).
|
|
30
|
+
|
|
31
|
+
## Tools
|
|
32
|
+
|
|
33
|
+
`ChatGoogle` supports standard LangChain tool calling as
|
|
34
|
+
well as Gemini-specific "Specialty Tools" (like Code Execution and Grounding).
|
|
35
|
+
|
|
36
|
+
See the [LangChain.js documentation](https://docs.langchain.com/oss/javascript/integrations/chat/google).
|
|
37
|
+
for details.
|
|
38
|
+
|
|
39
|
+
## Reporting issues
|
|
40
|
+
|
|
41
|
+
Please report any problems encountered with the library in the
|
|
42
|
+
[LangChain.js github repository](https://github.com/langchain-ai/langchainjs/issues).
|
|
43
|
+
|
|
44
|
+
Please provide as many details as possible and make sure the title
|
|
45
|
+
references the @langchain/google library. A code sample that can reproduce
|
|
46
|
+
the issue is very welcome.
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
Contributions are welcome! You may wish to [open an issue](https://github.com/langchain-ai/langchainjs/issues)
|
|
51
|
+
before you begin and tag [@hntrl](https://github.com/hntrl) and
|
|
52
|
+
[@afirstenberg](https://github.com/afirstenberg) with your plans.
|
|
53
|
+
|
|
54
|
+
To develop the Google package, you'll need to follow these instructions:
|
|
55
|
+
|
|
56
|
+
### Install dependencies
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Build the package
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pnpm build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or from the repo root:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pnpm build --filter=@langchain/google
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Run tests
|
|
75
|
+
|
|
76
|
+
Test files should live within a `tests/` file in the `src/` folder. Unit tests should end in `.test.ts` and integration tests should
|
|
77
|
+
end in `.int.test.ts`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm test
|
|
81
|
+
pnpm test:int
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Note that the integration tests run against currently supported models and
|
|
85
|
+
platforms.
|
|
86
|
+
|
|
87
|
+
### Lint & Format
|
|
88
|
+
|
|
89
|
+
Run the linter & formatter to ensure your code is up to standard:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pnpm lint && pnpm format
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Adding new entrypoints
|
|
96
|
+
|
|
97
|
+
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.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|