Skip to content

writer

Estimated time to read: 38 minutes

POML TypeScript API


Classes

CsvWriter

Defined in: packages/poml/writer.ts:1288

Extends

Extended by

Constructors

Constructor

new CsvWriter(ir?, options?): CsvWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

MarkdownOptions

Returns

CsvWriter

Inherited from

MarkdownWriter.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

MarkdownWriter.ir

options

protected options: MarkdownOptions

Defined in: packages/poml/writer.ts:72

Inherited from

MarkdownWriter.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

MarkdownWriter.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

MarkdownWriter.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

MarkdownWriter.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

MarkdownWriter.createMappingNode

handleTable()

protected handleTable(tableHeadElements, tableBodyElements, tableElement, $): MarkdownBox

Defined in: packages/poml/writer.ts:1289

Parameters
tableHeadElements

Cheerio\<any>

tableBodyElements

Cheerio\<any>

tableElement

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

Overrides

MarkdownWriter.handleTable

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

MarkdownWriter.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

MarkdownWriter.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): MarkdownOptions

Defined in: packages/poml/writer.ts:646

Parameters
options?

MarkdownOptions

Returns

MarkdownOptions

Inherited from

MarkdownWriter.initializeOptions

makeBox()

protected makeBox(text, layout, element): MarkdownBox

Defined in: packages/poml/writer.ts:664

Parameters
text

string | MarkdownBox

layout

"block" | "newline" | "inline"

element

Cheerio\<any>

Returns

MarkdownBox

Inherited from

MarkdownWriter.makeBox

markupLanguage()

protected markupLanguage(): string

Defined in: packages/poml/writer.ts:1333

Returns

string

Overrides

MarkdownWriter.markupLanguage

processMultipleTableRows()

protected processMultipleTableRows(elements, $): StringTableRow[]

Defined in: packages/poml/writer.ts:1030

Parameters
elements

Cheerio\<any>

$

CheerioAPI

Returns

StringTableRow[]

Inherited from

MarkdownWriter.processMultipleTableRows

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

MarkdownWriter.raiseError

raiseErrorAndReturnEmpty()

protected raiseErrorAndReturnEmpty(message, element): MarkdownBox

Defined in: packages/poml/writer.ts:659

Parameters
message

string

element

Cheerio\<any>

Returns

MarkdownBox

Inherited from

MarkdownWriter.raiseErrorAndReturnEmpty

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

MarkdownWriter.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

MarkdownWriter.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

MarkdownWriter.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1174

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Inherited from

MarkdownWriter.writeElementTree

writeElementTreeImpl()

protected writeElementTreeImpl(element, $): MarkdownBox

Defined in: packages/poml/writer.ts:1318

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

Overrides

MarkdownWriter.writeElementTreeImpl

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

MarkdownWriter.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

MarkdownWriter.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

MarkdownWriter.writeWithSourceMap


EnvironmentDispatcher

Defined in: packages/poml/writer.ts:564

Extends

  • Writer\<any>

Constructors

Constructor

new EnvironmentDispatcher(ir?, options?): EnvironmentDispatcher

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

any

Returns

EnvironmentDispatcher

Inherited from

Writer<any>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

MarkdownWriter.ir

options

protected options: any

Defined in: packages/poml/writer.ts:72

Inherited from

Writer.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

Writer.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

Writer.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

Writer.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

Writer.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

Writer.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

Writer.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): any

Defined in: packages/poml/writer.ts:82

Parameters
options?

any

Returns

any

Inherited from

Writer.initializeOptions

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

Writer.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

Writer.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

Writer.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

Writer.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:565

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

Writer.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

Writer.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

Writer.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

Writer.writeWithSourceMap


FreeWriter

Defined in: packages/poml/writer.ts:1655

Extends

  • Writer\<FreeOptions>

Constructors

Constructor

new FreeWriter(ir?, options?): FreeWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

TruncateOptions

Returns

FreeWriter

Inherited from

Writer<FreeOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

Writer.ir

options

protected options: TruncateOptions

Defined in: packages/poml/writer.ts:72

Inherited from

Writer.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

Writer.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

Writer.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

Writer.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

Writer.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

Writer.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

Writer.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): TruncateOptions

Defined in: packages/poml/writer.ts:1656

Parameters
options?

TruncateOptions

Returns

TruncateOptions

Overrides

Writer.initializeOptions

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

