to_dict

View as MarkdownOpen in Claude

Convert the POM to a list of section dictionaries. Useful for serializing the POM for storage or passing to other components that expect dictionary input.

Returns

list[dict[str, Any]] — Serialized section list. Each dictionary contains keys like "title", "body", and "bullets".

Example

1from signalwire.core.pom_builder import PomBuilder
2
3pom = PomBuilder()
4pom.add_section("Role", body="You are a helpful assistant.")
5pom.add_section("Rules", bullets=["Be concise", "Be accurate"])
6
7data = pom.to_dict()
8print(data)
9# [
10# {"title": "Role", "body": "You are a helpful assistant."},
11# {"title": "Rules", "bullets": ["Be concise", "Be accurate"]}
12# ]