# ============================================================
# QueryMind environment variable example
# Copy this file to .env and fill in real values
# ============================================================

# ============================================================
# Mem0 Agent Memory configuration
# ============================================================
# Mem0 persists the agent's conversational memory.

# Embedder settings
MEM0_EMBEDDER_PROVIDER=openai
MEM0_EMBEDDER_MODEL=text-embedding-3-small

# Mem0 LLM settings (used for memory indexing and retrieval)
MEM0_LLM_PROVIDER=openai
MEM0_LLM_MODEL=gpt-4o-mini
MEM0_LLM_BASE_URL=

# Mem0 vector store settings (PgVector)
MEM0_VECTOR_STORE_PROVIDER=pgvector
MEM0_PGVECTOR_HOST=localhost
MEM0_PGVECTOR_PORT=5432
MEM0_PGVECTOR_DATABASE=mem0
MEM0_PGVECTOR_USERNAME=your_pgvector_username
MEM0_PGVECTOR_PASSWORD=your_pgvector_password

# ============================================================
# Neo4j Schema Memory configuration
# ============================================================
# Neo4j stores the graph structure for database schemas.

NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_neo4j_password
NEO4J_DATABASE=neo4j

# ============================================================
# Mem0 vector config (vector layer for Schema Memory)
# ============================================================
# Schema Memory uses a two-layer structure: vector search + graph relations.

# Embedder settings
EMBEDDING_PROVIDER=openai
EMBEDDING_MODEL=text-embedding-3-small

# LLM settings
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o-mini

# Vector store settings (PgVector)
VECTOR_STORE_PROVIDER=pgvector
PGVECTOR_HOST=localhost
PGVECTOR_PORT=5432
PGVECTOR_DATABASE=mem0
PGVECTOR_USERNAME=postgres
PGVECTOR_PASSWORD=your_pgvector_password

# ============================================================
# API keys (shared across modules)
# ============================================================
# OpenAI API key (used by the embedder and some LLMs)
OPENAI_API_KEY=your_openai_api_key

# MiniMax API key (optional, if you use MiniMax LLM)
MINIMAX_API_KEY=

# vLLM API key (optional, if you use vLLM)
VLLM_API_KEY=

# Schema Governance (shared by Agent / Evaluation)
# Controls schema_retrieve stop conditions, duplicate queries, and rephrase strategy.
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_MAX_CALLS=3
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_MAX_FAILURES=2
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_SUCCESSES_TO_LOCK=2
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_SAME_QUERY_LIMIT=2
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_NO_NEW_TABLES_LIMIT=2
SCHEMA_GOVERNANCE_SCHEMA_RETRIEVE_EMPTY_RESULTS_LIMIT=2
SCHEMA_GOVERNANCE_RECAP_TRIGGER_RATIO=0.7
SCHEMA_GOVERNANCE_RECAP_MIN_TOOL_ITERATIONS=4

# SQL Governance (shared by Agent / Evaluation)
# Controls SQL complexity, metadata introspection, and SQL self-check rephrasing.
ALLOW_METADATA_QUERY=false
SQL_GOVERNANCE_MAX_QUERY_LENGTH=10000
SQL_GOVERNANCE_MAX_SUBQUERIES=5
SQL_GOVERNANCE_MAX_CTE_DEPTH=3
SQL_GOVERNANCE_MAX_JOINS=15
SQL_GOVERNANCE_RECAP_TRIGGER_RATIO=0.7
SQL_GOVERNANCE_RECAP_MIN_TOOL_ITERATIONS=4
SQL_GOVERNANCE_FREEZE_TRIGGER_RATIO=0.65
SQL_GOVERNANCE_FREEZE_MIN_TOOL_ITERATIONS=8
SQL_GOVERNANCE_FREEZE_MIN_BEST_SQL_SUPPORT=2

# ============================================================
# Evaluation (QueryMind Evaluation)
# ============================================================
# my_evaluation.py loads the .env file from this directory automatically.
# The variables below control the evaluation dataset, LLMs, database connections, and report output.
# The evaluation LLM supports Anthropic-compatible endpoints; EVAL_* takes precedence, and if the provider matches you can reuse the global LLM_* settings.
# For relative paths, prefer paths relative to QueryMind/src; the script resolves them automatically.

# Dataset and output
EVAL_DATASET_PATH=evals/datasets/basic.yaml
EVAL_OUTPUT_DIR=evals/eval_results
EVAL_MAX_CONCURRENCY=2
EVAL_MAX_TOOL_ITERATIONS=25
EVAL_PREVIEW_ROWS=10
EVAL_PASS_THRESHOLD=0.7
EVAL_ALLOW_WRITE_SQL=false
EVAL_PROGRESS=auto
EVAL_LOG_LEVEL=WARNING
EVAL_FILE_LOG_LEVEL=DEBUG
EVAL_RECOVERY_MAX_RETRIES=5
EVAL_RECOVERY_BASE_DELAY_MS=1000
EVAL_RECOVERY_MAX_DELAY_MS=30000
EVAL_RECOVERY_INCLUDE_JITTER=true
# sync: re-extract the database schema and synchronize it to Schema Memory
# reuse_existing: initialize the connection only and reuse existing Schema Memory
EVAL_SCHEMA_SYNC_MODE=sync

# Evaluation LLMs (Agent / Judge)
# Leave blank to reuse MINIMAX_API_KEY
EVAL_AGENT_LLM_PROVIDER=minimax
EVAL_AGENT_MODEL=Minimax-M2.7
EVAL_AGENT_API_KEY=
EVAL_AGENT_BASE_URL=https://api.minimaxi.com/anthropic
ANTHROPIC_MAX_RETRIES=5
ANTHROPIC_RETRY_INITIAL_DELAY=1.0
ANTHROPIC_RETRY_BACKOFF_FACTOR=2.0
ANTHROPIC_RETRY_MAX_DELAY=30.0
ANTHROPIC_RETRY_JITTER_RATIO=0.25

EVAL_JUDGE_LLM_PROVIDER=minimax
EVAL_JUDGE_MODEL=Minimax-M2.7
EVAL_JUDGE_API_KEY=
EVAL_JUDGE_BASE_URL=https://api.minimaxi.com/anthropic

# Target database
EVAL_DATABASE_ID=adventureworks
EVAL_DB_DIALECT=postgres

# PostgreSQL evaluation connection (choose one: connection string or separate parameters)
EVAL_POSTGRES_CONNECTION_STRING=
EVAL_POSTGRES_HOST=localhost
EVAL_POSTGRES_PORT=5432
EVAL_POSTGRES_DATABASE=your_eval_database
EVAL_POSTGRES_USER=postgres
EVAL_POSTGRES_PASSWORD=your_db_password

# SQLite evaluation connection
EVAL_SQLITE_DATABASE_PATH=

# MSSQL evaluation connection
EVAL_MSSQL_ODBC_CONN_STR=
