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 f7bb0ba23..c2e735537 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 @@ -205,9 +205,9 @@ def run( # rename the meta key to be inline with OpenAI meta output keys for response in replies: - if response.meta is not None and "usage" in response.meta: - response.meta["usage"]["prompt_tokens"] = response.meta["usage"].pop("input_tokens") - response.meta["usage"]["completion_tokens"] = response.meta["usage"].pop("output_tokens") + if response.meta is not None: + response.meta["prompt_tokens"] = response.meta.pop("prompt_token_count") + response.meta["completion_tokens"] = response.meta.pop("generation_token_count") return {"replies": replies}