@langchain/core 0.2.14 → 0.2.16
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/README.md +1 -1
- package/caches.cjs +1 -1
- package/caches.d.cts +1 -1
- package/caches.d.ts +1 -1
- package/caches.js +1 -1
- package/callbacks/dispatch/web.cjs +1 -0
- package/callbacks/dispatch/web.d.cts +1 -0
- package/callbacks/dispatch/web.d.ts +1 -0
- package/callbacks/dispatch/web.js +1 -0
- package/callbacks/dispatch.cjs +1 -0
- package/callbacks/dispatch.d.cts +1 -0
- package/callbacks/dispatch.d.ts +1 -0
- package/callbacks/dispatch.js +1 -0
- package/dist/{caches.cjs → caches/base.cjs} +6 -6
- package/dist/{caches.d.ts → caches/base.d.ts} +7 -7
- package/dist/{caches.js → caches/base.js} +6 -6
- package/dist/caches/tests/in_memory_cache.test.d.ts +1 -0
- package/dist/caches/tests/in_memory_cache.test.js +33 -0
- package/dist/callbacks/base.cjs +8 -0
- package/dist/callbacks/base.d.ts +16 -10
- package/dist/callbacks/base.js +8 -0
- package/dist/callbacks/dispatch/index.cjs +49 -0
- package/dist/callbacks/dispatch/index.d.ts +35 -0
- package/dist/callbacks/dispatch/index.js +45 -0
- package/dist/callbacks/dispatch/web.cjs +61 -0
- package/dist/callbacks/dispatch/web.d.ts +32 -0
- package/dist/callbacks/dispatch/web.js +57 -0
- package/dist/callbacks/manager.cjs +32 -5
- package/dist/callbacks/manager.d.ts +5 -2
- package/dist/callbacks/manager.js +31 -5
- package/dist/language_models/base.cjs +4 -4
- package/dist/language_models/base.d.ts +2 -2
- package/dist/language_models/base.js +1 -1
- package/dist/language_models/chat_models.d.ts +4 -4
- package/dist/language_models/llms.d.ts +1 -1
- package/dist/language_models/tests/chat_models.test.js +33 -0
- package/dist/load/import_map.cjs +2 -2
- package/dist/load/import_map.d.ts +2 -2
- package/dist/load/import_map.js +2 -2
- package/dist/messages/ai.cjs +2 -0
- package/dist/messages/ai.js +2 -0
- package/dist/messages/base.cjs +45 -5
- package/dist/messages/base.d.ts +1 -0
- package/dist/messages/base.js +43 -4
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/tests/base_message.test.js +134 -2
- package/dist/messages/tests/message_utils.test.js +54 -2
- package/dist/messages/tool.cjs +31 -0
- package/dist/messages/tool.d.ts +27 -0
- package/dist/messages/tool.js +32 -1
- package/dist/messages/transformers.cjs +1 -0
- package/dist/messages/transformers.js +1 -0
- package/dist/messages/utils.cjs +5 -1
- package/dist/messages/utils.js +5 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +2 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +2 -0
- package/dist/runnables/base.cjs +89 -16
- package/dist/runnables/base.d.ts +51 -0
- package/dist/runnables/base.js +86 -15
- package/dist/runnables/config.cjs +30 -8
- package/dist/runnables/config.js +30 -8
- package/dist/runnables/history.cjs +1 -1
- package/dist/runnables/history.d.ts +1 -3
- package/dist/runnables/history.js +1 -1
- package/dist/runnables/index.cjs +2 -1
- package/dist/runnables/index.d.ts +1 -1
- package/dist/runnables/index.js +1 -1
- package/dist/runnables/tests/runnable.test.js +3 -3
- package/dist/runnables/tests/runnable_stream_events.test.js +1 -1
- package/dist/runnables/tests/runnable_stream_events_v2.test.js +124 -19
- package/dist/runnables/tests/runnable_tools.test.d.ts +1 -0
- package/dist/runnables/tests/runnable_tools.test.js +111 -0
- package/dist/singletons/tests/async_local_storage.test.js +38 -4
- package/dist/{tools.cjs → tools/index.cjs} +130 -14
- package/dist/{tools.d.ts → tools/index.d.ts} +69 -31
- package/dist/{tools.js → tools/index.js} +130 -14
- package/dist/tools/tests/tools.test.d.ts +1 -0
- package/dist/tools/tests/tools.test.js +74 -0
- package/dist/tracers/base.cjs +1 -0
- package/dist/tracers/base.d.ts +1 -1
- package/dist/tracers/base.js +1 -0
- package/dist/tracers/event_stream.cjs +15 -0
- package/dist/tracers/event_stream.d.ts +1 -0
- package/dist/tracers/event_stream.js +15 -0
- package/dist/tracers/initialize.cjs +2 -0
- package/dist/tracers/initialize.d.ts +2 -0
- package/dist/tracers/initialize.js +2 -0
- package/dist/types/zod.cjs +2 -0
- package/dist/types/zod.d.ts +2 -0
- package/dist/types/zod.js +1 -0
- package/dist/utils/callbacks.cjs +17 -0
- package/dist/utils/callbacks.d.ts +1 -0
- package/dist/utils/callbacks.js +13 -0
- package/dist/utils/function_calling.cjs +38 -10
- package/dist/utils/function_calling.d.ts +32 -11
- package/dist/utils/function_calling.js +36 -9
- package/dist/utils/testing/index.cjs +10 -3
- package/dist/utils/testing/index.d.ts +1 -1
- package/dist/utils/testing/index.js +9 -2
- package/package.json +28 -14
- package/tools.cjs +1 -1
- package/tools.d.cts +1 -1
- package/tools.d.ts +1 -1
- package/tools.js +1 -1
- package/dist/utils/beta_warning.cjs +0 -11
- package/dist/utils/beta_warning.d.ts +0 -5
- package/dist/utils/beta_warning.js +0 -7
- package/utils/beta_warning.cjs +0 -1
- package/utils/beta_warning.d.cts +0 -1
- package/utils/beta_warning.d.ts +0 -1
- package/utils/beta_warning.js +0 -1
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStructuredTool = exports.convertToOpenAITool = exports.convertToOpenAIFunction = void 0;
|
|
3
|
+
exports.isRunnableToolLike = exports.isStructuredTool = exports.convertToOpenAITool = exports.convertToOpenAIFunction = void 0;
|
|
4
4
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
+
const base_js_1 = require("../runnables/base.cjs");
|
|
5
6
|
/**
|
|
6
|
-
* Formats a `StructuredTool` instance into a format
|
|
7
|
-
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
8
|
-
* function to convert the schema of the `StructuredTool`
|
|
9
|
-
* schema, which is then used as the parameters for the OpenAI function.
|
|
7
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a format
|
|
8
|
+
* that is compatible with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
9
|
+
* function to convert the schema of the `StructuredTool` or `RunnableToolLike`
|
|
10
|
+
* into a JSON schema, which is then used as the parameters for the OpenAI function.
|
|
11
|
+
*
|
|
12
|
+
* @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.
|
|
13
|
+
* @returns {FunctionDefinition} The inputted tool in OpenAI function format.
|
|
10
14
|
*/
|
|
11
15
|
function convertToOpenAIFunction(tool) {
|
|
12
16
|
return {
|
|
@@ -17,15 +21,19 @@ function convertToOpenAIFunction(tool) {
|
|
|
17
21
|
}
|
|
18
22
|
exports.convertToOpenAIFunction = convertToOpenAIFunction;
|
|
19
23
|
/**
|
|
20
|
-
* Formats a `StructuredTool` instance into a
|
|
21
|
-
* with OpenAI tool calling. It uses the
|
|
22
|
-
* function to convert the schema of the `StructuredTool`
|
|
23
|
-
* schema, which is then used as the
|
|
24
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a
|
|
25
|
+
* format that is compatible with OpenAI tool calling. It uses the
|
|
26
|
+
* `zodToJsonSchema` function to convert the schema of the `StructuredTool`
|
|
27
|
+
* or `RunnableToolLike` into a JSON schema, which is then used as the
|
|
28
|
+
* parameters for the OpenAI tool.
|
|
29
|
+
*
|
|
30
|
+
* @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.
|
|
31
|
+
* @returns {ToolDefinition} The inputted tool in OpenAI tool format.
|
|
24
32
|
*/
|
|
25
33
|
function convertToOpenAITool(
|
|
26
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
35
|
tool) {
|
|
28
|
-
if (isStructuredTool(tool)) {
|
|
36
|
+
if (isStructuredTool(tool) || isRunnableToolLike(tool)) {
|
|
29
37
|
return {
|
|
30
38
|
type: "function",
|
|
31
39
|
function: convertToOpenAIFunction(tool),
|
|
@@ -34,6 +42,12 @@ tool) {
|
|
|
34
42
|
return tool;
|
|
35
43
|
}
|
|
36
44
|
exports.convertToOpenAITool = convertToOpenAITool;
|
|
45
|
+
/**
|
|
46
|
+
* Confirm whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
47
|
+
*
|
|
48
|
+
* @param {StructuredToolInterface | Record<string, any> | undefined} tool The tool to check if it is an instance of `StructuredToolInterface`.
|
|
49
|
+
* @returns {tool is StructuredToolInterface} Whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
50
|
+
*/
|
|
37
51
|
function isStructuredTool(
|
|
38
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
53
|
tool) {
|
|
@@ -41,3 +55,17 @@ tool) {
|
|
|
41
55
|
Array.isArray(tool.lc_namespace));
|
|
42
56
|
}
|
|
43
57
|
exports.isStructuredTool = isStructuredTool;
|
|
58
|
+
/**
|
|
59
|
+
* Confirm whether the inputted tool is an instance of `RunnableToolLike`.
|
|
60
|
+
*
|
|
61
|
+
* @param {unknown | undefined} tool The tool to check if it is an instance of `RunnableToolLike`.
|
|
62
|
+
* @returns {tool is RunnableToolLike} Whether the inputted tool is an instance of `RunnableToolLike`.
|
|
63
|
+
*/
|
|
64
|
+
function isRunnableToolLike(tool) {
|
|
65
|
+
return (tool !== undefined &&
|
|
66
|
+
base_js_1.Runnable.isRunnable(tool) &&
|
|
67
|
+
"lc_name" in tool.constructor &&
|
|
68
|
+
typeof tool.constructor.lc_name === "function" &&
|
|
69
|
+
tool.constructor.lc_name() === "RunnableToolLike");
|
|
70
|
+
}
|
|
71
|
+
exports.isRunnableToolLike = isRunnableToolLike;
|
|
@@ -1,17 +1,38 @@
|
|
|
1
|
-
import { StructuredToolInterface } from "../tools.js";
|
|
1
|
+
import { StructuredToolInterface } from "../tools/index.js";
|
|
2
2
|
import { FunctionDefinition, ToolDefinition } from "../language_models/base.js";
|
|
3
|
+
import { RunnableToolLike } from "../runnables/base.js";
|
|
3
4
|
/**
|
|
4
|
-
* Formats a `StructuredTool` instance into a format
|
|
5
|
-
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
6
|
-
* function to convert the schema of the `StructuredTool`
|
|
7
|
-
* schema, which is then used as the parameters for the OpenAI function.
|
|
5
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a format
|
|
6
|
+
* that is compatible with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
7
|
+
* function to convert the schema of the `StructuredTool` or `RunnableToolLike`
|
|
8
|
+
* into a JSON schema, which is then used as the parameters for the OpenAI function.
|
|
9
|
+
*
|
|
10
|
+
* @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.
|
|
11
|
+
* @returns {FunctionDefinition} The inputted tool in OpenAI function format.
|
|
8
12
|
*/
|
|
9
|
-
export declare function convertToOpenAIFunction(tool: StructuredToolInterface): FunctionDefinition;
|
|
13
|
+
export declare function convertToOpenAIFunction(tool: StructuredToolInterface | RunnableToolLike): FunctionDefinition;
|
|
10
14
|
/**
|
|
11
|
-
* Formats a `StructuredTool` instance into a
|
|
12
|
-
* with OpenAI tool calling. It uses the
|
|
13
|
-
* function to convert the schema of the `StructuredTool`
|
|
14
|
-
* schema, which is then used as the
|
|
15
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a
|
|
16
|
+
* format that is compatible with OpenAI tool calling. It uses the
|
|
17
|
+
* `zodToJsonSchema` function to convert the schema of the `StructuredTool`
|
|
18
|
+
* or `RunnableToolLike` into a JSON schema, which is then used as the
|
|
19
|
+
* parameters for the OpenAI tool.
|
|
20
|
+
*
|
|
21
|
+
* @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.
|
|
22
|
+
* @returns {ToolDefinition} The inputted tool in OpenAI tool format.
|
|
23
|
+
*/
|
|
24
|
+
export declare function convertToOpenAITool(tool: StructuredToolInterface | Record<string, any> | RunnableToolLike): ToolDefinition;
|
|
25
|
+
/**
|
|
26
|
+
* Confirm whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
27
|
+
*
|
|
28
|
+
* @param {StructuredToolInterface | Record<string, any> | undefined} tool The tool to check if it is an instance of `StructuredToolInterface`.
|
|
29
|
+
* @returns {tool is StructuredToolInterface} Whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
15
30
|
*/
|
|
16
|
-
export declare function convertToOpenAITool(tool: StructuredToolInterface | Record<string, any>): ToolDefinition;
|
|
17
31
|
export declare function isStructuredTool(tool?: StructuredToolInterface | Record<string, any>): tool is StructuredToolInterface;
|
|
32
|
+
/**
|
|
33
|
+
* Confirm whether the inputted tool is an instance of `RunnableToolLike`.
|
|
34
|
+
*
|
|
35
|
+
* @param {unknown | undefined} tool The tool to check if it is an instance of `RunnableToolLike`.
|
|
36
|
+
* @returns {tool is RunnableToolLike} Whether the inputted tool is an instance of `RunnableToolLike`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isRunnableToolLike(tool?: unknown): tool is RunnableToolLike;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
+
import { Runnable } from "../runnables/base.js";
|
|
2
3
|
/**
|
|
3
|
-
* Formats a `StructuredTool` instance into a format
|
|
4
|
-
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
5
|
-
* function to convert the schema of the `StructuredTool`
|
|
6
|
-
* schema, which is then used as the parameters for the OpenAI function.
|
|
4
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a format
|
|
5
|
+
* that is compatible with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
6
|
+
* function to convert the schema of the `StructuredTool` or `RunnableToolLike`
|
|
7
|
+
* into a JSON schema, which is then used as the parameters for the OpenAI function.
|
|
8
|
+
*
|
|
9
|
+
* @param {StructuredToolInterface | RunnableToolLike} tool The tool to convert to an OpenAI function.
|
|
10
|
+
* @returns {FunctionDefinition} The inputted tool in OpenAI function format.
|
|
7
11
|
*/
|
|
8
12
|
export function convertToOpenAIFunction(tool) {
|
|
9
13
|
return {
|
|
@@ -13,15 +17,19 @@ export function convertToOpenAIFunction(tool) {
|
|
|
13
17
|
};
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
|
-
* Formats a `StructuredTool` instance into a
|
|
17
|
-
* with OpenAI tool calling. It uses the
|
|
18
|
-
* function to convert the schema of the `StructuredTool`
|
|
19
|
-
* schema, which is then used as the
|
|
20
|
+
* Formats a `StructuredTool` or `RunnableToolLike` instance into a
|
|
21
|
+
* format that is compatible with OpenAI tool calling. It uses the
|
|
22
|
+
* `zodToJsonSchema` function to convert the schema of the `StructuredTool`
|
|
23
|
+
* or `RunnableToolLike` into a JSON schema, which is then used as the
|
|
24
|
+
* parameters for the OpenAI tool.
|
|
25
|
+
*
|
|
26
|
+
* @param {StructuredToolInterface | Record<string, any> | RunnableToolLike} tool The tool to convert to an OpenAI tool.
|
|
27
|
+
* @returns {ToolDefinition} The inputted tool in OpenAI tool format.
|
|
20
28
|
*/
|
|
21
29
|
export function convertToOpenAITool(
|
|
22
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
31
|
tool) {
|
|
24
|
-
if (isStructuredTool(tool)) {
|
|
32
|
+
if (isStructuredTool(tool) || isRunnableToolLike(tool)) {
|
|
25
33
|
return {
|
|
26
34
|
type: "function",
|
|
27
35
|
function: convertToOpenAIFunction(tool),
|
|
@@ -29,9 +37,28 @@ tool) {
|
|
|
29
37
|
}
|
|
30
38
|
return tool;
|
|
31
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Confirm whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
42
|
+
*
|
|
43
|
+
* @param {StructuredToolInterface | Record<string, any> | undefined} tool The tool to check if it is an instance of `StructuredToolInterface`.
|
|
44
|
+
* @returns {tool is StructuredToolInterface} Whether the inputted tool is an instance of `StructuredToolInterface`.
|
|
45
|
+
*/
|
|
32
46
|
export function isStructuredTool(
|
|
33
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
48
|
tool) {
|
|
35
49
|
return (tool !== undefined &&
|
|
36
50
|
Array.isArray(tool.lc_namespace));
|
|
37
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Confirm whether the inputted tool is an instance of `RunnableToolLike`.
|
|
54
|
+
*
|
|
55
|
+
* @param {unknown | undefined} tool The tool to check if it is an instance of `RunnableToolLike`.
|
|
56
|
+
* @returns {tool is RunnableToolLike} Whether the inputted tool is an instance of `RunnableToolLike`.
|
|
57
|
+
*/
|
|
58
|
+
export function isRunnableToolLike(tool) {
|
|
59
|
+
return (tool !== undefined &&
|
|
60
|
+
Runnable.isRunnable(tool) &&
|
|
61
|
+
"lc_name" in tool.constructor &&
|
|
62
|
+
typeof tool.constructor.lc_name === "function" &&
|
|
63
|
+
tool.constructor.lc_name() === "RunnableToolLike");
|
|
64
|
+
}
|
|
@@ -13,7 +13,7 @@ const base_js_1 = require("../../output_parsers/base.cjs");
|
|
|
13
13
|
const outputs_js_1 = require("../../outputs.cjs");
|
|
14
14
|
const index_js_2 = require("../../retrievers/index.cjs");
|
|
15
15
|
const base_js_2 = require("../../runnables/base.cjs");
|
|
16
|
-
const
|
|
16
|
+
const index_js_3 = require("../../tools/index.cjs");
|
|
17
17
|
const base_js_3 = require("../../tracers/base.cjs");
|
|
18
18
|
const embeddings_js_1 = require("../../embeddings.cjs");
|
|
19
19
|
/**
|
|
@@ -162,7 +162,14 @@ class FakeChatModel extends chat_models_js_1.BaseChatModel {
|
|
|
162
162
|
],
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
const text = messages
|
|
165
|
+
const text = messages
|
|
166
|
+
.map((m) => {
|
|
167
|
+
if (typeof m.content === "string") {
|
|
168
|
+
return m.content;
|
|
169
|
+
}
|
|
170
|
+
return JSON.stringify(m.content, null, 2);
|
|
171
|
+
})
|
|
172
|
+
.join("\n");
|
|
166
173
|
await runManager?.handleLLMNewToken(text);
|
|
167
174
|
return {
|
|
168
175
|
generations: [
|
|
@@ -475,7 +482,7 @@ class FakeTracer extends base_js_3.BaseTracer {
|
|
|
475
482
|
}
|
|
476
483
|
}
|
|
477
484
|
exports.FakeTracer = FakeTracer;
|
|
478
|
-
class FakeTool extends
|
|
485
|
+
class FakeTool extends index_js_3.StructuredTool {
|
|
479
486
|
constructor(fields) {
|
|
480
487
|
super(fields);
|
|
481
488
|
Object.defineProperty(this, "name", {
|
|
@@ -9,7 +9,7 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
9
9
|
import { GenerationChunk, type ChatResult, ChatGenerationChunk } from "../../outputs.js";
|
|
10
10
|
import { BaseRetriever } from "../../retrievers/index.js";
|
|
11
11
|
import { Runnable } from "../../runnables/base.js";
|
|
12
|
-
import { StructuredTool, ToolParams } from "../../tools.js";
|
|
12
|
+
import { StructuredTool, ToolParams } from "../../tools/index.js";
|
|
13
13
|
import { BaseTracer, Run } from "../../tracers/base.js";
|
|
14
14
|
import { Embeddings, EmbeddingsParams } from "../../embeddings.js";
|
|
15
15
|
import { StructuredOutputMethodParams, BaseLanguageModelInput, StructuredOutputMethodOptions } from "../../language_models/base.js";
|
|
@@ -10,7 +10,7 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
10
10
|
import { ChatGenerationChunk, } from "../../outputs.js";
|
|
11
11
|
import { BaseRetriever } from "../../retrievers/index.js";
|
|
12
12
|
import { Runnable, RunnableLambda } from "../../runnables/base.js";
|
|
13
|
-
import { StructuredTool } from "../../tools.js";
|
|
13
|
+
import { StructuredTool } from "../../tools/index.js";
|
|
14
14
|
import { BaseTracer } from "../../tracers/base.js";
|
|
15
15
|
import { Embeddings } from "../../embeddings.js";
|
|
16
16
|
/**
|
|
@@ -155,7 +155,14 @@ export class FakeChatModel extends BaseChatModel {
|
|
|
155
155
|
],
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
const text = messages
|
|
158
|
+
const text = messages
|
|
159
|
+
.map((m) => {
|
|
160
|
+
if (typeof m.content === "string") {
|
|
161
|
+
return m.content;
|
|
162
|
+
}
|
|
163
|
+
return JSON.stringify(m.content, null, 2);
|
|
164
|
+
})
|
|
165
|
+
.join("\n");
|
|
159
166
|
await runManager?.handleLLMNewToken(text);
|
|
160
167
|
return {
|
|
161
168
|
generations: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"prettier": "^2.8.3",
|
|
75
75
|
"release-it": "^15.10.1",
|
|
76
76
|
"rimraf": "^5.0.1",
|
|
77
|
+
"ts-jest": "^29.1.0",
|
|
77
78
|
"typescript": "~5.1.6",
|
|
78
79
|
"web-streams-polyfill": "^3.3.3"
|
|
79
80
|
},
|
|
@@ -122,6 +123,24 @@
|
|
|
122
123
|
"import": "./callbacks/base.js",
|
|
123
124
|
"require": "./callbacks/base.cjs"
|
|
124
125
|
},
|
|
126
|
+
"./callbacks/dispatch": {
|
|
127
|
+
"types": {
|
|
128
|
+
"import": "./callbacks/dispatch.d.ts",
|
|
129
|
+
"require": "./callbacks/dispatch.d.cts",
|
|
130
|
+
"default": "./callbacks/dispatch.d.ts"
|
|
131
|
+
},
|
|
132
|
+
"import": "./callbacks/dispatch.js",
|
|
133
|
+
"require": "./callbacks/dispatch.cjs"
|
|
134
|
+
},
|
|
135
|
+
"./callbacks/dispatch/web": {
|
|
136
|
+
"types": {
|
|
137
|
+
"import": "./callbacks/dispatch/web.d.ts",
|
|
138
|
+
"require": "./callbacks/dispatch/web.d.cts",
|
|
139
|
+
"default": "./callbacks/dispatch/web.d.ts"
|
|
140
|
+
},
|
|
141
|
+
"import": "./callbacks/dispatch/web.js",
|
|
142
|
+
"require": "./callbacks/dispatch/web.cjs"
|
|
143
|
+
},
|
|
125
144
|
"./callbacks/manager": {
|
|
126
145
|
"types": {
|
|
127
146
|
"import": "./callbacks/manager.d.ts",
|
|
@@ -473,15 +492,6 @@
|
|
|
473
492
|
"import": "./utils/async_caller.js",
|
|
474
493
|
"require": "./utils/async_caller.cjs"
|
|
475
494
|
},
|
|
476
|
-
"./utils/beta_warning": {
|
|
477
|
-
"types": {
|
|
478
|
-
"import": "./utils/beta_warning.d.ts",
|
|
479
|
-
"require": "./utils/beta_warning.d.cts",
|
|
480
|
-
"default": "./utils/beta_warning.d.ts"
|
|
481
|
-
},
|
|
482
|
-
"import": "./utils/beta_warning.js",
|
|
483
|
-
"require": "./utils/beta_warning.cjs"
|
|
484
|
-
},
|
|
485
495
|
"./utils/chunk_array": {
|
|
486
496
|
"types": {
|
|
487
497
|
"import": "./utils/chunk_array.d.ts",
|
|
@@ -615,6 +625,14 @@
|
|
|
615
625
|
"callbacks/base.js",
|
|
616
626
|
"callbacks/base.d.ts",
|
|
617
627
|
"callbacks/base.d.cts",
|
|
628
|
+
"callbacks/dispatch.cjs",
|
|
629
|
+
"callbacks/dispatch.js",
|
|
630
|
+
"callbacks/dispatch.d.ts",
|
|
631
|
+
"callbacks/dispatch.d.cts",
|
|
632
|
+
"callbacks/dispatch/web.cjs",
|
|
633
|
+
"callbacks/dispatch/web.js",
|
|
634
|
+
"callbacks/dispatch/web.d.ts",
|
|
635
|
+
"callbacks/dispatch/web.d.cts",
|
|
618
636
|
"callbacks/manager.cjs",
|
|
619
637
|
"callbacks/manager.js",
|
|
620
638
|
"callbacks/manager.d.ts",
|
|
@@ -771,10 +789,6 @@
|
|
|
771
789
|
"utils/async_caller.js",
|
|
772
790
|
"utils/async_caller.d.ts",
|
|
773
791
|
"utils/async_caller.d.cts",
|
|
774
|
-
"utils/beta_warning.cjs",
|
|
775
|
-
"utils/beta_warning.js",
|
|
776
|
-
"utils/beta_warning.d.ts",
|
|
777
|
-
"utils/beta_warning.d.cts",
|
|
778
792
|
"utils/chunk_array.cjs",
|
|
779
793
|
"utils/chunk_array.js",
|
|
780
794
|
"utils/chunk_array.d.ts",
|
package/tools.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/tools.cjs');
|
|
1
|
+
module.exports = require('./dist/tools/index.cjs');
|
package/tools.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/tools.js'
|
|
1
|
+
export * from './dist/tools/index.js'
|
package/tools.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/tools.js'
|
|
1
|
+
export * from './dist/tools/index.js'
|
package/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/tools.js'
|
|
1
|
+
export * from './dist/tools/index.js'
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.betaWarning = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Util function for logging a warning when a method is called.
|
|
6
|
-
* @param {string} func The name of the function that is in beta.
|
|
7
|
-
*/
|
|
8
|
-
function betaWarning(func) {
|
|
9
|
-
console.warn(`The function '${func}' is in beta. It is actively being worked on, so the API may change.`);
|
|
10
|
-
}
|
|
11
|
-
exports.betaWarning = betaWarning;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Util function for logging a warning when a method is called.
|
|
3
|
-
* @param {string} func The name of the function that is in beta.
|
|
4
|
-
*/
|
|
5
|
-
export function betaWarning(func) {
|
|
6
|
-
console.warn(`The function '${func}' is in beta. It is actively being worked on, so the API may change.`);
|
|
7
|
-
}
|
package/utils/beta_warning.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../dist/utils/beta_warning.cjs');
|
package/utils/beta_warning.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../dist/utils/beta_warning.js'
|
package/utils/beta_warning.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../dist/utils/beta_warning.js'
|
package/utils/beta_warning.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../dist/utils/beta_warning.js'
|