@langchain/core 0.3.46 → 0.3.47
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/prompts/dict.cjs +12 -6
- package/dist/prompts/dict.d.ts +1 -1
- package/dist/prompts/dict.js +12 -6
- package/package.json +1 -1
package/dist/prompts/dict.cjs
CHANGED
|
@@ -5,7 +5,9 @@ const base_js_1 = require("../runnables/base.cjs");
|
|
|
5
5
|
const template_js_1 = require("./template.cjs");
|
|
6
6
|
class DictPromptTemplate extends base_js_1.Runnable {
|
|
7
7
|
constructor(fields) {
|
|
8
|
-
|
|
8
|
+
const templateFormat = fields.templateFormat ?? "f-string";
|
|
9
|
+
const inputVariables = _getInputVariables(fields.template, templateFormat);
|
|
10
|
+
super({ inputVariables, ...fields });
|
|
9
11
|
Object.defineProperty(this, "lc_namespace", {
|
|
10
12
|
enumerable: true,
|
|
11
13
|
configurable: true,
|
|
@@ -28,13 +30,17 @@ class DictPromptTemplate extends base_js_1.Runnable {
|
|
|
28
30
|
enumerable: true,
|
|
29
31
|
configurable: true,
|
|
30
32
|
writable: true,
|
|
31
|
-
value:
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "inputVariables", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: void 0
|
|
32
40
|
});
|
|
33
41
|
this.template = fields.template;
|
|
34
|
-
this.templateFormat =
|
|
35
|
-
|
|
36
|
-
get inputVariables() {
|
|
37
|
-
return _getInputVariables(this.template, this.templateFormat);
|
|
42
|
+
this.templateFormat = templateFormat;
|
|
43
|
+
this.inputVariables = inputVariables;
|
|
38
44
|
}
|
|
39
45
|
async format(values) {
|
|
40
46
|
return _insertInputVariables(this.template, values, this.templateFormat);
|
package/dist/prompts/dict.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ export declare class DictPromptTemplate<RunInput extends InputValues = InputValu
|
|
|
7
7
|
lc_serializable: boolean;
|
|
8
8
|
template: Record<string, unknown>;
|
|
9
9
|
templateFormat: TemplateFormat;
|
|
10
|
+
inputVariables: Array<Extract<keyof RunInput, string>>;
|
|
10
11
|
constructor(fields: {
|
|
11
12
|
template: Record<string, unknown>;
|
|
12
13
|
templateFormat?: TemplateFormat;
|
|
13
14
|
});
|
|
14
|
-
get inputVariables(): Array<Extract<keyof RunInput, string>>;
|
|
15
15
|
format(values: TypedPromptInputValues<RunInput>): Promise<RunOutput>;
|
|
16
16
|
invoke(values: TypedPromptInputValues<InputValues>): Promise<RunOutput>;
|
|
17
17
|
}
|
package/dist/prompts/dict.js
CHANGED
|
@@ -2,7 +2,9 @@ import { Runnable } from "../runnables/base.js";
|
|
|
2
2
|
import { parseTemplate, renderTemplate } from "./template.js";
|
|
3
3
|
export class DictPromptTemplate extends Runnable {
|
|
4
4
|
constructor(fields) {
|
|
5
|
-
|
|
5
|
+
const templateFormat = fields.templateFormat ?? "f-string";
|
|
6
|
+
const inputVariables = _getInputVariables(fields.template, templateFormat);
|
|
7
|
+
super({ inputVariables, ...fields });
|
|
6
8
|
Object.defineProperty(this, "lc_namespace", {
|
|
7
9
|
enumerable: true,
|
|
8
10
|
configurable: true,
|
|
@@ -25,13 +27,17 @@ export class DictPromptTemplate extends Runnable {
|
|
|
25
27
|
enumerable: true,
|
|
26
28
|
configurable: true,
|
|
27
29
|
writable: true,
|
|
28
|
-
value:
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "inputVariables", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: void 0
|
|
29
37
|
});
|
|
30
38
|
this.template = fields.template;
|
|
31
|
-
this.templateFormat =
|
|
32
|
-
|
|
33
|
-
get inputVariables() {
|
|
34
|
-
return _getInputVariables(this.template, this.templateFormat);
|
|
39
|
+
this.templateFormat = templateFormat;
|
|
40
|
+
this.inputVariables = inputVariables;
|
|
35
41
|
}
|
|
36
42
|
async format(values) {
|
|
37
43
|
return _insertInputVariables(this.template, values, this.templateFormat);
|