ScribeberryScribeberry Docs

Note Generation

Generate structured clinical notes from conversation text or audio files.

Note generation is the core feature of the Scribeberry API. Provide conversation text (or an audio URL), choose a template, and receive a structured clinical note.

Generate from Text

The most common pattern: your application has already captured the conversation text (from a transcription service, chat interface, or manual entry) and you want to generate a structured note.

generate-from-text.ts
const result = await sb.notes.generate({
  templateId: 'template-id',
  conversationText: `
    Doctor: What brings you in today?
    Patient: I've had a persistent cough for about two weeks.
    It's worse at night and sometimes I bring up clear mucus.
    Doctor: Any fever, shortness of breath, or chest pain?
    Patient: No fever. A little short of breath when climbing stairs.
    Doctor: Let's listen to your lungs... I hear some mild wheezing
    bilaterally. I'd like to start you on an albuterol inhaler
    and follow up in a week.
  `,
});
 
console.log(result.note.markdown);

Response

{
  note: {
    markdown: "# Chief Complaint\nPersistent cough for 2 weeks...",
    text: "Chief Complaint: Persistent cough for 2 weeks...",
    structured: {
      "Chief Complaint": "Persistent cough for 2 weeks...",
      "History of Present Illness": "Patient reports...",
      "Assessment": "Mild reactive airway disease...",
      "Plan": "1. Albuterol inhaler PRN..."
    }
  },
  template: {
    id: "template-id",
    name: "SOAP Note"
  }
}

Generate from Audio

Provide a URL to an audio file, and Scribeberry will transcribe it first, then generate the note.

generate-from-audio.ts
const result = await sb.notes.generate({
  templateId: 'template-id',
  audioUrl: 'https://your-storage.com/recordings/visit-123.wav',
  sourceLanguage: 'en-US',
  transcriptionQuality: 'high',
});
 
// The transcript is included in the response
console.log(result.transcript?.text);
console.log(result.note.markdown);

ℹ️ Info: Audio note generation takes longer (30–120 seconds) because it includes transcription before note generation. The SDK automatically increases the timeout for this operation.

Parameters

ParameterTypeRequiredDescription
templateIdstringTemplate to structure the note with
conversationTextstringRaw conversation text
audioUrlstringURL to an audio file (WAV, MP3, WebM, etc.)
sourceLanguagestringLanguage code (default: en-US)
transcriptionQuality'low' | 'medium' | 'high'Transcription accuracy (default: high)
contextRecord<string, string>Additional context for the LLM

⚠️ Warning: You must provide either conversationText or audioUrl (or both). If both are provided, the conversation text is used as the primary input and the audio is transcribed as supplementary context.

Adding Context

Use the context parameter to provide additional information that should influence note generation:

const result = await sb.notes.generate({
  templateId: 'template-id',
  conversationText: '...',
  context: {
    patientAge: '45',
    specialty: 'cardiology',
    visitType: 'follow-up',
    previousDiagnosis: 'Hypertension, Type 2 Diabetes',
  },
});

Response Types

GenerateNoteResult

interface GenerateNoteResult {
  note: Note;
  transcript?: {
    text: string;
    confidence: number;
    duration: number;
    sourceLanguage: string;
  };
  template: {
    id: string;
    name: string;
  };
}

Note

interface Note {
  /** Full note in Markdown format. */
  markdown: string;
 
  /** Full note as plain text. */
  text: string;
 
  /** Sections keyed by heading name. */
  structured: Record<string, string>;
}

The structured object makes it easy to extract individual sections:

const assessment = result.note.structured['Assessment'];
const plan = result.note.structured['Plan'];

Best Practices

  1. Choose the right template — match the template to the visit type for best results
  2. Include context — additional context like patient age and specialty improves accuracy
  3. Use high quality transcription — for audio inputs, high quality is recommended for clinical use
  4. Validate output — always have a clinician review generated notes before use

On this page