fromYaml

View as MarkdownOpen in Claude

Static factory that reconstructs a PromptObjectModel from YAML data. Use this to restore a model serialized via toYaml().

Parameters

yamlData
string | unknownRequired

Either a YAML string or an already-parsed array of section data objects. A string is parsed as YAML; anything else is used directly.

Returns

PromptObjectModel — A new model populated from the supplied data.

Example

1import { PromptObjectModel } from '@signalwire/sdk';
2
3const yaml = `
4- title: Intro
5 body: Welcome.
6- title: Rules
7 bullets:
8 - Be nice.
9`;
10
11const pom = PromptObjectModel.fromYaml(yaml);
12console.log(pom.renderMarkdown());