Writer.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

Writer.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

Writer.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

Writer.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1696

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

Writer.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

Writer.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

Writer.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

Writer.writeWithSourceMap


HtmlWriter

Defined in: packages/poml/writer.ts:1195

Extends

  • Writer\<HtmlOptions>

Constructors

Constructor

new HtmlWriter(ir?, options?): HtmlWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

HtmlOptions

Returns

HtmlWriter

Inherited from

Writer<HtmlOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

Writer.ir

options

protected options: HtmlOptions

Defined in: packages/poml/writer.ts:72

Inherited from

Writer.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

Writer.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

Writer.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

Writer.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

Writer.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

Writer.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

Writer.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): HtmlOptions

Defined in: packages/poml/writer.ts:1198

Parameters
options?

HtmlOptions

Returns

HtmlOptions

Overrides

Writer.initializeOptions

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

Writer.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

Writer.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

Writer.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

Writer.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1272

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

Writer.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

Writer.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

Writer.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

Writer.writeWithSourceMap


JsonWriter

Defined in: packages/poml/writer.ts:1515

Extends

  • SerializeWriter\<JsonOptions>

Constructors

Constructor

new JsonWriter(ir?, options?): JsonWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

JsonOptions

Returns

JsonWriter

Inherited from

SerializeWriter<JsonOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

SerializeWriter.ir

options

protected options: JsonOptions

Defined in: packages/poml/writer.ts:72

Inherited from

SerializeWriter.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

SerializeWriter.tokenizerCache

Accessors

serializeLanguage
Get Signature

get serializeLanguage(): string

Defined in: packages/poml/writer.ts:1516

Returns

string

Overrides

SerializeWriter.serializeLanguage

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

SerializeWriter.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

SerializeWriter.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

SerializeWriter.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

SerializeWriter.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

SerializeWriter.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): JsonOptions

Defined in: packages/poml/writer.ts:1520

Parameters
options?

JsonOptions

Returns

JsonOptions

Overrides

SerializeWriter.initializeOptions

parseAny()

protected parseAny(element, $, singleAsObject?): any

Defined in: packages/poml/writer.ts:1389

Parameters
element

Cheerio\<any>

$

CheerioAPI

singleAsObject?

boolean

Returns

any

Inherited from

SerializeWriter.parseAny

parseEnv()

protected parseEnv(element, $): any

Defined in: packages/poml/writer.ts:1468

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseEnv

parseGeneralElement()

protected parseGeneralElement(element, $): any

Defined in: packages/poml/writer.ts:1496

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseGeneralElement

parseObject()

protected parseObject(element, $): any

Defined in: packages/poml/writer.ts:1454

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseObject

parseText()

protected parseText(element, text, type): any

Defined in: packages/poml/writer.ts:1353

Parameters
element

Cheerio\<any>

text

string

type

string

Returns

any

Inherited from

SerializeWriter.parseText

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

SerializeWriter.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

SerializeWriter.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

SerializeWriter.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

SerializeWriter.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1526

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

SerializeWriter.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

SerializeWriter.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

SerializeWriter.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

SerializeWriter.writeWithSourceMap


MarkdownWriter

Defined in: packages/poml/writer.ts:645

Extends

  • Writer\<MarkdownOptions>

Extended by

Constructors

Constructor

new MarkdownWriter(ir?, options?): MarkdownWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

MarkdownOptions

Returns

MarkdownWriter

Inherited from

Writer<MarkdownOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

Writer.ir

options

protected options: MarkdownOptions

Defined in: packages/poml/writer.ts:72

Inherited from

Writer.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

Writer.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

Writer.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

Writer.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

Writer.createMappingNode

handleTable()

protected handleTable(tableHeadElements, tableBodyElements, tableElement, $): MarkdownBox

Defined in: packages/poml/writer.ts:1056

Parameters
tableHeadElements

Cheerio\<any>

tableBodyElements

Cheerio\<any>

tableElement

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

Writer.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

Writer.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): MarkdownOptions

Defined in: packages/poml/writer.ts:646

Parameters
options?

MarkdownOptions

Returns

MarkdownOptions

Overrides

Writer.initializeOptions

makeBox()

protected makeBox(text, layout, element): MarkdownBox

Defined in: packages/poml/writer.ts:664

Parameters
text

string | MarkdownBox

layout

"block" | "newline" | "inline"

