@langchain/google-vertexai-web 0.0.1
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/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/chat_models.cjs +19 -0
- package/dist/chat_models.d.ts +13 -0
- package/dist/chat_models.js +15 -0
- package/dist/index.cjs +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/llms.cjs +19 -0
- package/dist/llms.d.ts +13 -0
- package/dist/llms.js +15 -0
- package/dist/types.cjs +17 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/utils.cjs +17 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/index.cjs +1 -0
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +117 -0
- package/types.cjs +1 -0
- package/types.d.cts +1 -0
- package/types.d.ts +1 -0
- package/types.js +1 -0
- package/utils.cjs +1 -0
- package/utils.d.cts +1 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 LangChain
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# LangChain google-vertexai-web
|
2
|
+
|
3
|
+
This package contains resources to access Google AI/ML models
|
4
|
+
and other Google services via Vertex AI. Authorization to these
|
5
|
+
services use either an API Key or service account credentials
|
6
|
+
that are included in an environment variable.
|
7
|
+
|
8
|
+
If you are running this on the Google Cloud Platform, or in a way
|
9
|
+
where service account credentials can be stored on a file system,
|
10
|
+
consider using the @langchain/google-vertexai
|
11
|
+
package *instead*. You do not need to use both packages. See the
|
12
|
+
section on **Authorization** below.
|
13
|
+
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ yarn add @langchain/google-vertexai-web
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
## Authorization
|
23
|
+
|
24
|
+
Authorization is done through a Google Cloud Service Account.
|
25
|
+
|
26
|
+
To handle service accounts, this package uses the `google-auth-library`
|
27
|
+
package, and you may wish to consult the documentation for that library
|
28
|
+
about how it does so. But in short, classes in this package will use
|
29
|
+
credentials from the first of the following that apply:
|
30
|
+
|
31
|
+
1. An API Key that is passed to the constructor using the `apiKey` attribute
|
32
|
+
2. Credentials that are passed to the constructor using the `authInfo` attribute
|
33
|
+
3. An API Key that is set in the environment variable `API_KEY`
|
34
|
+
4. The Service Account credentials that are saved directly into the
|
35
|
+
`GOOGLE_WEB_CREDENTIALS`
|
36
|
+
5. The Service Account credentials that are saved directly into the
|
37
|
+
`GOOGLE_VERTEX_AI_WEB_CREDENTIALS` (deprecated)
|
38
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ChatVertexAI = void 0;
|
4
|
+
const google_webauth_1 = require("@langchain/google-webauth");
|
5
|
+
/**
|
6
|
+
* Integration with a chat model.
|
7
|
+
*/
|
8
|
+
class ChatVertexAI extends google_webauth_1.ChatGoogle {
|
9
|
+
static lc_name() {
|
10
|
+
return "ChatVertexAI";
|
11
|
+
}
|
12
|
+
constructor(fields) {
|
13
|
+
super({
|
14
|
+
...fields,
|
15
|
+
platformType: "gcp",
|
16
|
+
});
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.ChatVertexAI = ChatVertexAI;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type ChatGoogleInput, ChatGoogle } from "@langchain/google-webauth";
|
2
|
+
/**
|
3
|
+
* Input to chat model class.
|
4
|
+
*/
|
5
|
+
export interface ChatVertexAIInput extends ChatGoogleInput {
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Integration with a chat model.
|
9
|
+
*/
|
10
|
+
export declare class ChatVertexAI extends ChatGoogle {
|
11
|
+
static lc_name(): string;
|
12
|
+
constructor(fields?: ChatVertexAIInput);
|
13
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ChatGoogle } from "@langchain/google-webauth";
|
2
|
+
/**
|
3
|
+
* Integration with a chat model.
|
4
|
+
*/
|
5
|
+
export class ChatVertexAI extends ChatGoogle {
|
6
|
+
static lc_name() {
|
7
|
+
return "ChatVertexAI";
|
8
|
+
}
|
9
|
+
constructor(fields) {
|
10
|
+
super({
|
11
|
+
...fields,
|
12
|
+
platformType: "gcp",
|
13
|
+
});
|
14
|
+
}
|
15
|
+
}
|
package/dist/index.cjs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./chat_models.cjs"), exports);
|
18
|
+
__exportStar(require("./llms.cjs"), exports);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/llms.cjs
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.VertexAI = void 0;
|
4
|
+
const google_webauth_1 = require("@langchain/google-webauth");
|
5
|
+
/**
|
6
|
+
* Integration with a LLM model.
|
7
|
+
*/
|
8
|
+
class VertexAI extends google_webauth_1.GoogleLLM {
|
9
|
+
static lc_name() {
|
10
|
+
return "VertexAI";
|
11
|
+
}
|
12
|
+
constructor(fields) {
|
13
|
+
super({
|
14
|
+
...fields,
|
15
|
+
platformType: "gcp",
|
16
|
+
});
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.VertexAI = VertexAI;
|
package/dist/llms.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type GoogleLLMInput, GoogleLLM } from "@langchain/google-webauth";
|
2
|
+
/**
|
3
|
+
* Input to LLM model class.
|
4
|
+
*/
|
5
|
+
export interface VertexAIInput extends GoogleLLMInput {
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Integration with a LLM model.
|
9
|
+
*/
|
10
|
+
export declare class VertexAI extends GoogleLLM {
|
11
|
+
static lc_name(): string;
|
12
|
+
constructor(fields?: VertexAIInput);
|
13
|
+
}
|
package/dist/llms.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import { GoogleLLM } from "@langchain/google-webauth";
|
2
|
+
/**
|
3
|
+
* Integration with a LLM model.
|
4
|
+
*/
|
5
|
+
export class VertexAI extends GoogleLLM {
|
6
|
+
static lc_name() {
|
7
|
+
return "VertexAI";
|
8
|
+
}
|
9
|
+
constructor(fields) {
|
10
|
+
super({
|
11
|
+
...fields,
|
12
|
+
platformType: "gcp",
|
13
|
+
});
|
14
|
+
}
|
15
|
+
}
|
package/dist/types.cjs
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("@langchain/google-webauth/types"), exports);
|
package/dist/types.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@langchain/google-webauth/types";
|
package/dist/types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@langchain/google-webauth/types";
|
package/dist/utils.cjs
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("@langchain/google-webauth/utils"), exports);
|
package/dist/utils.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@langchain/google-webauth/utils";
|
package/dist/utils.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@langchain/google-webauth/utils";
|
package/index.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./dist/index.cjs');
|
package/index.d.cts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/index.js'
|
package/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/index.js'
|
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/index.js'
|
package/package.json
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
{
|
2
|
+
"name": "@langchain/google-vertexai-web",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "LangChain.js support for Google Vertex AI Web",
|
5
|
+
"type": "module",
|
6
|
+
"engines": {
|
7
|
+
"node": ">=18"
|
8
|
+
},
|
9
|
+
"main": "./index.js",
|
10
|
+
"types": "./index.d.ts",
|
11
|
+
"repository": {
|
12
|
+
"type": "git",
|
13
|
+
"url": "git@github.com:langchain-ai/langchainjs.git"
|
14
|
+
},
|
15
|
+
"homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-vertexai-web/",
|
16
|
+
"scripts": {
|
17
|
+
"build": "yarn run build:deps && yarn clean && yarn build:esm && yarn build:cjs && yarn build:scripts",
|
18
|
+
"build:deps": "yarn run turbo:command build --filter=@langchain/google-gauth",
|
19
|
+
"build:esm": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist/ && rm -rf dist/tests dist/**/tests",
|
20
|
+
"build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && yarn move-cjs-to-dist && rm -rf dist-cjs",
|
21
|
+
"build:watch": "yarn create-entrypoints && tsc --outDir dist/ --watch",
|
22
|
+
"build:scripts": "yarn create-entrypoints && yarn check-tree-shaking",
|
23
|
+
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
24
|
+
"lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
25
|
+
"lint": "yarn lint:eslint && yarn lint:dpdm",
|
26
|
+
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
|
27
|
+
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 yarn lc-build --config ./langchain.config.js --create-entrypoints --pre",
|
28
|
+
"prepack": "yarn build",
|
29
|
+
"test": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
30
|
+
"test:watch": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
31
|
+
"test:single": "yarn run build:deps && NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
32
|
+
"test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
33
|
+
"format": "prettier --config .prettierrc --write \"src\"",
|
34
|
+
"format:check": "prettier --config .prettierrc --check \"src\"",
|
35
|
+
"move-cjs-to-dist": "yarn lc-build --config ./langchain.config.js --move-cjs-dist",
|
36
|
+
"create-entrypoints": "yarn lc-build --config ./langchain.config.js --create-entrypoints",
|
37
|
+
"check-tree-shaking": "yarn lc-build --config ./langchain.config.js --tree-shaking"
|
38
|
+
},
|
39
|
+
"author": "LangChain",
|
40
|
+
"license": "MIT",
|
41
|
+
"dependencies": {
|
42
|
+
"@langchain/core": "~0.1.1",
|
43
|
+
"@langchain/google-webauth": "~0.0.1"
|
44
|
+
},
|
45
|
+
"devDependencies": {
|
46
|
+
"@jest/globals": "^29.5.0",
|
47
|
+
"@langchain/scripts": "~0.0",
|
48
|
+
"@swc/core": "^1.3.90",
|
49
|
+
"@swc/jest": "^0.2.29",
|
50
|
+
"@tsconfig/recommended": "^1.0.3",
|
51
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
52
|
+
"@typescript-eslint/parser": "^6.12.0",
|
53
|
+
"dotenv": "^16.3.1",
|
54
|
+
"dpdm": "^3.12.0",
|
55
|
+
"eslint": "^8.33.0",
|
56
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
57
|
+
"eslint-config-prettier": "^8.6.0",
|
58
|
+
"eslint-plugin-import": "^2.27.5",
|
59
|
+
"eslint-plugin-no-instanceof": "^1.0.1",
|
60
|
+
"eslint-plugin-prettier": "^4.2.1",
|
61
|
+
"jest": "^29.5.0",
|
62
|
+
"jest-environment-node": "^29.6.4",
|
63
|
+
"prettier": "^2.8.3",
|
64
|
+
"release-it": "^15.10.1",
|
65
|
+
"rollup": "^4.5.2",
|
66
|
+
"ts-jest": "^29.1.0",
|
67
|
+
"typescript": "<5.2.0"
|
68
|
+
},
|
69
|
+
"publishConfig": {
|
70
|
+
"access": "public"
|
71
|
+
},
|
72
|
+
"exports": {
|
73
|
+
".": {
|
74
|
+
"types": {
|
75
|
+
"import": "./index.d.ts",
|
76
|
+
"require": "./index.d.cts",
|
77
|
+
"default": "./index.d.ts"
|
78
|
+
},
|
79
|
+
"import": "./index.js",
|
80
|
+
"require": "./index.cjs"
|
81
|
+
},
|
82
|
+
"./utils": {
|
83
|
+
"types": {
|
84
|
+
"import": "./utils.d.ts",
|
85
|
+
"require": "./utils.d.cts",
|
86
|
+
"default": "./utils.d.ts"
|
87
|
+
},
|
88
|
+
"import": "./utils.js",
|
89
|
+
"require": "./utils.cjs"
|
90
|
+
},
|
91
|
+
"./types": {
|
92
|
+
"types": {
|
93
|
+
"import": "./types.d.ts",
|
94
|
+
"require": "./types.d.cts",
|
95
|
+
"default": "./types.d.ts"
|
96
|
+
},
|
97
|
+
"import": "./types.js",
|
98
|
+
"require": "./types.cjs"
|
99
|
+
},
|
100
|
+
"./package.json": "./package.json"
|
101
|
+
},
|
102
|
+
"files": [
|
103
|
+
"dist/",
|
104
|
+
"index.cjs",
|
105
|
+
"index.js",
|
106
|
+
"index.d.ts",
|
107
|
+
"index.d.cts",
|
108
|
+
"utils.cjs",
|
109
|
+
"utils.js",
|
110
|
+
"utils.d.ts",
|
111
|
+
"utils.d.cts",
|
112
|
+
"types.cjs",
|
113
|
+
"types.js",
|
114
|
+
"types.d.ts",
|
115
|
+
"types.d.cts"
|
116
|
+
]
|
117
|
+
}
|
package/types.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./dist/types.cjs');
|
package/types.d.cts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/types.js'
|
package/types.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/types.js'
|
package/types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/types.js'
|
package/utils.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./dist/utils.cjs');
|
package/utils.d.cts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/utils.js'
|
package/utils.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/utils.js'
|
package/utils.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './dist/utils.js'
|