What each kind of result carries
source_evidence is a list of short strings, and it is absent on a memory that has none. A document passage carries a citation instead.
Where to find them
Ask for the ranked shape and every item sits in one list, best first. A document item has akind (passage, record or fetched) and a citation. Memories carry kind: "memory" when they are ranked together with documents.
passages, records and fetched, each item carrying its citation. A list is absent when it has no items.
The TypeScript SDK (0.9.0) has no named types for document item fields, so
kind and citation are read from the item as shown.What a citation holds
A field that does not apply comes back as
null; source_disconnected, etag and age_seconds are left out unless they apply. Check that a field is set before you use it.
Open the source
url is a link you can show as it is. For the file itself, pass document_key and version to documents.original, which returns the file’s bytes. It never returns a link, so serve the bytes from your own endpoint to the user who clicked.
documents.original is Python 0.9.0 and later and JavaScript 0.9.0 and later; in TypeScript it returns the bytes as a Uint8Array. See documents.original.
When there is no link
urlis empty. The document was sent as a file with nosource.url. Open it withdocuments.original, or build your own link fromdocument_id.document_keyis empty on a fetched item. An item read live from a connected source has itsurl,fetched_atandetag, and adocument_keyonly when a stored copy of the document exists.document_key,urlandanchorare all empty. Synap leaves them out whenever the document itself is not visible to the caller, for example because your visibility policy hides its Instance.document_id,version,section_pathandpageare still there to show as text.pageorsection_pathis empty. The format has no pages or headings, such as a plain text file.documents.originalraisesContextNotFoundError. The document or that version no longer exists, was deleted, is not visible, or has no stored original.- A conversation memory. It has no citation, only
source_evidence.
Next steps
Documents
Ids, versions and provenance: where citation fields come from.
documents.original
Download the file behind a citation.