Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.corti.ai/llms.txt

Use this file to discover all available pages before exploring further.

← Back to Guided Synthesis overview Use this for prototyping, one-off generations, or workflows where you don’t want to maintain stored sections. Define both the template instructions and each section’s full generation block inline. Sections and the wrapping template are created as auto-generated resources and immediately published — and like all auto-generated aggregates, are retained for 30 days only (see Auto-generated template aggregates — 30-day retention).
// Replace these with your values
const INTERACTION_ID = "<your-interaction-id>";

const result = await client.documents.generate({
  outputLanguage: "en-US",
  interactionId: INTERACTION_ID,
  dynamicTemplate: {
    name: "Allergy follow-up note (inline prototype)",
    generation: {
      instructions: { prompt: "Produce a focused allergy follow-up note." },
      sections: [
        {
          heading: "History of present illness",
          instructions: {
            contentPrompt: "Summarise the recent course of the patient's allergy symptoms.",
            writingStylePrompt: "Concise, professional.",
          },
          outputSchema: { type: "string" },
        },
        {
          heading: "Plan",
          instructions: {
            contentPrompt: "Outline next steps including any medication changes, testing or follow-up.",
          },
          outputSchema: {
            type: "array",
            itemFormat: "numbered",
            maxItems: 5,
            items: { type: "string" },
          },
        },
      ],
    },
  },
});
Each inline sections[] entry is a full SectionGeneration — same shape you’d POST /documents/sections with. Use the full outputSchema toolbox (string, number, boolean, array, object with fields) to constrain output. See Section Schemas for design patterns.

Mapping response section IDs back to your inline sections — Path 4 gotcha

Path 4 is the one place where mapping response keys back to your request sections is non-trivial. Your request supplies an ordered list of SectionGeneration objects with no IDs of your own, but the response’s stringDocument / structuredDocument are keyed by server-generated section UUIDs. To attach the right heading to each rendered section:
  1. Take the templateVersionId returned in the response.
  2. Call GET /documents/templates/{templateId}/versions/{templateVersionId}.
  3. The version’s sections[] array preserves your request order and carries the resolved section IDs. Build a position → sectionId → heading mapping from that response, then key the rendered output against it.
The auto-generated aggregate the follow-up GET reads is itself subject to the 30-day retention window. Do the mapping read soon after generation (typically in the same processing pass), or persist the mapping in your service.
This is a known DX gap for Path 4 specifically. The roadmap includes returning client-supplied identifiers (or section ordering) directly on the response so the follow-up GET isn’t needed.

When to use this path

ScenarioWhy Path 4
Prototyping a new section or schema before promoting into your stored libraryIterate in one request; no authoring overhead.
One-off generation that doesn’t justify creating a sectionInline what you need; the auto-generated aggregate is your receipt.
Experiments on prompt + schema combinationsRun the same call with variations; compare outputs.

Guided Synthesis overview

Shared concepts: input context, response shape, errors, 30-day retention.

Section Schemas

Schema patterns for the outputSchema shapes you’ll define inline.