langchain 0.0.137 → 0.0.139
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/minimax.cjs +1 -0
- package/chat_models/minimax.d.ts +1 -0
- package/chat_models/minimax.js +1 -0
- package/dist/agents/initialize.cjs +11 -0
- package/dist/agents/initialize.d.ts +4 -0
- package/dist/agents/initialize.js +11 -0
- package/dist/agents/xml/index.cjs +119 -0
- package/dist/agents/xml/index.d.ts +51 -0
- package/dist/agents/xml/index.js +114 -0
- package/dist/agents/xml/prompt.cjs +23 -0
- package/dist/agents/xml/prompt.d.ts +1 -0
- package/dist/agents/xml/prompt.js +20 -0
- package/dist/callbacks/base.d.ts +12 -4
- package/dist/callbacks/handlers/run_collector.cjs +50 -0
- package/dist/callbacks/handlers/run_collector.d.ts +26 -0
- package/dist/callbacks/handlers/run_collector.js +46 -0
- package/dist/callbacks/handlers/tracer.cjs +33 -20
- package/dist/callbacks/handlers/tracer.d.ts +7 -3
- package/dist/callbacks/handlers/tracer.js +33 -20
- package/dist/callbacks/handlers/tracer_langchain.cjs +1 -0
- package/dist/callbacks/handlers/tracer_langchain.d.ts +2 -1
- package/dist/callbacks/handlers/tracer_langchain.js +1 -0
- package/dist/callbacks/index.cjs +3 -1
- package/dist/callbacks/index.d.ts +1 -0
- package/dist/callbacks/index.js +1 -0
- package/dist/callbacks/manager.cjs +29 -14
- package/dist/callbacks/manager.d.ts +9 -4
- package/dist/callbacks/manager.js +29 -14
- package/dist/chains/openai_functions/extraction.cjs +2 -2
- package/dist/chains/openai_functions/extraction.d.ts +5 -4
- package/dist/chains/openai_functions/extraction.js +2 -2
- package/dist/chains/openai_functions/openapi.d.ts +2 -1
- package/dist/chains/openai_functions/structured_output.d.ts +4 -3
- package/dist/chains/openai_functions/tagging.cjs +2 -2
- package/dist/chains/openai_functions/tagging.d.ts +5 -4
- package/dist/chains/openai_functions/tagging.js +2 -2
- package/dist/chat_models/anthropic.cjs +7 -5
- package/dist/chat_models/anthropic.d.ts +17 -12
- package/dist/chat_models/anthropic.js +4 -2
- package/dist/chat_models/minimax.cjs +547 -0
- package/dist/chat_models/minimax.d.ts +364 -0
- package/dist/chat_models/minimax.js +543 -0
- package/dist/chat_models/ollama.cjs +136 -0
- package/dist/chat_models/ollama.d.ts +34 -0
- package/dist/chat_models/ollama.js +136 -0
- package/dist/embeddings/minimax.cjs +152 -0
- package/dist/embeddings/minimax.d.ts +104 -0
- package/dist/embeddings/minimax.js +148 -0
- package/dist/experimental/chat_models/anthropic_functions.cjs +129 -0
- package/dist/experimental/chat_models/anthropic_functions.d.ts +20 -0
- package/dist/experimental/chat_models/anthropic_functions.js +125 -0
- package/dist/llms/ollama.cjs +136 -0
- package/dist/llms/ollama.d.ts +34 -0
- package/dist/llms/ollama.js +136 -0
- package/dist/load/import_constants.cjs +1 -0
- package/dist/load/import_constants.js +1 -0
- package/dist/load/import_map.cjs +4 -2
- package/dist/load/import_map.d.ts +2 -0
- package/dist/load/import_map.js +2 -0
- package/dist/schema/output_parser.cjs +1 -1
- package/dist/schema/output_parser.js +1 -1
- package/dist/schema/runnable.cjs +54 -15
- package/dist/schema/runnable.d.ts +9 -3
- package/dist/schema/runnable.js +55 -16
- package/dist/sql_db.cjs +3 -1
- package/dist/sql_db.js +3 -1
- package/dist/util/ollama.d.ts +34 -0
- package/dist/vectorstores/redis.cjs +17 -2
- package/dist/vectorstores/redis.d.ts +10 -1
- package/dist/vectorstores/redis.js +17 -2
- package/dist/vectorstores/zep.cjs +2 -1
- package/dist/vectorstores/zep.js +3 -2
- package/embeddings/minimax.cjs +1 -0
- package/embeddings/minimax.d.ts +1 -0
- package/embeddings/minimax.js +1 -0
- package/experimental/chat_models/anthropic_functions.cjs +1 -0
- package/experimental/chat_models/anthropic_functions.d.ts +1 -0
- package/experimental/chat_models/anthropic_functions.js +1 -0
- package/package.json +34 -5
package/dist/schema/runnable.cjs
CHANGED
|
@@ -122,37 +122,73 @@ class Runnable extends serializable_js_1.Serializable {
|
|
|
122
122
|
await runManager?.handleChainEnd(_coerceToDict(output, "output"));
|
|
123
123
|
return output;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Helper method to transform an Iterator of Input values into an Iterator of
|
|
127
|
+
* Output values, with callbacks.
|
|
128
|
+
* Use this to implement `stream()` or `transform()` in Runnable subclasses.
|
|
129
|
+
*/
|
|
130
|
+
async *_transformStreamWithConfig(inputGenerator, transformer, options) {
|
|
131
|
+
let finalInput;
|
|
132
|
+
let finalInputSupported = true;
|
|
133
|
+
let finalOutput;
|
|
134
|
+
let finalOutputSupported = true;
|
|
126
135
|
const callbackManager_ = await manager_js_1.CallbackManager.configure(options?.callbacks, undefined, options?.tags, undefined, options?.metadata);
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
let runManager;
|
|
137
|
+
const serializedRepresentation = this.toJSON();
|
|
138
|
+
async function* wrapInputForTracing() {
|
|
139
|
+
for await (const chunk of inputGenerator) {
|
|
140
|
+
if (!runManager) {
|
|
141
|
+
// Start the run manager AFTER the iterator starts to preserve
|
|
142
|
+
// tracing order
|
|
143
|
+
runManager = await callbackManager_?.handleChainStart(serializedRepresentation, { input: "" }, undefined, options?.runType);
|
|
144
|
+
}
|
|
145
|
+
if (finalInputSupported) {
|
|
146
|
+
if (finalInput === undefined) {
|
|
147
|
+
finalInput = chunk;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
try {
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
finalInput = finalInput.concat(chunk);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
finalInput = undefined;
|
|
156
|
+
finalInputSupported = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
yield chunk;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const wrappedInputGenerator = wrapInputForTracing();
|
|
131
164
|
try {
|
|
132
|
-
|
|
165
|
+
const outputIterator = transformer(wrappedInputGenerator, runManager, options);
|
|
166
|
+
for await (const chunk of outputIterator) {
|
|
133
167
|
yield chunk;
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
136
|
-
|
|
168
|
+
if (finalOutputSupported) {
|
|
169
|
+
if (finalOutput === undefined) {
|
|
170
|
+
finalOutput = chunk;
|
|
137
171
|
}
|
|
138
172
|
else {
|
|
139
173
|
try {
|
|
140
174
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
-
|
|
175
|
+
finalOutput = finalOutput.concat(chunk);
|
|
142
176
|
}
|
|
143
|
-
catch
|
|
144
|
-
|
|
145
|
-
|
|
177
|
+
catch {
|
|
178
|
+
finalOutput = undefined;
|
|
179
|
+
finalOutputSupported = false;
|
|
146
180
|
}
|
|
147
181
|
}
|
|
148
182
|
}
|
|
149
183
|
}
|
|
150
184
|
}
|
|
151
185
|
catch (e) {
|
|
152
|
-
await runManager?.handleChainError(e
|
|
186
|
+
await runManager?.handleChainError(e, undefined, undefined, undefined, {
|
|
187
|
+
inputs: _coerceToDict(finalInput, "input"),
|
|
188
|
+
});
|
|
153
189
|
throw e;
|
|
154
190
|
}
|
|
155
|
-
await runManager?.handleChainEnd(_coerceToDict(
|
|
191
|
+
await runManager?.handleChainEnd(finalOutput ?? {}, undefined, undefined, undefined, { inputs: _coerceToDict(finalInput, "input") });
|
|
156
192
|
}
|
|
157
193
|
_patchConfig(config = {}, callbackManager = undefined) {
|
|
158
194
|
return { ...config, callbacks: callbackManager };
|
|
@@ -411,6 +447,9 @@ exports.RunnableMap = RunnableMap;
|
|
|
411
447
|
* A runnable that runs a callable.
|
|
412
448
|
*/
|
|
413
449
|
class RunnableLambda extends Runnable {
|
|
450
|
+
static lc_name() {
|
|
451
|
+
return "RunnableLambda";
|
|
452
|
+
}
|
|
414
453
|
constructor(fields) {
|
|
415
454
|
super(fields);
|
|
416
455
|
Object.defineProperty(this, "lc_namespace", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCallbackConfig, CallbackManager } from "../callbacks/manager.js";
|
|
1
|
+
import { BaseCallbackConfig, CallbackManager, CallbackManagerForChainRun } from "../callbacks/manager.js";
|
|
2
2
|
import { Serializable } from "../load/serializable.js";
|
|
3
3
|
import { IterableReadableStream } from "../util/stream.js";
|
|
4
4
|
export type RunnableConfig = BaseCallbackConfig;
|
|
@@ -58,9 +58,14 @@ export declare abstract class Runnable<RunInput = any, RunOutput = any, CallOpti
|
|
|
58
58
|
protected _callWithConfig<T extends RunInput>(func: (input: T) => Promise<RunOutput>, input: T, options?: RunnableConfig & {
|
|
59
59
|
runType?: string;
|
|
60
60
|
}): Promise<RunOutput>;
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Helper method to transform an Iterator of Input values into an Iterator of
|
|
63
|
+
* Output values, with callbacks.
|
|
64
|
+
* Use this to implement `stream()` or `transform()` in Runnable subclasses.
|
|
65
|
+
*/
|
|
66
|
+
protected _transformStreamWithConfig<I extends RunInput, O extends RunOutput>(inputGenerator: AsyncGenerator<I>, transformer: (generator: AsyncGenerator<I>, runManager?: CallbackManagerForChainRun, options?: Partial<RunnableConfig>) => AsyncGenerator<O>, options?: RunnableConfig & {
|
|
62
67
|
runType?: string;
|
|
63
|
-
}): AsyncGenerator<
|
|
68
|
+
}): AsyncGenerator<O>;
|
|
64
69
|
_patchConfig(config?: Partial<CallOptions>, callbackManager?: CallbackManager | undefined): Partial<CallOptions>;
|
|
65
70
|
/**
|
|
66
71
|
* Create a new runnable sequence that runs each individual runnable in series,
|
|
@@ -126,6 +131,7 @@ export declare class RunnableMap<RunInput> extends Runnable<RunInput, Record<str
|
|
|
126
131
|
* A runnable that runs a callable.
|
|
127
132
|
*/
|
|
128
133
|
export declare class RunnableLambda<RunInput, RunOutput> extends Runnable<RunInput, RunOutput> {
|
|
134
|
+
static lc_name(): string;
|
|
129
135
|
lc_namespace: string[];
|
|
130
136
|
protected func: RunnableFunc<RunInput, RunOutput>;
|
|
131
137
|
constructor(fields: {
|
package/dist/schema/runnable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallbackManager } from "../callbacks/manager.js";
|
|
1
|
+
import { CallbackManager, } from "../callbacks/manager.js";
|
|
2
2
|
import { Serializable } from "../load/serializable.js";
|
|
3
3
|
import { IterableReadableStream } from "../util/stream.js";
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -119,37 +119,73 @@ export class Runnable extends Serializable {
|
|
|
119
119
|
await runManager?.handleChainEnd(_coerceToDict(output, "output"));
|
|
120
120
|
return output;
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Helper method to transform an Iterator of Input values into an Iterator of
|
|
124
|
+
* Output values, with callbacks.
|
|
125
|
+
* Use this to implement `stream()` or `transform()` in Runnable subclasses.
|
|
126
|
+
*/
|
|
127
|
+
async *_transformStreamWithConfig(inputGenerator, transformer, options) {
|
|
128
|
+
let finalInput;
|
|
129
|
+
let finalInputSupported = true;
|
|
130
|
+
let finalOutput;
|
|
131
|
+
let finalOutputSupported = true;
|
|
123
132
|
const callbackManager_ = await CallbackManager.configure(options?.callbacks, undefined, options?.tags, undefined, options?.metadata);
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
let runManager;
|
|
134
|
+
const serializedRepresentation = this.toJSON();
|
|
135
|
+
async function* wrapInputForTracing() {
|
|
136
|
+
for await (const chunk of inputGenerator) {
|
|
137
|
+
if (!runManager) {
|
|
138
|
+
// Start the run manager AFTER the iterator starts to preserve
|
|
139
|
+
// tracing order
|
|
140
|
+
runManager = await callbackManager_?.handleChainStart(serializedRepresentation, { input: "" }, undefined, options?.runType);
|
|
141
|
+
}
|
|
142
|
+
if (finalInputSupported) {
|
|
143
|
+
if (finalInput === undefined) {
|
|
144
|
+
finalInput = chunk;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
try {
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
149
|
+
finalInput = finalInput.concat(chunk);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
finalInput = undefined;
|
|
153
|
+
finalInputSupported = false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
yield chunk;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const wrappedInputGenerator = wrapInputForTracing();
|
|
128
161
|
try {
|
|
129
|
-
|
|
162
|
+
const outputIterator = transformer(wrappedInputGenerator, runManager, options);
|
|
163
|
+
for await (const chunk of outputIterator) {
|
|
130
164
|
yield chunk;
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
133
|
-
|
|
165
|
+
if (finalOutputSupported) {
|
|
166
|
+
if (finalOutput === undefined) {
|
|
167
|
+
finalOutput = chunk;
|
|
134
168
|
}
|
|
135
169
|
else {
|
|
136
170
|
try {
|
|
137
171
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
138
|
-
|
|
172
|
+
finalOutput = finalOutput.concat(chunk);
|
|
139
173
|
}
|
|
140
|
-
catch
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
catch {
|
|
175
|
+
finalOutput = undefined;
|
|
176
|
+
finalOutputSupported = false;
|
|
143
177
|
}
|
|
144
178
|
}
|
|
145
179
|
}
|
|
146
180
|
}
|
|
147
181
|
}
|
|
148
182
|
catch (e) {
|
|
149
|
-
await runManager?.handleChainError(e
|
|
183
|
+
await runManager?.handleChainError(e, undefined, undefined, undefined, {
|
|
184
|
+
inputs: _coerceToDict(finalInput, "input"),
|
|
185
|
+
});
|
|
150
186
|
throw e;
|
|
151
187
|
}
|
|
152
|
-
await runManager?.handleChainEnd(_coerceToDict(
|
|
188
|
+
await runManager?.handleChainEnd(finalOutput ?? {}, undefined, undefined, undefined, { inputs: _coerceToDict(finalInput, "input") });
|
|
153
189
|
}
|
|
154
190
|
_patchConfig(config = {}, callbackManager = undefined) {
|
|
155
191
|
return { ...config, callbacks: callbackManager };
|
|
@@ -405,6 +441,9 @@ export class RunnableMap extends Runnable {
|
|
|
405
441
|
* A runnable that runs a callable.
|
|
406
442
|
*/
|
|
407
443
|
export class RunnableLambda extends Runnable {
|
|
444
|
+
static lc_name() {
|
|
445
|
+
return "RunnableLambda";
|
|
446
|
+
}
|
|
408
447
|
constructor(fields) {
|
|
409
448
|
super(fields);
|
|
410
449
|
Object.defineProperty(this, "lc_namespace", {
|
package/dist/sql_db.cjs
CHANGED
|
@@ -66,7 +66,6 @@ class SqlDatabase extends serializable_js_1.Serializable {
|
|
|
66
66
|
this.ignoreTables = fields?.ignoreTables ?? [];
|
|
67
67
|
this.sampleRowsInTableInfo =
|
|
68
68
|
fields?.sampleRowsInTableInfo ?? this.sampleRowsInTableInfo;
|
|
69
|
-
this.customDescription = Object.fromEntries(Object.entries(fields?.customDescription ?? {}).filter(([key, _]) => this.allTables.map((table) => table.tableName).includes(key)));
|
|
70
69
|
}
|
|
71
70
|
static async fromDataSourceParams(fields) {
|
|
72
71
|
const sqlDatabase = new SqlDatabase(fields);
|
|
@@ -74,6 +73,9 @@ class SqlDatabase extends serializable_js_1.Serializable {
|
|
|
74
73
|
await sqlDatabase.appDataSource.initialize();
|
|
75
74
|
}
|
|
76
75
|
sqlDatabase.allTables = await (0, sql_utils_js_1.getTableAndColumnsName)(sqlDatabase.appDataSource);
|
|
76
|
+
sqlDatabase.customDescription = Object.fromEntries(Object.entries(fields?.customDescription ?? {}).filter(([key, _]) => sqlDatabase.allTables
|
|
77
|
+
.map((table) => table.tableName)
|
|
78
|
+
.includes(key)));
|
|
77
79
|
(0, sql_utils_js_1.verifyIncludeTablesExistInDatabase)(sqlDatabase.allTables, sqlDatabase.includesTables);
|
|
78
80
|
(0, sql_utils_js_1.verifyIgnoreTablesExistInDatabase)(sqlDatabase.allTables, sqlDatabase.ignoreTables);
|
|
79
81
|
return sqlDatabase;
|
package/dist/sql_db.js
CHANGED
|
@@ -63,7 +63,6 @@ export class SqlDatabase extends Serializable {
|
|
|
63
63
|
this.ignoreTables = fields?.ignoreTables ?? [];
|
|
64
64
|
this.sampleRowsInTableInfo =
|
|
65
65
|
fields?.sampleRowsInTableInfo ?? this.sampleRowsInTableInfo;
|
|
66
|
-
this.customDescription = Object.fromEntries(Object.entries(fields?.customDescription ?? {}).filter(([key, _]) => this.allTables.map((table) => table.tableName).includes(key)));
|
|
67
66
|
}
|
|
68
67
|
static async fromDataSourceParams(fields) {
|
|
69
68
|
const sqlDatabase = new SqlDatabase(fields);
|
|
@@ -71,6 +70,9 @@ export class SqlDatabase extends Serializable {
|
|
|
71
70
|
await sqlDatabase.appDataSource.initialize();
|
|
72
71
|
}
|
|
73
72
|
sqlDatabase.allTables = await getTableAndColumnsName(sqlDatabase.appDataSource);
|
|
73
|
+
sqlDatabase.customDescription = Object.fromEntries(Object.entries(fields?.customDescription ?? {}).filter(([key, _]) => sqlDatabase.allTables
|
|
74
|
+
.map((table) => table.tableName)
|
|
75
|
+
.includes(key)));
|
|
74
76
|
verifyIncludeTablesExistInDatabase(sqlDatabase.allTables, sqlDatabase.includesTables);
|
|
75
77
|
verifyIgnoreTablesExistInDatabase(sqlDatabase.allTables, sqlDatabase.ignoreTables);
|
|
76
78
|
return sqlDatabase;
|
package/dist/util/ollama.d.ts
CHANGED
|
@@ -1,38 +1,72 @@
|
|
|
1
1
|
import { BaseLanguageModelCallOptions } from "../base_language/index.js";
|
|
2
2
|
export interface OllamaInput {
|
|
3
|
+
embeddingOnly?: boolean;
|
|
4
|
+
f16KV?: boolean;
|
|
5
|
+
frequencyPenalty?: number;
|
|
6
|
+
logitsAll?: boolean;
|
|
7
|
+
lowVram?: boolean;
|
|
8
|
+
mainGpu?: number;
|
|
3
9
|
model?: string;
|
|
4
10
|
baseUrl?: string;
|
|
5
11
|
mirostat?: number;
|
|
6
12
|
mirostatEta?: number;
|
|
7
13
|
mirostatTau?: number;
|
|
14
|
+
numBatch?: number;
|
|
8
15
|
numCtx?: number;
|
|
9
16
|
numGpu?: number;
|
|
17
|
+
numGqa?: number;
|
|
18
|
+
numKeep?: number;
|
|
10
19
|
numThread?: number;
|
|
20
|
+
penalizeNewline?: boolean;
|
|
21
|
+
presencePenalty?: number;
|
|
11
22
|
repeatLastN?: number;
|
|
12
23
|
repeatPenalty?: number;
|
|
24
|
+
ropeFrequencyBase?: number;
|
|
25
|
+
ropeFrequencyScale?: number;
|
|
13
26
|
temperature?: number;
|
|
14
27
|
stop?: string[];
|
|
15
28
|
tfsZ?: number;
|
|
16
29
|
topK?: number;
|
|
17
30
|
topP?: number;
|
|
31
|
+
typicalP?: number;
|
|
32
|
+
useMLock?: boolean;
|
|
33
|
+
useMMap?: boolean;
|
|
34
|
+
vocabOnly?: boolean;
|
|
18
35
|
}
|
|
19
36
|
export interface OllamaRequestParams {
|
|
20
37
|
model: string;
|
|
21
38
|
prompt: string;
|
|
22
39
|
options: {
|
|
40
|
+
embedding_only?: boolean;
|
|
41
|
+
f16_kv?: boolean;
|
|
42
|
+
frequency_penalty?: number;
|
|
43
|
+
logits_all?: boolean;
|
|
44
|
+
low_vram?: boolean;
|
|
45
|
+
main_gpu?: number;
|
|
23
46
|
mirostat?: number;
|
|
24
47
|
mirostat_eta?: number;
|
|
25
48
|
mirostat_tau?: number;
|
|
49
|
+
num_batch?: number;
|
|
26
50
|
num_ctx?: number;
|
|
27
51
|
num_gpu?: number;
|
|
52
|
+
num_gqa?: number;
|
|
53
|
+
num_keep?: number;
|
|
28
54
|
num_thread?: number;
|
|
55
|
+
penalize_newline?: boolean;
|
|
56
|
+
presence_penalty?: number;
|
|
29
57
|
repeat_last_n?: number;
|
|
30
58
|
repeat_penalty?: number;
|
|
59
|
+
rope_frequency_base?: number;
|
|
60
|
+
rope_frequency_scale?: number;
|
|
31
61
|
temperature?: number;
|
|
32
62
|
stop?: string[];
|
|
33
63
|
tfs_z?: number;
|
|
34
64
|
top_k?: number;
|
|
35
65
|
top_p?: number;
|
|
66
|
+
typical_p?: number;
|
|
67
|
+
use_mlock?: boolean;
|
|
68
|
+
use_mmap?: boolean;
|
|
69
|
+
vocab_only?: boolean;
|
|
36
70
|
};
|
|
37
71
|
}
|
|
38
72
|
export interface OllamaCallOptions extends BaseLanguageModelCallOptions {
|
|
@@ -235,17 +235,32 @@ class RedisVectorStore extends base_js_1.VectorStore {
|
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
237
|
* Method for dropping an index from the RedisVectorStore.
|
|
238
|
+
* @param deleteDocuments Optional boolean indicating whether to drop the associated documents.
|
|
238
239
|
* @returns A promise that resolves to a boolean indicating whether the index was dropped.
|
|
239
240
|
*/
|
|
240
|
-
async dropIndex() {
|
|
241
|
+
async dropIndex(deleteDocuments) {
|
|
241
242
|
try {
|
|
242
|
-
|
|
243
|
+
const options = deleteDocuments ? { DD: deleteDocuments } : undefined;
|
|
244
|
+
await this.redisClient.ft.dropIndex(this.indexName, options);
|
|
243
245
|
return true;
|
|
244
246
|
}
|
|
245
247
|
catch (err) {
|
|
246
248
|
return false;
|
|
247
249
|
}
|
|
248
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Deletes vectors from the vector store.
|
|
253
|
+
* @param params The parameters for deleting vectors.
|
|
254
|
+
* @returns A promise that resolves when the vectors have been deleted.
|
|
255
|
+
*/
|
|
256
|
+
async delete(params) {
|
|
257
|
+
if (params.deleteAll) {
|
|
258
|
+
await this.dropIndex(true);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
throw new Error(`Invalid parameters passed to "delete".`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
249
264
|
buildQuery(query, k, filter) {
|
|
250
265
|
const vectorScoreField = "vector_score";
|
|
251
266
|
let hybridFields = "*";
|
|
@@ -136,9 +136,18 @@ export declare class RedisVectorStore extends VectorStore {
|
|
|
136
136
|
createIndex(dimensions?: number): Promise<void>;
|
|
137
137
|
/**
|
|
138
138
|
* Method for dropping an index from the RedisVectorStore.
|
|
139
|
+
* @param deleteDocuments Optional boolean indicating whether to drop the associated documents.
|
|
139
140
|
* @returns A promise that resolves to a boolean indicating whether the index was dropped.
|
|
140
141
|
*/
|
|
141
|
-
dropIndex(): Promise<boolean>;
|
|
142
|
+
dropIndex(deleteDocuments?: boolean): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Deletes vectors from the vector store.
|
|
145
|
+
* @param params The parameters for deleting vectors.
|
|
146
|
+
* @returns A promise that resolves when the vectors have been deleted.
|
|
147
|
+
*/
|
|
148
|
+
delete(params: {
|
|
149
|
+
deleteAll: boolean;
|
|
150
|
+
}): Promise<void>;
|
|
142
151
|
private buildQuery;
|
|
143
152
|
private prepareFilter;
|
|
144
153
|
/**
|
|
@@ -232,17 +232,32 @@ export class RedisVectorStore extends VectorStore {
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* Method for dropping an index from the RedisVectorStore.
|
|
235
|
+
* @param deleteDocuments Optional boolean indicating whether to drop the associated documents.
|
|
235
236
|
* @returns A promise that resolves to a boolean indicating whether the index was dropped.
|
|
236
237
|
*/
|
|
237
|
-
async dropIndex() {
|
|
238
|
+
async dropIndex(deleteDocuments) {
|
|
238
239
|
try {
|
|
239
|
-
|
|
240
|
+
const options = deleteDocuments ? { DD: deleteDocuments } : undefined;
|
|
241
|
+
await this.redisClient.ft.dropIndex(this.indexName, options);
|
|
240
242
|
return true;
|
|
241
243
|
}
|
|
242
244
|
catch (err) {
|
|
243
245
|
return false;
|
|
244
246
|
}
|
|
245
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Deletes vectors from the vector store.
|
|
250
|
+
* @param params The parameters for deleting vectors.
|
|
251
|
+
* @returns A promise that resolves when the vectors have been deleted.
|
|
252
|
+
*/
|
|
253
|
+
async delete(params) {
|
|
254
|
+
if (params.deleteAll) {
|
|
255
|
+
await this.dropIndex(true);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
throw new Error(`Invalid parameters passed to "delete".`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
246
261
|
buildQuery(query, k, filter) {
|
|
247
262
|
const vectorScoreField = "vector_score";
|
|
248
263
|
let hybridFields = "*";
|
|
@@ -76,7 +76,8 @@ class ZepVectorStore extends base_js_1.VectorStore {
|
|
|
76
76
|
catch (err) {
|
|
77
77
|
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
78
78
|
if (err instanceof Error) {
|
|
79
|
-
|
|
79
|
+
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
80
|
+
if (err instanceof zep_js_1.NotFoundError || err.name === "NotFoundError") {
|
|
80
81
|
await this.createCollection(args);
|
|
81
82
|
}
|
|
82
83
|
else {
|
package/dist/vectorstores/zep.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZepClient } from "@getzep/zep-js";
|
|
1
|
+
import { NotFoundError, ZepClient, } from "@getzep/zep-js";
|
|
2
2
|
import { VectorStore } from "./base.js";
|
|
3
3
|
import { Document } from "../document.js";
|
|
4
4
|
import { FakeEmbeddings } from "../embeddings/fake.js";
|
|
@@ -73,7 +73,8 @@ export class ZepVectorStore extends VectorStore {
|
|
|
73
73
|
catch (err) {
|
|
74
74
|
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
75
75
|
if (err instanceof Error) {
|
|
76
|
-
|
|
76
|
+
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
77
|
+
if (err instanceof NotFoundError || err.name === "NotFoundError") {
|
|
77
78
|
await this.createCollection(args);
|
|
78
79
|
}
|
|
79
80
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/embeddings/minimax.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/embeddings/minimax.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/embeddings/minimax.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../dist/experimental/chat_models/anthropic_functions.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/experimental/chat_models/anthropic_functions.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/experimental/chat_models/anthropic_functions.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.139",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
"embeddings/googlepalm.cjs",
|
|
101
101
|
"embeddings/googlepalm.js",
|
|
102
102
|
"embeddings/googlepalm.d.ts",
|
|
103
|
+
"embeddings/minimax.cjs",
|
|
104
|
+
"embeddings/minimax.js",
|
|
105
|
+
"embeddings/minimax.d.ts",
|
|
103
106
|
"llms.cjs",
|
|
104
107
|
"llms.js",
|
|
105
108
|
"llms.d.ts",
|
|
@@ -394,6 +397,9 @@
|
|
|
394
397
|
"chat_models/ollama.cjs",
|
|
395
398
|
"chat_models/ollama.js",
|
|
396
399
|
"chat_models/ollama.d.ts",
|
|
400
|
+
"chat_models/minimax.cjs",
|
|
401
|
+
"chat_models/minimax.js",
|
|
402
|
+
"chat_models/minimax.d.ts",
|
|
397
403
|
"schema.cjs",
|
|
398
404
|
"schema.js",
|
|
399
405
|
"schema.d.ts",
|
|
@@ -574,6 +580,9 @@
|
|
|
574
580
|
"experimental/multimodal_embeddings/googlevertexai.cjs",
|
|
575
581
|
"experimental/multimodal_embeddings/googlevertexai.js",
|
|
576
582
|
"experimental/multimodal_embeddings/googlevertexai.d.ts",
|
|
583
|
+
"experimental/chat_models/anthropic_functions.cjs",
|
|
584
|
+
"experimental/chat_models/anthropic_functions.js",
|
|
585
|
+
"experimental/chat_models/anthropic_functions.d.ts",
|
|
577
586
|
"evaluation.cjs",
|
|
578
587
|
"evaluation.js",
|
|
579
588
|
"evaluation.d.ts",
|
|
@@ -622,7 +631,7 @@
|
|
|
622
631
|
"@elastic/elasticsearch": "^8.4.0",
|
|
623
632
|
"@faker-js/faker": "^7.6.0",
|
|
624
633
|
"@getmetal/metal-sdk": "^4.0.0",
|
|
625
|
-
"@getzep/zep-js": "^0.
|
|
634
|
+
"@getzep/zep-js": "^0.7.0",
|
|
626
635
|
"@gomomento/sdk": "^1.23.0",
|
|
627
636
|
"@google-ai/generativelanguage": "^0.2.1",
|
|
628
637
|
"@google-cloud/storage": "^6.10.1",
|
|
@@ -679,6 +688,7 @@
|
|
|
679
688
|
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
680
689
|
"eslint-plugin-prettier": "^4.2.1",
|
|
681
690
|
"faiss-node": "^0.3.0",
|
|
691
|
+
"fast-xml-parser": "^4.2.7",
|
|
682
692
|
"firebase-admin": "^11.9.0",
|
|
683
693
|
"google-auth-library": "^8.9.0",
|
|
684
694
|
"graphql": "^16.6.0",
|
|
@@ -736,7 +746,7 @@
|
|
|
736
746
|
"@clickhouse/client": "^0.0.14",
|
|
737
747
|
"@elastic/elasticsearch": "^8.4.0",
|
|
738
748
|
"@getmetal/metal-sdk": "*",
|
|
739
|
-
"@getzep/zep-js": "^0.
|
|
749
|
+
"@getzep/zep-js": "^0.7.0",
|
|
740
750
|
"@gomomento/sdk": "^1.23.0",
|
|
741
751
|
"@google-ai/generativelanguage": "^0.2.1",
|
|
742
752
|
"@google-cloud/storage": "^6.10.1",
|
|
@@ -768,6 +778,7 @@
|
|
|
768
778
|
"d3-dsv": "^2.0.0",
|
|
769
779
|
"epub2": "^3.0.1",
|
|
770
780
|
"faiss-node": "^0.3.0",
|
|
781
|
+
"fast-xml-parser": "^4.2.7",
|
|
771
782
|
"firebase-admin": "^11.9.0",
|
|
772
783
|
"google-auth-library": "^8.9.0",
|
|
773
784
|
"hnswlib-node": "^1.4.2",
|
|
@@ -939,6 +950,9 @@
|
|
|
939
950
|
"faiss-node": {
|
|
940
951
|
"optional": true
|
|
941
952
|
},
|
|
953
|
+
"fast-xml-parser": {
|
|
954
|
+
"optional": true
|
|
955
|
+
},
|
|
942
956
|
"firebase-admin": {
|
|
943
957
|
"optional": true
|
|
944
958
|
},
|
|
@@ -1034,7 +1048,7 @@
|
|
|
1034
1048
|
}
|
|
1035
1049
|
},
|
|
1036
1050
|
"dependencies": {
|
|
1037
|
-
"@anthropic-ai/sdk": "^0.
|
|
1051
|
+
"@anthropic-ai/sdk": "^0.6.2",
|
|
1038
1052
|
"ansi-styles": "^5.0.0",
|
|
1039
1053
|
"binary-extensions": "^2.2.0",
|
|
1040
1054
|
"camelcase": "6",
|
|
@@ -1044,7 +1058,7 @@
|
|
|
1044
1058
|
"js-tiktoken": "^1.0.7",
|
|
1045
1059
|
"js-yaml": "^4.1.0",
|
|
1046
1060
|
"jsonpointer": "^5.0.1",
|
|
1047
|
-
"langsmith": "~0.0.
|
|
1061
|
+
"langsmith": "~0.0.31",
|
|
1048
1062
|
"ml-distance": "^4.0.0",
|
|
1049
1063
|
"object-hash": "^3.0.0",
|
|
1050
1064
|
"openai": "^3.3.0",
|
|
@@ -1231,6 +1245,11 @@
|
|
|
1231
1245
|
"import": "./embeddings/googlepalm.js",
|
|
1232
1246
|
"require": "./embeddings/googlepalm.cjs"
|
|
1233
1247
|
},
|
|
1248
|
+
"./embeddings/minimax": {
|
|
1249
|
+
"types": "./embeddings/minimax.d.ts",
|
|
1250
|
+
"import": "./embeddings/minimax.js",
|
|
1251
|
+
"require": "./embeddings/minimax.cjs"
|
|
1252
|
+
},
|
|
1234
1253
|
"./llms": {
|
|
1235
1254
|
"node": {
|
|
1236
1255
|
"types": "./llms.d.ts",
|
|
@@ -1729,6 +1748,11 @@
|
|
|
1729
1748
|
"import": "./chat_models/ollama.js",
|
|
1730
1749
|
"require": "./chat_models/ollama.cjs"
|
|
1731
1750
|
},
|
|
1751
|
+
"./chat_models/minimax": {
|
|
1752
|
+
"types": "./chat_models/minimax.d.ts",
|
|
1753
|
+
"import": "./chat_models/minimax.js",
|
|
1754
|
+
"require": "./chat_models/minimax.cjs"
|
|
1755
|
+
},
|
|
1732
1756
|
"./schema": {
|
|
1733
1757
|
"types": "./schema.d.ts",
|
|
1734
1758
|
"import": "./schema.js",
|
|
@@ -2031,6 +2055,11 @@
|
|
|
2031
2055
|
"import": "./experimental/multimodal_embeddings/googlevertexai.js",
|
|
2032
2056
|
"require": "./experimental/multimodal_embeddings/googlevertexai.cjs"
|
|
2033
2057
|
},
|
|
2058
|
+
"./experimental/chat_models/anthropic_functions": {
|
|
2059
|
+
"types": "./experimental/chat_models/anthropic_functions.d.ts",
|
|
2060
|
+
"import": "./experimental/chat_models/anthropic_functions.js",
|
|
2061
|
+
"require": "./experimental/chat_models/anthropic_functions.cjs"
|
|
2062
|
+
},
|
|
2034
2063
|
"./evaluation": {
|
|
2035
2064
|
"types": "./evaluation.d.ts",
|
|
2036
2065
|
"import": "./evaluation.js",
|