element

Cheerio\<any>

Returns

MarkdownBox

markupLanguage()

protected markupLanguage(): string

Defined in: packages/poml/writer.ts:1183

Returns

string

processMultipleTableRows()

protected processMultipleTableRows(elements, $): StringTableRow[]

Defined in: packages/poml/writer.ts:1030

Parameters
elements

Cheerio\<any>

$

CheerioAPI

Returns

StringTableRow[]

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

Writer.raiseError

raiseErrorAndReturnEmpty()

protected raiseErrorAndReturnEmpty(message, element): MarkdownBox

Defined in: packages/poml/writer.ts:659

Parameters
message

string

element

Cheerio\<any>

Returns

MarkdownBox

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

Writer.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

Writer.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

Writer.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1174

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

Writer.writeElementTree

writeElementTreeImpl()

protected writeElementTreeImpl(element, $): MarkdownBox

Defined in: packages/poml/writer.ts:1107

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

Writer.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

Writer.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

Writer.writeWithSourceMap


MultiMediaWriter

Defined in: packages/poml/writer.ts:1713

Extends

  • Writer\<MultiMediaOptions>

Constructors

Constructor

new MultiMediaWriter(ir?, options?): MultiMediaWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

any

Returns

MultiMediaWriter

Inherited from

Writer<MultiMediaOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

Writer.ir

options

protected options: any

Defined in: packages/poml/writer.ts:72

Inherited from

Writer.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

Writer.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

Writer.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

Writer.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

Writer.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

Writer.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

Writer.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): any

Defined in: packages/poml/writer.ts:1714

Parameters
options?

any

Returns

any

Overrides

Writer.initializeOptions

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

Writer.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

Writer.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

Writer.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

Writer.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1847

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

Writer.writeElementTree

writeElementTrees()

writeElementTrees(elements, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1830

Parameters
elements

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

Writer.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

Writer.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

Writer.writeWithSourceMap


TsvWriter

Defined in: packages/poml/writer.ts:1338

Extends

Constructors

Constructor

new TsvWriter(ir?, options?): TsvWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

MarkdownOptions

Returns

TsvWriter

Inherited from

CsvWriter.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

CsvWriter.ir

options

protected options: MarkdownOptions

Defined in: packages/poml/writer.ts:72

Inherited from

CsvWriter.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

CsvWriter.tokenizerCache

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

CsvWriter.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

CsvWriter.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

CsvWriter.createMappingNode

handleTable()

protected handleTable(tableHeadElements, tableBodyElements, tableElement, $): MarkdownBox

Defined in: packages/poml/writer.ts:1289

Parameters
tableHeadElements

Cheerio\<any>

tableBodyElements

Cheerio\<any>

tableElement

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

Inherited from

CsvWriter.handleTable

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

CsvWriter.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

CsvWriter.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): MarkdownOptions

Defined in: packages/poml/writer.ts:1339

Parameters
options?

MarkdownOptions

Returns

MarkdownOptions

Overrides

CsvWriter.initializeOptions

makeBox()

protected makeBox(text, layout, element): MarkdownBox

Defined in: packages/poml/writer.ts:664

Parameters
text

string | MarkdownBox

layout

"block" | "newline" | "inline"

element

Cheerio\<any>

Returns

MarkdownBox

Inherited from

CsvWriter.makeBox

markupLanguage()

protected markupLanguage(): string

Defined in: packages/poml/writer.ts:1343

Returns

string

Overrides

CsvWriter.markupLanguage

processMultipleTableRows()

protected processMultipleTableRows(elements, $): StringTableRow[]

Defined in: packages/poml/writer.ts:1030

Parameters
elements

Cheerio\<any>

$

CheerioAPI

Returns

StringTableRow[]

Inherited from

CsvWriter.processMultipleTableRows

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

CsvWriter.raiseError

raiseErrorAndReturnEmpty()

protected raiseErrorAndReturnEmpty(message, element): MarkdownBox

Defined in: packages/poml/writer.ts:659

Parameters
message

string

element

Cheerio\<any>

Returns

MarkdownBox

Inherited from

CsvWriter.raiseErrorAndReturnEmpty

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

CsvWriter.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

CsvWriter.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

CsvWriter.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1174

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Inherited from

CsvWriter.writeElementTree

writeElementTreeImpl()

protected writeElementTreeImpl(element, $): MarkdownBox

