Skip to content

Commit

Permalink
Fixed bug where logged output_tokens value was incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Nov 20, 2024
1 parent 7c5d2bb commit 5dd618b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def log_to_db(self, db):
"duration_ms": self.duration_ms(),
"datetime_utc": self.datetime_utc(),
"input_tokens": self.input_tokens,
"output_tokens": self.input_tokens,
"output_tokens": self.output_tokens,
"token_details": (
json.dumps(self.token_details) if self.token_details else None
),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_chat_basic(mock_model, logs_db):
"duration_ms": ANY,
"datetime_utc": ANY,
"input_tokens": 2,
"output_tokens": 2,
"output_tokens": 1,
"token_details": None,
},
]
Expand Down

0 comments on commit 5dd618b

Please sign in to comment.