API Reference

API reference for DocLayer’s Search Module

Below you can find the API reference for the dl-search module options. This interface is accessible from the module itself. To get it just use:

import type { ModuleOptions } from '@vuehouse/dl-search';

ModuleOptions

The initial options for the DocLayer Module. These options are related to the module's setup and do affect the search engine behavior or appearance.

export interface ModuleOptions {  /**   * The content collections to process.   *   * @default ['docs']   * @see {@link collections}   */  collections?: string[];  /**   * Search Assistant configuration.   *   * @see {@link assistant}   */  assistant?: {    /**     * Whether the Assistant is enabled.     *     * @default false     * @see {@link assistantenabled}     */    enabled?: boolean;    /**     * Whether to use provided context meta from the assistant message.     *     * @default true     * @see {@link assistantcontextmeta}     */    contextMeta?: boolean;    /**     * Whether to use the fully precised context for the Assistant.     *     * @default true     * @see {@link assistantprecisecontext}     */    preciseContext?: boolean;    /**     * Number of top (best ranked) context chunks to use for the answer.     * When extractContextFrom is `page`, also caps how many distinct pages are expanded     * into the model context dump.     *     * Higher values improve recall but increase computation.     * It is not recommended to set this value above 5, as performance may degrade noticeably.     * Maximum value is 10.     *     * @default 3     * @see {@link assistantcontexttopk}     */    contextTopK?: NumberRange<1>;    /**     * Number of top (best ranked) content sections to consider during coarse retrieval.     *     * Higher values improve recall but increase computation / token use.     * It is not recommended to set this value above 5, as performance may degrade significantly.     * Maximum value is 10.     *     * @default 3     * @see {@link assistantcontenttopk}     */    contentTopK?: NumberRange<3>;    /**     * How retrieved hits are expanded into the model context dump.     *     * - `section` — use ranked section chunks only (legacy / smaller payloads).     * - `page` — rank by section, then deliver each winning page as its full     *   flattened sections so sibling facts stay available.     *     * @default 'section'     * @see {@link assistantextractsourcefrom}     */    extractContextFrom?: 'section' | 'page';    /**     * Whether to extract code from the context or the answer.     *     * If the remote model is properly instructed, it should provide the code reference along with the answer,     * correctly injected within the answer context. If undefined code references will not be extracted.     *     * @default undefined     * @see {@link extractcodefrom}     */    extractCodeFrom?: 'context' | 'answer';    /**     * Model to use for the Assistant.     *     * @throws Not operational as for now - TBA.     * @see {@link ModelConfig}     * @see {@link assistantmodel}     */    model?: ModelConfig;    /**     * Embeddings configuration.     *     * @default undefined     * @see {@link embedding}     */    embedding?: {      /**       * Embedding model name/type to use.       *       * @default 'e5'       */      model: 'allmini' | 'e5';    };  };  /**   * AST parser exclusions.   *   * All of the special characters, tags, definitions, etc. that should be excluded from the AST parser.   *   * @default undefined   * @see {@link Exclusions}   * @see {@link exclusions}   */  exclusions?: Exclusions;  /**   * Number of module iterations (parsing content and building static assets).   *   * To avoid running the module (generating assets) each time templates are generated,   * the module will run a given number of times.   *   * @default { current: 0, total: 1 }   * @see {@link iterations}   */  iterations?: {    /**     * Current number of module iterations.     * Should stay unchanged.     *     * @default 0     * @private     */    current: number;    /**     * Total number of module iterations.     * It will react each time templates will be regenerated, until it reaches the total value.     *     * @default 1     */    total: number;  };  /**   * Whether to enable debug mode.   *   * @see {@link DebugOptions}   * @see {@link debug}   */  debug?: DebugOptions | boolean;  /**   * Record mode for the module.   *   * Defines if the module should record (save) the content Collections to files as AST(s) (parsed & raw).   *   * @default false   * @private   */  readonly record?: boolean;}

Model

The AI model configuration used for the AI Assistant. Configuration varies depending on the model type. More about it, you can read here.

type ModelConfig =  | {      type: 'local';      /**       * Local model configuration.       *       * @default undefined       * @requires `type` to be set to `local`       */      config?:        | {            /**             * Number of answers to return from the Assistant.             *             * Must be an integer in the range of 1 to 5.             *             * @default 1             */            answerCount?: NumberRange<1, 5>;            /**             * Whether to process the answer with the question-answering model.             *             * If `false`, the Assistant will return the raw answer from the content context comparison algorithm.             *             * @default true             */            modelProcessedAnswer?: true;            /**             * Whether to extract richest answer from the Assistant search.             *             * It will be ignored if `answerCount` set to `1`.             *             * @default undefined             */            extractRichestAnswer?: boolean;          }        | undefined;    }  | {      /**       * Resolves answers through `dl.adapters.assistant` from `app.config.ts`.       *       * Register an assistant adapter with `defineDoclayerAdapter`.       * The adapter receives `{ prompt, context }` after local retrieval. For secrets, have the adapter       * call a server route.       *       * @see {@link https://docs.doclayer.com/docs/search/configuration#assistantmodeltyperemote}       * @see {@link https://docs.doclayer.com/docs/adapters}       */      type: 'remote';    }  | {      type: 'dl';      /**       * DocLayer AI model configuration.       *       * @requires `type` to be set to `dl`       */      config: {        /** Endpoint of the DocLayer API handling the model to use. */        endpoint: `https://${string}/api`;        /** First stage API signature. Used only to config the request origin. */        token: string;      };    }  | {      /**       * @deprecated for now as unused       */      type: 'custom';      /**       * Custom model configuration.       *       * @deprecated       */      config?: HuggingFacePipelineOptions;    };

Exclusions

Metadata exclusions for the AST parser. More about it, you can read here.

export type Exclusions = {  /**   * AST exclusions for the AST parser.   *   * Excluding content entries with the following paths.   *   * @default ['.navigation', '.navigation.yml']   */  ast?: string[];  /**   * AST block definition (name) exclusions for the AST parser.   *   * Entirely excluding AST blocks (along with its inner content) with the following definitions (names).   * Mostly, these are code-related tags that are extracted by the `cref` internal algorithm.   *   * Example: `pre`, `code`, `blockquote`, `html`, `style`, `dl-code`, `dl-renderer`, etc.   */  def?: string[];  /**   * AST block name (tag) exclusions for the AST parser.   *   * Excluding all of the AST block names (tags) (like `style`, `html`, `span`, etc.).   * Content inside these blocks is not excluded.   */  tag?: string[];  /**   * Custom Markdown tag exclusions for the AST parser.   *   * These exclusions are related to the internal custom Markdown notations used along the content components.   * Mostly these should be untouched.   */  custom?: {    /**     * Custom tags (defined along with the Markdown content) to exclude.     *     * Example: `/strong/`, `/code/`     *     * @default undefined     */    tag: string[];    /**     * Content to exclude between these custom tags (define along with the Markdown content).     *     * @default undefined     */    content: string[];  };};

DebugOptions

Debug options for the module. More about it, you can read here.

type DebugOptions = {  /**   * While `debug.parser` (required) is disabled, mint mode (`mint`) is on, reporting issues only once.   *   * @default false   * @private   */  mint?: boolean;  /**   * Enable debug mode for the AST building process.   *   * @default false   */  parser?: boolean;  /**   * Enable debug mode for the Assistant process.   *   * @default false   */  assistant?: boolean;  /**   * Whether to compress the content & embeddings.   *   * @default false   */  compression?: boolean;};