Skip to main content

Overview

In the Corti API, Templates define the structure for document that are generated by Corti AI models from various inputs, such as conversational transcripts, facts, or other medical documents. Read more about Templates. This page walks through generating documents from facts vs transcripts.
This feature requires human oversight of its outputs

Steps to Generate Documents

  1. Review and Finalize Input:
  • Using FactsR™: If you extract facts from an ambient conversation or an existing transcript or document, you can enable the clinician to review and make final edits to the extracted facts, or discard irrelevant ones. You can then exclude discarded and only include the finalized facts to generate the document. You can also include additional facts derived from the EHR/EMR in your request.
  • Using transcript: You can generate documents based only on the transcript as input. We recommend utilising only the stringified text of the returned transcript. In contrast to the next option, the LLM is made aware of the input source being a transcript.
  • Using other text: You can generate documents also based on any other stringified text.
  1. Make a POST Request: Send a POST request to the /interactions/{id}/documents endpoint, and include the data input according to the chosen context.type, templateKey, and outputLanguage in the request payload.
    • The ‘templateKey’ parameter defines the format of the output document.
    • The ‘outputLanguage’ parameter defines the language the output note will be written in.
    • Please see this page for a list of supported language codes.
    • Use the GET /templates request to see available templates; add ?lang= to the request to filter for available languages.
    • Retention Policy:
      If you do not want the generated document to be saved to the database, you can add the header X-Corti-Retention-Policy: none to your request. When this header is set, the API will generate and return the document as usual, but will not persist it. The response will include the header X-Corti-Retention-Policy: acknowledged to confirm that your retention preference was respected.
  2. Processing the Request and Receiving the Document: The API processes the submitted data, applying the specified template to generate the structured document. If the request is successful, the API returns a 200 OK status along with the formatted document in markdown text.

Generate Document from Facts vs. from Transcript

For the typical real-time ambient documentation workflow, summary documentation can be generated either on the basis of facts or the transcript. If your integration is centered around facts, those would typically have been extracted automatically during the live stream (source: core) but you might have also created facts to pipe over relevant pre-chart information, e.g. demographics (source: system), or have given the clinician the ability to add and edit live notes (source: user). In the end, you decide which facts to use as the basis to generate a document. If you workflow is not centred around a real-time ambient conversation, you can also extract facts from a text input, or generate the transcript based on an existing audio recording. Let’s look at the differences in the request payload when generating a document on the basis of facts vs. a transcript.

Generate Document from Facts as Input

Document from facts - static template
  curl --request POST \
  --url https://api.$environment.corti.app/v2/interactions/$id/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Tenant-Name: <tenantname>' \
    --header 'Content-Type: application/json' \
    --data '{
    "context": [
      {
        "type": "facts",
        "data": [
          {
            "text": "32 year-old female",
            "group": "demographics",
          "source": "system" # example of a fact that was created via REST
          },
          {
            "text": "itchy rash, started last week",
            "group": "history-of-present-illness",
          "source": "core" # fact generated by Corti LLM during stream
          },
          {
            "text": "allergic to birch pollen since childhood",
            "group": "allergies",
            "source": "core"
          },
          {
            "text": "typical eczema appearance",
            "group": "assessment",
            "source": "core"
          },
          {
            "text": "corticosteroid treatment, follow-up in 4 weeks",
            "group": "plan",
          "source": "user" # a fact edited by the end user
          }        
        ]
      }
    ],
    "templateKey": "corti-soap",
    "name": "Soap note summary: itchy rash",
  "outputLanguage": "en-US" # BCP-47 code
  }'

Generate Document from Transcript as Input

Document from transcript - static template
  curl --request POST \
  --url https://api.$environment.corti.app/v2/interactions/$id/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Tenant-Name: <tenantname>' \
    --header 'Content-Type: application/json' \
    --data '{
    "context": [
      {
        "type": "transcript",
      "data":
          {
            "text": "tell me a bit about what’s been going on? When did you first start feeling unwell?\n\n- Erm, I think it was, uh, probably about, like, a week ago? I just started feeling a bit, you know, off—like, uh, tired and achy. Then my throat got really sore, and it, uh, just didn’t get any better.\n\n- Right, okay. And when you say achy, was it more like muscle aches, or, uh, like, joint pain?\n\n- Um, mostly muscles, like, all over? Especially my legs and back. I just, like, wanted to stay in bed. And the sore throat, it’s, um, like, scratchy but also kinda raw, if that makes sense?\n\n- Yeah, it does. Have you had any fever? Like, have you felt hot or shivery at all?\n\n- Oh, yeah, definitely. A couple nights I woke up, uh, like, proper drenched in sweat. Then, uh, during the day, I'd get really cold even with a jumper on.\n\n- Mm-hmm. What about your nose? Any congestion or runny nose?\n\n- Uh, not really, no. Just, like, a tiny bit blocked, but mostly it's my throat and, uh, feeling knackered, really.\n\n- And are you coughing at all? Like, a dry cough or anything productive, like, bringing up phlegm?\n\n- Yeah, um, a bit of a cough, kinda dry. It’s worse at night, actually. Like, when I lie down, I start, uh, coughing more."
          }
      }
    ],
    "templateKey": "corti-brief-clinical-note",
    "name": "test brief note from transcript",
  "outputLanguage": "en" # BCP-47 code
  }'
Document generation based on a transcript supports definition of one “data” object and one “text” object in the request, as seen above. If your transcript contains multiple text strings, they will need to be combined into a single string.