Skip to content

Commit 1bdbe20

Browse files
author
Erick Friis
authored
Merge pull request #72 from langchain-ai/cc/standard_tests
add standard tests
2 parents 46f2a7f + 80d683a commit 1bdbe20

File tree

4 files changed

+143
-2
lines changed

4 files changed

+143
-2
lines changed

libs/aws/poetry.lock

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/aws/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pytest-cov = "^4.1.0"
2525
syrupy = "^4.0.2"
2626
pytest-asyncio = "^0.23.2"
2727
langchain-core = { git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/core" }
28+
langchain-standard-tests = {git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/standard-tests"}
2829

2930
[tool.poetry.group.codespell]
3031
optional = true
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"""Standard LangChain interface tests"""
2+
3+
from typing import Type
4+
5+
import pytest
6+
from langchain_core.language_models import BaseChatModel
7+
from langchain_standard_tests.integration_tests import ChatModelIntegrationTests
8+
9+
from langchain_aws.chat_models.bedrock import ChatBedrock
10+
11+
12+
class TestBedrockStandard(ChatModelIntegrationTests):
13+
@pytest.fixture
14+
def chat_model_class(self) -> Type[BaseChatModel]:
15+
return ChatBedrock
16+
17+
@pytest.fixture
18+
def chat_model_params(self) -> dict:
19+
return {
20+
"model_id": "anthropic.claude-3-sonnet-20240229-v1:0",
21+
}
22+
23+
@pytest.mark.xfail(reason="Not implemented.")
24+
def test_usage_metadata(
25+
self,
26+
chat_model_class: Type[BaseChatModel],
27+
chat_model_params: dict,
28+
) -> None:
29+
super().test_usage_metadata(
30+
chat_model_class,
31+
chat_model_params,
32+
)
33+
34+
@pytest.mark.xfail(reason="Not implemented.")
35+
def test_stop_sequence(
36+
self,
37+
chat_model_class: Type[BaseChatModel],
38+
chat_model_params: dict,
39+
) -> None:
40+
super().test_stop_sequence(
41+
chat_model_class,
42+
chat_model_params,
43+
)
44+
45+
@pytest.mark.xfail(reason="Not yet implemented.")
46+
def test_tool_message_histories_string_content(
47+
self,
48+
chat_model_class: Type[BaseChatModel],
49+
chat_model_params: dict,
50+
chat_model_has_tool_calling: bool,
51+
) -> None:
52+
super().test_tool_message_histories_string_content(
53+
chat_model_class, chat_model_params, chat_model_has_tool_calling
54+
)
55+
56+
@pytest.mark.xfail(reason="Not yet implemented.")
57+
def test_tool_message_histories_list_content(
58+
self,
59+
chat_model_class: Type[BaseChatModel],
60+
chat_model_params: dict,
61+
chat_model_has_tool_calling: bool,
62+
) -> None:
63+
super().test_tool_message_histories_list_content(
64+
chat_model_class, chat_model_params, chat_model_has_tool_calling
65+
)
66+
67+
@pytest.mark.xfail(reason="Not yet implemented.")
68+
def test_structured_few_shot_examples(
69+
self,
70+
chat_model_class: Type[BaseChatModel],
71+
chat_model_params: dict,
72+
chat_model_has_tool_calling: bool,
73+
) -> None:
74+
super().test_structured_few_shot_examples(
75+
chat_model_class, chat_model_params, chat_model_has_tool_calling
76+
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Standard LangChain interface tests"""
2+
3+
from typing import Type
4+
5+
import pytest
6+
from langchain_core.language_models import BaseChatModel
7+
from langchain_standard_tests.unit_tests import ChatModelUnitTests
8+
9+
from langchain_aws.chat_models.bedrock import ChatBedrock
10+
11+
12+
class TestBedrockStandard(ChatModelUnitTests):
13+
@pytest.fixture
14+
def chat_model_class(self) -> Type[BaseChatModel]:
15+
return ChatBedrock
16+
17+
@pytest.fixture
18+
def chat_model_params(self) -> dict:
19+
return {
20+
"model_id": "anthropic.claude-3-sonnet-20240229-v1:0",
21+
"region_name": "us-east-1",
22+
}
23+
24+
@pytest.mark.xfail(reason="Not implemented.")
25+
def test_chat_model_init_api_key(
26+
self,
27+
chat_model_class: Type[BaseChatModel],
28+
chat_model_params: dict,
29+
) -> None:
30+
super().test_chat_model_init_api_key(
31+
chat_model_class,
32+
chat_model_params,
33+
)
34+
35+
@pytest.mark.xfail(reason="Not implemented.")
36+
def test_standard_params(
37+
self,
38+
chat_model_class: Type[BaseChatModel],
39+
chat_model_params: dict,
40+
) -> None:
41+
super().test_standard_params(
42+
chat_model_class,
43+
chat_model_params,
44+
)

0 commit comments

Comments
 (0)