ExuluReadApi provides low-level, RBAC-enforced read functions for knowledge contexts. Where ExuluContext.search() covers relevance-ranked retrieval, ExuluReadApi covers targeted reads by item ID or external ID, embed-query utilities, and table-name resolution — all while applying the same access-control rules as the GraphQL layer.
Use ExuluReadApi when you need to read specific known items without going through vector search, or when you need the underlying table names to build custom queries.
API surface
ExuluReadApi.authorizedRead
applyAccessControl. At least itemIds or externalIds must be supplied — unconstrained full-table reads are rejected.
object
required
The context to read from. Must have an
id matching a registered ExuluContext.User
required
Authenticated user. Used for RBAC filtering on the items table.
string
required
Role ID. Merged into the user object so access-control’s role branch works correctly.
string[]
Filter to chunks whose parent item ID is in this list.
string[]
Filter to chunks whose parent item
external_id is in this list.{ from?: number; to?: number }
Restrict to a contiguous range of
chunk_index values within the matched items.Promise<VectorSearchChunkResult[]>
Chunk rows with joined item metadata, ordered by
(source, chunk_index).ExuluReadApi.embedQuery
object
required
Context descriptor.
id must match a registered ExuluContext; embedder.model selects the LiteLLM embedding model.string
required
The text to embed.
User
Authenticated user. Forwarded to
resolveEmbedder for spend attribution.string
Role ID forwarded to
resolveEmbedder for access-control tagging."document" | "query"
Hint passed to the embedding model. Controls Matryoshka / asymmetric embedding direction where the model supports it. Defaults to
"query".Promise<number[]>
The embedding vector. Returns an empty array when the embedder produces no output.
ExuluReadApi.entitiesAvailable
true when the context declares an entities config and the corresponding _chunk_entities table physically exists. Use this to guard entity tool registration at runtime.
Table-name helpers
Example
Notes
authorizedReadalways applies RBAC viaapplyAccessControlon theitemsalias — this gate cannot be bypassed throughopts.- Results are ordered by
(chunks.source, chunks.chunk_index)— stable page order for items with multiple chunks. embedQueryroutes through the sameresolveEmbedderpath as the ingestion pipeline, so LiteLLM cost attribution applies.
Related
- ExuluContext — introduction:
ExuluContext.search()for relevance-ranked retrieval. VectorSearchChunkResult: shape of the returned chunk rows.