Defined in: packages/poml/writer.ts:1318

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

MarkdownBox

Inherited from

CsvWriter.writeElementTreeImpl

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

CsvWriter.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

CsvWriter.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

CsvWriter.writeWithSourceMap


XmlWriter

Defined in: packages/poml/writer.ts:1574

Extends

  • SerializeWriter\<XmlOptions>

Constructors

Constructor

new XmlWriter(ir?, options?): XmlWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

XmlOptions

Returns

XmlWriter

Inherited from

SerializeWriter<XmlOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

SerializeWriter.ir

options

protected options: XmlOptions

Defined in: packages/poml/writer.ts:72

Inherited from

SerializeWriter.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

SerializeWriter.tokenizerCache

Accessors

serializeLanguage
Get Signature

get serializeLanguage(): string

Defined in: packages/poml/writer.ts:1575

Returns

string

Overrides

SerializeWriter.serializeLanguage

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

SerializeWriter.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

SerializeWriter.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

SerializeWriter.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

SerializeWriter.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

SerializeWriter.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): XmlOptions

Defined in: packages/poml/writer.ts:1579

Parameters
options?

XmlOptions

Returns

XmlOptions

Overrides

SerializeWriter.initializeOptions

parseAny()

protected parseAny(element, $, singleAsObject?): any

Defined in: packages/poml/writer.ts:1389

Parameters
element

Cheerio\<any>

$

CheerioAPI

singleAsObject?

boolean

Returns

any

Inherited from

SerializeWriter.parseAny

parseEnv()

protected parseEnv(element, $): any

Defined in: packages/poml/writer.ts:1468

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseEnv

parseGeneralElement()

protected parseGeneralElement(element, $): any

Defined in: packages/poml/writer.ts:1496

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseGeneralElement

parseObject()

protected parseObject(element, $): any

Defined in: packages/poml/writer.ts:1454

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseObject

parseText()

protected parseText(element, text, type): any

Defined in: packages/poml/writer.ts:1353

Parameters
element

Cheerio\<any>

text

string

type

string

Returns

any

Inherited from

SerializeWriter.parseText

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

SerializeWriter.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

SerializeWriter.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

SerializeWriter.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

SerializeWriter.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1636

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

SerializeWriter.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

SerializeWriter.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

SerializeWriter.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

SerializeWriter.writeWithSourceMap


YamlWriter

Defined in: packages/poml/writer.ts:1542

Extends

  • SerializeWriter\<YamlOptions>

Constructors

Constructor

new YamlWriter(ir?, options?): YamlWriter

Defined in: packages/poml/writer.ts:75

Parameters
ir?

string

options?

YamlOptions

Returns

YamlWriter

Inherited from

SerializeWriter<YamlOptions>.constructor

Properties

ir

protected ir: string = ''

Defined in: packages/poml/writer.ts:71

Inherited from

SerializeWriter.ir

options

protected options: YamlOptions

Defined in: packages/poml/writer.ts:72

Inherited from

SerializeWriter.options

tokenizerCache

protected tokenizerCache: object = {}

Defined in: packages/poml/writer.ts:73

Index Signature

[model: string]: Tiktoken

Inherited from

SerializeWriter.tokenizerCache

Accessors

serializeLanguage
Get Signature

get serializeLanguage(): string

Defined in: packages/poml/writer.ts:1543

Returns

string

Overrides

SerializeWriter.serializeLanguage

Methods

assignSpeakers()

assignSpeakers(result, $): SpeakerNode[]

Defined in: packages/poml/writer.ts:260

Parameters
result

WriterPartialResult

$

CheerioAPI

Returns

SpeakerNode[]

Inherited from

SerializeWriter.assignSpeakers

buildSourceMap()

protected buildSourceMap(result): SourceSegment[]

Defined in: packages/poml/writer.ts:425

Transform a WriterResult into discrete source map segments.

The segments are ordered so that rich content can be reconstructed in the correct visual order while preserving multimedia positioning.

Parameters
result

WriterResult

Returns

SourceSegment[]

Inherited from

SerializeWriter.buildSourceMap

createMappingNode()

protected createMappingNode(element, outputLength): MappingNode

Defined in: packages/poml/writer.ts:154

Parameters
element

Cheerio\<any>

outputLength

number

Returns

MappingNode

Inherited from

SerializeWriter.createMappingNode

