Interface IOutlineSchema<Data, Param>

Interface representing the schema for configuring an outline operation. Defines the structure and behavior of an outline, including data generation and validation.

interface IOutlineSchema<
    Data extends IOutlineData = IOutlineData,
    Param extends IOutlineParam = IOutlineParam,
> {
    callbacks?: IOutlineCallbacks;
    completion: string;
    docDescription?: string;
    format: IOutlineFormat;
    getOutlineHistory(args: IOutlineArgs<Param>): Promise<void>;
    maxAttempts?: number;
    outlineName: string;
    prompt: string | (outlineName: string) => string | Promise<string>;
    system?: string[] | (outlineName: string) => string[] | Promise<string[]>;
    validations?: (
        IOutlineValidation<Data, Param>
        | IOutlineValidationFn<Data, Param>
    )[];
}

Type Parameters

  • Data extends IOutlineData = IOutlineData

    The type of the data param, defaults to IOutlineData.

  • Param extends IOutlineParam = IOutlineParam

    The type of the input param, defaults to IOutlineParam. IOutlineSchema

Properties

callbacks?: IOutlineCallbacks

Optional set of callbacks for outline lifecycle events. Allows customization of attempt, document, and validation handling.

completion: string

The name of the completion for JSON

docDescription?: string

Optional description for documentation purposes. Aids in understanding the purpose or behavior of the outline.

The format/schema definition for the outline data. Specifies the expected structure, required fields, and property metadata for validation and documentation.

maxAttempts?: number

Optional maximum number of attempts for the outline operation. Limits the number of retries if validations fail.

outlineName: string

The unique name of the outline within the system. Identifies the specific outline configuration.

prompt: string | (outlineName: string) => string | Promise<string>

The prompt used to initiate the outline operation. Can be a static string or a function that generates the prompt dynamically based on the outline name. If a function is provided, it may return a string or a Promise resolving to a string. This prompt is typically sent to the completion engine or model to guide the generation process.

system?: string[] | (outlineName: string) => string[] | Promise<string[]>

The system prompt(s) provided to the language model for the outline operation. Can be a static array of strings or a function that generates the system prompts dynamically based on the outline name. These prompts are typically used to set context, instructions, or constraints for the model before user or assistant messages.

validations?: (
    IOutlineValidation<Data, Param>
    | IOutlineValidationFn<Data, Param>
)[]

Array of validation functions or configurations to apply to the outline data. Supports both direct validation functions and structured validation configurations.

Methods

  • Function to generate structured data for the outline operation. Processes input param and history to produce the desired data.

    Parameters

    • args: IOutlineArgs<Param>

    Returns Promise<void>