Reference Library

A reference library is a collection of reference diagrams that can be used by Eraser AI. They can be modular patterns meant to be used as re-usable building blocks in a larger diagram or fully fledged example diagrams meant to be a base template.

Navigate to the AI reference page to create and manage reference libraries and diagrams.

Creating a reference library

  1. Open to the AI reference page
  2. Click on the library selection dropdown
  3. Click on "New library"
  4. Fill out a "Name" for the library and a "Description" in a few words

Creating a reference diagram

If you have not done so already, first create the diagram that you would like to set as a reference diagram. You can do so using Eraser's AI features (text-to-diagram, image-to-diagram), or manually writing the diagram-as-code syntax. You will want to access this diagram for the final step of the below:

  1. Open the AI reference page and select the library that you'd like to add a reference diagram into
    1. Note that you cannot add reference diagrams to pre-built libraries (AWS, Azure, GCP)
  2. Click on the "New Reference" button
  3. Enter a name for the reference
  4. Select a diagram type
  5. Enter a reference diagram description. Describing what the diagram is, when it is relevant, and how to use it will help Eraser AI best utilize the reference diagram
  6. On the right half (canvas) of the page, click on one of the diagram creation options
  7. In the diagram code editor, paste the diagram code of the diagram that you would like to set as a reference

Using the reference library in the app

Once you have a reference library and some reference diagrams inside of it, you can use the library when you are generating AI diagrams.

  1. In an Eraser file, create a blank AI diagram
  2. In the sidebar, click on "Add source"
  3. Select "Reference Library"
  4. Select the library you want to use
  5. Enter a prompt, directly referencing the library name and the reference diagram name as necessary.
    1. Example #1. Create a mobile application architecture diagram utilizing the Payment Processing Module and Authentication Module from the ACME Corp Architecture Library
    2. Example #2. Using the User Flow Template in the ACME Corp Diagram Library as a base, create a user flow diagram that shows the new user sign up process.

Using the reference library in the API

In the /api/render/prompt endpoint (docs), you can specify a contextId to use a reference library in a diagram generation API call.

The contextId can be obtained using the below steps:

  1. Open the AI references page
  2. Select the library you want to use in your API call in the library selection dropdown
  3. The URL in the browser URL bar will contain a contextId
    1. e.g. https://app.eraser.io/dashboard/ai-context?contextId=YOUR-CONTEXT-ID
  4. Copy the contextIdand provide it in the /api/render/prompt API call