jdesiree commited on
Commit
93cc64a
·
verified ·
1 Parent(s): afa319a

Removed Mode

Browse files
Files changed (1) hide show
  1. metrics.py +1 -16
metrics.py CHANGED
@@ -9,7 +9,6 @@ import threading
9
  class InteractionMetric:
10
  """Single interaction metrics"""
11
  timestamp: str
12
- mode: str
13
  query_length: int
14
  response_time: float
15
  input_tokens: int
@@ -62,7 +61,6 @@ class EduBotMetrics:
62
  return len(text) // 4
63
 
64
  def log_interaction(self,
65
- mode: str,
66
  query: str,
67
  response: str,
68
  timing_context: dict,
@@ -84,7 +82,6 @@ class EduBotMetrics:
84
  # Create metric record
85
  metric = InteractionMetric(
86
  timestamp=datetime.now().isoformat(),
87
- mode=mode,
88
  query_length=len(query),
89
  response_time=response_time,
90
  input_tokens=input_tokens,
@@ -111,7 +108,6 @@ class EduBotMetrics:
111
  data = [
112
  {
113
  'timestamp': m.timestamp,
114
- 'mode': m.mode,
115
  'query_length': m.query_length,
116
  'response_time': m.response_time,
117
  'input_tokens': m.input_tokens,
@@ -166,18 +162,8 @@ class EduBotMetrics:
166
  "avg_provider_latency": sum(provider_latencies) / len(provider_latencies),
167
  "avg_tokens": sum(token_counts) / len(token_counts),
168
  "avg_chunks": sum(chunk_counts) / len(chunk_counts),
169
- "mode_distribution": self._get_mode_distribution()
170
  }
171
 
172
- def _get_mode_distribution(self) -> dict:
173
- """Get distribution of modes used"""
174
- mode_counts = {}
175
- for metric in self.metrics:
176
- mode_counts[metric.mode] = mode_counts.get(metric.mode, 0) + 1
177
-
178
- total = len(self.metrics)
179
- return {mode: (count / total) * 100 for mode, count in mode_counts.items()}
180
-
181
  def export_csv(self, filename: str = None):
182
  """Export metrics to CSV format"""
183
  if filename is None:
@@ -188,7 +174,7 @@ class EduBotMetrics:
188
 
189
  with open(filename, 'w', newline='') as csvfile:
190
  fieldnames = [
191
- 'timestamp', 'mode', 'query_length', 'response_time',
192
  'input_tokens', 'output_tokens', 'total_tokens',
193
  'streaming_chunks', 'provider_latency', 'error_occurred'
194
  ]
@@ -198,7 +184,6 @@ class EduBotMetrics:
198
  for metric in self.metrics:
199
  writer.writerow({
200
  'timestamp': metric.timestamp,
201
- 'mode': metric.mode,
202
  'query_length': metric.query_length,
203
  'response_time': metric.response_time,
204
  'input_tokens': metric.input_tokens,
 
9
  class InteractionMetric:
10
  """Single interaction metrics"""
11
  timestamp: str
 
12
  query_length: int
13
  response_time: float
14
  input_tokens: int
 
61
  return len(text) // 4
62
 
63
  def log_interaction(self,
 
64
  query: str,
65
  response: str,
66
  timing_context: dict,
 
82
  # Create metric record
83
  metric = InteractionMetric(
84
  timestamp=datetime.now().isoformat(),
 
85
  query_length=len(query),
86
  response_time=response_time,
87
  input_tokens=input_tokens,
 
108
  data = [
109
  {
110
  'timestamp': m.timestamp,
 
111
  'query_length': m.query_length,
112
  'response_time': m.response_time,
113
  'input_tokens': m.input_tokens,
 
162
  "avg_provider_latency": sum(provider_latencies) / len(provider_latencies),
163
  "avg_tokens": sum(token_counts) / len(token_counts),
164
  "avg_chunks": sum(chunk_counts) / len(chunk_counts),
 
165
  }
166
 
 
 
 
 
 
 
 
 
 
167
  def export_csv(self, filename: str = None):
168
  """Export metrics to CSV format"""
169
  if filename is None:
 
174
 
175
  with open(filename, 'w', newline='') as csvfile:
176
  fieldnames = [
177
+ 'timestamp', 'query_length', 'response_time',
178
  'input_tokens', 'output_tokens', 'total_tokens',
179
  'streaming_chunks', 'provider_latency', 'error_occurred'
180
  ]
 
184
  for metric in self.metrics:
185
  writer.writerow({
186
  'timestamp': metric.timestamp,
 
187
  'query_length': metric.query_length,
188
  'response_time': metric.response_time,
189
  'input_tokens': metric.input_tokens,