| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | """Regression tests for Anthropic protocol exports used by serving. |
| 4 | |
| 5 | Guards against Docker/nightly images shipping a stale protocol module that is |
| 6 | missing symbols imported by ``vllm.entrypoints.anthropic.serving`` (issue #44759). |
| 7 | """ |
| 8 | |
| 9 | import pytest |
| 10 | |
| 11 | from vllm.entrypoints.anthropic.protocol import ( |
| 12 | AnthropicContentBlock, |
| 13 | AnthropicContextManagement, |
| 14 | AnthropicCountTokensRequest, |
| 15 | AnthropicCountTokensResponse, |
| 16 | AnthropicDelta, |
| 17 | AnthropicError, |
| 18 | AnthropicMessagesRequest, |
| 19 | AnthropicMessagesResponse, |
| 20 | AnthropicOutputConfig, |
| 21 | AnthropicStreamEvent, |
| 22 | AnthropicThinkingConfig, |
| 23 | AnthropicUsage, |
| 24 | ) |
| 25 | |
| 26 | pytestmark = pytest.mark.skip_global_cleanup |
| 27 | |
| 28 | SERVING_PROTOCOL_EXPORTS = ( |
| 29 | AnthropicContentBlock, |
| 30 | AnthropicContextManagement, |
| 31 | AnthropicCountTokensRequest, |
| 32 | AnthropicCountTokensResponse, |
| 33 | AnthropicDelta, |
| 34 | AnthropicError, |
| 35 | AnthropicMessagesRequest, |
| 36 | AnthropicMessagesResponse, |
| 37 | AnthropicOutputConfig, |
| 38 | AnthropicStreamEvent, |
| 39 | AnthropicThinkingConfig, |
| 40 | AnthropicUsage, |
| 41 | ) |
| 42 | |
| 43 | |
| 44 | def test_serving_protocol_exports_are_importable(): |
| 45 | for export in SERVING_PROTOCOL_EXPORTS: |
| 46 | assert export is not None |
| 47 | |
| 48 | |
| 49 | def test_anthropic_output_config_instantiation(): |
| 50 | config = AnthropicOutputConfig() |
| 51 | assert config.effort is None |
| 52 | assert config.format is None |