Skip to content

Commit 8fb3a11

Browse files
authored
fix(models/anthropic): remove the deprecated models (#2489)
* fix: remove deprecated models * chore: bump version * chore: get model list by `_position.yaml`
1 parent 5807ecc commit 8fb3a11

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

models/anthropic/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ resource:
2525
model:
2626
enabled: false
2727
type: plugin
28-
version: 0.2.5
28+
version: 0.3.0

models/anthropic/models/llm/_position.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,4 @@
55
- claude-opus-4-1-20250805
66
- claude-opus-4-20250514
77
- claude-sonnet-4-20250514
8-
- claude-3-5-haiku-20241022
9-
- claude-3-5-sonnet-20241022
10-
- claude-3-5-sonnet-20240620
11-
- claude-3-7-sonnet-20250219
12-
- claude-3-haiku-20240307
13-
- claude-3-opus-20240229
14-
- claude-3-sonnet-20240229
8+
- claude-3-7-sonnet-20250219

models/anthropic/tests/test_llm_call.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
import pytest
5+
import yaml
56

67
from dify_plugin.config.integration_config import IntegrationConfig
78
from dify_plugin.core.entities.plugin.request import (
@@ -15,14 +16,26 @@
1516

1617

1718
def get_all_models() -> list[str]:
18-
"""Discover all model names from models/llm/*.yaml files."""
19+
"""Read model names from models/llm/_position.yaml."""
1920
models_dir = Path(__file__).parent.parent / "models" / "llm"
21+
position_file = models_dir / "_position.yaml"
22+
if not position_file.exists():
23+
raise FileNotFoundError(f"Missing model position file: {position_file}")
24+
25+
try:
26+
data = yaml.safe_load(position_file.read_text(encoding="utf-8"))
27+
except yaml.YAMLError as exc:
28+
raise ValueError(f"Invalid YAML in {position_file}") from exc
29+
30+
if data is None:
31+
return []
32+
if not isinstance(data, list):
33+
raise ValueError(f"Expected a YAML list in {position_file}")
34+
2035
models: list[str] = []
21-
for yaml_file in models_dir.glob("*.yaml"):
22-
if yaml_file.name.startswith("_"):
23-
continue
24-
model_name = yaml_file.stem
25-
models.append(model_name)
36+
for item in data:
37+
if isinstance(item, str) and item.strip():
38+
models.append(item.strip())
2639
return models
2740

2841

0 commit comments

Comments
 (0)