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

import { PromptObjectModel } from '@signalwire/sdk';
const yaml = `
- title: Intro
body: Welcome.
- title: Rules
bullets:
- Be nice.
`;
const pom = PromptObjectModel.fromYaml(yaml);
console.log(pom.renderMarkdown());