Skip to Content
Vatson Office

Document spec

The DocumentSpec that create_document takes. Blocks of headings, paragraphs, lists and tables, with real Word styles and numbering.

A DocumentSpec is a title and a list of blocks: heading, paragraph, list, table, pageBreak, toc, image, section and definitions. Headings get real heading styles, lists get Word numbering (never typed "1." or "-"), and tables get the dark header band and a totals row when asked. Page setup, header, footer, page numbers, comments and tracked changes are fields of the spec.

Expense policy document with headings, a table of limits and a numbered list
An expense policy from a DocumentSpec, as LibreOffice renders it

Smallest example

create_document input
{
  "filename": "expense-policy",
  "spec": {
    "title": "Expense policy",
    "blocks": [
      { "kind": "heading", "level": 1, "text": "Purpose" },
      { "kind": "paragraph", "text": "This policy explains which costs the company pays and how to claim them." },
      { "kind": "list", "style": "number", "items": ["Keep the receipt", "Fill in the expense form within 30 days", "Send it to your manager"] }
    ]
  }
}

A full example

The spec behind the expense policy.

Fields

Generated from the schema the tools send to the model. A field with ? is optional.

FieldTypeDescription
version?1
lang?stringBCP 47 language tag of the text, for spelling and hyphenation; default from the host settings
titlestring (max 200 chars)Document title in sentence case: the first line and the file's title property
subtitle?string (max 300 chars)
font?string (max 64 chars)One font for body and headings; default Calibri
page?object
header?string (max 200 chars)Text at the top of every page
footer?string (max 200 chars)Text at the bottom of every page
pageNumbers?"pageOfTotal" | "page" | "none"Page numbers at the bottom right, in the document language: "Page 2 of 5" (default), "2", or none
firstPage?objectA different first page (a cover): its own header and footer, blank when omitted
comments?object[] (at most 500)
trackChanges?objectAuthor and date of the ins/del/change marks
blocksobject[] (at least 1, at most 2,000)

page

FieldTypeDescription
size?"A4" | "Letter"Default: Letter for en-US, A4 for every other locale
orientation?"portrait" | "landscape"

firstPage

A different first page (a cover): its own header and footer, blank when omitted

FieldTypeDescription
header?string (max 200 chars)
footer?string (max 200 chars)

comments[]

FieldTypeDescription
idstring (max 40 chars)Referenced by comment on a run or block
authorstring (max 80 chars)
initials?string (max 9 chars)Default: from the author's name
date?string
textstring (max 2,000 chars)
resolved?boolean
replies?object[] (at most 50)

comments[].replies[]

FieldTypeDescription
authorstring (max 80 chars)
initials?string (max 9 chars)
date?string
textstring (max 2,000 chars)

trackChanges

Author and date of the ins/del/change marks

FieldTypeDescription
authorstring (max 80 chars)Author of the tracked changes
date?string
record?booleanTurn on Track Changes in Word, so later edits are tracked too

blocks[] kind: "heading"

FieldTypeDescription
kind"heading"
level1 | 2 | 3
textstring (max 200 chars)
change?"insert" | "delete"Tracked insertion or deletion of the whole block
comment?string (max 40 chars)Id of a comment in comments anchored to the whole block
bookmark?string (max 40 chars)Bookmark name on the block

blocks[] kind: "paragraph"

FieldTypeDescription
kind"paragraph"
textstring | (string | object)[]
align?"left" | "center" | "right" | "justify"
change?"insert" | "delete"Tracked insertion or deletion of the whole block
comment?string (max 40 chars)Id of a comment in comments anchored to the whole block
bookmark?string (max 40 chars)Bookmark name on the block

blocks[] kind: "list"

FieldTypeDescription
kind"list"
style?"bullet" | "number" | "clauses""clauses" numbers 1, 1.1, 1.1.1 and continues through the document
items(string | (string | object)[] | object)[] (at least 1, at most 200)
restart?booleanClauses only: start again at 1

blocks[].items[]

FieldTypeDescription
textstring | (string | object)[]
level?integer (min 0, max 2)0 = top level, 1 = nested once, 2 = twice (clauses only)
change?"insert" | "delete"Tracked insertion or deletion of the whole block
comment?string (max 40 chars)Id of a comment in comments anchored to the whole block

blocks[] kind: "table"

FieldTypeDescription
kind"table"
columnsstring[] (at least 1, at most 12)Header row
rows((string | number | null)[])[] (at least 1, at most 500)
align?("left" | "center" | "right")[]Per-column alignment; numbers default right
caption?string (max 200 chars)One short line under the table: source, assumption or how to read it
total?boolean | stringAdds a totals row the compiler computes: figure columns summed, a placeholder column gets [[Total <column>]]. A string is the row label
currency?string (max 8 chars)Money columns: ISO code (EUR, USD) or symbol; number cells show it in the document language's format, e.g. 1.200 €
rowChanges?("insert" | "delete" | null)[]Tracked insertion or deletion per body row, null for unchanged

blocks[] kind: "pageBreak"

FieldTypeDescription
kind"pageBreak"

blocks[] kind: "toc"

FieldTypeDescription
kind"toc"
title?string (max 80 chars)Heading above the table; default "Contents" in the document language
levels?1 | 2 | 3Heading levels it lists

blocks[] kind: "image"

FieldTypeDescription
kind"image"
srcstringdata: URI (PNG, JPEG or SVG), https URL or asset:<id> the caller resolves
altstring (max 255 chars)Alt text, required for accessibility
width?number (min 10, max 100)Percent of the text width; default the image's own size, at most the text width
caption?string (max 300 chars)Caption under the image, numbered "Figure 1: ..."
fallback?stringSVG only: PNG data: URI for applications that cannot show SVG; drawn from the SVG when omitted
bookmark?string (max 40 chars)Id of a comment in comments anchored to the whole block

blocks[] kind: "section"

FieldTypeDescription
kind"section"
orientation?"portrait" | "landscape"Default: the orientation of the section before
header?string (max 200 chars)Default: the header of the section before
footer?string (max 200 chars)Default: the footer of the section before
firstPage?objectA different first page of the section (blank when the text is omitted)

blocks[].firstPage

A different first page of the section (blank when the text is omitted)

FieldTypeDescription
header?string (max 200 chars)
footer?string (max 200 chars)

blocks[] kind: "definitions"

FieldTypeDescription
kind"definitions"
itemsobject[] (at least 1, at most 200)

blocks[].items[]

FieldTypeDescription
termstring (max 120 chars)
textstring | (string | object)[]

On this page