Skip to content

TypeScript API Reference

Estimated time to read: 1 minute

Warning

The TypeScript API is currently in rapid development and may change frequently. Please do not consider it a stable API. Use at your own risk.

Note

This documentation is auto-generated from the TypeScript source code using TypeDoc.

Installation

Stable Release

To use the POML TypeScript API, install the package via npm:

npm install pomljs

Nightly Build

npm install pomljs@nightly

Quick Start

import { Paragraph, Image } from 'poml/essentials';
import { read, write } from 'poml';
const prompt = <Paragraph>
  Hello, world! Here is an image:
  <Image src="photo.jpg" alt="A beautiful scenery" />
</Paragraph>;

// Parse the prompt components into an intermediate representation (IR)
const ir = await read(prompt);

// Render it to different formats
const markdown = write(ir);