From 499d2dc3270174030caaf6fb0bd84d438132f9da Mon Sep 17 00:00:00 2001 From: FloRul Date: Wed, 24 Apr 2024 10:51:26 -0400 Subject: [PATCH] Fix streaming_callback serialization in AmazonBedrockChatGenerator --- .../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