@langchain/core 0.1.11 → 0.1.12
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.
|
@@ -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
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-promise-executor-return */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
4
|
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;
|
|
5
|
+
exports.FakeTracer = exports.FakeListChatMessageHistory = exports.FakeChatMessageHistory = exports.FakeListChatModel = exports.FakeRetriever = exports.FakeChatModel = exports.FakeStreamingLLM = exports.FakeLLM = exports.FakeRunnable = exports.FakeSplitIntoListParser = void 0;
|
|
6
6
|
const chat_history_js_1 = require("../../chat_history.cjs");
|
|
7
7
|
const document_js_1 = require("../../documents/document.cjs");
|
|
8
8
|
const chat_models_js_1 = require("../../language_models/chat_models.cjs");
|
|
@@ -12,6 +12,7 @@ const base_js_1 = require("../../output_parsers/base.cjs");
|
|
|
12
12
|
const outputs_js_1 = require("../../outputs.cjs");
|
|
13
13
|
const retrievers_js_1 = require("../../retrievers.cjs");
|
|
14
14
|
const base_js_2 = require("../../runnables/base.cjs");
|
|
15
|
+
const base_js_3 = require("../../tracers/base.cjs");
|
|
15
16
|
/**
|
|
16
17
|
* Parser for comma-separated values. It splits the input text by commas
|
|
17
18
|
* and trims the resulting values.
|
|
@@ -343,3 +344,25 @@ class FakeListChatMessageHistory extends chat_history_js_1.BaseListChatMessageHi
|
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
346
|
exports.FakeListChatMessageHistory = FakeListChatMessageHistory;
|
|
347
|
+
class FakeTracer extends base_js_3.BaseTracer {
|
|
348
|
+
constructor() {
|
|
349
|
+
super();
|
|
350
|
+
Object.defineProperty(this, "name", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
configurable: true,
|
|
353
|
+
writable: true,
|
|
354
|
+
value: "fake_tracer"
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(this, "runs", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
configurable: true,
|
|
359
|
+
writable: true,
|
|
360
|
+
value: []
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
persistRun(run) {
|
|
364
|
+
this.runs.push(run);
|
|
365
|
+
return Promise.resolve();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
exports.FakeTracer = FakeTracer;
|
|
@@ -8,6 +8,7 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
8
8
|
import { GenerationChunk, type ChatResult, ChatGenerationChunk } from "../../outputs.js";
|
|
9
9
|
import { BaseRetriever } from "../../retrievers.js";
|
|
10
10
|
import { Runnable } from "../../runnables/base.js";
|
|
11
|
+
import { BaseTracer, Run } from "../../tracers/base.js";
|
|
11
12
|
/**
|
|
12
13
|
* Parser for comma-separated values. It splits the input text by commas
|
|
13
14
|
* and trims the resulting values.
|
|
@@ -123,3 +124,9 @@ export declare class FakeListChatMessageHistory extends BaseListChatMessageHisto
|
|
|
123
124
|
addMessage(message: BaseMessage): Promise<void>;
|
|
124
125
|
getMessages(): Promise<BaseMessage[]>;
|
|
125
126
|
}
|
|
127
|
+
export declare class FakeTracer extends BaseTracer {
|
|
128
|
+
name: string;
|
|
129
|
+
runs: Run[];
|
|
130
|
+
constructor();
|
|
131
|
+
protected persistRun(run: Run): Promise<void>;
|
|
132
|
+
}
|
|
@@ -9,6 +9,7 @@ import { BaseOutputParser } from "../../output_parsers/base.js";
|
|
|
9
9
|
import { ChatGenerationChunk, } from "../../outputs.js";
|
|
10
10
|
import { BaseRetriever } from "../../retrievers.js";
|
|
11
11
|
import { Runnable } from "../../runnables/base.js";
|
|
12
|
+
import { BaseTracer } from "../../tracers/base.js";
|
|
12
13
|
/**
|
|
13
14
|
* Parser for comma-separated values. It splits the input text by commas
|
|
14
15
|
* and trims the resulting values.
|
|
@@ -331,3 +332,24 @@ export class FakeListChatMessageHistory extends BaseListChatMessageHistory {
|
|
|
331
332
|
return this.messages;
|
|
332
333
|
}
|
|
333
334
|
}
|
|
335
|
+
export class FakeTracer extends BaseTracer {
|
|
336
|
+
constructor() {
|
|
337
|
+
super();
|
|
338
|
+
Object.defineProperty(this, "name", {
|
|
339
|
+
enumerable: true,
|
|
340
|
+
configurable: true,
|
|
341
|
+
writable: true,
|
|
342
|
+
value: "fake_tracer"
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(this, "runs", {
|
|
345
|
+
enumerable: true,
|
|
346
|
+
configurable: true,
|
|
347
|
+
writable: true,
|
|
348
|
+
value: []
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
persistRun(run) {
|
|
352
|
+
this.runs.push(run);
|
|
353
|
+
return Promise.resolve();
|
|
354
|
+
}
|
|
355
|
+
}
|