# Neural Autolearn Configuration
#
# This configuration is part of the neural plugin and controls automatic
# training for neural networks with LLM providers.
#
# The autolearn section can be added to any neural rule configuration.
# It uses expression-based conditions for strong confidence learning.
#
# Documentation: doc/neural-llm-embeddings-guide.md

# Example autolearn configuration for neural rules
# Add this inside a neural rule:
#
# neural {
#   rules {
#     llm_classifier {
#       providers = [
#         { type = "llm"; llm_type = "ollama"; model = "nomic-embed-text"; }
#       ];
#
#       # Autolearn configuration
#       autolearn {
#         enabled = true;
#
#         # Score thresholds
#         spam_score = 15.0;     # Learn spam if score >= 15.0
#         ham_score = -5.0;      # Learn ham if score <= -5.0
#
#         # Action requirements (optional, more restrictive)
#         spam_action = "reject";
#         ham_action = "no action";
#
#         # Expression-based conditions (rspamd_expression syntax)
#         # These provide fine-grained control over learning decisions
#         spam_condition = "BAYES_SPAM & (DMARC_POLICY_REJECT | RBL_SPAMHAUS_SBL)";
#         ham_condition = "BAYES_HAM & DKIM_VALID_AU & SPF_PASS";
#
#         # Required symbols (all must be present)
#         spam_symbols = ["BAYES_SPAM"];
#         ham_symbols = ["BAYES_HAM", "DKIM_VALID"];
#
#         # Forbidden symbols (any blocks learning)
#         skip_symbols = ["WHITELIST_SENDER", "GREYLIST"];
#
#         # Symbol weight thresholds
#         spam_symbol_weight = 5.0;   # Sum of spam_symbols scores >= 5.0
#         ham_symbol_weight = -3.0;   # Sum of ham_symbols scores <= -3.0
#
#         # Probabilistic sampling (reduce training volume)
#         sampling {
#           spam_prob = 0.5;   # Learn 50% of qualifying spam
#           ham_prob = 0.5;
#         }
#
#         # Skip local/authenticated messages
#         check_local = true;
#         check_authed = true;
#       }
#     }
#   }
# }

# Conservative production example:
# autolearn {
#   enabled = true;
#   spam_score = 20.0;
#   ham_score = -8.0;
#   spam_action = "reject";
#   spam_condition = "BAYES_SPAM & !WHITELIST_SENDER";
#   ham_condition = "BAYES_HAM & DKIM_VALID_AU";
#   skip_symbols = ["GREYLIST", "RATELIMITED"];
#   sampling {
#     spam_prob = 0.3;
#     ham_prob = 0.3;
#   }
# }

# Aggressive initial training example:
# autolearn {
#   enabled = true;
#   spam_score = 10.0;
#   ham_score = -2.0;
# }
