Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/askui/callbacks/usage_tracking_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ def __init__(
self._pricing = pricing
self._summary = UsageSummary()

@override
def on_conversation_start(self, conversation: Conversation) -> None:
self._summary = UsageSummary()
Comment on lines -68 to -70
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was resetting the Usage Summery?


@override
def on_step_end(
self,
Expand All @@ -77,6 +73,10 @@ def on_step_end(
result: SpeakerResult,
) -> None:
if result.usage:
self._reporter.add_message(
role="Usage Tracker",
content=f"Usage for step {step_index}: {str(result.usage)}",
)
Comment on lines +76 to +79
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only for debugging?

self._accumulate(result.usage)

@override
Expand Down
5 changes: 5 additions & 0 deletions src/askui/model_providers/askui_vlm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from askui.models.shared.prompts import SystemPrompt
from askui.models.shared.tools import ToolCollection
from askui.utils.model_pricing import ModelPricing

_DEFAULT_MODEL_ID = "claude-sonnet-4-6"

Expand Down Expand Up @@ -69,6 +70,10 @@ def __init__(
def model_id(self) -> str:
return self._model_id_value

@property
def pricing(self) -> ModelPricing | None:
return ModelPricing.for_model(self._model_id_value)

@cached_property
def _messages_api(self) -> AnthropicMessagesApi:
"""Lazily initialise the AnthropicMessagesApi on first use."""
Expand Down
Loading