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 when 90% of the base template is right but you want to patch a section title, swap a section’s writing style, or replace its output schema — for a single call, without changing the underlying template. A new auto-generated template aggregate is persisted with inheritedFromId pointing at the base template. The aggregate is fully resolved and drift-proof — but 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 SECTION_ID = "<your-section-id>";
const TEMPLATE_ID = "<your-template-id>";

const result = await client.documents.generate({
  outputLanguage: "en-US",
  interactionId: INTERACTION_ID,
  templateRef: {
    templateId: TEMPLATE_ID,
    overrides: {
      instructions: {
        prompt: "Produce a pediatric consultation note. Refer to the patient as the child.",
      },
      sections: [
        {
          sectionId: SECTION_ID,
          generation: {
            heading: "Anamnesis",
            instructions: {
              writingStylePrompt: "Family-centred language; use second person sparingly.",
            },
          },
        },
      ],
    },
  },
});

Override semantics — important

The override patches obey different merge rules per field:
  • instructions (template- or section-level) is per-field partial. Any field you omit is inherited from the parent’s published version.
  • outputSchema is wholesale. Whatever you submit fully replaces the parent schema. Partial schemas are not merged.
The same rules apply when you create an inheriting section via inheritFromId on POST /documents/sections.
Each section entry under overrides.sections must reference a section that is already linked to the base template version. You cannot add new sections via overrides — use Path 3 (assembly) for that.

When to use this path

ScenarioWhy Path 2
Per-user UI customization on top of a stable templateDrop the user-collected tweak straight into templateRef.overrides. No new resource per user.
One-off adjustment to a Corti Standard or your own templateThe base stays untouched; the auto-generated aggregate records exactly what was used.
You need traceability of what produced each documentThe response’s templateId / templateVersionId point at the persisted aggregate; reference it for 30 days.

Guided Synthesis overview

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

Customization Cookbook — Recipe 3

The end-user-driven pattern that maps directly onto Path 2 (presets vs. free-prompt).