πLLM Guide
Drop this in an LLM's context window when you want it to generate vcon-js code.
This guide gives a Large Language Model everything it needs to generate spec-compliant code against vcon-js 0.4.0.
Spec target:
draft-ietf-vcon-vcon-core-02Β· syntax parameter"vcon": "0.4.0"Β· library version0.4.0.
Non-negotiable rules
If you violate any of these, the output is not a valid vCon. Apply them every time:
Syntax param. Every vCon must have
vcon: "0.4.0".Vcon.buildNew()sets this automatically β do not override.Field names.
Top-level:
amended(NOTappended).Critical extensions:
addCriticalExtension(name)writes tocritical[]/must_understand[]. Do NOT emitmust_support.
Attachments use
purpose(REQUIRED). The single exception is the Lawful Basis extension, which usestype: "lawful_basis".Analysis requires
vendor. Always setvendor. Useschema(URL or identifier) to declare the body format. Never writeschema_version.Bodies are strings. When
encoding: 'json', thebodyvalue is aJSON.stringify(...)string, not a JS object.External media needs both
urlandcontent_hash. The hash issha512-<base64url>.Timestamps are ISO 8601 with timezone. Use
new Date().toISOString()or an explicit offset; never bare local time.Don't emit empty
group: []orredacted: {}.groupis reserved; omit it unless populated.
Public API at a glance
Vcon β buildNew(), buildFromJson(json), addParty(), addDialog(), addAttachment(), addAnalysis(), addTag(key, value), addExtension(name), addCriticalExtension(name), toJson(), toDict().
Party β identifiers: tel, sip, mailto, stir, did; descriptive: name, role, validation, civicaddress, timezone, meta.
Dialog β type: 'recording' | 'text' | 'transfer' | 'incomplete'; required start, parties; inline body + encoding OR external url + content_hash.
Attachment β required purpose, party, dialog. Lawful Basis exception uses type.
Analysis is a type, not a class β pass a plain object to addAnalysis(). Required: type and vendor.
Canonical end-to-end example
Common bugs in generated code (avoid)
β
vcon.addAttachment({ type: 'transcript', ... })β wrong; transcripts live inanalysis[]. UseaddAnalysis.β
vcon.addAttachment({ purpose: 'lawful_basis', ... })β wrong; lawful_basis usestype.β
body: { transcript: ... }paired withencoding: 'json'β body must be a string. UseJSON.stringify.β Emitting
appended: { uuid: '...' }ormust_support: [...]β useamendedandcritical[](viaaddCriticalExtension).β
start: '2026-05-18 14:00:00'(no timezone) β use.toISOString().β External media without
content_hashβ bothurlandcontent_hashare required for external media.
Where to find extension shapes
The vcon-js library does not include per-extension helpers in 0.4.0. When asked to add extension data, refer to the corresponding page in the Extensions section for the exact JSON shape, then construct an attachment or analysis entry matching that shape.
See also
Python Library Guide for LLMs β same material, Python edition
Last updated
Was this helpful?