Skip to content

Commit

Permalink
removing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista committed Aug 13, 2024
1 parent e5bfc98 commit 5a4ae68
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,12 @@ def run(
response.meta["usage"]["prompt_tokens"] = response.meta["usage"].pop("input_tokens")
if "output_tokens" in response.meta["usage"]:
response.meta["usage"]["completion_tokens"] = response.meta["usage"].pop("output_tokens")
elif "usage" not in response.meta:
else:
if "prompt_token_count" in response.meta:
response.meta["usage"] = {}
response.meta["usage"]["prompt_tokens"] = response.meta.pop("prompt_token_count")
if "generation_token_count" in response.meta:
response.meta["usage"]["completion_tokens"] = response.meta.pop("generation_token_count")
else:
msg = "The meta key is not in the expected format."
raise ValueError(msg)

return {"replies": replies}

Expand Down

0 comments on commit 5a4ae68

Please sign in to comment.