from_sections

View as MarkdownOpen in Claude

Class method that creates a PomBuilder from a list of section dictionaries. Use this to reconstruct a POM from serialized data produced by to_dict().

Parameters

sections
list[dict[str, Any]]Required

List of section definition dictionaries. Each dictionary should contain a "title" key and optionally "body" and "bullets" keys.

Returns

PomBuilder — A new builder instance with the sections populated.

Example

1from signalwire.core.pom_builder import PomBuilder
2
3sections = [
4 {"title": "Role", "body": "You are a helpful assistant."},
5 {"title": "Rules", "bullets": ["Be concise", "Be accurate"]}
6]
7
8rebuilt = PomBuilder.from_sections(sections)
9xml_prompt = rebuilt.render_xml()
10print(xml_prompt)