compileSlotValues
Stentor API Reference / stentor-utils/src / compileSlotValues
Function: compileSlotValues()
Call Signatureβ
compileSlotValues(
responseOutput,slots,replaceWhenUndefined?,macros?):string
Defined in: packages/stentor-utils/src/compilers/compileSlotValues.ts:111
Compiles a templated response with slot values from the provided slot map.
For example, when passed "What date do you want your ${flowers}?"
and the slot map contains a slot with name flowers it will replace
it with the value.
It will handle the different potential value types for slots such as strings, numbers, dates and durations.
By default, if the slot value does not exist, the template value is left untouched.
Parametersβ
responseOutputβ
string
slotsβ
replaceWhenUndefined?β
boolean
When set to true, it will replace the value with 'undefined' if it doesn't exist, default behavior is to leave the template as is.
macros?β
Returnsβ
string
Deprecatedβ
Use class Compiler, which handles both JSONPaths & Slots
Call Signatureβ
compileSlotValues(
responseOutput,slots,replaceWhenUndefined?,macros?):ResponseOutput
Defined in: packages/stentor-utils/src/compilers/compileSlotValues.ts:112
Compiles a templated response with slot values from the provided slot map.
For example, when passed "What date do you want your ${flowers}?"
and the slot map contains a slot with name flowers it will replace
it with the value.
It will handle the different potential value types for slots such as strings, numbers, dates and durations.
By default, if the slot value does not exist, the template value is left untouched.
Parametersβ
responseOutputβ
slotsβ
replaceWhenUndefined?β
boolean
When set to true, it will replace the value with 'undefined' if it doesn't exist, default behavior is to leave the template as is.
macros?β
Returnsβ
Deprecatedβ
Use class Compiler, which handles both JSONPaths & Slots