<?php

namespace App\Config;

class PromptBuilderConfig{
    /**
     * Approximate character-to-token ratio for conservative prompt budgeting.
     */
    public const CHARS_PER_TOKEN = 4;

    /**
     * Keep a small gap so history does not consume the last available prompt space.
     */
    public const HISTORY_PADDING_CHARS = 400;

    /**
     * Reserve some space for the model output.
     */
    public const OUTPUT_RESERVE_RATIO = 0.25;
    public const OUTPUT_RESERVE_MIN_TOKENS = 768;
    public const OUTPUT_RESERVE_MAX_TOKENS = 6000;

    /**
     * Reserve a small safety buffer to avoid hitting the context limit too tightly.
     */
    public const SAFETY_RESERVE_RATIO = 0.05;
    public const SAFETY_RESERVE_MIN_TOKENS = 256;
    public const SAFETY_RESERVE_MAX_TOKENS = 1024;

    /**
     * Ensure the prompt budget never collapses completely on smaller models.
     */
    public const MIN_PROMPT_BUDGET_TOKENS = 1024;

    /**
     * Limit how many ranked shop results are passed into the final prompt.
     * The shop search may return many candidates, but the LLM should only see
     * the most relevant top subset after local reranking.
     */
    public const MAX_SHOP_RESULTS_IN_PROMPT = 8;

    /**
     * Technical product prompts should be answered like documentation,
     * not like sales copy.
     */
    public const TECHNICAL_PRODUCT_KEYWORDS = [
        'technisch',
        'technical',
        'produkt',
        'product',
        'gerät',
        'device',
        'modell',
        'model',
        'messprinzip',
        'measurement principle',
        'schnittstelle',
        'interface',
        'relais',
        'relay',
        'indikator',
        'indicator',
        'spannung',
        'voltage',
        'strom',
        'current',
        'druck',
        'pressure',
        'temperatur',
        'temperature',
        'schutzart',
        'ip',
        'fehlercode',
        'error code',
        'wasserhärte',
        'hardness',
        'testomat',
        'chlor',
        'chlormessung',
    ];

    public const ACCESSORY_REQUEST_KEYWORDS = [
        'passend',
        'passende',
        'passendes',
        'zubehör',
        'zubehor',
        'dazu',
        'indikator',
        'reagenz',
        'kit',
        'set',
        'zusatz',
        'ergänzung',
        'ergaenzung',
    ];
}
