mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 06:48:02 -05:00
Use response_id to track token usage for MessageActions (#6913)
Co-authored-by: Calvin Smith <email@cjsmith.io>
This commit is contained in:
@@ -215,6 +215,13 @@ def response_to_actions(response: ModelResponse) -> list[Action]:
|
||||
)
|
||||
)
|
||||
|
||||
# Add response id to actions
|
||||
# This will ensure we can match both actions without tool calls (e.g. MessageAction)
|
||||
# and actions with tool calls (e.g. CmdRunAction, IPythonRunCellAction, etc.)
|
||||
# with the token usage data
|
||||
for action in actions:
|
||||
action.response_id = response.id
|
||||
|
||||
assert len(actions) >= 1
|
||||
return actions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user