# Please don't modify this file as your changes might be overwritten with
# the next update.
#
# You can modify 'local.d/gpt.conf' to add and merge
# parameters defined inside this section
#
# You can modify 'override.d/gpt.conf' to strictly override all
# parameters defined inside this section
#
# See https://rspamd.com/doc/faq.html#what-are-the-locald-and-overrided-directories
# for details
#
# Module documentation can be found at  https://rspamd.com/doc/modules/gpt.html

gpt {
  # Supported types: openai
  type = "openai";
  # Your key to access the API (add this to enable this plugin)
  #api_key = "xxx";
  # Model name
  model = "gpt-5-mini"; # or parallel model requests [ "gpt-5-mini", "gpt-4o-mini" ];
  # Per-model parameters
  model_parameters = {
    "gpt-5-mini" = {
      max_completion_tokens = 1000,
    },
    "gpt-5-nano" = {
      max_completion_tokens = 1000,
    },
    "gpt-4o-mini" = {
      max_tokens = 1000,
      temperature = 0.0,
    }
  };
  # Timeout for requests
  timeout = 10s;
  # Prompt for the model (use default if not set)
  #prompt = "xxx";
  # Custom condition (lua function)
  #condition = "xxx";
  # Autolearn if gpt classified
  #autolearn = true;
  # Reply conversion (lua code)
  #reply_conversion = "xxx";

  # Default set of symbols to be excepted
  #symbols_to_except = [
  #  'BAYES_SPAM',
  #  'WHITELIST_SPF',
  #  'WHITELIST_DKIM',
  #  'WHITELIST_DMARC',
  #  'FUZZY_DENIED',
  #];

  # Be sure to enable module after you specify the API key
  enabled = false;

  # Optional web search context (disabled by default)
  # Extracts domains from email URLs and queries a search API for context
  search_context = {
    enabled = false; # Enable web search context
    #search_url = "https://leta.mullvad.net/search/__data.json"; # Search API endpoint
    #search_engine = "brave"; # Search engine (brave, google, etc.)
    #max_domains = 3; # Maximum domains to search
    #max_results_per_query = 3; # Maximum results per domain
    #timeout = 5; # HTTP timeout in seconds
    #cache_ttl = 3600; # Cache TTL in seconds (1 hour)
    #cache_key_prefix = "gpt_search"; # Redis cache key prefix
    #as_system = true; # Inject as system message
  };

  # Include dynamic conf for the rule
  .include(try=true,priority=5) "${DBDIR}/dynamic/gpt.conf"
  .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/gpt.conf"
  .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/gpt.conf"
}
