langchain 0.0.160 → 0.0.161
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/embeddings/bedrock.cjs +73 -0
- package/dist/embeddings/bedrock.d.ts +47 -0
- package/dist/embeddings/bedrock.js +69 -0
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.cjs +297 -0
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +183 -0
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.js +291 -0
- package/dist/load/import_constants.cjs +2 -0
- package/dist/load/import_constants.js +2 -0
- package/dist/load/import_map.cjs +4 -1
- package/dist/load/import_map.d.ts +3 -0
- package/dist/load/import_map.js +3 -0
- package/dist/retrievers/chaindesk.cjs +71 -0
- package/dist/retrievers/chaindesk.d.ts +18 -0
- package/dist/retrievers/chaindesk.js +67 -0
- package/dist/retrievers/contextual_compression.cjs +2 -2
- package/dist/retrievers/contextual_compression.js +2 -2
- package/dist/retrievers/databerry.cjs +1 -0
- package/dist/retrievers/databerry.d.ts +1 -0
- package/dist/retrievers/databerry.js +1 -0
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +78 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +39 -0
- package/dist/retrievers/document_compressors/embeddings_filter.js +74 -0
- package/dist/retrievers/document_compressors/index.cjs +33 -1
- package/dist/retrievers/document_compressors/index.d.ts +14 -1
- package/dist/retrievers/document_compressors/index.js +31 -0
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.cjs +28 -0
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.d.ts +1 -0
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.js +26 -0
- package/dist/retrievers/tavily_search_api.cjs +144 -0
- package/dist/retrievers/tavily_search_api.d.ts +38 -0
- package/dist/retrievers/tavily_search_api.js +140 -0
- package/dist/schema/runnable/base.cjs +3 -0
- package/dist/schema/runnable/base.d.ts +1 -0
- package/dist/schema/runnable/base.js +3 -0
- package/dist/text_splitter.cjs +22 -8
- package/dist/text_splitter.d.ts +1 -0
- package/dist/text_splitter.js +22 -8
- package/dist/types/googlevertexai-types.d.ts +7 -5
- package/dist/util/googlevertexai-connection.cjs +35 -27
- package/dist/util/googlevertexai-connection.d.ts +12 -8
- package/dist/util/googlevertexai-connection.js +33 -26
- package/dist/util/googlevertexai-webauth.d.ts +2 -2
- package/dist/vectorstores/googlevertexai.d.ts +4 -4
- package/embeddings/bedrock.cjs +1 -0
- package/embeddings/bedrock.d.ts +1 -0
- package/embeddings/bedrock.js +1 -0
- package/experimental/hubs/makersuite/googlemakersuitehub.cjs +1 -0
- package/experimental/hubs/makersuite/googlemakersuitehub.d.ts +1 -0
- package/experimental/hubs/makersuite/googlemakersuitehub.js +1 -0
- package/package.json +46 -1
- package/retrievers/chaindesk.cjs +1 -0
- package/retrievers/chaindesk.d.ts +1 -0
- package/retrievers/chaindesk.js +1 -0
- package/retrievers/document_compressors/embeddings_filter.cjs +1 -0
- package/retrievers/document_compressors/embeddings_filter.d.ts +1 -0
- package/retrievers/document_compressors/embeddings_filter.js +1 -0
- package/retrievers/tavily_search_api.cjs +1 -0
- package/retrievers/tavily_search_api.d.ts +1 -0
- package/retrievers/tavily_search_api.js +1 -0
|
@@ -858,6 +858,9 @@ class RunnableMap extends Runnable {
|
|
|
858
858
|
this.steps[key] = _coerceToRunnable(value);
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
+
static from(steps) {
|
|
862
|
+
return new RunnableMap({ steps });
|
|
863
|
+
}
|
|
861
864
|
async invoke(input, options
|
|
862
865
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
863
866
|
) {
|
|
@@ -287,6 +287,7 @@ export declare class RunnableMap<RunInput> extends Runnable<RunInput, Record<str
|
|
|
287
287
|
constructor(fields: {
|
|
288
288
|
steps: Record<string, RunnableLike<RunInput>>;
|
|
289
289
|
});
|
|
290
|
+
static from<RunInput>(steps: Record<string, RunnableLike<RunInput>>): RunnableMap<RunInput>;
|
|
290
291
|
invoke(input: RunInput, options?: Partial<BaseCallbackConfig>): Promise<Record<string, any>>;
|
|
291
292
|
}
|
|
292
293
|
/**
|
|
@@ -847,6 +847,9 @@ export class RunnableMap extends Runnable {
|
|
|
847
847
|
this.steps[key] = _coerceToRunnable(value);
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
+
static from(steps) {
|
|
851
|
+
return new RunnableMap({ steps });
|
|
852
|
+
}
|
|
850
853
|
async invoke(input, options
|
|
851
854
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
852
855
|
) {
|
package/dist/text_splitter.cjs
CHANGED
|
@@ -76,21 +76,30 @@ class TextSplitter extends document_js_2.BaseDocumentTransformer {
|
|
|
76
76
|
const text = texts[i];
|
|
77
77
|
let lineCounterIndex = 1;
|
|
78
78
|
let prevChunk = null;
|
|
79
|
+
let indexPrevChunk = -1;
|
|
79
80
|
for (const chunk of await this.splitText(text)) {
|
|
80
81
|
let pageContent = chunkHeader;
|
|
81
82
|
// we need to count the \n that are in the text before getting removed by the splitting
|
|
82
|
-
|
|
83
|
-
if (prevChunk) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
const indexChunk = text.indexOf(chunk, indexPrevChunk + 1);
|
|
84
|
+
if (prevChunk === null) {
|
|
85
|
+
const newLinesBeforeFirstChunk = this.numberOfNewLines(text, 0, indexChunk);
|
|
86
|
+
lineCounterIndex += newLinesBeforeFirstChunk;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const indexEndPrevChunk = indexPrevChunk + (await this.lengthFunction(prevChunk));
|
|
90
|
+
if (indexEndPrevChunk < indexChunk) {
|
|
91
|
+
const numberOfIntermediateNewLines = this.numberOfNewLines(text, indexEndPrevChunk, indexChunk);
|
|
92
|
+
lineCounterIndex += numberOfIntermediateNewLines;
|
|
93
|
+
}
|
|
94
|
+
else if (indexEndPrevChunk > indexChunk) {
|
|
95
|
+
const numberOfIntermediateNewLines = this.numberOfNewLines(text, indexChunk, indexEndPrevChunk);
|
|
96
|
+
lineCounterIndex -= numberOfIntermediateNewLines;
|
|
97
|
+
}
|
|
88
98
|
if (appendChunkOverlapHeader) {
|
|
89
99
|
pageContent += chunkOverlapHeader;
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
const newLinesCount = (chunk.match(/\n/g) || []).length;
|
|
102
|
+
const newLinesCount = this.numberOfNewLines(chunk);
|
|
94
103
|
const loc = _metadatas[i].loc && typeof _metadatas[i].loc === "object"
|
|
95
104
|
? { ..._metadatas[i].loc }
|
|
96
105
|
: {};
|
|
@@ -109,10 +118,15 @@ class TextSplitter extends document_js_2.BaseDocumentTransformer {
|
|
|
109
118
|
}));
|
|
110
119
|
lineCounterIndex += newLinesCount;
|
|
111
120
|
prevChunk = chunk;
|
|
121
|
+
indexPrevChunk = indexChunk;
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
return documents;
|
|
115
125
|
}
|
|
126
|
+
numberOfNewLines(text, start, end) {
|
|
127
|
+
const textSection = text.slice(start, end);
|
|
128
|
+
return (textSection.match(/\n/g) || []).length;
|
|
129
|
+
}
|
|
116
130
|
async splitDocuments(documents, chunkHeaderOptions = {}) {
|
|
117
131
|
const selectedDocuments = documents.filter((doc) => doc.pageContent !== undefined);
|
|
118
132
|
const texts = selectedDocuments.map((doc) => doc.pageContent);
|
package/dist/text_splitter.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare abstract class TextSplitter extends BaseDocumentTransformer imple
|
|
|
23
23
|
abstract splitText(text: string): Promise<string[]>;
|
|
24
24
|
protected splitOnSeparator(text: string, separator: string): string[];
|
|
25
25
|
createDocuments(texts: string[], metadatas?: Record<string, any>[], chunkHeaderOptions?: TextSplitterChunkHeaderOptions): Promise<Document[]>;
|
|
26
|
+
private numberOfNewLines;
|
|
26
27
|
splitDocuments(documents: Document[], chunkHeaderOptions?: TextSplitterChunkHeaderOptions): Promise<Document[]>;
|
|
27
28
|
private joinDocs;
|
|
28
29
|
mergeSplits(splits: string[], separator: string): Promise<string[]>;
|
package/dist/text_splitter.js
CHANGED
|
@@ -73,21 +73,30 @@ export class TextSplitter extends BaseDocumentTransformer {
|
|
|
73
73
|
const text = texts[i];
|
|
74
74
|
let lineCounterIndex = 1;
|
|
75
75
|
let prevChunk = null;
|
|
76
|
+
let indexPrevChunk = -1;
|
|
76
77
|
for (const chunk of await this.splitText(text)) {
|
|
77
78
|
let pageContent = chunkHeader;
|
|
78
79
|
// we need to count the \n that are in the text before getting removed by the splitting
|
|
79
|
-
|
|
80
|
-
if (prevChunk) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
const indexChunk = text.indexOf(chunk, indexPrevChunk + 1);
|
|
81
|
+
if (prevChunk === null) {
|
|
82
|
+
const newLinesBeforeFirstChunk = this.numberOfNewLines(text, 0, indexChunk);
|
|
83
|
+
lineCounterIndex += newLinesBeforeFirstChunk;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const indexEndPrevChunk = indexPrevChunk + (await this.lengthFunction(prevChunk));
|
|
87
|
+
if (indexEndPrevChunk < indexChunk) {
|
|
88
|
+
const numberOfIntermediateNewLines = this.numberOfNewLines(text, indexEndPrevChunk, indexChunk);
|
|
89
|
+
lineCounterIndex += numberOfIntermediateNewLines;
|
|
90
|
+
}
|
|
91
|
+
else if (indexEndPrevChunk > indexChunk) {
|
|
92
|
+
const numberOfIntermediateNewLines = this.numberOfNewLines(text, indexChunk, indexEndPrevChunk);
|
|
93
|
+
lineCounterIndex -= numberOfIntermediateNewLines;
|
|
94
|
+
}
|
|
85
95
|
if (appendChunkOverlapHeader) {
|
|
86
96
|
pageContent += chunkOverlapHeader;
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
|
-
|
|
90
|
-
const newLinesCount = (chunk.match(/\n/g) || []).length;
|
|
99
|
+
const newLinesCount = this.numberOfNewLines(chunk);
|
|
91
100
|
const loc = _metadatas[i].loc && typeof _metadatas[i].loc === "object"
|
|
92
101
|
? { ..._metadatas[i].loc }
|
|
93
102
|
: {};
|
|
@@ -106,10 +115,15 @@ export class TextSplitter extends BaseDocumentTransformer {
|
|
|
106
115
|
}));
|
|
107
116
|
lineCounterIndex += newLinesCount;
|
|
108
117
|
prevChunk = chunk;
|
|
118
|
+
indexPrevChunk = indexChunk;
|
|
109
119
|
}
|
|
110
120
|
}
|
|
111
121
|
return documents;
|
|
112
122
|
}
|
|
123
|
+
numberOfNewLines(text, start, end) {
|
|
124
|
+
const textSection = text.slice(start, end);
|
|
125
|
+
return (textSection.match(/\n/g) || []).length;
|
|
126
|
+
}
|
|
113
127
|
async splitDocuments(documents, chunkHeaderOptions = {}) {
|
|
114
128
|
const selectedDocuments = documents.filter((doc) => doc.pageContent !== undefined);
|
|
115
129
|
const texts = selectedDocuments.map((doc) => doc.pageContent);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BaseLLMParams } from "../llms/base.js";
|
|
2
|
-
export interface
|
|
2
|
+
export interface GoogleConnectionParams<AuthOptions> {
|
|
3
|
+
authOptions?: AuthOptions;
|
|
4
|
+
}
|
|
5
|
+
export interface GoogleVertexAIConnectionParams<AuthOptions> extends GoogleConnectionParams<AuthOptions> {
|
|
3
6
|
/** Hostname for the API call */
|
|
4
7
|
endpoint?: string;
|
|
5
|
-
authOptions?: AuthOptions;
|
|
6
8
|
/** Region where the LLM is stored */
|
|
7
9
|
location?: string;
|
|
8
10
|
/** The version of the API functions. Part of the path. */
|
|
@@ -40,10 +42,10 @@ export interface GoogleVertexAIModelParams {
|
|
|
40
42
|
}
|
|
41
43
|
export interface GoogleVertexAIBaseLLMInput<AuthOptions> extends BaseLLMParams, GoogleVertexAIConnectionParams<AuthOptions>, GoogleVertexAIModelParams {
|
|
42
44
|
}
|
|
43
|
-
export interface
|
|
45
|
+
export interface GoogleResponse {
|
|
44
46
|
data: any;
|
|
45
47
|
}
|
|
46
|
-
export interface GoogleVertexAIBasePrediction extends
|
|
48
|
+
export interface GoogleVertexAIBasePrediction extends GoogleResponse {
|
|
47
49
|
safetyAttributes?: any;
|
|
48
50
|
}
|
|
49
51
|
export interface GoogleVertexAILLMResponse<PredictionType extends GoogleVertexAIBasePrediction> {
|
|
@@ -51,7 +53,7 @@ export interface GoogleVertexAILLMResponse<PredictionType extends GoogleVertexAI
|
|
|
51
53
|
predictions: PredictionType[];
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
export interface
|
|
56
|
+
export interface GoogleAbstractedClient {
|
|
55
57
|
request: (opts: {
|
|
56
58
|
url?: string;
|
|
57
59
|
method?: "GET" | "POST";
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleVertexAILLMConnection = exports.GoogleVertexAIConnection = void 0;
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
3
|
+
exports.GoogleVertexAILLMConnection = exports.GoogleVertexAIConnection = exports.GoogleConnection = void 0;
|
|
4
|
+
class GoogleConnection {
|
|
5
|
+
constructor(caller, client) {
|
|
6
6
|
Object.defineProperty(this, "caller", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
configurable: true,
|
|
9
9
|
writable: true,
|
|
10
10
|
value: void 0
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(this, "endpoint", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: "us-central1-aiplatform.googleapis.com"
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "location", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: "us-central1"
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(this, "apiVersion", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: "v1"
|
|
29
|
-
});
|
|
30
12
|
Object.defineProperty(this, "client", {
|
|
31
13
|
enumerable: true,
|
|
32
14
|
configurable: true,
|
|
@@ -34,14 +16,8 @@ class GoogleVertexAIConnection {
|
|
|
34
16
|
value: void 0
|
|
35
17
|
});
|
|
36
18
|
this.caller = caller;
|
|
37
|
-
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
38
|
-
this.location = fields?.location ?? this.location;
|
|
39
|
-
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
40
19
|
this.client = client;
|
|
41
20
|
}
|
|
42
|
-
buildMethod() {
|
|
43
|
-
return "POST";
|
|
44
|
-
}
|
|
45
21
|
async _request(data, options) {
|
|
46
22
|
const url = await this.buildUrl();
|
|
47
23
|
const method = this.buildMethod();
|
|
@@ -64,6 +40,38 @@ class GoogleVertexAIConnection {
|
|
|
64
40
|
}
|
|
65
41
|
}
|
|
66
42
|
}
|
|
43
|
+
exports.GoogleConnection = GoogleConnection;
|
|
44
|
+
class GoogleVertexAIConnection extends GoogleConnection {
|
|
45
|
+
constructor(fields, caller, client) {
|
|
46
|
+
super(caller, client);
|
|
47
|
+
Object.defineProperty(this, "endpoint", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: "us-central1-aiplatform.googleapis.com"
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(this, "location", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: "us-central1"
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(this, "apiVersion", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: "v1"
|
|
64
|
+
});
|
|
65
|
+
this.caller = caller;
|
|
66
|
+
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
67
|
+
this.location = fields?.location ?? this.location;
|
|
68
|
+
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
69
|
+
this.client = client;
|
|
70
|
+
}
|
|
71
|
+
buildMethod() {
|
|
72
|
+
return "POST";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
67
75
|
exports.GoogleVertexAIConnection = GoogleVertexAIConnection;
|
|
68
76
|
class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
|
|
69
77
|
constructor(fields, caller, client) {
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { BaseLanguageModelCallOptions } from "../base_language/index.js";
|
|
2
2
|
import { AsyncCaller, AsyncCallerCallOptions } from "./async_caller.js";
|
|
3
|
-
import type { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams,
|
|
4
|
-
export declare abstract class
|
|
3
|
+
import type { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams, GoogleResponse, GoogleAbstractedClient } from "../types/googlevertexai-types.js";
|
|
4
|
+
export declare abstract class GoogleConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse> {
|
|
5
5
|
caller: AsyncCaller;
|
|
6
|
+
client: GoogleAbstractedClient;
|
|
7
|
+
constructor(caller: AsyncCaller, client: GoogleAbstractedClient);
|
|
8
|
+
abstract buildUrl(): Promise<string>;
|
|
9
|
+
abstract buildMethod(): string;
|
|
10
|
+
_request(data: unknown | undefined, options: CallOptions): Promise<ResponseType>;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class GoogleVertexAIConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse, AuthOptions> extends GoogleConnection<CallOptions, ResponseType> implements GoogleVertexAIConnectionParams<AuthOptions> {
|
|
6
13
|
endpoint: string;
|
|
7
14
|
location: string;
|
|
8
15
|
apiVersion: string;
|
|
9
|
-
client:
|
|
10
|
-
constructor(fields: GoogleVertexAIConnectionParams<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleVertexAIAbstractedClient);
|
|
11
|
-
abstract buildUrl(): Promise<string>;
|
|
16
|
+
constructor(fields: GoogleVertexAIConnectionParams<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient);
|
|
12
17
|
buildMethod(): string;
|
|
13
|
-
_request(data: unknown | undefined, options: CallOptions): Promise<ResponseType>;
|
|
14
18
|
}
|
|
15
19
|
export declare class GoogleVertexAILLMConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction, AuthOptions> extends GoogleVertexAIConnection<CallOptions, PredictionType, AuthOptions> implements GoogleVertexAIBaseLLMInput<AuthOptions> {
|
|
16
20
|
model: string;
|
|
17
|
-
client:
|
|
18
|
-
constructor(fields: GoogleVertexAIBaseLLMInput<AuthOptions> | undefined, caller: AsyncCaller, client:
|
|
21
|
+
client: GoogleAbstractedClient;
|
|
22
|
+
constructor(fields: GoogleVertexAIBaseLLMInput<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient);
|
|
19
23
|
buildUrl(): Promise<string>;
|
|
20
24
|
request(instances: InstanceType[], parameters: GoogleVertexAIModelParams, options: CallOptions): Promise<GoogleVertexAILLMResponse<PredictionType>>;
|
|
21
25
|
}
|
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
export class
|
|
2
|
-
constructor(
|
|
1
|
+
export class GoogleConnection {
|
|
2
|
+
constructor(caller, client) {
|
|
3
3
|
Object.defineProperty(this, "caller", {
|
|
4
4
|
enumerable: true,
|
|
5
5
|
configurable: true,
|
|
6
6
|
writable: true,
|
|
7
7
|
value: void 0
|
|
8
8
|
});
|
|
9
|
-
Object.defineProperty(this, "endpoint", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: "us-central1-aiplatform.googleapis.com"
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "location", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: "us-central1"
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "apiVersion", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: "v1"
|
|
26
|
-
});
|
|
27
9
|
Object.defineProperty(this, "client", {
|
|
28
10
|
enumerable: true,
|
|
29
11
|
configurable: true,
|
|
@@ -31,14 +13,8 @@ export class GoogleVertexAIConnection {
|
|
|
31
13
|
value: void 0
|
|
32
14
|
});
|
|
33
15
|
this.caller = caller;
|
|
34
|
-
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
35
|
-
this.location = fields?.location ?? this.location;
|
|
36
|
-
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
37
16
|
this.client = client;
|
|
38
17
|
}
|
|
39
|
-
buildMethod() {
|
|
40
|
-
return "POST";
|
|
41
|
-
}
|
|
42
18
|
async _request(data, options) {
|
|
43
19
|
const url = await this.buildUrl();
|
|
44
20
|
const method = this.buildMethod();
|
|
@@ -61,6 +37,37 @@ export class GoogleVertexAIConnection {
|
|
|
61
37
|
}
|
|
62
38
|
}
|
|
63
39
|
}
|
|
40
|
+
export class GoogleVertexAIConnection extends GoogleConnection {
|
|
41
|
+
constructor(fields, caller, client) {
|
|
42
|
+
super(caller, client);
|
|
43
|
+
Object.defineProperty(this, "endpoint", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: "us-central1-aiplatform.googleapis.com"
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "location", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: "us-central1"
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "apiVersion", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: "v1"
|
|
60
|
+
});
|
|
61
|
+
this.caller = caller;
|
|
62
|
+
this.endpoint = fields?.endpoint ?? this.endpoint;
|
|
63
|
+
this.location = fields?.location ?? this.location;
|
|
64
|
+
this.apiVersion = fields?.apiVersion ?? this.apiVersion;
|
|
65
|
+
this.client = client;
|
|
66
|
+
}
|
|
67
|
+
buildMethod() {
|
|
68
|
+
return "POST";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
64
71
|
export class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
|
|
65
72
|
constructor(fields, caller, client) {
|
|
66
73
|
super(fields, caller, client);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Credentials } from "web-auth-library/google";
|
|
2
|
-
import type {
|
|
2
|
+
import type { GoogleAbstractedClient } from "../types/googlevertexai-types.js";
|
|
3
3
|
export type WebGoogleAuthOptions = {
|
|
4
4
|
credentials: string | Credentials;
|
|
5
5
|
scope?: string | string[];
|
|
6
6
|
accessToken?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare class WebGoogleAuth implements
|
|
8
|
+
export declare class WebGoogleAuth implements GoogleAbstractedClient {
|
|
9
9
|
options: WebGoogleAuthOptions;
|
|
10
10
|
constructor(options?: WebGoogleAuthOptions);
|
|
11
11
|
getProjectId(): Promise<string>;
|
|
@@ -4,7 +4,7 @@ import { Embeddings } from "../embeddings/base.js";
|
|
|
4
4
|
import { Document, DocumentInput } from "../document.js";
|
|
5
5
|
import { GoogleVertexAIConnection } from "../util/googlevertexai-connection.js";
|
|
6
6
|
import { AsyncCaller, AsyncCallerCallOptions, AsyncCallerParams } from "../util/async_caller.js";
|
|
7
|
-
import { GoogleVertexAIConnectionParams,
|
|
7
|
+
import { GoogleVertexAIConnectionParams, GoogleResponse } from "../types/googlevertexai-types.js";
|
|
8
8
|
import { Docstore } from "../schema/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* Allows us to create IdDocument classes that contain the ID.
|
|
@@ -26,7 +26,7 @@ interface DeployedIndex {
|
|
|
26
26
|
id: string;
|
|
27
27
|
index: string;
|
|
28
28
|
}
|
|
29
|
-
interface IndexEndpointResponse extends
|
|
29
|
+
interface IndexEndpointResponse extends GoogleResponse {
|
|
30
30
|
data: {
|
|
31
31
|
deployedIndexes: DeployedIndex[];
|
|
32
32
|
publicEndpointDomainName: string;
|
|
@@ -49,7 +49,7 @@ export interface MatchingEngineDeleteParams {
|
|
|
49
49
|
interface RemoveDatapointParams extends GoogleVertexAIConnectionParams<GoogleAuthOptions> {
|
|
50
50
|
index: string;
|
|
51
51
|
}
|
|
52
|
-
interface RemoveDatapointResponse extends
|
|
52
|
+
interface RemoveDatapointResponse extends GoogleResponse {
|
|
53
53
|
}
|
|
54
54
|
declare class RemoveDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, RemoveDatapointResponse, GoogleAuthOptions> {
|
|
55
55
|
index: string;
|
|
@@ -75,7 +75,7 @@ interface IndexDatapoint {
|
|
|
75
75
|
restricts?: Restriction[];
|
|
76
76
|
crowdingTag?: CrowdingTag;
|
|
77
77
|
}
|
|
78
|
-
interface UpsertDatapointResponse extends
|
|
78
|
+
interface UpsertDatapointResponse extends GoogleResponse {
|
|
79
79
|
}
|
|
80
80
|
declare class UpsertDatapointConnection extends GoogleVertexAIConnection<AsyncCallerCallOptions, UpsertDatapointResponse, GoogleAuthOptions> {
|
|
81
81
|
index: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/embeddings/bedrock.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/embeddings/bedrock.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/embeddings/bedrock.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../../dist/experimental/hubs/makersuite/googlemakersuitehub.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../dist/experimental/hubs/makersuite/googlemakersuitehub.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../dist/experimental/hubs/makersuite/googlemakersuitehub.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.161",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -79,6 +79,9 @@
|
|
|
79
79
|
"embeddings/base.cjs",
|
|
80
80
|
"embeddings/base.js",
|
|
81
81
|
"embeddings/base.d.ts",
|
|
82
|
+
"embeddings/bedrock.cjs",
|
|
83
|
+
"embeddings/bedrock.js",
|
|
84
|
+
"embeddings/bedrock.d.ts",
|
|
82
85
|
"embeddings/cache_backed.cjs",
|
|
83
86
|
"embeddings/cache_backed.js",
|
|
84
87
|
"embeddings/cache_backed.d.ts",
|
|
@@ -487,6 +490,9 @@
|
|
|
487
490
|
"retrievers/metal.cjs",
|
|
488
491
|
"retrievers/metal.js",
|
|
489
492
|
"retrievers/metal.d.ts",
|
|
493
|
+
"retrievers/chaindesk.cjs",
|
|
494
|
+
"retrievers/chaindesk.js",
|
|
495
|
+
"retrievers/chaindesk.d.ts",
|
|
490
496
|
"retrievers/databerry.cjs",
|
|
491
497
|
"retrievers/databerry.js",
|
|
492
498
|
"retrievers/databerry.d.ts",
|
|
@@ -505,12 +511,18 @@
|
|
|
505
511
|
"retrievers/parent_document.cjs",
|
|
506
512
|
"retrievers/parent_document.js",
|
|
507
513
|
"retrievers/parent_document.d.ts",
|
|
514
|
+
"retrievers/tavily_search_api.cjs",
|
|
515
|
+
"retrievers/tavily_search_api.js",
|
|
516
|
+
"retrievers/tavily_search_api.d.ts",
|
|
508
517
|
"retrievers/time_weighted.cjs",
|
|
509
518
|
"retrievers/time_weighted.js",
|
|
510
519
|
"retrievers/time_weighted.d.ts",
|
|
511
520
|
"retrievers/document_compressors/chain_extract.cjs",
|
|
512
521
|
"retrievers/document_compressors/chain_extract.js",
|
|
513
522
|
"retrievers/document_compressors/chain_extract.d.ts",
|
|
523
|
+
"retrievers/document_compressors/embeddings_filter.cjs",
|
|
524
|
+
"retrievers/document_compressors/embeddings_filter.js",
|
|
525
|
+
"retrievers/document_compressors/embeddings_filter.d.ts",
|
|
514
526
|
"retrievers/hyde.cjs",
|
|
515
527
|
"retrievers/hyde.js",
|
|
516
528
|
"retrievers/hyde.d.ts",
|
|
@@ -640,6 +652,9 @@
|
|
|
640
652
|
"experimental/llms/bittensor.cjs",
|
|
641
653
|
"experimental/llms/bittensor.js",
|
|
642
654
|
"experimental/llms/bittensor.d.ts",
|
|
655
|
+
"experimental/hubs/makersuite/googlemakersuitehub.cjs",
|
|
656
|
+
"experimental/hubs/makersuite/googlemakersuitehub.js",
|
|
657
|
+
"experimental/hubs/makersuite/googlemakersuitehub.d.ts",
|
|
643
658
|
"evaluation.cjs",
|
|
644
659
|
"evaluation.js",
|
|
645
660
|
"evaluation.d.ts",
|
|
@@ -673,6 +688,7 @@
|
|
|
673
688
|
"license": "MIT",
|
|
674
689
|
"devDependencies": {
|
|
675
690
|
"@aws-crypto/sha256-js": "^5.0.0",
|
|
691
|
+
"@aws-sdk/client-bedrock-runtime": "^3.422.0",
|
|
676
692
|
"@aws-sdk/client-dynamodb": "^3.310.0",
|
|
677
693
|
"@aws-sdk/client-kendra": "^3.352.0",
|
|
678
694
|
"@aws-sdk/client-lambda": "^3.310.0",
|
|
@@ -800,6 +816,7 @@
|
|
|
800
816
|
},
|
|
801
817
|
"peerDependencies": {
|
|
802
818
|
"@aws-crypto/sha256-js": "^5.0.0",
|
|
819
|
+
"@aws-sdk/client-bedrock-runtime": "^3.422.0",
|
|
803
820
|
"@aws-sdk/client-dynamodb": "^3.310.0",
|
|
804
821
|
"@aws-sdk/client-kendra": "^3.352.0",
|
|
805
822
|
"@aws-sdk/client-lambda": "^3.310.0",
|
|
@@ -888,6 +905,9 @@
|
|
|
888
905
|
"@aws-crypto/sha256-js": {
|
|
889
906
|
"optional": true
|
|
890
907
|
},
|
|
908
|
+
"@aws-sdk/client-bedrock-runtime": {
|
|
909
|
+
"optional": true
|
|
910
|
+
},
|
|
891
911
|
"@aws-sdk/client-dynamodb": {
|
|
892
912
|
"optional": true
|
|
893
913
|
},
|
|
@@ -1295,6 +1315,11 @@
|
|
|
1295
1315
|
"import": "./embeddings/base.js",
|
|
1296
1316
|
"require": "./embeddings/base.cjs"
|
|
1297
1317
|
},
|
|
1318
|
+
"./embeddings/bedrock": {
|
|
1319
|
+
"types": "./embeddings/bedrock.d.ts",
|
|
1320
|
+
"import": "./embeddings/bedrock.js",
|
|
1321
|
+
"require": "./embeddings/bedrock.cjs"
|
|
1322
|
+
},
|
|
1298
1323
|
"./embeddings/cache_backed": {
|
|
1299
1324
|
"types": "./embeddings/cache_backed.d.ts",
|
|
1300
1325
|
"import": "./embeddings/cache_backed.js",
|
|
@@ -1975,6 +2000,11 @@
|
|
|
1975
2000
|
"import": "./retrievers/metal.js",
|
|
1976
2001
|
"require": "./retrievers/metal.cjs"
|
|
1977
2002
|
},
|
|
2003
|
+
"./retrievers/chaindesk": {
|
|
2004
|
+
"types": "./retrievers/chaindesk.d.ts",
|
|
2005
|
+
"import": "./retrievers/chaindesk.js",
|
|
2006
|
+
"require": "./retrievers/chaindesk.cjs"
|
|
2007
|
+
},
|
|
1978
2008
|
"./retrievers/databerry": {
|
|
1979
2009
|
"types": "./retrievers/databerry.d.ts",
|
|
1980
2010
|
"import": "./retrievers/databerry.js",
|
|
@@ -2005,6 +2035,11 @@
|
|
|
2005
2035
|
"import": "./retrievers/parent_document.js",
|
|
2006
2036
|
"require": "./retrievers/parent_document.cjs"
|
|
2007
2037
|
},
|
|
2038
|
+
"./retrievers/tavily_search_api": {
|
|
2039
|
+
"types": "./retrievers/tavily_search_api.d.ts",
|
|
2040
|
+
"import": "./retrievers/tavily_search_api.js",
|
|
2041
|
+
"require": "./retrievers/tavily_search_api.cjs"
|
|
2042
|
+
},
|
|
2008
2043
|
"./retrievers/time_weighted": {
|
|
2009
2044
|
"types": "./retrievers/time_weighted.d.ts",
|
|
2010
2045
|
"import": "./retrievers/time_weighted.js",
|
|
@@ -2015,6 +2050,11 @@
|
|
|
2015
2050
|
"import": "./retrievers/document_compressors/chain_extract.js",
|
|
2016
2051
|
"require": "./retrievers/document_compressors/chain_extract.cjs"
|
|
2017
2052
|
},
|
|
2053
|
+
"./retrievers/document_compressors/embeddings_filter": {
|
|
2054
|
+
"types": "./retrievers/document_compressors/embeddings_filter.d.ts",
|
|
2055
|
+
"import": "./retrievers/document_compressors/embeddings_filter.js",
|
|
2056
|
+
"require": "./retrievers/document_compressors/embeddings_filter.cjs"
|
|
2057
|
+
},
|
|
2018
2058
|
"./retrievers/hyde": {
|
|
2019
2059
|
"types": "./retrievers/hyde.d.ts",
|
|
2020
2060
|
"import": "./retrievers/hyde.js",
|
|
@@ -2230,6 +2270,11 @@
|
|
|
2230
2270
|
"import": "./experimental/llms/bittensor.js",
|
|
2231
2271
|
"require": "./experimental/llms/bittensor.cjs"
|
|
2232
2272
|
},
|
|
2273
|
+
"./experimental/hubs/makersuite/googlemakersuitehub": {
|
|
2274
|
+
"types": "./experimental/hubs/makersuite/googlemakersuitehub.d.ts",
|
|
2275
|
+
"import": "./experimental/hubs/makersuite/googlemakersuitehub.js",
|
|
2276
|
+
"require": "./experimental/hubs/makersuite/googlemakersuitehub.cjs"
|
|
2277
|
+
},
|
|
2233
2278
|
"./evaluation": {
|
|
2234
2279
|
"types": "./evaluation.d.ts",
|
|
2235
2280
|
"import": "./evaluation.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/retrievers/chaindesk.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/chaindesk.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/chaindesk.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../dist/retrievers/document_compressors/embeddings_filter.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/retrievers/document_compressors/embeddings_filter.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/retrievers/document_compressors/embeddings_filter.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/retrievers/tavily_search_api.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/tavily_search_api.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/retrievers/tavily_search_api.js'
|