Skip to main content
This page documents the top-level functions, enums, and types exported from @exulu/backend that are not part of a class. For class APIs see the Core classes and the other reference pages in this section.

Functions

defaultChunker

The built-in ChunkerOperation used when a context configures an embedding model but does not provide a custom chunker. It runs the SentenceChunker over the item’s primary text content — checking content, then description, prefixed by name — and respects maxChunkSize as the per-chunk token budget. Use defaultChunker directly when you want to invoke the standard chunking logic from a custom processor or in tests.
See ExuluChunkers for the full suite of built-in chunkers.

enableLiteLLMClientMode

Switches the current process into LiteLLM client mode: instead of spawning and supervising its own proxy, the process connects to a proxy managed by a separate process (typically the IMP HTTP server). Call this once at the very start of a worker or CLI process that shares a proxy with a running IMP server. Without it, the worker would attempt to spawn its own proxy on LITELLM_PORT — colliding with the server’s process — or fail with “package root not set”.
enableLiteLLMClientMode is a no-op when the current process has already started its own supervisor (e.g. a combined server + worker process). It is idempotent. See Self-hosting / LiteLLM for deployment context.

postgresClient

Returns a memoized Knex instance connected to the IMP Postgres database. On first call, creates the database if it does not exist (using POSTGRES_DB_NAME, defaulting to "exulu"). Subsequent calls return the cached connection. db is a Knex instance with pgvector registered, so vector operations (db.raw('... <=> ?', [vector])) work out of the box.
The connection pool defaults to min: 2, max: 4. Connection timeouts, SSL, and credentials are read from environment variables (POSTGRES_DB_HOST, POSTGRES_DB_PORT, POSTGRES_DB_USER, POSTGRES_DB_PASSWORD, POSTGRES_DB_SSL).

Enums

EXULU_STATISTICS_TYPE_ENUM

String enum for the platform’s statistics event types, used as the type field in the statistics table. The corresponding TypeScript union type is EXULU_STATISTICS_TYPE.

EXULU_JOB_STATUS_ENUM

String enum for BullMQ job statuses, used when querying the jobs table or filtering on queue inspector results. The corresponding TypeScript union type is EXULU_JOB_STATUS.

Types

ChunkerOperation

The function signature for a custom chunker. Implement this type and pass the result as the chunker option of an ExuluContext embedder config. utils.storage is available for chunkers that need to read files from object storage (e.g. to extract text from a PDF before chunking).

ChunkerResponse

The return value of a ChunkerOperation. metadata is stored in a Postgres JSONB column — any JSON-serializable value is accepted (e.g. a page number from a PDF chunker).

ExuluContextEmbedder

The embedder configuration on an ExuluContext. model is the LiteLLM model_name of the embedding model (declared in config.litellm.yaml). When queue is provided, embedding jobs run in the background via BullMQ.

ExuluAgent

The database agent record, extended with hydrated relations. Named ExuluAgent at the package boundary (the internal type is agent.ts:ExuluAgent). Passed to tool execute functions, ExuluEval.run, ExuluReranker.rerank, and other contexts where the calling agent’s identity is needed.

VectorSearchChunkResult

The shape returned by ExuluContext.search(), ExuluReadApi.authorizedRead(), and passed to ExuluReranker.rerank(). chunk_entities is present only when the entity layer is enabled for the context.

ExuluOauthConfig

OAuth 2.0 configuration for an ExuluTool. When a tool is constructed with an oauth property, IMP wraps its execute to require a valid access token. provider lets multiple tools share the same token under one consent grant; when omitted each tool uses its own id as the provider key. See ExuluTool — introduction for the full OAuth integration guide.

ExuluOauthToolContext

The OAuth context injected into an OAuth-enabled tool’s execute inputs as inputs._oauth. expiresAt is null when the provider did not report an expiry. scopes is the space-joined granted scope string when reported.

ExuluItem

The base record shape for items stored in a knowledge context. Re-exported from @EXULU_TYPES/models/item as ExuluItem for package consumers. The index signature ([key: string]: any) accommodates context-specific custom fields defined in ExuluContext.fields.