Skip to content

Commit 4fbd995

Browse files
committed
feat(anthropic): add SUPPORTED_MODELS to AnthropicVertexChatGenerator
1 parent 7a9a4f5 commit 4fbd995

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

integrations/anthropic/src/haystack_integrations/components/generators/anthropic/chat/vertex_chat_generator.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from collections.abc import Callable
3-
from typing import Any
3+
from typing import Any, ClassVar
44

55
from haystack import component, default_from_dict, default_to_dict, logging
66
from haystack.dataclasses import StreamingChunk
@@ -64,8 +64,22 @@ class AnthropicVertexChatGenerator(AnthropicChatGenerator):
6464
For more details on supported models and their capabilities, refer to the Anthropic
6565
[documentation](https://docs.anthropic.com/claude/docs/intro-to-claude).
6666
67+
For the list of available model IDs on Vertex AI, see
68+
[Anthropic's Claude models on Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude).
6769
"""
6870

71+
SUPPORTED_MODELS: ClassVar[list[str]] = [
72+
"claude-sonnet-4@20250514",
73+
"claude-opus-4@20250514",
74+
"claude-sonnet-4-5",
75+
"claude-opus-4-5",
76+
"claude-sonnet-4-6",
77+
"claude-opus-4-6",
78+
"claude-opus-4-1",
79+
"claude-haiku-4-5",
80+
"claude-3-5-haiku",
81+
]
82+
6983
def __init__(
7084
self,
7185
region: str,

integrations/anthropic/tests/test_vertex_chat_generator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ def chat_messages():
1717

1818

1919
class TestAnthropicVertexChatGenerator:
20+
def test_supported_models(self):
21+
"""SUPPORTED_MODELS is a non-empty list of strings."""
22+
assert isinstance(AnthropicVertexChatGenerator.SUPPORTED_MODELS, list)
23+
assert len(AnthropicVertexChatGenerator.SUPPORTED_MODELS) > 0
24+
assert all(isinstance(m, str) for m in AnthropicVertexChatGenerator.SUPPORTED_MODELS)
25+
2026
def test_init_default(self):
2127
component = AnthropicVertexChatGenerator(region="us-central1", project_id="test-project-id")
2228
assert component.region == "us-central1"

0 commit comments

Comments
 (0)