fromSections

View as MarkdownOpen in Claude

Static factory method that reconstructs a PomBuilder from an array of PomSectionData objects. Use this to restore a prompt serialized via toJson() or toDict().

Parameters

sections
PomSectionData[]Required

Array of section data objects. Each must include at minimum a title, and may include body, bullets, numbered, numberedBullets, and nested subsections.

Returns

PomBuilder — a new builder populated with the given sections.

Example

1import { PomBuilder } from '@signalwire/sdk';
2
3const data = [
4 { title: 'Intro', body: 'Welcome.' },
5 { title: 'Rules', bullets: ['Be nice.', 'Stay on topic.'] },
6];
7
8const pom = PomBuilder.fromSections(data);
9console.log(pom.renderMarkdown());