|
9 | 9 | from askui.model_providers.detection_provider import DetectionProvider |
10 | 10 | from askui.model_providers.image_qa_provider import ImageQAProvider |
11 | 11 | from askui.model_providers.vlm_provider import VlmProvider |
12 | | -from askui.models.shared.agent_message_param import ( |
13 | | - MessageParam, |
14 | | - UsageParam, |
15 | | -) |
| 12 | +from askui.models.shared.agent_message_param import MessageParam |
16 | 13 | from askui.models.shared.settings import ActSettings |
17 | 14 | from askui.models.shared.tools import ToolCollection |
18 | 15 | from askui.models.shared.truncation_strategies import ( |
@@ -84,7 +81,6 @@ def __init__( |
84 | 81 | # Speakers and current state |
85 | 82 | self.speakers = speakers |
86 | 83 | self.current_speaker = speakers[speakers.default_speaker] |
87 | | - self.accumulated_usage = UsageParam() |
88 | 84 |
|
89 | 85 | # Model providers - accessible by speakers via conversation instance |
90 | 86 | self.vlm_provider = vlm_provider |
@@ -184,7 +180,6 @@ def _setup_control_loop( |
184 | 180 | reporters: list[Reporter] | None = None, |
185 | 181 | ) -> None: |
186 | 182 | # Reset state |
187 | | - self.accumulated_usage = UsageParam() |
188 | 183 | self._executed_from_cache = False |
189 | 184 | self.speakers.reset_state() |
190 | 185 |
|
@@ -221,9 +216,6 @@ def _conclude_control_loop(self) -> None: |
221 | 216 | if self.cache_manager is not None and not self._executed_from_cache: |
222 | 217 | self.cache_manager.finish_recording(self.get_messages()) |
223 | 218 |
|
224 | | - # Report final usage |
225 | | - self._reporter.add_usage_summary(self.accumulated_usage.model_dump()) |
226 | | - |
227 | 219 | def _setup_speaker_handoff(self) -> None: |
228 | 220 | """Set up speaker handoff infrastructure. |
229 | 221 |
|
@@ -316,10 +308,6 @@ def _execute_step(self) -> bool: |
316 | 308 | status_continue = self._handle_result_status(result) |
317 | 309 | continue_loop = continue_loop or status_continue |
318 | 310 |
|
319 | | - # 5. Collect Statistics |
320 | | - if result.usage: |
321 | | - self._accumulate_usage(result.usage) |
322 | | - |
323 | 311 | self._on_step_end(self._step_index, result) |
324 | 312 | self._step_index += 1 |
325 | 313 |
|
@@ -450,34 +438,3 @@ def get_truncation_strategy(self) -> TruncationStrategy | None: |
450 | 438 | Current truncation strategy or None if not initialized |
451 | 439 | """ |
452 | 440 | return self._truncation_strategy |
453 | | - |
454 | | - def _accumulate_usage(self, step_usage: UsageParam) -> None: |
455 | | - """Accumulate token usage statistics. |
456 | | -
|
457 | | - Args: |
458 | | - step_usage: Usage from a single step |
459 | | - """ |
460 | | - self.accumulated_usage.input_tokens = ( |
461 | | - self.accumulated_usage.input_tokens or 0 |
462 | | - ) + (step_usage.input_tokens or 0) |
463 | | - self.accumulated_usage.output_tokens = ( |
464 | | - self.accumulated_usage.output_tokens or 0 |
465 | | - ) + (step_usage.output_tokens or 0) |
466 | | - self.accumulated_usage.cache_creation_input_tokens = ( |
467 | | - self.accumulated_usage.cache_creation_input_tokens or 0 |
468 | | - ) + (step_usage.cache_creation_input_tokens or 0) |
469 | | - self.accumulated_usage.cache_read_input_tokens = ( |
470 | | - self.accumulated_usage.cache_read_input_tokens or 0 |
471 | | - ) + (step_usage.cache_read_input_tokens or 0) |
472 | | - |
473 | | - current_span = trace.get_current_span() |
474 | | - current_span.set_attributes( |
475 | | - { |
476 | | - "input_tokens": step_usage.input_tokens or 0, |
477 | | - "output_tokens": step_usage.output_tokens or 0, |
478 | | - "cache_creation_input_tokens": ( |
479 | | - step_usage.cache_creation_input_tokens or 0 |
480 | | - ), |
481 | | - "cache_read_input_tokens": step_usage.cache_read_input_tokens or 0, |
482 | | - } |
483 | | - ) |
0 commit comments