@langchain/core
Advanced tools
Comparing version
@@ -10,2 +10,3 @@ import { Runnable } from "../runnables/base.js"; | ||
templateFormat: TemplateFormat; | ||
inputVariables: Array<Extract<keyof RunInput, string>>; | ||
constructor(fields: { | ||
@@ -15,5 +16,4 @@ template: Record<string, unknown>; | ||
}); | ||
get inputVariables(): Array<Extract<keyof RunInput, string>>; | ||
format(values: TypedPromptInputValues<RunInput>): Promise<RunOutput>; | ||
invoke(values: TypedPromptInputValues<InputValues>): Promise<RunOutput>; | ||
} |
@@ -5,3 +5,5 @@ import { Runnable } from "../runnables/base.js"; | ||
constructor(fields) { | ||
super(fields); | ||
const templateFormat = fields.templateFormat ?? "f-string"; | ||
const inputVariables = _getInputVariables(fields.template, templateFormat); | ||
super({ inputVariables, ...fields }); | ||
Object.defineProperty(this, "lc_namespace", { | ||
@@ -29,10 +31,14 @@ enumerable: true, | ||
writable: true, | ||
value: "f-string" | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "inputVariables", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
this.template = fields.template; | ||
this.templateFormat = fields.templateFormat ?? this.templateFormat; | ||
this.templateFormat = templateFormat; | ||
this.inputVariables = inputVariables; | ||
} | ||
get inputVariables() { | ||
return _getInputVariables(this.template, this.templateFormat); | ||
} | ||
async format(values) { | ||
@@ -39,0 +45,0 @@ return _insertInputVariables(this.template, values, this.templateFormat); |
{ | ||
"name": "@langchain/core", | ||
"version": "0.3.46", | ||
"version": "0.3.47", | ||
"description": "Core LangChain.js abstractions and schemas", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
2264252
0.02%56679
0.02%