From 5a4ae688ed40b6033d646b7b0cdf6360efa2e83e Mon Sep 17 00:00:00 2001 From: "David S. Batista" Date: Tue, 13 Aug 2024 15:46:28 +0200 Subject: [PATCH] removing exception --- .../generators/amazon_bedrock/chat/chat_generator.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py index c374c7793..9f82a4199 100644 --- a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py +++ b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py @@ -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}