langchain 0.0.132 → 0.0.133
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/dist/agents/chat/outputParser.cjs +2 -1
- package/dist/agents/chat/outputParser.js +2 -1
- package/dist/agents/executor.cjs +106 -7
- package/dist/agents/executor.d.ts +23 -0
- package/dist/agents/executor.js +104 -6
- package/dist/agents/mrkl/outputParser.cjs +2 -1
- package/dist/agents/mrkl/outputParser.js +2 -1
- package/dist/chat_models/googlevertexai.cjs +1 -1
- package/dist/chat_models/googlevertexai.d.ts +2 -2
- package/dist/chat_models/googlevertexai.js +2 -2
- package/dist/chat_models/ollama.cjs +8 -8
- package/dist/chat_models/ollama.js +8 -8
- package/dist/document_loaders/web/notionapi.cjs +153 -74
- package/dist/document_loaders/web/notionapi.d.ts +19 -10
- package/dist/document_loaders/web/notionapi.js +154 -75
- package/dist/embeddings/googlevertexai.cjs +1 -1
- package/dist/embeddings/googlevertexai.d.ts +2 -2
- package/dist/embeddings/googlevertexai.js +2 -2
- package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +1 -1
- package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -2
- package/dist/experimental/multimodal_embeddings/googlevertexai.js +2 -2
- package/dist/llms/googlevertexai.cjs +1 -1
- package/dist/llms/googlevertexai.js +2 -2
- package/dist/load/import_constants.cjs +1 -0
- package/dist/load/import_constants.js +1 -0
- package/dist/schema/output_parser.cjs +2 -2
- package/dist/schema/output_parser.js +2 -2
- package/dist/tools/base.cjs +26 -2
- package/dist/tools/base.d.ts +9 -0
- package/dist/tools/base.js +24 -1
- package/dist/types/googlevertexai-types.d.ts +8 -3
- package/dist/util/googlevertexai-connection.cjs +49 -15
- package/dist/util/googlevertexai-connection.d.ts +12 -4
- package/dist/util/googlevertexai-connection.js +46 -13
- package/dist/vectorstores/googlevertexai.cjs +550 -0
- package/dist/vectorstores/googlevertexai.d.ts +180 -0
- package/dist/vectorstores/googlevertexai.js +519 -0
- package/dist/vectorstores/vectara.cjs +11 -2
- package/dist/vectorstores/vectara.d.ts +10 -1
- package/dist/vectorstores/vectara.js +11 -2
- package/package.json +10 -2
- package/vectorstores/googlevertexai.cjs +1 -0
- package/vectorstores/googlevertexai.d.ts +1 -0
- package/vectorstores/googlevertexai.js +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleVertexAIConnection = void 0;
|
|
3
|
+
exports.GoogleVertexAILLMConnection = exports.GoogleVertexAIConnection = void 0;
|
|
4
4
|
const google_auth_library_1 = require("google-auth-library");
|
|
5
5
|
class GoogleVertexAIConnection {
|
|
6
6
|
constructor(fields, caller) {
|
|
@@ -22,11 +22,11 @@ class GoogleVertexAIConnection {
|
|
|
22
22
|
writable: true,
|
|
23
23
|
value: "us-central1"
|
|
24
24
|
});
|
|
25
|
-
Object.defineProperty(this, "
|
|
25
|
+
Object.defineProperty(this, "apiVersion", {
|
|
26
26
|
enumerable: true,
|
|
27
27
|
configurable: true,
|
|
28
28
|
writable: true,
|
|
29
|
-
value:
|
|
29
|
+
value: "v1"
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(this, "auth", {
|
|
32
32
|
enumerable: true,
|
|
@@ -37,31 +37,65 @@ class GoogleVertexAIConnection {
|
|
|
37
37
|
this.caller = caller;
|
|
38
38
|
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
39
39
|
this.location = fields?.location ?? this.location;
|
|
40
|
-
this.
|
|
40
|
+
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
41
41
|
this.auth = new google_auth_library_1.GoogleAuth({
|
|
42
42
|
scopes: "https://www.googleapis.com/auth/cloud-platform",
|
|
43
43
|
...fields?.authOptions,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
buildMethod() {
|
|
47
|
+
return "POST";
|
|
48
|
+
}
|
|
49
|
+
async _request(data, options) {
|
|
47
50
|
const client = await this.auth.getClient();
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const data = {
|
|
52
|
-
instances,
|
|
53
|
-
parameters,
|
|
54
|
-
};
|
|
51
|
+
const url = await this.buildUrl();
|
|
52
|
+
const method = this.buildMethod();
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
54
|
const opts = {
|
|
56
55
|
url,
|
|
57
56
|
method,
|
|
58
|
-
data,
|
|
59
57
|
};
|
|
58
|
+
if (data && method === "POST") {
|
|
59
|
+
opts.data = data;
|
|
60
|
+
}
|
|
60
61
|
async function _request() {
|
|
61
62
|
return client.request(opts);
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
try {
|
|
65
|
+
const callResponse = await this.caller.callWithOptions({ signal: options?.signal }, _request.bind(client));
|
|
66
|
+
const response = callResponse; // Done for typecast safety, I guess
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
69
|
+
catch (x) {
|
|
70
|
+
console.error(JSON.stringify(x, null, 1));
|
|
71
|
+
throw x;
|
|
72
|
+
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
exports.GoogleVertexAIConnection = GoogleVertexAIConnection;
|
|
76
|
+
class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
|
|
77
|
+
constructor(fields, caller) {
|
|
78
|
+
super(fields, caller);
|
|
79
|
+
Object.defineProperty(this, "model", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: void 0
|
|
84
|
+
});
|
|
85
|
+
this.model = fields?.model ?? this.model;
|
|
86
|
+
}
|
|
87
|
+
async buildUrl() {
|
|
88
|
+
const projectId = await this.auth.getProjectId();
|
|
89
|
+
const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
|
|
90
|
+
return url;
|
|
91
|
+
}
|
|
92
|
+
async request(instances, parameters, options) {
|
|
93
|
+
const data = {
|
|
94
|
+
instances,
|
|
95
|
+
parameters,
|
|
96
|
+
};
|
|
97
|
+
const response = await this._request(data, options);
|
|
98
|
+
return response;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GoogleVertexAILLMConnection = GoogleVertexAILLMConnection;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { GoogleAuth } from "google-auth-library";
|
|
2
2
|
import { BaseLanguageModelCallOptions } from "../base_language/index.js";
|
|
3
|
-
import { AsyncCaller } from "./async_caller.js";
|
|
4
|
-
import { GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams } from "../types/googlevertexai-types.js";
|
|
5
|
-
export declare class GoogleVertexAIConnection<CallOptions extends
|
|
3
|
+
import { AsyncCaller, AsyncCallerCallOptions } from "./async_caller.js";
|
|
4
|
+
import { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams, GoogleVertexAIResponse } from "../types/googlevertexai-types.js";
|
|
5
|
+
export declare abstract class GoogleVertexAIConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleVertexAIResponse> implements GoogleVertexAIConnectionParams {
|
|
6
6
|
caller: AsyncCaller;
|
|
7
7
|
endpoint: string;
|
|
8
8
|
location: string;
|
|
9
|
-
|
|
9
|
+
apiVersion: string;
|
|
10
10
|
auth: GoogleAuth;
|
|
11
11
|
constructor(fields: GoogleVertexAIConnectionParams | undefined, caller: AsyncCaller);
|
|
12
|
+
abstract buildUrl(): Promise<string>;
|
|
13
|
+
buildMethod(): string;
|
|
14
|
+
_request(data: unknown | undefined, options: CallOptions): Promise<ResponseType>;
|
|
15
|
+
}
|
|
16
|
+
export declare class GoogleVertexAILLMConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction> extends GoogleVertexAIConnection<CallOptions, PredictionType> implements GoogleVertexAIBaseLLMInput {
|
|
17
|
+
model: string;
|
|
18
|
+
constructor(fields: GoogleVertexAIBaseLLMInput | undefined, caller: AsyncCaller);
|
|
19
|
+
buildUrl(): Promise<string>;
|
|
12
20
|
request(instances: InstanceType[], parameters: GoogleVertexAIModelParams, options: CallOptions): Promise<GoogleVertexAILLMResponse<PredictionType>>;
|
|
13
21
|
}
|
|
@@ -19,11 +19,11 @@ export class GoogleVertexAIConnection {
|
|
|
19
19
|
writable: true,
|
|
20
20
|
value: "us-central1"
|
|
21
21
|
});
|
|
22
|
-
Object.defineProperty(this, "
|
|
22
|
+
Object.defineProperty(this, "apiVersion", {
|
|
23
23
|
enumerable: true,
|
|
24
24
|
configurable: true,
|
|
25
25
|
writable: true,
|
|
26
|
-
value:
|
|
26
|
+
value: "v1"
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(this, "auth", {
|
|
29
29
|
enumerable: true,
|
|
@@ -34,30 +34,63 @@ export class GoogleVertexAIConnection {
|
|
|
34
34
|
this.caller = caller;
|
|
35
35
|
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
36
36
|
this.location = fields?.location ?? this.location;
|
|
37
|
-
this.
|
|
37
|
+
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
38
38
|
this.auth = new GoogleAuth({
|
|
39
39
|
scopes: "https://www.googleapis.com/auth/cloud-platform",
|
|
40
40
|
...fields?.authOptions,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
buildMethod() {
|
|
44
|
+
return "POST";
|
|
45
|
+
}
|
|
46
|
+
async _request(data, options) {
|
|
44
47
|
const client = await this.auth.getClient();
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const data = {
|
|
49
|
-
instances,
|
|
50
|
-
parameters,
|
|
51
|
-
};
|
|
48
|
+
const url = await this.buildUrl();
|
|
49
|
+
const method = this.buildMethod();
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
51
|
const opts = {
|
|
53
52
|
url,
|
|
54
53
|
method,
|
|
55
|
-
data,
|
|
56
54
|
};
|
|
55
|
+
if (data && method === "POST") {
|
|
56
|
+
opts.data = data;
|
|
57
|
+
}
|
|
57
58
|
async function _request() {
|
|
58
59
|
return client.request(opts);
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
+
try {
|
|
62
|
+
const callResponse = await this.caller.callWithOptions({ signal: options?.signal }, _request.bind(client));
|
|
63
|
+
const response = callResponse; // Done for typecast safety, I guess
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
66
|
+
catch (x) {
|
|
67
|
+
console.error(JSON.stringify(x, null, 1));
|
|
68
|
+
throw x;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
|
|
73
|
+
constructor(fields, caller) {
|
|
74
|
+
super(fields, caller);
|
|
75
|
+
Object.defineProperty(this, "model", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
configurable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
value: void 0
|
|
80
|
+
});
|
|
81
|
+
this.model = fields?.model ?? this.model;
|
|
82
|
+
}
|
|
83
|
+
async buildUrl() {
|
|
84
|
+
const projectId = await this.auth.getProjectId();
|
|
85
|
+
const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
|
|
86
|
+
return url;
|
|
87
|
+
}
|
|
88
|
+
async request(instances, parameters, options) {
|
|
89
|
+
const data = {
|
|
90
|
+
instances,
|
|
91
|
+
parameters,
|
|
92
|
+
};
|
|
93
|
+
const response = await this._request(data, options);
|
|
61
94
|
return response;
|
|
62
95
|
}
|
|
63
96
|
}
|