Skip to content
An 8-bit style icon shows three overlapping geometric panels: one features angle brackets symbolizing XML, another displays a triple backtick and smiley for Markdown, and the last is a plain rectangle with a smiley for "none." Each panel is a different color, outlined simply, and there are no gradients or shadows. The composition is flat, balanced, and uses only five distinct corporate colors on a transparent or plain background at 128x128 pixels.

Fence Formats

GenAIScript supports various types of “fence” formats when rendering def function, since LLMs may behave differently depending on the format of the input text. As of 1.82.0, the default format is to use XML tags.

The following def call will generate a fenced region with different syntax:

  • xml
def("TEXT", ":)", { fenceFormat: "xml" })
<TEXT>
:)
</TEXT>
  • markdown
def("TEXT", ":)", { fenceFormat: "markdown" })
TEXT:
\`\`\`
:)
\`\`\`
  • none
def("TEXT", ":)", { fenceFormat: "none" })
TEXT:
:)

If you are using the xml format, it is advised to use <NAME> when referencing the def variable, or use the returned value as the name.

const textName = def("TEXT", ":)", { fenceFormat: "xml" })
$`Summarize ${textName}` // Summarize <TEXT>

GenAIScript will automatically pick a format based on the model. However, you can override the format at the script level.

script({ fenceFormat: "xml" })

or at the def level:

def("TEXT", ":)", { fenceFormat: "xml" })

or through the --fence-format flag on the cli:

Terminal window
genaiscript run ... --fence-format xml