@langchain/core 0.1.27-rc.2 → 0.1.28
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/chat_history.cjs +33 -0
- package/dist/chat_history.d.ts +32 -1
- package/dist/chat_history.js +33 -0
- package/dist/language_models/chat_models.d.ts +1 -1
- package/dist/load/index.cjs +3 -3
- package/dist/load/index.d.ts +5 -5
- package/dist/load/index.js +3 -3
- package/dist/tracers/log_stream.d.ts +1 -1
- package/package.json +2 -1
package/dist/chat_history.cjs
CHANGED
|
@@ -15,6 +15,13 @@ exports.BaseChatMessageHistory = BaseChatMessageHistory;
|
|
|
15
15
|
* histories should extend this class.
|
|
16
16
|
*/
|
|
17
17
|
class BaseListChatMessageHistory extends serializable_js_1.Serializable {
|
|
18
|
+
/**
|
|
19
|
+
* This is a convenience method for adding a human message string to the store.
|
|
20
|
+
* Please note that this is a convenience method. Code should favor the
|
|
21
|
+
* bulk addMessages interface instead to save on round-trips to the underlying
|
|
22
|
+
* persistence layer.
|
|
23
|
+
* This method may be deprecated in a future release.
|
|
24
|
+
*/
|
|
18
25
|
addUserMessage(message) {
|
|
19
26
|
return this.addMessage(new index_js_1.HumanMessage(message));
|
|
20
27
|
}
|
|
@@ -22,8 +29,34 @@ class BaseListChatMessageHistory extends serializable_js_1.Serializable {
|
|
|
22
29
|
addAIChatMessage(message) {
|
|
23
30
|
return this.addMessage(new index_js_1.AIMessage(message));
|
|
24
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* This is a convenience method for adding an AI message string to the store.
|
|
34
|
+
* Please note that this is a convenience method. Code should favor the bulk
|
|
35
|
+
* addMessages interface instead to save on round-trips to the underlying
|
|
36
|
+
* persistence layer.
|
|
37
|
+
* This method may be deprecated in a future release.
|
|
38
|
+
*/
|
|
25
39
|
addAIMessage(message) {
|
|
26
40
|
return this.addMessage(new index_js_1.AIMessage(message));
|
|
27
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Add a list of messages.
|
|
44
|
+
*
|
|
45
|
+
* Implementations should override this method to handle bulk addition of messages
|
|
46
|
+
* in an efficient manner to avoid unnecessary round-trips to the underlying store.
|
|
47
|
+
*
|
|
48
|
+
* @param messages - A list of BaseMessage objects to store.
|
|
49
|
+
*/
|
|
50
|
+
async addMessages(messages) {
|
|
51
|
+
for (const message of messages) {
|
|
52
|
+
await this.addMessage(message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Remove all messages from the store.
|
|
57
|
+
*/
|
|
58
|
+
clear() {
|
|
59
|
+
throw new Error("Not implemented.");
|
|
60
|
+
}
|
|
28
61
|
}
|
|
29
62
|
exports.BaseListChatMessageHistory = BaseListChatMessageHistory;
|
package/dist/chat_history.d.ts
CHANGED
|
@@ -16,10 +16,41 @@ export declare abstract class BaseChatMessageHistory extends Serializable {
|
|
|
16
16
|
* histories should extend this class.
|
|
17
17
|
*/
|
|
18
18
|
export declare abstract class BaseListChatMessageHistory extends Serializable {
|
|
19
|
+
/** Returns a list of messages stored in the store. */
|
|
20
|
+
abstract getMessages(): Promise<BaseMessage[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Add a message object to the store.
|
|
23
|
+
*/
|
|
19
24
|
abstract addMessage(message: BaseMessage): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* This is a convenience method for adding a human message string to the store.
|
|
27
|
+
* Please note that this is a convenience method. Code should favor the
|
|
28
|
+
* bulk addMessages interface instead to save on round-trips to the underlying
|
|
29
|
+
* persistence layer.
|
|
30
|
+
* This method may be deprecated in a future release.
|
|
31
|
+
*/
|
|
20
32
|
addUserMessage(message: string): Promise<void>;
|
|
21
33
|
/** @deprecated Use addAIMessage instead */
|
|
22
34
|
addAIChatMessage(message: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* This is a convenience method for adding an AI message string to the store.
|
|
37
|
+
* Please note that this is a convenience method. Code should favor the bulk
|
|
38
|
+
* addMessages interface instead to save on round-trips to the underlying
|
|
39
|
+
* persistence layer.
|
|
40
|
+
* This method may be deprecated in a future release.
|
|
41
|
+
*/
|
|
23
42
|
addAIMessage(message: string): Promise<void>;
|
|
24
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Add a list of messages.
|
|
45
|
+
*
|
|
46
|
+
* Implementations should override this method to handle bulk addition of messages
|
|
47
|
+
* in an efficient manner to avoid unnecessary round-trips to the underlying store.
|
|
48
|
+
*
|
|
49
|
+
* @param messages - A list of BaseMessage objects to store.
|
|
50
|
+
*/
|
|
51
|
+
addMessages(messages: BaseMessage[]): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Remove all messages from the store.
|
|
54
|
+
*/
|
|
55
|
+
clear(): Promise<void>;
|
|
25
56
|
}
|
package/dist/chat_history.js
CHANGED
|
@@ -11,6 +11,13 @@ export class BaseChatMessageHistory extends Serializable {
|
|
|
11
11
|
* histories should extend this class.
|
|
12
12
|
*/
|
|
13
13
|
export class BaseListChatMessageHistory extends Serializable {
|
|
14
|
+
/**
|
|
15
|
+
* This is a convenience method for adding a human message string to the store.
|
|
16
|
+
* Please note that this is a convenience method. Code should favor the
|
|
17
|
+
* bulk addMessages interface instead to save on round-trips to the underlying
|
|
18
|
+
* persistence layer.
|
|
19
|
+
* This method may be deprecated in a future release.
|
|
20
|
+
*/
|
|
14
21
|
addUserMessage(message) {
|
|
15
22
|
return this.addMessage(new HumanMessage(message));
|
|
16
23
|
}
|
|
@@ -18,7 +25,33 @@ export class BaseListChatMessageHistory extends Serializable {
|
|
|
18
25
|
addAIChatMessage(message) {
|
|
19
26
|
return this.addMessage(new AIMessage(message));
|
|
20
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* This is a convenience method for adding an AI message string to the store.
|
|
30
|
+
* Please note that this is a convenience method. Code should favor the bulk
|
|
31
|
+
* addMessages interface instead to save on round-trips to the underlying
|
|
32
|
+
* persistence layer.
|
|
33
|
+
* This method may be deprecated in a future release.
|
|
34
|
+
*/
|
|
21
35
|
addAIMessage(message) {
|
|
22
36
|
return this.addMessage(new AIMessage(message));
|
|
23
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Add a list of messages.
|
|
40
|
+
*
|
|
41
|
+
* Implementations should override this method to handle bulk addition of messages
|
|
42
|
+
* in an efficient manner to avoid unnecessary round-trips to the underlying store.
|
|
43
|
+
*
|
|
44
|
+
* @param messages - A list of BaseMessage objects to store.
|
|
45
|
+
*/
|
|
46
|
+
async addMessages(messages) {
|
|
47
|
+
for (const message of messages) {
|
|
48
|
+
await this.addMessage(message);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Remove all messages from the store.
|
|
53
|
+
*/
|
|
54
|
+
clear() {
|
|
55
|
+
throw new Error("Not implemented.");
|
|
56
|
+
}
|
|
24
57
|
}
|
|
@@ -48,7 +48,7 @@ export declare abstract class BaseChatModel<CallOptions extends BaseChatModelCal
|
|
|
48
48
|
ParsedCallOptions: Omit<CallOptions, keyof RunnableConfig & "timeout">;
|
|
49
49
|
lc_namespace: string[];
|
|
50
50
|
constructor(fields: BaseChatModelParams);
|
|
51
|
-
|
|
51
|
+
_combineLLMOutput?(...llmOutputs: LLMResult["llmOutput"][]): LLMResult["llmOutput"];
|
|
52
52
|
protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, this["ParsedCallOptions"]];
|
|
53
53
|
/**
|
|
54
54
|
* Invokes the chat model with a single input.
|
package/dist/load/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ function combineAliasesAndInvert(constructor) {
|
|
|
42
42
|
}, {});
|
|
43
43
|
}
|
|
44
44
|
async function reviver(value) {
|
|
45
|
-
const { optionalImportsMap, optionalImportEntrypoints, importMap, secretsMap, path = ["$"], } = this;
|
|
45
|
+
const { optionalImportsMap = {}, optionalImportEntrypoints = [], importMap = {}, secretsMap = {}, path = ["$"], } = this;
|
|
46
46
|
const pathStr = path.join(".");
|
|
47
47
|
if (typeof value === "object" &&
|
|
48
48
|
value !== null &&
|
|
@@ -182,8 +182,8 @@ async function reviver(value) {
|
|
|
182
182
|
}
|
|
183
183
|
return value;
|
|
184
184
|
}
|
|
185
|
-
async function load(text,
|
|
185
|
+
async function load(text, mappings) {
|
|
186
186
|
const json = JSON.parse(text);
|
|
187
|
-
return reviver.call({
|
|
187
|
+
return reviver.call({ ...mappings }, json);
|
|
188
188
|
}
|
|
189
189
|
exports.load = load;
|
package/dist/load/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OptionalImportMap, SecretMap } from "./import_type.js";
|
|
2
|
-
export declare function load<T>(text: string,
|
|
3
|
-
secretsMap
|
|
4
|
-
optionalImportsMap
|
|
5
|
-
optionalImportEntrypoints
|
|
6
|
-
importMap
|
|
2
|
+
export declare function load<T>(text: string, mappings?: {
|
|
3
|
+
secretsMap?: SecretMap;
|
|
4
|
+
optionalImportsMap?: OptionalImportMap;
|
|
5
|
+
optionalImportEntrypoints?: string[];
|
|
6
|
+
importMap?: Record<string, unknown>;
|
|
7
7
|
}): Promise<T>;
|
package/dist/load/index.js
CHANGED
|
@@ -16,7 +16,7 @@ function combineAliasesAndInvert(constructor) {
|
|
|
16
16
|
}, {});
|
|
17
17
|
}
|
|
18
18
|
async function reviver(value) {
|
|
19
|
-
const { optionalImportsMap, optionalImportEntrypoints, importMap, secretsMap, path = ["$"], } = this;
|
|
19
|
+
const { optionalImportsMap = {}, optionalImportEntrypoints = [], importMap = {}, secretsMap = {}, path = ["$"], } = this;
|
|
20
20
|
const pathStr = path.join(".");
|
|
21
21
|
if (typeof value === "object" &&
|
|
22
22
|
value !== null &&
|
|
@@ -156,7 +156,7 @@ async function reviver(value) {
|
|
|
156
156
|
}
|
|
157
157
|
return value;
|
|
158
158
|
}
|
|
159
|
-
export async function load(text,
|
|
159
|
+
export async function load(text, mappings) {
|
|
160
160
|
const json = JSON.parse(text);
|
|
161
|
-
return reviver.call({
|
|
161
|
+
return reviver.call({ ...mappings }, json);
|
|
162
162
|
}
|
|
@@ -101,7 +101,7 @@ export type StreamEventData = {
|
|
|
101
101
|
/**
|
|
102
102
|
* A streaming event.
|
|
103
103
|
*
|
|
104
|
-
* Schema of a streaming event which is produced from the
|
|
104
|
+
* Schema of a streaming event which is produced from the streamEvents method.
|
|
105
105
|
*/
|
|
106
106
|
export type StreamEvent = {
|
|
107
107
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"prepack": "yarn build",
|
|
28
28
|
"release": "release-it --only-version --config .release-it.json",
|
|
29
29
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
30
|
+
"test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
30
31
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
31
32
|
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
32
33
|
"format": "prettier --config .prettierrc --write \"src\"",
|