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}