File size: 969 Bytes
ef87fec
3f0e775
 
30b1518
 
 
 
 
 
 
 
 
 
 
7e327f2
ef87fec
 
 
 
 
 
 
 
7e327f2
30b1518
 
 
7e327f2
30b1518
 
7e327f2
 
ef87fec
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
from smolagents import LiteLLMModel, TransformersModel


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",
]

TRANSFORMERS_MODEL_IDS = [
    "Qwen/Qwen2.5-VL-3B-Instruct",
    "Qwen/Qwen2.5-VL-7B-Instruct",
    "Qwen/Qwen2.5-VL-14B-Instruct",
    "Qwen/Qwen2.5-VL-32B-Instruct",
    "Qwen/Qwen2.5-VL-72B-Instruct",
]


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


def get_transformers_model(model_id):
    model = TransformersModel(model_id=model_id)
    return model