indentMappings()

protected indentMappings(mappings, indent, ignoreBefore): MappingNode[]

Defined in: packages/poml/writer.ts:178

Add an offset to mapping nodes.

Parameters
mappings

MappingNode[]

Original mappings.

indent

number

The offset amount.

ignoreBefore

number

Ignore the mappings before this index.

Returns

MappingNode[]

  • The new mappings.
Inherited from

SerializeWriter.indentMappings

indentMultiMedia()

protected indentMultiMedia(multimedia, indent, ignoreBefore): PositionalContentMultiMedia[]

Defined in: packages/poml/writer.ts:188

Parameters
multimedia

PositionalContentMultiMedia[]

indent

number

ignoreBefore

number

Returns

PositionalContentMultiMedia[]

Inherited from

SerializeWriter.indentMultiMedia

initializeOptions()

protected initializeOptions(options?): YamlOptions

Defined in: packages/poml/writer.ts:1547

Parameters
options?

YamlOptions

Returns

YamlOptions

Overrides

SerializeWriter.initializeOptions

parseAny()

protected parseAny(element, $, singleAsObject?): any

Defined in: packages/poml/writer.ts:1389

Parameters
element

Cheerio\<any>

$

CheerioAPI

singleAsObject?

boolean

Returns

any

Inherited from

SerializeWriter.parseAny

parseEnv()

protected parseEnv(element, $): any

Defined in: packages/poml/writer.ts:1468

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseEnv

parseGeneralElement()

protected parseGeneralElement(element, $): any

Defined in: packages/poml/writer.ts:1496

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseGeneralElement

parseObject()

protected parseObject(element, $): any

Defined in: packages/poml/writer.ts:1454

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

any

Inherited from

SerializeWriter.parseObject

parseText()

protected parseText(element, text, type): any

Defined in: packages/poml/writer.ts:1353

Parameters
element

Cheerio\<any>

text

string

type

string

Returns

any

Inherited from

SerializeWriter.parseText

raiseError()

protected raiseError(message, element): WriterPartialResult

Defined in: packages/poml/writer.ts:201

Parameters
message

string

element

Cheerio\<any>

Returns

WriterPartialResult

Inherited from

SerializeWriter.raiseError

reset()

protected reset(ir): void

Defined in: packages/poml/writer.ts:86

Parameters
ir

string

Returns

void

Inherited from

SerializeWriter.reset

truncateText()

protected truncateText(text, charLimit?, tokenLimit?, options?): string

Defined in: packages/poml/writer.ts:90

Parameters
text

string

charLimit?

number

tokenLimit?

number

options?

TruncateOptions

Returns

string

Inherited from

SerializeWriter.truncateText

write()

write(ir): RichContent

Defined in: packages/poml/writer.ts:241

Convert an IR string into RichContent without exposing mapping information.

The method delegates to writeWithSourceMap and then collapses the returned segments back into a single rich content value.

Parameters
ir

string

Returns

RichContent

Inherited from

SerializeWriter.write

writeElementTree()

writeElementTree(element, $): WriterPartialResult

Defined in: packages/poml/writer.ts:1554

Parameters
element

Cheerio\<any>

$

CheerioAPI

Returns

WriterPartialResult

Overrides

SerializeWriter.writeElementTree

writeMessages()

writeMessages(ir): Message[]

Defined in: packages/poml/writer.ts:252

Convert an IR string into an array of speaker messages.

It internally uses writeMessagesWithSourceMap and removes the mapping information from each message.

Parameters
ir

string

Returns

Message[]

Inherited from

SerializeWriter.writeMessages

writeMessagesWithSourceMap()

writeMessagesWithSourceMap(ir): SourceMapMessage[]

Defined in: packages/poml/writer.ts:378

Similar to writeWithSourceMap but groups the segments into speaker messages.

Parameters
ir

string

Returns

SourceMapMessage[]

Inherited from

SerializeWriter.writeMessagesWithSourceMap

writeWithSourceMap()

writeWithSourceMap(ir): SourceMapRichContent[]

Defined in: packages/poml/writer.ts:362

Render the IR string and return detailed mapping for each produced content segment.

Each returned SourceMapRichContent describes the slice of the input IR that generated the piece of output.

Parameters
ir

string

Returns

SourceMapRichContent[]

Inherited from

SerializeWriter.writeWithSourceMap