rag-sentinel 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rag-sentinel
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: RAG Evaluation Framework using Ragas metrics and MLflow tracking
5
5
  Author: RAGSentinel Team
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rag-sentinel"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "RAG Evaluation Framework using Ragas metrics and MLflow tracking"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -20,7 +20,9 @@ import socket
20
20
  import subprocess
21
21
  import time
22
22
  import argparse
23
+ import configparser
23
24
  from pathlib import Path
25
+ from urllib.parse import urlparse
24
26
 
25
27
 
26
28
  # =============================================================================
@@ -34,6 +36,39 @@ TEMPLATES_DIR = Path(__file__).parent / "templates"
34
36
  # Helper Functions
35
37
  # =============================================================================
36
38
 
39
+ def get_mlflow_host_port():
40
+ """
41
+ Read MLflow tracking_uri from config.ini and parse host and port.
42
+
43
+ Returns:
44
+ tuple: (host, port) - defaults to ("127.0.0.1", 5001) if not configured
45
+ """
46
+ default_host = "127.0.0.1"
47
+ default_port = 5000
48
+
49
+ config_path = Path("config.ini")
50
+ if not config_path.exists():
51
+ return default_host, default_port
52
+
53
+ try:
54
+ ini = configparser.ConfigParser()
55
+ ini.read(config_path)
56
+
57
+ tracking_uri = ini.get("mlflow", "tracking_uri", fallback=None)
58
+ if not tracking_uri:
59
+ return default_host, default_port
60
+
61
+ # Parse the URI (e.g., "http://192.168.1.100:5000")
62
+ parsed = urlparse(tracking_uri)
63
+
64
+ host = parsed.hostname or default_host
65
+ port = parsed.port or default_port
66
+
67
+ return host, port
68
+ except Exception:
69
+ return default_host, default_port
70
+
71
+
37
72
  def is_port_in_use(host, port):
38
73
  """
39
74
  Check if a port is already in use.
@@ -49,7 +84,7 @@ def is_port_in_use(host, port):
49
84
  return s.connect_ex((host, port)) == 0
50
85
 
51
86
 
52
- def start_mlflow_server(host="127.0.0.1", port=5001):
87
+ def start_mlflow_server(host, port):
53
88
  """
54
89
  Start MLflow tracking server as a background process.
55
90
 
@@ -57,8 +92,8 @@ def start_mlflow_server(host="127.0.0.1", port=5001):
57
92
  will skip starting a new instance.
58
93
 
59
94
  Args:
60
- host: The hostname to bind the server to (default: "127.0.0.1")
61
- port: The port number for the server (default: 5001)
95
+ host: The hostname to bind the server to
96
+ port: The port number for the server
62
97
 
63
98
  Returns:
64
99
  subprocess.Popen or None: The server process, or None if already running
@@ -144,8 +179,9 @@ def cmd_run(args):
144
179
 
145
180
  This command:
146
181
  1. Validates that all required config files exist
147
- 2. Starts MLflow server (unless --no-server is specified)
148
- 3. Runs the evaluation using the evaluator module
182
+ 2. Reads MLflow host/port from config.ini
183
+ 3. Starts MLflow server (unless --no-server is specified)
184
+ 4. Runs the evaluation using the evaluator module
149
185
 
150
186
  Args:
151
187
  args: Parsed command-line arguments (includes --no-server flag)
@@ -161,9 +197,10 @@ def cmd_run(args):
161
197
  print("\nRun 'rag-sentinel init' first to create config files.")
162
198
  sys.exit(1)
163
199
 
164
- # Start MLflow server if not disabled
200
+ # Start MLflow server if not disabled (uses host/port from config.ini)
165
201
  if not args.no_server:
166
- start_mlflow_server()
202
+ host, port = get_mlflow_host_port()
203
+ start_mlflow_server(host, port)
167
204
 
168
205
  # Import and run the evaluation
169
206
  from rag_sentinel.evaluator import run_evaluation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rag-sentinel
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: RAG Evaluation Framework using Ragas metrics and MLflow tracking
5
5
  Author: RAGSentinel Team
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes