@langchain/core 0.1.11 → 0.1.13
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/language_models/base.d.ts +4 -0
- package/dist/load/import_map.cjs +2 -1
- package/dist/load/import_map.d.ts +1 -0
- package/dist/load/import_map.js +1 -0
- package/dist/prompts/template.d.ts +1 -1
- package/dist/runnables/base.cjs +5 -1
- package/dist/runnables/base.js +5 -1
- package/dist/tracers/base.cjs +1 -1
- package/dist/tracers/base.js +1 -1
- package/dist/utils/function_calling.cjs +31 -0
- package/dist/utils/function_calling.d.ts +16 -0
- package/dist/utils/function_calling.js +26 -0
- package/dist/utils/stream.d.ts +1 -1
- package/dist/utils/testing/index.cjs +55 -3
- package/dist/utils/testing/index.d.ts +22 -1
- package/dist/utils/testing/index.js +52 -2
- package/package.json +11 -2
- package/utils/function_calling.cjs +1 -0
- package/utils/function_calling.d.ts +1 -0
- package/utils/function_calling.js +1 -0
package/dist/load/import_map.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.vectorstores = exports.utils__types = exports.utils__tiktoken = exports.utils__testing = exports.utils__stream = exports.utils__math = exports.utils__json_schema = exports.utils__json_patch = exports.utils__hash = exports.utils__env = exports.utils__chunk_array = exports.utils__async_caller = exports.tracers__tracer_langchain_v1 = exports.tracers__tracer_langchain = exports.tracers__run_collector = exports.tracers__log_stream = exports.tracers__initialize = exports.tracers__console = exports.tracers__base = exports.tools = exports.stores = exports.retrievers = exports.runnables = exports.prompt_values = exports.prompts = exports.outputs = exports.output_parsers = exports.messages = exports.memory = exports.load__serializable = exports.language_models__llms = exports.language_models__chat_models = exports.language_models__base = exports.example_selectors = exports.embeddings = exports.documents = exports.chat_history = exports.callbacks__promises = exports.callbacks__manager = exports.callbacks__base = exports.caches = exports.agents = void 0;
|
|
27
|
+
exports.vectorstores = exports.utils__types = exports.utils__tiktoken = exports.utils__testing = exports.utils__stream = exports.utils__math = exports.utils__json_schema = exports.utils__json_patch = exports.utils__hash = exports.utils__function_calling = exports.utils__env = exports.utils__chunk_array = exports.utils__async_caller = exports.tracers__tracer_langchain_v1 = exports.tracers__tracer_langchain = exports.tracers__run_collector = exports.tracers__log_stream = exports.tracers__initialize = exports.tracers__console = exports.tracers__base = exports.tools = exports.stores = exports.retrievers = exports.runnables = exports.prompt_values = exports.prompts = exports.outputs = exports.output_parsers = exports.messages = exports.memory = exports.load__serializable = exports.language_models__llms = exports.language_models__chat_models = exports.language_models__base = exports.example_selectors = exports.embeddings = exports.documents = exports.chat_history = exports.callbacks__promises = exports.callbacks__manager = exports.callbacks__base = exports.caches = exports.agents = void 0;
|
|
28
28
|
exports.agents = __importStar(require("../agents.cjs"));
|
|
29
29
|
exports.caches = __importStar(require("../caches.cjs"));
|
|
30
30
|
exports.callbacks__base = __importStar(require("../callbacks/base.cjs"));
|
|
@@ -58,6 +58,7 @@ exports.tracers__tracer_langchain_v1 = __importStar(require("../tracers/tracer_l
|
|
|
58
58
|
exports.utils__async_caller = __importStar(require("../utils/async_caller.cjs"));
|
|
59
59
|
exports.utils__chunk_array = __importStar(require("../utils/chunk_array.cjs"));
|
|
60
60
|
exports.utils__env = __importStar(require("../utils/env.cjs"));
|
|
61
|
+
exports.utils__function_calling = __importStar(require("../utils/function_calling.cjs"));
|
|
61
62
|
exports.utils__hash = __importStar(require("../utils/hash.cjs"));
|
|
62
63
|
exports.utils__json_patch = __importStar(require("../utils/json_patch.cjs"));
|
|
63
64
|
exports.utils__json_schema = __importStar(require("../utils/json_schema.cjs"));
|
|
@@ -31,6 +31,7 @@ export * as tracers__tracer_langchain_v1 from "../tracers/tracer_langchain_v1.js
|
|
|
31
31
|
export * as utils__async_caller from "../utils/async_caller.js";
|
|
32
32
|
export * as utils__chunk_array from "../utils/chunk_array.js";
|
|
33
33
|
export * as utils__env from "../utils/env.js";
|
|
34
|
+
export * as utils__function_calling from "../utils/function_calling.js";
|
|
34
35
|
export * as utils__hash from "../utils/hash.js";
|
|
35
36
|
export * as utils__json_patch from "../utils/json_patch.js";
|
|
36
37
|
export * as utils__json_schema from "../utils/json_schema.js";
|
package/dist/load/import_map.js
CHANGED
|
@@ -32,6 +32,7 @@ export * as tracers__tracer_langchain_v1 from "../tracers/tracer_langchain_v1.js
|
|
|
32
32
|
export * as utils__async_caller from "../utils/async_caller.js";
|
|
33
33
|
export * as utils__chunk_array from "../utils/chunk_array.js";
|
|
34
34
|
export * as utils__env from "../utils/env.js";
|
|
35
|
+
export * as utils__function_calling from "../utils/function_calling.js";
|
|
35
36
|
export * as utils__hash from "../utils/hash.js";
|
|
36
37
|
export * as utils__json_patch from "../utils/json_patch.js";
|
|
37
38
|
export * as utils__json_schema from "../utils/json_schema.js";
|
|
@@ -8,7 +8,7 @@ export type TemplateFormat = "f-string";
|
|
|
8
8
|
* Type that represents a node in a parsed format string. It can be either
|
|
9
9
|
* a literal text or a variable name.
|
|
10
10
|
*/
|
|
11
|
-
type ParsedFStringNode = {
|
|
11
|
+
export type ParsedFStringNode = {
|
|
12
12
|
type: "literal";
|
|
13
13
|
text: string;
|
|
14
14
|
} | {
|
package/dist/runnables/base.cjs
CHANGED
|
@@ -14,7 +14,11 @@ const async_caller_js_1 = require("../utils/async_caller.cjs");
|
|
|
14
14
|
const root_listener_js_1 = require("../tracers/root_listener.cjs");
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
function _coerceToDict(value, defaultKey) {
|
|
17
|
-
return value &&
|
|
17
|
+
return value &&
|
|
18
|
+
!Array.isArray(value) &&
|
|
19
|
+
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
20
|
+
!(value instanceof Date) &&
|
|
21
|
+
typeof value === "object"
|
|
18
22
|
? value
|
|
19
23
|
: { [defaultKey]: value };
|
|
20
24
|
}
|
package/dist/runnables/base.js
CHANGED
|
@@ -8,7 +8,11 @@ import { AsyncCaller } from "../utils/async_caller.js";
|
|
|
8
8
|
import { RootListenersTracer } from "../tracers/root_listener.js";
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function _coerceToDict(value, defaultKey) {
|
|
11
|
-
return value &&
|
|
11
|
+
return value &&
|
|
12
|
+
!Array.isArray(value) &&
|
|
13
|
+
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
14
|
+
!(value instanceof Date) &&
|
|
15
|
+
typeof value === "object"
|
|
12
16
|
? value
|
|
13
17
|
: { [defaultKey]: value };
|
|
14
18
|
}
|
package/dist/tracers/base.cjs
CHANGED
|
@@ -218,7 +218,7 @@ class BaseTracer extends base_js_1.BaseCallbackHandler {
|
|
|
218
218
|
throw new Error("No chain run to end.");
|
|
219
219
|
}
|
|
220
220
|
run.end_time = Date.now();
|
|
221
|
-
run.error = error.message;
|
|
221
|
+
run.error = error.message + (error.stack ? `\n\n${error.stack}` : "");
|
|
222
222
|
run.events.push({
|
|
223
223
|
name: "error",
|
|
224
224
|
time: new Date(run.end_time).toISOString(),
|
package/dist/tracers/base.js
CHANGED
|
@@ -215,7 +215,7 @@ export class BaseTracer extends BaseCallbackHandler {
|
|
|
215
215
|
throw new Error("No chain run to end.");
|
|
216
216
|
}
|
|
217
217
|
run.end_time = Date.now();
|
|
218
|
-
run.error = error.message;
|
|
218
|
+
run.error = error.message + (error.stack ? `\n\n${error.stack}` : "");
|
|
219
219
|
run.events.push({
|
|
220
220
|
name: "error",
|
|
221
221
|
time: new Date(run.end_time).toISOString(),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToOpenAITool = exports.convertToOpenAIFunction = void 0;
|
|
4
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
+
/**
|
|
6
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
7
|
+
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
8
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
9
|
+
* schema, which is then used as the parameters for the OpenAI function.
|
|
10
|
+
*/
|
|
11
|
+
function convertToOpenAIFunction(tool) {
|
|
12
|
+
return {
|
|
13
|
+
name: tool.name,
|
|
14
|
+
description: tool.description,
|
|
15
|
+
parameters: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.convertToOpenAIFunction = convertToOpenAIFunction;
|
|
19
|
+
/**
|
|
20
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
21
|
+
* with OpenAI tool calling. It uses the `zodToJsonSchema`
|
|
22
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
23
|
+
* schema, which is then used as the parameters for the OpenAI tool.
|
|
24
|
+
*/
|
|
25
|
+
function convertToOpenAITool(tool) {
|
|
26
|
+
return {
|
|
27
|
+
type: "function",
|
|
28
|
+
function: convertToOpenAIFunction(tool),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.convertToOpenAITool = convertToOpenAITool;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StructuredToolInterface } from "../tools.js";
|
|
2
|
+
import { FunctionDefinition, ToolDefinition } from "../language_models/base.js";
|
|
3
|
+
/**
|
|
4
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
5
|
+
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
6
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
7
|
+
* schema, which is then used as the parameters for the OpenAI function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertToOpenAIFunction(tool: StructuredToolInterface): FunctionDefinition;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
12
|
+
* with OpenAI tool calling. It uses the `zodToJsonSchema`
|
|
13
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
14
|
+
* schema, which is then used as the parameters for the OpenAI tool.
|
|
15
|
+
*/
|
|
16
|
+
export declare function convertToOpenAITool(tool: StructuredToolInterface): ToolDefinition;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
+
/**
|
|
3
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
4
|
+
* with OpenAI function calling. It uses the `zodToJsonSchema`
|
|
5
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
6
|
+
* schema, which is then used as the parameters for the OpenAI function.
|
|
7
|
+
*/
|
|
8
|
+
export function convertToOpenAIFunction(tool) {
|
|
9
|
+
return {
|
|
10
|
+
name: tool.name,
|
|
11
|
+
description: tool.description,
|
|
12
|
+
parameters: zodToJsonSchema(tool.schema),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Formats a `StructuredTool` instance into a format that is compatible
|
|
17
|
+
* with OpenAI tool calling. It uses the `zodToJsonSchema`
|
|
18
|
+
* function to convert the schema of the `StructuredTool` into a JSON
|
|
19
|
+
* schema, which is then used as the parameters for the OpenAI tool.
|
|
20
|
+
*/
|
|
21
|
+
export function convertToOpenAITool(tool) {
|
|
22
|
+
return {
|
|
23
|
+
type: "function",
|
|
24
|
+
function: convertToOpenAIFunction(tool),
|
|
25
|
+
};
|
|
26
|
+
}
|
package/dist/utils/stream.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface IterableReadableStreamInterface<T> extends ReadableStream<T>,
|
|
1
|
+
export interface IterableReadableStreamInterface<T> extends ReadableStream<T>, AsyncIterable<T> {
|
|
2
2
|
}
|
|
3
3
|
export declare class IterableReadableStream<T> extends ReadableStream<T> implements IterableReadableStreamInterface<T> {
|
|
4
4
|
reader: ReadableStreamDefaultReader<T>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable no-promise-executor-return */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.FakeListChatMessageHistory = exports.FakeChatMessageHistory = exports.FakeListChatModel = exports.FakeRetriever = exports.FakeChatModel = exports.FakeStreamingLLM = exports.FakeLLM = exports.FakeRunnable = exports.FakeSplitIntoListParser = void 0;
|
|
3
|
+
exports.FakeTool = exports.FakeTracer = exports.FakeListChatMessageHistory = exports.FakeChatMessageHistory = exports.FakeListChatModel = exports.FakeRetriever = exports.FakeChatModel = exports.FakeStreamingLLM = exports.FakeLLM = exports.FakeRunnable = exports.FakeSplitIntoListParser = void 0;
|
|
6
4
|
const chat_history_js_1 = require("../../chat_history.cjs");
|
|
7
5
|
const document_js_1 = require("../../documents/document.cjs");
|
|
8
6
|
const chat_models_js_1 = require("../../language_models/chat_models.cjs");
|
|
@@ -12,6 +10,8 @@ const base_js_1 = require("../../output_parsers/base.cjs");
|
|
|
12
10
|
const outputs_js_1 = require("../../outputs.cjs");
|
|
13
11
|
const retrievers_js_1 = require("../../retrievers.cjs");
|
|
14
12
|
const base_js_2 = require("../../runnables/base.cjs");
|
|
13
|
+
const tools_js_1 = require("../../tools.cjs");
|
|
14
|
+
const base_js_3 = require("../../tracers/base.cjs");
|
|
15
15
|
/**
|
|
16
16
|
* Parser for comma-separated values. It splits the input text by commas
|
|
17
17
|
* and trims the resulting values.
|
|
@@ -343,3 +343,55 @@ class FakeListChatMessageHistory extends chat_history_js_1.BaseListChatMessageHi
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
exports.FakeListChatMessageHistory = FakeListChatMessageHistory;
|
|
346
|
+
class FakeTracer extends base_js_3.BaseTracer {
|
|
347
|
+
constructor() {
|
|
348
|
+
super();
|
|
349
|
+
Object.defineProperty(this, "name", {
|
|
350
|
+
enumerable: true,
|
|
351
|
+
configurable: true,
|
|
352
|
+
writable: true,
|
|
353
|
+
value: "fake_tracer"
|
|
354
|
+
});
|
|
355
|
+
Object.defineProperty(this, "runs", {
|
|
356
|
+
enumerable: true,
|
|
357
|
+
configurable: true,
|
|
358
|
+
writable: true,
|
|
359
|
+
value: []
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
persistRun(run) {
|
|
363
|
+
this.runs.push(run);
|
|
364
|
+
return Promise.resolve();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
exports.FakeTracer = FakeTracer;
|
|
368
|
+
class FakeTool extends tools_js_1.StructuredTool {
|
|
369
|
+
constructor(fields) {
|
|
370
|
+
super(fields);
|
|
371
|
+
Object.defineProperty(this, "name", {
|
|
372
|
+
enumerable: true,
|
|
373
|
+
configurable: true,
|
|
374
|
+
writable: true,
|
|
375
|
+
value: void 0
|
|
376
|
+
});
|
|
377
|
+
Object.defineProperty(this, "description", {
|
|
378
|
+
enumerable: true,
|
|
379
|
+
configurable: true,
|
|
380
|
+
writable: true,
|
|
381
|
+
value: void 0
|
|
382
|
+
});
|
|
383
|
+
Object.defineProperty(this, "schema", {
|
|
384
|
+
enumerable: true,
|
|
385
|
+
configurable: true,
|
|
386
|
+
writable: true,
|
|
387
|
+
value: void 0
|
|
388
|
+
});
|
|
389
|
+
this.name = fields.name;
|
|
390
|
+
this.description = fields.description;
|
|
391
|
+
this.schema = fields.schema;
|
|
392
|
+
}
|
|
393
|
+
async _call(arg, _runManager) {
|
|
394
|
+
return JSON.stringify(arg);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
exports.FakeTool = FakeTool;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseCallbackConfig, CallbackManagerForLLMRun, CallbackManagerForToolRun } from "../../callbacks/manager.js";
|
|
2
3
|
import { BaseChatMessageHistory, BaseListChatMessageHistory } from "../../chat_history.js";
|
|
3
4
|
import { Document } from "../../documents/document.js";
|
|
4
5
|
import { BaseChatModel, BaseChatModelParams } from "../../language_models/chat_models.js";
|
|
@@ -8,6 +9,8 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
8
9
|
import { GenerationChunk, type ChatResult, ChatGenerationChunk } from "../../outputs.js";
|
|
9
10
|
import { BaseRetriever } from "../../retrievers.js";
|
|
10
11
|
import { Runnable } from "../../runnables/base.js";
|
|
12
|
+
import { StructuredTool, ToolParams } from "../../tools.js";
|
|
13
|
+
import { BaseTracer, Run } from "../../tracers/base.js";
|
|
11
14
|
/**
|
|
12
15
|
* Parser for comma-separated values. It splits the input text by commas
|
|
13
16
|
* and trims the resulting values.
|
|
@@ -123,3 +126,21 @@ export declare class FakeListChatMessageHistory extends BaseListChatMessageHisto
|
|
|
123
126
|
addMessage(message: BaseMessage): Promise<void>;
|
|
124
127
|
getMessages(): Promise<BaseMessage[]>;
|
|
125
128
|
}
|
|
129
|
+
export declare class FakeTracer extends BaseTracer {
|
|
130
|
+
name: string;
|
|
131
|
+
runs: Run[];
|
|
132
|
+
constructor();
|
|
133
|
+
protected persistRun(run: Run): Promise<void>;
|
|
134
|
+
}
|
|
135
|
+
export interface FakeToolParams<T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>> extends ToolParams {
|
|
136
|
+
name: string;
|
|
137
|
+
description: string;
|
|
138
|
+
schema: T;
|
|
139
|
+
}
|
|
140
|
+
export declare class FakeTool<T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>> extends StructuredTool<T> {
|
|
141
|
+
name: string;
|
|
142
|
+
description: string;
|
|
143
|
+
schema: T;
|
|
144
|
+
constructor(fields: FakeToolParams<T>);
|
|
145
|
+
protected _call(arg: z.output<T>, _runManager?: CallbackManagerForToolRun): Promise<string>;
|
|
146
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-promise-executor-return */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
1
|
import { BaseChatMessageHistory, BaseListChatMessageHistory, } from "../../chat_history.js";
|
|
4
2
|
import { Document } from "../../documents/document.js";
|
|
5
3
|
import { BaseChatModel, } from "../../language_models/chat_models.js";
|
|
@@ -9,6 +7,8 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
9
7
|
import { ChatGenerationChunk, } from "../../outputs.js";
|
|
10
8
|
import { BaseRetriever } from "../../retrievers.js";
|
|
11
9
|
import { Runnable } from "../../runnables/base.js";
|
|
10
|
+
import { StructuredTool } from "../../tools.js";
|
|
11
|
+
import { BaseTracer } from "../../tracers/base.js";
|
|
12
12
|
/**
|
|
13
13
|
* Parser for comma-separated values. It splits the input text by commas
|
|
14
14
|
* and trims the resulting values.
|
|
@@ -331,3 +331,53 @@ export class FakeListChatMessageHistory extends BaseListChatMessageHistory {
|
|
|
331
331
|
return this.messages;
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
+
export class FakeTracer extends BaseTracer {
|
|
335
|
+
constructor() {
|
|
336
|
+
super();
|
|
337
|
+
Object.defineProperty(this, "name", {
|
|
338
|
+
enumerable: true,
|
|
339
|
+
configurable: true,
|
|
340
|
+
writable: true,
|
|
341
|
+
value: "fake_tracer"
|
|
342
|
+
});
|
|
343
|
+
Object.defineProperty(this, "runs", {
|
|
344
|
+
enumerable: true,
|
|
345
|
+
configurable: true,
|
|
346
|
+
writable: true,
|
|
347
|
+
value: []
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
persistRun(run) {
|
|
351
|
+
this.runs.push(run);
|
|
352
|
+
return Promise.resolve();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
export class FakeTool extends StructuredTool {
|
|
356
|
+
constructor(fields) {
|
|
357
|
+
super(fields);
|
|
358
|
+
Object.defineProperty(this, "name", {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
configurable: true,
|
|
361
|
+
writable: true,
|
|
362
|
+
value: void 0
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(this, "description", {
|
|
365
|
+
enumerable: true,
|
|
366
|
+
configurable: true,
|
|
367
|
+
writable: true,
|
|
368
|
+
value: void 0
|
|
369
|
+
});
|
|
370
|
+
Object.defineProperty(this, "schema", {
|
|
371
|
+
enumerable: true,
|
|
372
|
+
configurable: true,
|
|
373
|
+
writable: true,
|
|
374
|
+
value: void 0
|
|
375
|
+
});
|
|
376
|
+
this.name = fields.name;
|
|
377
|
+
this.description = fields.description;
|
|
378
|
+
this.schema = fields.schema;
|
|
379
|
+
}
|
|
380
|
+
async _call(arg, _runManager) {
|
|
381
|
+
return JSON.stringify(arg);
|
|
382
|
+
}
|
|
383
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"p-queue": "^6.6.2",
|
|
44
44
|
"p-retry": "4",
|
|
45
45
|
"uuid": "^9.0.0",
|
|
46
|
-
"zod": "^3.22.3"
|
|
46
|
+
"zod": "^3.22.3",
|
|
47
|
+
"zod-to-json-schema": "3.20.3"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@jest/globals": "^29.5.0",
|
|
@@ -254,6 +255,11 @@
|
|
|
254
255
|
"import": "./utils/env.js",
|
|
255
256
|
"require": "./utils/env.cjs"
|
|
256
257
|
},
|
|
258
|
+
"./utils/function_calling": {
|
|
259
|
+
"types": "./utils/function_calling.d.ts",
|
|
260
|
+
"import": "./utils/function_calling.js",
|
|
261
|
+
"require": "./utils/function_calling.cjs"
|
|
262
|
+
},
|
|
257
263
|
"./utils/hash": {
|
|
258
264
|
"types": "./utils/hash.d.ts",
|
|
259
265
|
"import": "./utils/hash.js",
|
|
@@ -405,6 +411,9 @@
|
|
|
405
411
|
"utils/env.cjs",
|
|
406
412
|
"utils/env.js",
|
|
407
413
|
"utils/env.d.ts",
|
|
414
|
+
"utils/function_calling.cjs",
|
|
415
|
+
"utils/function_calling.js",
|
|
416
|
+
"utils/function_calling.d.ts",
|
|
408
417
|
"utils/hash.cjs",
|
|
409
418
|
"utils/hash.js",
|
|
410
419
|
"utils/hash.d.ts",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/utils/function_calling.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/utils/function_calling.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/utils/function_calling.js'
|