File size: 636 Bytes
3f0e775
 
 
33eaa22
 
 
 
 
 
 
 
 
 
 
7e327f2
 
33eaa22
 
 
7e327f2
33eaa22
 
7e327f2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from smolagents import LiteLLMModel


ANTHROPIC_MODEL_IDS = [
    "claude-opus-4-20250514",
    "claude-sonnet-4-20250514",
    "claude-3-7-sonnet-latest",
    "claude-3-5-haiku-latest",
    "claude-3-5-sonnet-latest",
    "claude-3-5-sonnet-20240620",
    "claude-3-opus-latest",
    "claude-3-sonnet-20240229",
    "claude-3-haiku-20240307",
]


def get_anthropic_model(model_id, anthropic_api_key):
    if model_id not in ANTHROPIC_MODEL_IDS:
        raise ValueError(f"Model {model_id} not found in Anthropic model IDs")
    model = LiteLLMModel(
        model_id=model_id,
        api_key=anthropic_api_key,
    )
    return model