diff --git a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py index a9c5ff9fc22..6c3fcf62eb0 100644 --- a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py @@ -320,7 +320,7 @@ class ChatModelIntegrationTests(ChatModelTests): When using JSON mode, you must prompt the model to output JSON in your message. - Example: + Example: ```python structured_llm = llm.with_structured_output(MySchema, method="json_mode") structured_llm.invoke("... Return the result as JSON.") @@ -490,6 +490,8 @@ class ChatModelIntegrationTests(ChatModelTests): Boolean property indicating whether the chat model supports Anthropic-style inputs. + Defaults to `False`. + These inputs might feature "tool use" and "tool result" content blocks, e.g., ```python @@ -510,13 +512,15 @@ class ChatModelIntegrationTests(ChatModelTests): ```python @property def supports_anthropic_inputs(self) -> bool: - return False + return True ``` ??? info "`supports_image_tool_message`" Boolean property indicating whether the chat model supports a `ToolMessage` - that includes image content, e.g. in the OpenAI Chat Completions format: + that includes image content, e.g. in the OpenAI Chat Completions format. + + Defaults to `False`. ```python ToolMessage( @@ -553,13 +557,15 @@ class ChatModelIntegrationTests(ChatModelTests): ```python @property def supports_image_tool_message(self) -> bool: - return False + return True ``` ??? info "`supports_pdf_tool_message`" - Boolean property indicating whether the chat model supports a `ToolMessage - that include PDF content using the LangChain `FileContentBlock` format: + Boolean property indicating whether the chat model supports a `ToolMessage` + that includes PDF content using the LangChain `FileContentBlock` format. + + Defaults to `False`. ```python ToolMessage( @@ -581,7 +587,7 @@ class ChatModelIntegrationTests(ChatModelTests): ```python @property def supports_pdf_tool_message(self) -> bool: - return False + return True ``` ??? info "`supported_usage_metadata_details`" @@ -589,6 +595,8 @@ class ChatModelIntegrationTests(ChatModelTests): Property controlling what usage metadata details are emitted in both invoke and stream. + Defaults to `{"invoke": [], "stream": []}`. + `usage_metadata` is an optional dict attribute on `AIMessage` objects that track input and output tokens. @@ -606,6 +614,8 @@ class ChatModelIntegrationTests(ChatModelTests): [VCR](https://vcrpy.readthedocs.io/en/latest/) caching of HTTP calls, such as benchmarking tests. + Defaults to `False`. + To enable these tests, follow these steps: 1. Override the `enable_vcr_tests` property to return `True`: @@ -732,8 +742,7 @@ class ChatModelIntegrationTests(ChatModelTests): 3. Run tests to generate VCR cassettes. - Example: - ```bash + ```bash title="Example" uv run python -m pytest tests/integration_tests/test_chat_models.py::TestMyModel::test_stream_time ``` @@ -748,7 +757,7 @@ class ChatModelIntegrationTests(ChatModelTests): You can then commit the cassette to your repository. Subsequent test runs will use the cassette instead of making HTTP calls. - ''' # noqa: E501,D214 + ''' # noqa: E501 @property def standard_chat_model_params(self) -> dict: diff --git a/libs/standard-tests/langchain_tests/unit_tests/chat_models.py b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py index f23639f49c8..f6e93474d79 100644 --- a/libs/standard-tests/langchain_tests/unit_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py @@ -822,8 +822,7 @@ class ChatModelUnitTests(ChatModelTests): 3. Run tests to generate VCR cassettes. - Example: - ```bash + ```bash title="Example" uv run python -m pytest tests/integration_tests/test_chat_models.py::TestMyModel::test_stream_time ```