Skip to content

Commit e4a234a

Browse files
SQLiciousclaude
andcommitted
feat: local MLflow tracking with SQLite backend
Switch from Databricks-hosted MLflow to local SQLite backend for dev. Add test script to verify MLflow experiment logging works locally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b75e33a commit e4a234a

3 files changed

Lines changed: 41 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ chroma_data/
77
*.egg-info/
88
.DS_Store
99
mlruns/
10+
mlflow.db
11+
mlartifacts/
1012
spark-warehouse/
1113
derby.log
1214
metastore_db/

scripts/test_mlflow_local.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Quick test: verify MLflow tracks locally."""
2+
import sys
3+
from pathlib import Path
4+
5+
sys.path.insert(0, str(Path(__file__).parent.parent))
6+
7+
import mlflow
8+
9+
# Use local file-based tracking (no server needed)
10+
mlflow.set_tracking_uri("sqlite:///mlflow.db")
11+
mlflow.set_experiment("queryforge-eval")
12+
13+
with mlflow.start_run(run_name="test-local-tracking"):
14+
# Simulate what a real eval run would log
15+
mlflow.log_param("prompt_version", "v1")
16+
mlflow.log_param("model", "claude-sonnet-4-20250514")
17+
18+
mlflow.log_metrics({
19+
"total_questions": 5,
20+
"sql_accuracy": 0.80,
21+
"avg_tokens_per_query": 350,
22+
"faithfulness": 0.90,
23+
"answer_relevancy": 0.85,
24+
"context_recall": 0.78,
25+
})
26+
27+
mlflow.log_text("SELECT SUM(balance) FROM accounts WHERE status = 'active'", "sample_sql.sql")
28+
mlflow.log_text("What is the total balance of active accounts?", "sample_question.txt")
29+
30+
run_id = mlflow.active_run().info.run_id
31+
print(f"MLflow run logged successfully!")
32+
print(f"Run ID: {run_id}")
33+
print(f"Experiment: queryforge-eval")
34+
print(f"\nTo view the dashboard, run:")
35+
print(f" mlflow ui --backend-store-uri mlruns")
36+
print(f" Then open http://localhost:5000")

src/core/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ class Settings(BaseSettings):
55
anthropic_api_key: str = ""
66
databricks_host: str = "https://community.cloud.databricks.com"
77
databricks_token: str = ""
8-
mlflow_tracking_uri: str = "databricks"
9-
mlflow_experiment_name: str = "/queryforge-eval"
8+
mlflow_tracking_uri: str = "sqlite:///mlflow.db"
9+
mlflow_experiment_name: str = "queryforge-eval"
1010
model_name: str = "claude-sonnet-4-20250514"
1111
max_tokens: int = 1024
12+
prompt_version: str = "v1"
1213

1314
class Config:
1415
env_file = ".env"

0 commit comments

Comments
 (0)