mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 06:40:04 +00:00
update README.md
This commit is contained in:
parent
b94fb8c086
commit
e393f512fc
@ -14,62 +14,68 @@ also break your CI if we introduce tests that your integration doesn't pass.
|
|||||||
|
|
||||||
Pip:
|
Pip:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install -U langchain-tests
|
pip install -U langchain-tests
|
||||||
```
|
```
|
||||||
|
|
||||||
Poetry:
|
Poetry:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry add langchain-tests
|
poetry add langchain-tests
|
||||||
```
|
```
|
||||||
|
|
||||||
|
uv:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv add langchain-tests
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To add standard tests to an integration package's e.g. ChatModel, you need to create
|
To add standard tests to an integration package (e.g., for a ChatModel), you need to create
|
||||||
|
|
||||||
1. A unit test class that inherits from ChatModelUnitTests
|
1. A unit test class that inherits from `ChatModelUnitTests`
|
||||||
2. An integration test class that inherits from ChatModelIntegrationTests
|
2. An integration test class that inherits from `ChatModelIntegrationTests`
|
||||||
|
|
||||||
`tests/unit_tests/test_standard.py`:
|
`tests/unit_tests/test_standard.py`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Standard LangChain interface tests"""
|
"""Standard LangChain interface tests"""
|
||||||
|
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from langchain_core.language_models import BaseChatModel
|
from langchain_core.language_models import BaseChatModel
|
||||||
from langchain_tests.unit_tests import ChatModelUnitTests
|
from langchain_tests.unit_tests import ChatModelUnitTests
|
||||||
|
|
||||||
from langchain_parrot_chain import ChatParrotChain
|
from langchain_parrot_chain import ChatParrotChain
|
||||||
|
|
||||||
|
|
||||||
class TestParrotChainStandard(ChatModelUnitTests):
|
class TestParrotChainStandard(ChatModelUnitTests):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def chat_model_class(self) -> Type[BaseChatModel]:
|
def chat_model_class(self) -> Type[BaseChatModel]:
|
||||||
return ChatParrotChain
|
return ChatParrotChain
|
||||||
```
|
```
|
||||||
|
|
||||||
`tests/integration_tests/test_standard.py`:
|
`tests/integration_tests/test_standard.py`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Standard LangChain interface tests"""
|
"""Standard LangChain interface tests"""
|
||||||
|
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from langchain_core.language_models import BaseChatModel
|
from langchain_core.language_models import BaseChatModel
|
||||||
from langchain_tests.integration_tests import ChatModelIntegrationTests
|
from langchain_tests.integration_tests import ChatModelIntegrationTests
|
||||||
|
|
||||||
from langchain_parrot_chain import ChatParrotChain
|
from langchain_parrot_chain import ChatParrotChain
|
||||||
|
|
||||||
|
|
||||||
class TestParrotChainStandard(ChatModelIntegrationTests):
|
class TestParrotChainStandard(ChatModelIntegrationTests):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def chat_model_class(self) -> Type[BaseChatModel]:
|
def chat_model_class(self) -> Type[BaseChatModel]:
|
||||||
return ChatParrotChain
|
return ChatParrotChain
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
@ -86,5 +92,4 @@ as required is optional.
|
|||||||
For chat models that support the new content blocks v1 format (multimodal content, reasoning blocks, citations, etc.), use the v1 test suite instead:
|
For chat models that support the new content blocks v1 format (multimodal content, reasoning blocks, citations, etc.), use the v1 test suite instead:
|
||||||
|
|
||||||
- See `QUICK_START.md` and `README_V1.md` for v1 testing documentation
|
- See `QUICK_START.md` and `README_V1.md` for v1 testing documentation
|
||||||
- Use `ChatModelV1UnitTests` from `langchain_tests.unit_tests.chat_models_v1`
|
- Use `ChatModelV1Tests` from `langchain_tests.unit_tests.chat_models_v1`
|
||||||
- V1 tests support `BaseChatModelV1` models with enhanced content block features
|
|
||||||
|
Loading…
Reference in New Issue
Block a user