setConsolidate

View as MarkdownOpen in Claude

Set whether to consolidate (summarize) conversation history when entering this context. Reduces token usage while preserving key information.

Parameters

consolidate
booleanRequired

Whether to consolidate previous conversation on entry.

Returns

Context — Self for method chaining.

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4builder.addContext('default').addStep('menu').setText('Ask what the caller needs.');
5
6const support = builder.addContext('support');
7support.setConsolidate(true);
8support.setSystemPrompt('You are a patient technical support engineer.');
9support.addStep('diagnose').setText('Understand the customer\'s issue.');