Skip to main content
EDN lets your application use its own documents as memory for AI answers. By placing documents in a project and building a Session Initialization Package (SIP), you can give your model relevant context and citations that point back to the original sources.

1. Create a project

Use Create a project to create a project for your documents. The response includes an id, which you pass as project_id in later API calls.

2. Upload your documents

Use Upload a document to add files to the project. This endpoint accepts multipart/form-data, not JSON. The request accepts these fields:
  • file: Required. A PDF, Word (DOCX), Excel (XLSX), PowerPoint (PPTX), Markdown, plain text, HTML, CSV or image (PNG, JPEG, TIFF, BMP, WebP) file, up to 5 MB and 30 pages, with up to 8 scanned pages. See Supported files.
  • session_id: Required.
  • project_id: Optional. Associates the document with your project. Without it, the document goes into general memory.
  • domain: Optional.
EDN splits the document text into sections and saves each section as a DOCUMENT_VERIFIED memory. The response includes chunks_stored, the number of memories made from the file (for a file that is already in the project, the number in the existing source), and source_id, the project source identifier. When no project_id is supplied, source_id is null.
An upload can return these errors:
  • 400: The document could not be read (INVALID_DOCUMENT), is a password-protected PDF (PASSWORD_PROTECTED) or has no usable text (NO_USABLE_CONTENT).
  • 409: The same file is already being processed in the project (DUPLICATE_IN_PROGRESS).
  • 413: The file is over 5 MB (FILE_TOO_LARGE), has more than 30 pages (TOO_MANY_PAGES), has more than 8 scanned pages (TOO_MANY_SCANNED_PAGES) or contains too much content (TOO_MUCH_CONTENT). Split it into parts.
  • 415: The file type is not supported.
  • 503: EDN is processing another document (BUSY), or the save did not finish and nothing was stored (WRITE_TIMEOUT, WRITE_INCOMPLETE). Documents are processed one at a time, so upload them one after another, and retry after the Retry-After header.
Uploading a file that is already a ready source of the project stores nothing new and returns already_present: true.

3. Check that the documents are ready

Use List project documents to retrieve the project’s documents, newest first. Each document includes:
  • ingest_status: pending while EDN processes the document, ready when it can be searched, or failed if it could not be read.
  • chunk_count: The number of memory records created from the document.
  • error_code and error_message: Why a failed document was not stored. Some failures are stored as PROCESSING_FAILED, and documents that failed before these fields existed have null. Uploading the same file again retries it.
Check that ingest_status is ready before using the document for retrieval.

4. Build a SIP from the project

Use Build a SIP to retrieve the memory relevant to the user’s question. Send:
  • query: What the user just asked.
  • session_id: The conversation session.
  • project_id: The project containing your documents.
With project_id, EDN uses only that project’s memory and documents. Set include_global to true to also use general memory. The response includes:
  • sip: The context text to place in the model’s prompt, ahead of the user’s message.
  • records_used: The number of memory records included in the SIP.
  • citations: The sources associated with numbered items in the SIP.
  • grounded: true when project_id was supplied.
EDN numbers each citable item [1], [2] and so on. Citable memories are DOCUMENT_VERIFIED, USER_STATED and USER_CONFIRMED. All sections of the same document share one citation number. Saved exchanges (ROUND) appear without a number and are never cited. Unconfirmed AI memories, replaced memories and deleted memories are never included.

5. Ask the model to cite its sources

Place the returned sip in the model’s prompt, ahead of the user’s message. Ask the model to cite the numbered sources [n] it uses in its answer. The citations response contains one entry for each citation number, with these fields:
  • index: The number represented by [n].
  • summary: The memory content associated with the citation.
  • provenance: The memory’s provenance class.
  • source_id: The document source identifier, or null for other memory.
  • source_title: The document title, or null for other memory.
  • record_id: The memory record identifier.
  • supporting_record_ids: Every memory record from that source that was used.
Use index to match each [n] in the model’s answer to its source. Display source_title to show the user which document supports the cited information.

6. When the project has no answer

When a project SIP build finds nothing relevant to the question, the response sets abstain to true. The SIP instructs the model to answer only from the project’s sources and to state plainly that the project has no sources on that topic, rather than guessing.

7. Keep the conversation in the project

Use Save a conversation turn after each user-assistant exchange, passing the same project_id. This saves the exchange in the project so later SIPs for that project can use it as context.

8. Remove a document

Use Remove a project document to remove a document from the project. Provide the source_id returned by Upload a document or List project documents. EDN removes the document and every memory created from it, so none of them is used again in SIPs, search or lists. Signed records of earlier SIPs keep the text those SIPs contained. The response includes records_removed, the number of memory records removed.

Next steps: See Build a SIP and Upload a document for the API reference.