diff --git a/libs/aws/poetry.lock b/libs/aws/poetry.lock index 96eeab2a..8e14b7b5 100644 --- a/libs/aws/poetry.lock +++ b/libs/aws/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" @@ -359,6 +359,26 @@ reference = "HEAD" resolved_reference = "06110e20b96f7b01a47c00477eaa9808149c28c0" subdirectory = "libs/core" +[[package]] +name = "langchain-standard-tests" +version = "0.1.0" +description = "Standard tests for LangChain implementations" +optional = false +python-versions = ">=3.8.1,<4.0" +files = [] +develop = false + +[package.dependencies] +langchain-core = ">=0.1.40,<0.3" +pytest = ">=7,<9" + +[package.source] +type = "git" +url = "https://github.com/langchain-ai/langchain.git" +reference = "HEAD" +resolved_reference = "936aedd10cdc22cb19d33b255ca65a8ddab3ab50" +subdirectory = "libs/standard-tests" + [[package]] name = "langsmith" version = "0.1.59" @@ -994,4 +1014,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "386209c3881cfb6abbff38f05fbad24c1c4370c65c215e56dc5c23383c2bef51" +content-hash = "2debfc6d2c6506b7b760adcc5bcc0242ee8fe01f0e73d95965406ead23962461" diff --git a/libs/aws/pyproject.toml b/libs/aws/pyproject.toml index ec43119f..9b6fe5b5 100644 --- a/libs/aws/pyproject.toml +++ b/libs/aws/pyproject.toml @@ -25,6 +25,7 @@ pytest-cov = "^4.1.0" syrupy = "^4.0.2" pytest-asyncio = "^0.23.2" langchain-core = { git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/core" } +langchain-standard-tests = {git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/standard-tests"} [tool.poetry.group.codespell] optional = true 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..a414e16e --- /dev/null +++ b/libs/aws/tests/unit_tests/test_standard.py @@ -0,0 +1,44 @@ +"""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", + "region_name": "us-east-1", + } + + @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, + )