Skip to content

Commit 60cddbc

Browse files
committed
Use sslr CompletionUsage in CompletionChunk message
1 parent 66f0d4c commit 60cddbc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llmstack/apps/runner/agent_controller.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ def add_llm_client_response_to_output_queue(self, response: Any):
462462
AgentControllerData(
463463
type=AgentControllerDataType.USAGE_DATA,
464464
data=AgentUsageData(
465-
prompt_tokens=response.usage.input_tokens,
466-
completion_tokens=response.usage.output_tokens,
465+
prompt_tokens=response.usage.get_input_tokens(),
466+
completion_tokens=response.usage.get_output_tokens(),
467467
total_tokens=response.usage.total_tokens,
468468
source=self._provider_config.provider_config_source,
469469
provider=str(self._provider_config),

llmstack/common/utils/sslr/types/chat/chat_completion_chunk.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
from openai.types.chat.chat_completion_chunk import ( # noqa F401
1010
ChoiceDeltaToolCallFunction as _ChoiceDeltaToolCallFunction,
1111
)
12-
from openai.types.completion_usage import CompletionUsage
1312

1413
from llmstack.common.utils.sslr.types.chat.chat_completion_message_param import (
1514
ContentPartParam,
1615
)
1716

17+
from ..completions_usage import CompletionUsage
18+
1819

1920
class ChoiceDelta(_ChoiceDelta):
2021
content: Union[str, List[ContentPartParam]]

0 commit comments

Comments
 (0)