Skip to navigation

Control how much of the prior conversation the model sees when this step begins. The setting applies to everything that came before the step; the step’s own turns accumulate normally, and nothing is deleted from the call log. Overrides the context-level default set with Context.setHistory().

Parameters

history
HistoryModeRequired

History visibility mode. Any other string throws at call time.

  • "keep" — clear nothing. Every prior step’s instructions and dialogue stay visible to the model.
  • "default" — hide the prior steps’ instructions but keep the user and assistant dialogue. This is the behavior when unset.
  • "hide" — hide the prior instructions and pull the prior dialogue out of the model’s context. Reference ${step_history.*} in this step’s text to bring back exactly what you need.

Returns

Step — Self for method chaining. Throws an Error if history is not one of the three modes.

Example

import { ContextBuilder } from '@signalwire/sdk';
const builder = new ContextBuilder();
const ctx = builder.addContext('default');
ctx.addStep('collect_pickup').setText('Ask for the pickup address.');
ctx.addStep('confirm_fare')
.setHistory('hide')
.setText('Quote the fare for the pickup at ${step_history.collect_pickup} and confirm.');