Serialize usage to JSON properly, closes #614

This commit is contained in:
Simon Willison 2024-11-06 03:27:25 -08:00
parent 245e025270
commit 3352eb9f57

View file

@ -514,7 +514,7 @@ def combine_chunks(chunks: List) -> dict:
for item in chunks:
if item.usage:
usage = dict(item.usage)
usage = item.usage.dict()
for choice in item.choices:
if choice.logprobs and hasattr(choice.logprobs, "top_logprobs"):
logprobs.append(