From 9ed323080bcc82ff70e9a0f56a6c2561fec42c2e Mon Sep 17 00:00:00 2001 From: Florian Rumiel Date: Wed, 24 Apr 2024 13:11:52 -0400 Subject: [PATCH] Fix streaming_callback serialization in AmazonBedrockChatGenerator (#685) --- .../generators/amazon_bedrock/chat/chat_generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 19f5c7620..960968755 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 @@ -210,6 +210,7 @@ def to_dict(self) -> Dict[str, Any]: :returns: Dictionary with serialized data. """ + callback_name = serialize_callable(self.streaming_callback) if self.streaming_callback else None return default_to_dict( self, aws_access_key_id=self.aws_access_key_id.to_dict() if self.aws_access_key_id else None, @@ -220,7 +221,7 @@ def to_dict(self) -> Dict[str, Any]: model=self.model, stop_words=self.stop_words, generation_kwargs=self.model_adapter.generation_kwargs, - streaming_callback=serialize_callable(self.streaming_callback), + streaming_callback=callback_name, ) @classmethod