lloyal-agents API Reference
    Preparing search index...

    Interface FormatChatOptions

    Options for chat template formatting

    Controls format-awareness fields passed to the chat template engine. All fields are optional -- sensible defaults are used when omitted.

    const result = await ctx.formatChat(messagesJson, {
    tools: JSON.stringify(tools),
    toolChoice: 'auto',
    reasoningFormat: 'auto',
    });
    interface FormatChatOptions {
        addGenerationPrompt?: boolean;
        enableThinking?: boolean;
        grammar?: string;
        jsonSchema?: string;
        parallelToolCalls?: boolean;
        reasoningFormat?: "auto" | "none" | "deepseek" | "deepseek_legacy";
        templateOverride?: string;
        toolChoice?: "auto" | "required" | "none";
        tools?: string;
    }
    Index

    Properties

    addGenerationPrompt?: boolean

    Append assistant prompt prefix (default: true). Set false when formatting partial conversations or for non-generation use cases like template validation.

    enableThinking?: boolean

    Enable <think> blocks (default: true). Pairs with reasoningFormat.

    grammar?: string

    Explicit GBNF grammar string for constrained generation. Mutually exclusive with jsonSchema.

    jsonSchema?: string

    JSON schema for constrained output. Converted to GBNF grammar internally. Mutually exclusive with grammar.

    parallelToolCalls?: boolean

    Allow parallel tool calls (default: false)

    reasoningFormat?: "auto" | "none" | "deepseek" | "deepseek_legacy"

    Reasoning format (default: "none")

    Controls <think> block handling in the template. Use "auto" to let the model's template decide.

    templateOverride?: string

    Custom Jinja2 template override (bypasses model's built-in template)

    toolChoice?: "auto" | "required" | "none"

    Tool choice strategy (default: "auto")

    tools?: string

    JSON array of OpenAI-format tool definitions

    const tools = [{ type: 'function', function: {
    name: 'get_weather',
    description: 'Get current weather',
    parameters: { type: 'object', properties: { location: { type: 'string' } } }
    }}];
    options.tools = JSON.stringify(tools);