From e255dfa6fd7fa5da0bdaf5172abc6dda310a750a Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Tue, 11 Jun 2024 15:48:45 -0400 Subject: [PATCH] implement tests --- .../chat_models/test_standard.py | 76 +++++++++++++++++++ libs/aws/tests/unit_tests/test_standard.py | 43 +++++++++++ 2 files changed, 119 insertions(+) create mode 100644 libs/aws/tests/integration_tests/chat_models/test_standard.py create mode 100644 libs/aws/tests/unit_tests/test_standard.py diff --git a/libs/aws/tests/integration_tests/chat_models/test_standard.py b/libs/aws/tests/integration_tests/chat_models/test_standard.py new file mode 100644 index 00000000..f9b211cf --- /dev/null +++ b/libs/aws/tests/integration_tests/chat_models/test_standard.py @@ -0,0 +1,76 @@ +"""Standard LangChain interface tests""" + +from typing import Type + +import pytest +from langchain_core.language_models import BaseChatModel +from langchain_standard_tests.integration_tests import ChatModelIntegrationTests + +from langchain_aws.chat_models.bedrock import ChatBedrock + + +class TestBedrockStandard(ChatModelIntegrationTests): + @pytest.fixture + def chat_model_class(self) -> Type[BaseChatModel]: + return ChatBedrock + + @pytest.fixture + def chat_model_params(self) -> dict: + return { + "model_id": "anthropic.claude-3-sonnet-20240229-v1:0", + } + + @pytest.mark.xfail(reason="Not implemented.") + def test_usage_metadata( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + ) -> None: + super().test_usage_metadata( + chat_model_class, + chat_model_params, + ) + + @pytest.mark.xfail(reason="Not implemented.") + def test_stop_sequence( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + ) -> None: + super().test_stop_sequence( + chat_model_class, + chat_model_params, + ) + + @pytest.mark.xfail(reason="Not yet implemented.") + def test_tool_message_histories_string_content( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + chat_model_has_tool_calling: bool, + ) -> None: + super().test_tool_message_histories_string_content( + chat_model_class, chat_model_params, chat_model_has_tool_calling + ) + + @pytest.mark.xfail(reason="Not yet implemented.") + def test_tool_message_histories_list_content( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + chat_model_has_tool_calling: bool, + ) -> None: + super().test_tool_message_histories_list_content( + chat_model_class, chat_model_params, chat_model_has_tool_calling + ) + + @pytest.mark.xfail(reason="Not yet implemented.") + def test_structured_few_shot_examples( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + chat_model_has_tool_calling: bool, + ) -> None: + super().test_structured_few_shot_examples( + chat_model_class, chat_model_params, chat_model_has_tool_calling + ) diff --git a/libs/aws/tests/unit_tests/test_standard.py b/libs/aws/tests/unit_tests/test_standard.py new file mode 100644 index 00000000..00c43a2c --- /dev/null +++ b/libs/aws/tests/unit_tests/test_standard.py @@ -0,0 +1,43 @@ +"""Standard LangChain interface tests""" + +from typing import Type + +import pytest +from langchain_core.language_models import BaseChatModel +from langchain_standard_tests.unit_tests import ChatModelUnitTests + +from langchain_aws.chat_models.bedrock import ChatBedrock + + +class TestBedrockStandard(ChatModelUnitTests): + @pytest.fixture + def chat_model_class(self) -> Type[BaseChatModel]: + return ChatBedrock + + @pytest.fixture + def chat_model_params(self) -> dict: + return { + "model_id": "anthropic.claude-3-sonnet-20240229-v1:0", + } + + @pytest.mark.xfail(reason="Not implemented.") + def test_chat_model_init_api_key( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + ) -> None: + super().test_chat_model_init_api_key( + chat_model_class, + chat_model_params, + ) + + @pytest.mark.xfail(reason="Not implemented.") + def test_standard_params( + self, + chat_model_class: Type[BaseChatModel], + chat_model_params: dict, + ) -> None: + super().test_standard_params( + chat_model_class, + chat_model_params, + )