From b6115c21282257984ebc0046e4013174a29c5f6e Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Tue, 30 Jan 2024 18:04:18 +0100 Subject: [PATCH] chore: Adjust amazon bedrock helper classes names (#297) * Adjust amazon bedrock helper classes names * Linting * Update tests * More linting * Small update --- .../{amazon_bedrock_adapters.py => adapters.py} | 2 +- .../generators/amazon_bedrock/generator.py | 12 ++++++------ .../{amazon_bedrock_handlers.py => handlers.py} | 0 .../amazon_bedrock/tests/test_amazon_bedrock.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/{amazon_bedrock_adapters.py => adapters.py} (99%) rename integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/{amazon_bedrock_handlers.py => handlers.py} (100%) diff --git a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/amazon_bedrock_adapters.py b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py similarity index 99% rename from integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/amazon_bedrock_adapters.py rename to integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py index b7e775cb8..40ba0bc67 100644 --- a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/amazon_bedrock_adapters.py +++ b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py @@ -2,7 +2,7 @@ from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional -from .amazon_bedrock_handlers import TokenStreamingHandler +from .handlers import TokenStreamingHandler class BedrockModelAdapter(ABC): diff --git a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/generator.py b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/generator.py index c79ef9de4..4c43c9a09 100644 --- a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/generator.py +++ b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/generator.py @@ -7,7 +7,7 @@ from botocore.exceptions import BotoCoreError, ClientError from haystack import component, default_from_dict, default_to_dict -from .amazon_bedrock_adapters import ( +from .adapters import ( AI21LabsJurassic2Adapter, AmazonTitanAdapter, AnthropicClaudeAdapter, @@ -15,16 +15,16 @@ CohereCommandAdapter, MetaLlama2ChatAdapter, ) -from .amazon_bedrock_handlers import ( - DefaultPromptHandler, - DefaultTokenStreamingHandler, - TokenStreamingHandler, -) from .errors import ( AmazonBedrockConfigurationError, AmazonBedrockInferenceError, AWSConfigurationError, ) +from .handlers import ( + DefaultPromptHandler, + DefaultTokenStreamingHandler, + TokenStreamingHandler, +) logger = logging.getLogger(__name__) diff --git a/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/amazon_bedrock_handlers.py b/integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/handlers.py similarity index 100% rename from integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/amazon_bedrock_handlers.py rename to integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/handlers.py diff --git a/integrations/amazon_bedrock/tests/test_amazon_bedrock.py b/integrations/amazon_bedrock/tests/test_amazon_bedrock.py index c6bb0add4..b08e9dfd5 100644 --- a/integrations/amazon_bedrock/tests/test_amazon_bedrock.py +++ b/integrations/amazon_bedrock/tests/test_amazon_bedrock.py @@ -5,7 +5,7 @@ from botocore.exceptions import BotoCoreError from haystack_integrations.components.generators.amazon_bedrock import AmazonBedrockGenerator -from haystack_integrations.components.generators.amazon_bedrock.amazon_bedrock_adapters import ( +from haystack_integrations.components.generators.amazon_bedrock.adapters import ( AI21LabsJurassic2Adapter, AmazonTitanAdapter, AnthropicClaudeAdapter, @@ -34,7 +34,7 @@ def mock_boto3_session(): @pytest.fixture def mock_prompt_handler(): with patch( - "haystack_integrations.components.generators.amazon_bedrock.amazon_bedrock_handlers.DefaultPromptHandler" + "haystack_integrations.components.generators.amazon_bedrock.handlers.DefaultPromptHandler" ) as mock_prompt_handler: yield mock_prompt_handler