langchain 0.0.147 → 0.0.149
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/chat_models/googlevertexai/web.cjs +1 -0
- package/chat_models/googlevertexai/web.d.ts +1 -0
- package/chat_models/googlevertexai/web.js +1 -0
- package/chat_models/googlevertexai.cjs +1 -1
- package/chat_models/googlevertexai.d.ts +1 -1
- package/chat_models/googlevertexai.js +1 -1
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +272 -1
- package/dist/chains/constitutional_ai/constitutional_principle.js +272 -1
- package/dist/chains/question_answering/load.cjs +12 -4
- package/dist/chains/question_answering/load.d.ts +2 -0
- package/dist/chains/question_answering/load.js +12 -4
- package/dist/chains/summarization/load.cjs +8 -4
- package/dist/chains/summarization/load.d.ts +2 -0
- package/dist/chains/summarization/load.js +8 -4
- package/dist/chat_models/{googlevertexai.cjs → googlevertexai/common.cjs} +14 -26
- package/dist/chat_models/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -22
- package/dist/chat_models/{googlevertexai.js → googlevertexai/common.js} +12 -24
- package/dist/chat_models/googlevertexai/index.cjs +36 -0
- package/dist/chat_models/googlevertexai/index.d.ts +21 -0
- package/dist/chat_models/googlevertexai/index.js +31 -0
- package/dist/chat_models/googlevertexai/web.cjs +33 -0
- package/dist/chat_models/googlevertexai/web.d.ts +19 -0
- package/dist/chat_models/googlevertexai/web.js +28 -0
- package/dist/document_loaders/web/notionapi.cjs +93 -70
- package/dist/document_loaders/web/notionapi.d.ts +33 -1
- package/dist/document_loaders/web/notionapi.js +89 -71
- package/dist/embeddings/googlevertexai.cjs +5 -1
- package/dist/embeddings/googlevertexai.d.ts +2 -1
- package/dist/embeddings/googlevertexai.js +5 -1
- package/dist/evaluation/agents/index.cjs +17 -0
- package/dist/evaluation/agents/index.d.ts +1 -0
- package/dist/evaluation/agents/index.js +1 -0
- package/dist/evaluation/agents/prompt.cjs +132 -0
- package/dist/evaluation/agents/prompt.d.ts +6 -0
- package/dist/evaluation/agents/prompt.js +129 -0
- package/dist/evaluation/agents/trajectory.cjs +189 -0
- package/dist/evaluation/agents/trajectory.d.ts +54 -0
- package/dist/evaluation/agents/trajectory.js +184 -0
- package/dist/evaluation/base.cjs +274 -0
- package/dist/evaluation/base.d.ts +232 -0
- package/dist/evaluation/base.js +263 -0
- package/dist/evaluation/comparison/index.cjs +17 -0
- package/dist/evaluation/comparison/index.d.ts +1 -0
- package/dist/evaluation/comparison/index.js +1 -0
- package/dist/evaluation/comparison/pairwise.cjs +244 -0
- package/dist/evaluation/comparison/pairwise.d.ts +50 -0
- package/dist/evaluation/comparison/pairwise.js +238 -0
- package/dist/evaluation/comparison/prompt.cjs +74 -0
- package/dist/evaluation/comparison/prompt.d.ts +21 -0
- package/dist/evaluation/comparison/prompt.js +71 -0
- package/dist/evaluation/criteria/criteria.cjs +259 -0
- package/dist/evaluation/criteria/criteria.d.ts +73 -0
- package/dist/evaluation/criteria/criteria.js +253 -0
- package/dist/evaluation/criteria/index.cjs +17 -0
- package/dist/evaluation/criteria/index.d.ts +1 -0
- package/dist/evaluation/criteria/index.js +1 -0
- package/dist/evaluation/criteria/prompt.cjs +36 -0
- package/dist/evaluation/criteria/prompt.d.ts +12 -0
- package/dist/evaluation/criteria/prompt.js +33 -0
- package/dist/evaluation/embedding_distance/base.cjs +163 -0
- package/dist/evaluation/embedding_distance/base.d.ts +78 -0
- package/dist/evaluation/embedding_distance/base.js +156 -0
- package/dist/evaluation/embedding_distance/index.cjs +17 -0
- package/dist/evaluation/embedding_distance/index.d.ts +1 -0
- package/dist/evaluation/embedding_distance/index.js +1 -0
- package/dist/evaluation/index.cjs +6 -0
- package/dist/evaluation/index.d.ts +6 -0
- package/dist/evaluation/index.js +6 -0
- package/dist/evaluation/loader.cjs +60 -0
- package/dist/evaluation/loader.d.ts +27 -0
- package/dist/evaluation/loader.js +56 -0
- package/dist/evaluation/types.cjs +2 -0
- package/dist/evaluation/types.d.ts +35 -0
- package/dist/evaluation/types.js +1 -0
- package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +5 -1
- package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -1
- package/dist/experimental/multimodal_embeddings/googlevertexai.js +5 -1
- package/dist/llms/bedrock.cjs +9 -1
- package/dist/llms/bedrock.d.ts +3 -0
- package/dist/llms/bedrock.js +9 -1
- package/dist/llms/{googlevertexai.js → googlevertexai/common.cjs} +21 -17
- package/dist/llms/{googlevertexai.d.ts → googlevertexai/common.d.ts} +13 -23
- package/dist/llms/{googlevertexai.cjs → googlevertexai/common.js} +17 -21
- package/dist/llms/googlevertexai/index.cjs +34 -0
- package/dist/llms/googlevertexai/index.d.ts +26 -0
- package/dist/llms/googlevertexai/index.js +30 -0
- package/dist/llms/googlevertexai/web.cjs +31 -0
- package/dist/llms/googlevertexai/web.d.ts +24 -0
- package/dist/llms/googlevertexai/web.js +27 -0
- package/dist/load/import_constants.cjs +2 -0
- package/dist/load/import_constants.js +2 -0
- package/dist/load/import_map.cjs +2 -1
- package/dist/load/import_map.d.ts +1 -0
- package/dist/load/import_map.js +1 -0
- package/dist/load/serializable.cjs +23 -4
- package/dist/load/serializable.js +23 -4
- package/dist/retrievers/multi_query.cjs +140 -0
- package/dist/retrievers/multi_query.d.ts +33 -0
- package/dist/retrievers/multi_query.js +136 -0
- package/dist/retrievers/self_query/base.cjs +1 -1
- package/dist/retrievers/self_query/base.js +2 -2
- package/dist/retrievers/self_query/functional.cjs +1 -1
- package/dist/retrievers/self_query/functional.js +2 -2
- package/dist/retrievers/self_query/utils.cjs +46 -6
- package/dist/retrievers/self_query/utils.d.ts +7 -0
- package/dist/retrievers/self_query/utils.js +44 -5
- package/dist/schema/runnable/base.cjs +910 -0
- package/dist/schema/runnable/base.d.ts +300 -0
- package/dist/schema/runnable/base.js +896 -0
- package/dist/schema/runnable/index.cjs +19 -926
- package/dist/schema/runnable/index.d.ts +4 -298
- package/dist/schema/runnable/index.js +3 -914
- package/dist/schema/runnable/passthrough.cjs +31 -0
- package/dist/schema/runnable/passthrough.d.ts +11 -0
- package/dist/schema/runnable/passthrough.js +27 -0
- package/dist/schema/runnable/router.cjs +74 -0
- package/dist/schema/runnable/router.d.ts +29 -0
- package/dist/schema/runnable/router.js +70 -0
- package/dist/types/googlevertexai-types.d.ts +11 -4
- package/dist/util/googlevertexai-connection.cjs +14 -15
- package/dist/util/googlevertexai-connection.d.ts +7 -7
- package/dist/util/googlevertexai-connection.js +14 -15
- package/dist/util/googlevertexai-webauth.cjs +56 -0
- package/dist/util/googlevertexai-webauth.d.ts +25 -0
- package/dist/util/googlevertexai-webauth.js +52 -0
- package/dist/vectorstores/googlevertexai.cjs +9 -8
- package/dist/vectorstores/googlevertexai.d.ts +8 -7
- package/dist/vectorstores/googlevertexai.js +9 -8
- package/dist/vectorstores/opensearch.cjs +4 -2
- package/dist/vectorstores/opensearch.d.ts +4 -1
- package/dist/vectorstores/opensearch.js +4 -2
- package/llms/googlevertexai/web.cjs +1 -0
- package/llms/googlevertexai/web.d.ts +1 -0
- package/llms/googlevertexai/web.js +1 -0
- package/llms/googlevertexai.cjs +1 -1
- package/llms/googlevertexai.d.ts +1 -1
- package/llms/googlevertexai.js +1 -1
- package/package.json +32 -3
- package/retrievers/multi_query.cjs +1 -0
- package/retrievers/multi_query.d.ts +1 -0
- package/retrievers/multi_query.js +1 -0
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.MatchingEngine = exports.IdDocument = void 0;
|
|
30
30
|
const uuid = __importStar(require("uuid"));
|
|
31
31
|
const flat_1 = __importDefault(require("flat"));
|
|
32
|
+
const google_auth_library_1 = require("google-auth-library");
|
|
32
33
|
const base_js_1 = require("./base.cjs");
|
|
33
34
|
const document_js_1 = require("../document.cjs");
|
|
34
35
|
const googlevertexai_connection_js_1 = require("../util/googlevertexai-connection.cjs");
|
|
@@ -51,7 +52,7 @@ class IdDocument extends document_js_1.Document {
|
|
|
51
52
|
exports.IdDocument = IdDocument;
|
|
52
53
|
class IndexEndpointConnection extends googlevertexai_connection_js_1.GoogleVertexAIConnection {
|
|
53
54
|
constructor(fields, caller) {
|
|
54
|
-
super(fields, caller);
|
|
55
|
+
super(fields, caller, new google_auth_library_1.GoogleAuth(fields.authOptions));
|
|
55
56
|
Object.defineProperty(this, "indexEndpoint", {
|
|
56
57
|
enumerable: true,
|
|
57
58
|
configurable: true,
|
|
@@ -61,7 +62,7 @@ class IndexEndpointConnection extends googlevertexai_connection_js_1.GoogleVerte
|
|
|
61
62
|
this.indexEndpoint = fields.indexEndpoint;
|
|
62
63
|
}
|
|
63
64
|
async buildUrl() {
|
|
64
|
-
const projectId = await this.
|
|
65
|
+
const projectId = await this.client.getProjectId();
|
|
65
66
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexEndpoints/${this.indexEndpoint}`;
|
|
66
67
|
return url;
|
|
67
68
|
}
|
|
@@ -74,7 +75,7 @@ class IndexEndpointConnection extends googlevertexai_connection_js_1.GoogleVerte
|
|
|
74
75
|
}
|
|
75
76
|
class RemoveDatapointConnection extends googlevertexai_connection_js_1.GoogleVertexAIConnection {
|
|
76
77
|
constructor(fields, caller) {
|
|
77
|
-
super(fields, caller);
|
|
78
|
+
super(fields, caller, new google_auth_library_1.GoogleAuth(fields.authOptions));
|
|
78
79
|
Object.defineProperty(this, "index", {
|
|
79
80
|
enumerable: true,
|
|
80
81
|
configurable: true,
|
|
@@ -84,7 +85,7 @@ class RemoveDatapointConnection extends googlevertexai_connection_js_1.GoogleVer
|
|
|
84
85
|
this.index = fields.index;
|
|
85
86
|
}
|
|
86
87
|
async buildUrl() {
|
|
87
|
-
const projectId = await this.
|
|
88
|
+
const projectId = await this.client.getProjectId();
|
|
88
89
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexes/${this.index}:removeDatapoints`;
|
|
89
90
|
return url;
|
|
90
91
|
}
|
|
@@ -100,7 +101,7 @@ class RemoveDatapointConnection extends googlevertexai_connection_js_1.GoogleVer
|
|
|
100
101
|
}
|
|
101
102
|
class UpsertDatapointConnection extends googlevertexai_connection_js_1.GoogleVertexAIConnection {
|
|
102
103
|
constructor(fields, caller) {
|
|
103
|
-
super(fields, caller);
|
|
104
|
+
super(fields, caller, new google_auth_library_1.GoogleAuth(fields.authOptions));
|
|
104
105
|
Object.defineProperty(this, "index", {
|
|
105
106
|
enumerable: true,
|
|
106
107
|
configurable: true,
|
|
@@ -110,7 +111,7 @@ class UpsertDatapointConnection extends googlevertexai_connection_js_1.GoogleVer
|
|
|
110
111
|
this.index = fields.index;
|
|
111
112
|
}
|
|
112
113
|
async buildUrl() {
|
|
113
|
-
const projectId = await this.
|
|
114
|
+
const projectId = await this.client.getProjectId();
|
|
114
115
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexes/${this.index}:upsertDatapoints`;
|
|
115
116
|
return url;
|
|
116
117
|
}
|
|
@@ -126,7 +127,7 @@ class UpsertDatapointConnection extends googlevertexai_connection_js_1.GoogleVer
|
|
|
126
127
|
}
|
|
127
128
|
class FindNeighborsConnection extends googlevertexai_connection_js_1.GoogleVertexAIConnection {
|
|
128
129
|
constructor(params, caller) {
|
|
129
|
-
super(params, caller);
|
|
130
|
+
super(params, caller, new google_auth_library_1.GoogleAuth(params.authOptions));
|
|
130
131
|
Object.defineProperty(this, "indexEndpoint", {
|
|
131
132
|
enumerable: true,
|
|
132
133
|
configurable: true,
|
|
@@ -143,7 +144,7 @@ class FindNeighborsConnection extends googlevertexai_connection_js_1.GoogleVerte
|
|
|
143
144
|
this.deployedIndexId = params.deployedIndexId;
|
|
144
145
|
}
|
|
145
146
|
async buildUrl() {
|
|
146
|
-
const projectId = await this.
|
|
147
|
+
const projectId = await this.client.getProjectId();
|
|
147
148
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexEndpoints/${this.indexEndpoint}:findNeighbors`;
|
|
148
149
|
return url;
|
|
149
150
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GoogleAuthOptions } from "google-auth-library";
|
|
1
2
|
import { VectorStore } from "./base.js";
|
|
2
3
|
import { Embeddings } from "../embeddings/base.js";
|
|
3
4
|
import { Document, DocumentInput } from "../document.js";
|
|
@@ -18,7 +19,7 @@ export declare class IdDocument extends Document implements IdDocumentInput {
|
|
|
18
19
|
id?: string;
|
|
19
20
|
constructor(fields: IdDocumentInput);
|
|
20
21
|
}
|
|
21
|
-
interface IndexEndpointConnectionParams extends GoogleVertexAIConnectionParams {
|
|
22
|
+
interface IndexEndpointConnectionParams extends GoogleVertexAIConnectionParams<GoogleAuthOptions> {
|
|
22
23
|
indexEndpoint: string;
|
|
23
24
|
}
|
|
24
25
|
interface DeployedIndex {
|
|
@@ -31,7 +32,7 @@ interface IndexEndpointResponse extends GoogleVertexAIResponse {
|
|
|
31
32
|
publicEndpointDomainName: string;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
declare class IndexEndpointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, IndexEndpointResponse> {
|
|
35
|
+
declare class IndexEndpointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, IndexEndpointResponse, GoogleAuthOptions> {
|
|
35
36
|
indexEndpoint: string;
|
|
36
37
|
constructor(fields: IndexEndpointConnectionParams, caller: AsyncCaller);
|
|
37
38
|
buildUrl(): Promise<string>;
|
|
@@ -45,19 +46,19 @@ declare class IndexEndpointConnection extends GoogleVertexAIConnection<AsyncCall
|
|
|
45
46
|
export interface MatchingEngineDeleteParams {
|
|
46
47
|
ids: string[];
|
|
47
48
|
}
|
|
48
|
-
interface RemoveDatapointParams extends GoogleVertexAIConnectionParams {
|
|
49
|
+
interface RemoveDatapointParams extends GoogleVertexAIConnectionParams<GoogleAuthOptions> {
|
|
49
50
|
index: string;
|
|
50
51
|
}
|
|
51
52
|
interface RemoveDatapointResponse extends GoogleVertexAIResponse {
|
|
52
53
|
}
|
|
53
|
-
declare class RemoveDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, RemoveDatapointResponse> {
|
|
54
|
+
declare class RemoveDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, RemoveDatapointResponse, GoogleAuthOptions> {
|
|
54
55
|
index: string;
|
|
55
56
|
constructor(fields: RemoveDatapointParams, caller: AsyncCaller);
|
|
56
57
|
buildUrl(): Promise<string>;
|
|
57
58
|
buildMethod(): string;
|
|
58
59
|
request(datapointIds: string[], options: AsyncCallerCallOptions): Promise<RemoveDatapointResponse>;
|
|
59
60
|
}
|
|
60
|
-
interface UpsertDatapointParams extends GoogleVertexAIConnectionParams {
|
|
61
|
+
interface UpsertDatapointParams extends GoogleVertexAIConnectionParams<GoogleAuthOptions> {
|
|
61
62
|
index: string;
|
|
62
63
|
}
|
|
63
64
|
export interface Restriction {
|
|
@@ -76,7 +77,7 @@ interface IndexDatapoint {
|
|
|
76
77
|
}
|
|
77
78
|
interface UpsertDatapointResponse extends GoogleVertexAIResponse {
|
|
78
79
|
}
|
|
79
|
-
declare class UpsertDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, UpsertDatapointResponse> {
|
|
80
|
+
declare class UpsertDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, UpsertDatapointResponse, GoogleAuthOptions> {
|
|
80
81
|
index: string;
|
|
81
82
|
constructor(fields: UpsertDatapointParams, caller: AsyncCaller);
|
|
82
83
|
buildUrl(): Promise<string>;
|
|
@@ -94,7 +95,7 @@ export interface PublicAPIEndpointInfo {
|
|
|
94
95
|
/**
|
|
95
96
|
* Parameters necessary to configure the Matching Engine.
|
|
96
97
|
*/
|
|
97
|
-
export interface MatchingEngineArgs extends GoogleVertexAIConnectionParams
|
|
98
|
+
export interface MatchingEngineArgs extends GoogleVertexAIConnectionParams<GoogleAuthOptions>, IndexEndpointConnectionParams, UpsertDatapointParams {
|
|
98
99
|
docstore: Docstore;
|
|
99
100
|
callerParams?: AsyncCallerParams;
|
|
100
101
|
callerOptions?: AsyncCallerCallOptions;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as uuid from "uuid";
|
|
2
2
|
import flatten from "flat";
|
|
3
|
+
import { GoogleAuth } from "google-auth-library";
|
|
3
4
|
import { VectorStore } from "./base.js";
|
|
4
5
|
import { Document } from "../document.js";
|
|
5
6
|
import { GoogleVertexAIConnection } from "../util/googlevertexai-connection.js";
|
|
@@ -21,7 +22,7 @@ export class IdDocument extends Document {
|
|
|
21
22
|
}
|
|
22
23
|
class IndexEndpointConnection extends GoogleVertexAIConnection {
|
|
23
24
|
constructor(fields, caller) {
|
|
24
|
-
super(fields, caller);
|
|
25
|
+
super(fields, caller, new GoogleAuth(fields.authOptions));
|
|
25
26
|
Object.defineProperty(this, "indexEndpoint", {
|
|
26
27
|
enumerable: true,
|
|
27
28
|
configurable: true,
|
|
@@ -31,7 +32,7 @@ class IndexEndpointConnection extends GoogleVertexAIConnection {
|
|
|
31
32
|
this.indexEndpoint = fields.indexEndpoint;
|
|
32
33
|
}
|
|
33
34
|
async buildUrl() {
|
|
34
|
-
const projectId = await this.
|
|
35
|
+
const projectId = await this.client.getProjectId();
|
|
35
36
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexEndpoints/${this.indexEndpoint}`;
|
|
36
37
|
return url;
|
|
37
38
|
}
|
|
@@ -44,7 +45,7 @@ class IndexEndpointConnection extends GoogleVertexAIConnection {
|
|
|
44
45
|
}
|
|
45
46
|
class RemoveDatapointConnection extends GoogleVertexAIConnection {
|
|
46
47
|
constructor(fields, caller) {
|
|
47
|
-
super(fields, caller);
|
|
48
|
+
super(fields, caller, new GoogleAuth(fields.authOptions));
|
|
48
49
|
Object.defineProperty(this, "index", {
|
|
49
50
|
enumerable: true,
|
|
50
51
|
configurable: true,
|
|
@@ -54,7 +55,7 @@ class RemoveDatapointConnection extends GoogleVertexAIConnection {
|
|
|
54
55
|
this.index = fields.index;
|
|
55
56
|
}
|
|
56
57
|
async buildUrl() {
|
|
57
|
-
const projectId = await this.
|
|
58
|
+
const projectId = await this.client.getProjectId();
|
|
58
59
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexes/${this.index}:removeDatapoints`;
|
|
59
60
|
return url;
|
|
60
61
|
}
|
|
@@ -70,7 +71,7 @@ class RemoveDatapointConnection extends GoogleVertexAIConnection {
|
|
|
70
71
|
}
|
|
71
72
|
class UpsertDatapointConnection extends GoogleVertexAIConnection {
|
|
72
73
|
constructor(fields, caller) {
|
|
73
|
-
super(fields, caller);
|
|
74
|
+
super(fields, caller, new GoogleAuth(fields.authOptions));
|
|
74
75
|
Object.defineProperty(this, "index", {
|
|
75
76
|
enumerable: true,
|
|
76
77
|
configurable: true,
|
|
@@ -80,7 +81,7 @@ class UpsertDatapointConnection extends GoogleVertexAIConnection {
|
|
|
80
81
|
this.index = fields.index;
|
|
81
82
|
}
|
|
82
83
|
async buildUrl() {
|
|
83
|
-
const projectId = await this.
|
|
84
|
+
const projectId = await this.client.getProjectId();
|
|
84
85
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexes/${this.index}:upsertDatapoints`;
|
|
85
86
|
return url;
|
|
86
87
|
}
|
|
@@ -96,7 +97,7 @@ class UpsertDatapointConnection extends GoogleVertexAIConnection {
|
|
|
96
97
|
}
|
|
97
98
|
class FindNeighborsConnection extends GoogleVertexAIConnection {
|
|
98
99
|
constructor(params, caller) {
|
|
99
|
-
super(params, caller);
|
|
100
|
+
super(params, caller, new GoogleAuth(params.authOptions));
|
|
100
101
|
Object.defineProperty(this, "indexEndpoint", {
|
|
101
102
|
enumerable: true,
|
|
102
103
|
configurable: true,
|
|
@@ -113,7 +114,7 @@ class FindNeighborsConnection extends GoogleVertexAIConnection {
|
|
|
113
114
|
this.deployedIndexId = params.deployedIndexId;
|
|
114
115
|
}
|
|
115
116
|
async buildUrl() {
|
|
116
|
-
const projectId = await this.
|
|
117
|
+
const projectId = await this.client.getProjectId();
|
|
117
118
|
const url = `https://${this.endpoint}/${this.apiVersion}/projects/${projectId}/locations/${this.location}/indexEndpoints/${this.indexEndpoint}:findNeighbors`;
|
|
118
119
|
return url;
|
|
119
120
|
}
|
|
@@ -106,15 +106,17 @@ class OpenSearchVectorStore extends base_js_1.VectorStore {
|
|
|
106
106
|
* exists, then adds the vectors and associated documents to the index.
|
|
107
107
|
* @param vectors The vectors to be added to the OpenSearch index.
|
|
108
108
|
* @param documents The documents associated with the vectors.
|
|
109
|
+
* @param options Optional parameter that can contain the IDs for the documents.
|
|
109
110
|
* @returns Promise resolving to void.
|
|
110
111
|
*/
|
|
111
|
-
async addVectors(vectors, documents) {
|
|
112
|
+
async addVectors(vectors, documents, options) {
|
|
112
113
|
await this.ensureIndexExists(vectors[0].length, this.engine, this.spaceType, this.efSearch, this.efConstruction, this.m);
|
|
114
|
+
const documentIds = options?.ids ?? Array.from({ length: vectors.length }, () => uuid.v4());
|
|
113
115
|
const operations = vectors.flatMap((embedding, idx) => [
|
|
114
116
|
{
|
|
115
117
|
index: {
|
|
116
118
|
_index: this.indexName,
|
|
117
|
-
_id:
|
|
119
|
+
_id: documentIds[idx],
|
|
118
120
|
},
|
|
119
121
|
},
|
|
120
122
|
{
|
|
@@ -61,9 +61,12 @@ export declare class OpenSearchVectorStore extends VectorStore {
|
|
|
61
61
|
* exists, then adds the vectors and associated documents to the index.
|
|
62
62
|
* @param vectors The vectors to be added to the OpenSearch index.
|
|
63
63
|
* @param documents The documents associated with the vectors.
|
|
64
|
+
* @param options Optional parameter that can contain the IDs for the documents.
|
|
64
65
|
* @returns Promise resolving to void.
|
|
65
66
|
*/
|
|
66
|
-
addVectors(vectors: number[][], documents: Document[]
|
|
67
|
+
addVectors(vectors: number[][], documents: Document[], options?: {
|
|
68
|
+
ids?: string[];
|
|
69
|
+
}): Promise<void>;
|
|
67
70
|
/**
|
|
68
71
|
* Method to perform a similarity search on the OpenSearch index using a
|
|
69
72
|
* query vector. It returns the k most similar documents and their scores.
|
|
@@ -80,15 +80,17 @@ export class OpenSearchVectorStore extends VectorStore {
|
|
|
80
80
|
* exists, then adds the vectors and associated documents to the index.
|
|
81
81
|
* @param vectors The vectors to be added to the OpenSearch index.
|
|
82
82
|
* @param documents The documents associated with the vectors.
|
|
83
|
+
* @param options Optional parameter that can contain the IDs for the documents.
|
|
83
84
|
* @returns Promise resolving to void.
|
|
84
85
|
*/
|
|
85
|
-
async addVectors(vectors, documents) {
|
|
86
|
+
async addVectors(vectors, documents, options) {
|
|
86
87
|
await this.ensureIndexExists(vectors[0].length, this.engine, this.spaceType, this.efSearch, this.efConstruction, this.m);
|
|
88
|
+
const documentIds = options?.ids ?? Array.from({ length: vectors.length }, () => uuid.v4());
|
|
87
89
|
const operations = vectors.flatMap((embedding, idx) => [
|
|
88
90
|
{
|
|
89
91
|
index: {
|
|
90
92
|
_index: this.indexName,
|
|
91
|
-
_id:
|
|
93
|
+
_id: documentIds[idx],
|
|
92
94
|
},
|
|
93
95
|
},
|
|
94
96
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../dist/llms/googlevertexai/web.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/llms/googlevertexai/web.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/llms/googlevertexai/web.js'
|
package/llms/googlevertexai.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('../dist/llms/googlevertexai.cjs');
|
|
1
|
+
module.exports = require('../dist/llms/googlevertexai/index.cjs');
|
package/llms/googlevertexai.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../dist/llms/googlevertexai.js'
|
|
1
|
+
export * from '../dist/llms/googlevertexai/index.js'
|
package/llms/googlevertexai.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../dist/llms/googlevertexai.js'
|
|
1
|
+
export * from '../dist/llms/googlevertexai/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.149",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -139,6 +139,9 @@
|
|
|
139
139
|
"llms/googlevertexai.cjs",
|
|
140
140
|
"llms/googlevertexai.js",
|
|
141
141
|
"llms/googlevertexai.d.ts",
|
|
142
|
+
"llms/googlevertexai/web.cjs",
|
|
143
|
+
"llms/googlevertexai/web.js",
|
|
144
|
+
"llms/googlevertexai/web.d.ts",
|
|
142
145
|
"llms/googlepalm.cjs",
|
|
143
146
|
"llms/googlepalm.js",
|
|
144
147
|
"llms/googlepalm.d.ts",
|
|
@@ -385,6 +388,9 @@
|
|
|
385
388
|
"chat_models/googlevertexai.cjs",
|
|
386
389
|
"chat_models/googlevertexai.js",
|
|
387
390
|
"chat_models/googlevertexai.d.ts",
|
|
391
|
+
"chat_models/googlevertexai/web.cjs",
|
|
392
|
+
"chat_models/googlevertexai/web.js",
|
|
393
|
+
"chat_models/googlevertexai/web.d.ts",
|
|
388
394
|
"chat_models/googlepalm.cjs",
|
|
389
395
|
"chat_models/googlepalm.js",
|
|
390
396
|
"chat_models/googlepalm.d.ts",
|
|
@@ -457,6 +463,9 @@
|
|
|
457
463
|
"retrievers/document_compressors.cjs",
|
|
458
464
|
"retrievers/document_compressors.js",
|
|
459
465
|
"retrievers/document_compressors.d.ts",
|
|
466
|
+
"retrievers/multi_query.cjs",
|
|
467
|
+
"retrievers/multi_query.js",
|
|
468
|
+
"retrievers/multi_query.d.ts",
|
|
460
469
|
"retrievers/multi_vector.cjs",
|
|
461
470
|
"retrievers/multi_vector.js",
|
|
462
471
|
"retrievers/multi_vector.d.ts",
|
|
@@ -641,7 +650,7 @@
|
|
|
641
650
|
"@huggingface/inference": "^1.5.1",
|
|
642
651
|
"@jest/globals": "^29.5.0",
|
|
643
652
|
"@mozilla/readability": "^0.4.4",
|
|
644
|
-
"@notionhq/client": "^2.2.
|
|
653
|
+
"@notionhq/client": "^2.2.10",
|
|
645
654
|
"@opensearch-project/opensearch": "^2.2.0",
|
|
646
655
|
"@pinecone-database/pinecone": "^0.0.14",
|
|
647
656
|
"@planetscale/database": "^1.8.0",
|
|
@@ -733,6 +742,7 @@
|
|
|
733
742
|
"vectordb": "^0.1.4",
|
|
734
743
|
"voy-search": "0.6.2",
|
|
735
744
|
"weaviate-ts-client": "^1.4.0",
|
|
745
|
+
"web-auth-library": "^1.0.3",
|
|
736
746
|
"youtube-transcript": "^1.0.6",
|
|
737
747
|
"youtubei.js": "^5.8.0"
|
|
738
748
|
},
|
|
@@ -757,7 +767,7 @@
|
|
|
757
767
|
"@google-cloud/storage": "^6.10.1",
|
|
758
768
|
"@huggingface/inference": "^1.5.1",
|
|
759
769
|
"@mozilla/readability": "*",
|
|
760
|
-
"@notionhq/client": "^2.2.
|
|
770
|
+
"@notionhq/client": "^2.2.10",
|
|
761
771
|
"@opensearch-project/opensearch": "*",
|
|
762
772
|
"@pinecone-database/pinecone": "*",
|
|
763
773
|
"@planetscale/database": "^1.8.0",
|
|
@@ -814,6 +824,7 @@
|
|
|
814
824
|
"vectordb": "^0.1.4",
|
|
815
825
|
"voy-search": "0.6.2",
|
|
816
826
|
"weaviate-ts-client": "^1.4.0",
|
|
827
|
+
"web-auth-library": "^1.0.3",
|
|
817
828
|
"youtube-transcript": "^1.0.6",
|
|
818
829
|
"youtubei.js": "^5.8.0"
|
|
819
830
|
},
|
|
@@ -1049,6 +1060,9 @@
|
|
|
1049
1060
|
"weaviate-ts-client": {
|
|
1050
1061
|
"optional": true
|
|
1051
1062
|
},
|
|
1063
|
+
"web-auth-library": {
|
|
1064
|
+
"optional": true
|
|
1065
|
+
},
|
|
1052
1066
|
"youtube-transcript": {
|
|
1053
1067
|
"optional": true
|
|
1054
1068
|
},
|
|
@@ -1313,6 +1327,11 @@
|
|
|
1313
1327
|
"import": "./llms/googlevertexai.js",
|
|
1314
1328
|
"require": "./llms/googlevertexai.cjs"
|
|
1315
1329
|
},
|
|
1330
|
+
"./llms/googlevertexai/web": {
|
|
1331
|
+
"types": "./llms/googlevertexai/web.d.ts",
|
|
1332
|
+
"import": "./llms/googlevertexai/web.js",
|
|
1333
|
+
"require": "./llms/googlevertexai/web.cjs"
|
|
1334
|
+
},
|
|
1316
1335
|
"./llms/googlepalm": {
|
|
1317
1336
|
"types": "./llms/googlepalm.d.ts",
|
|
1318
1337
|
"import": "./llms/googlepalm.js",
|
|
@@ -1723,6 +1742,11 @@
|
|
|
1723
1742
|
"import": "./chat_models/googlevertexai.js",
|
|
1724
1743
|
"require": "./chat_models/googlevertexai.cjs"
|
|
1725
1744
|
},
|
|
1745
|
+
"./chat_models/googlevertexai/web": {
|
|
1746
|
+
"types": "./chat_models/googlevertexai/web.d.ts",
|
|
1747
|
+
"import": "./chat_models/googlevertexai/web.js",
|
|
1748
|
+
"require": "./chat_models/googlevertexai/web.cjs"
|
|
1749
|
+
},
|
|
1726
1750
|
"./chat_models/googlepalm": {
|
|
1727
1751
|
"types": "./chat_models/googlepalm.d.ts",
|
|
1728
1752
|
"import": "./chat_models/googlepalm.js",
|
|
@@ -1843,6 +1867,11 @@
|
|
|
1843
1867
|
"import": "./retrievers/document_compressors.js",
|
|
1844
1868
|
"require": "./retrievers/document_compressors.cjs"
|
|
1845
1869
|
},
|
|
1870
|
+
"./retrievers/multi_query": {
|
|
1871
|
+
"types": "./retrievers/multi_query.d.ts",
|
|
1872
|
+
"import": "./retrievers/multi_query.js",
|
|
1873
|
+
"require": "./retrievers/multi_query.cjs"
|
|
1874
|
+
},
|
|
1846
1875
|
"./retrievers/multi_vector": {
|
|
1847
1876
|
"types": "./retrievers/multi_vector.d.ts",
|
|
1848
1877
|
"import": "./retrievers/multi_vector.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/retrievers/multi_query.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/multi_query.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/multi_query.js'
|