whosellm 0.1.1a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. whosellm-0.1.1a1/.bumpversion.toml +58 -0
  2. whosellm-0.1.1a1/.coveragerc +20 -0
  3. whosellm-0.1.1a1/.github/workflows/publish.yml +124 -0
  4. whosellm-0.1.1a1/.github/workflows/tests.yml +95 -0
  5. whosellm-0.1.1a1/.gitignore +58 -0
  6. whosellm-0.1.1a1/.windsurf/workflows/addmodel.md +78 -0
  7. whosellm-0.1.1a1/.windsurf/workflows/arch.md +50 -0
  8. whosellm-0.1.1a1/.windsurf/workflows/testllmeta.md +11 -0
  9. whosellm-0.1.1a1/CHANGELOG.md +44 -0
  10. whosellm-0.1.1a1/LICENSE +21 -0
  11. whosellm-0.1.1a1/PKG-INFO +229 -0
  12. whosellm-0.1.1a1/README.md +204 -0
  13. whosellm-0.1.1a1/docs/add_new_model_family.md +611 -0
  14. whosellm-0.1.1a1/docs/refactor_proposal.md +583 -0
  15. whosellm-0.1.1a1/examples/advanced_usage.py +194 -0
  16. whosellm-0.1.1a1/examples/basic_usage.py +60 -0
  17. whosellm-0.1.1a1/mypy.ini +25 -0
  18. whosellm-0.1.1a1/pyproject.toml +71 -0
  19. whosellm-0.1.1a1/pytest.ini +34 -0
  20. whosellm-0.1.1a1/ruff.toml +52 -0
  21. whosellm-0.1.1a1/tests/__init__.py +0 -0
  22. whosellm-0.1.1a1/tests/models/__init__.py +5 -0
  23. whosellm-0.1.1a1/tests/models/families/__init__.py +5 -0
  24. whosellm-0.1.1a1/tests/models/families/test_deepseek.py +105 -0
  25. whosellm-0.1.1a1/tests/models/families/test_deepseek_tencent.py +177 -0
  26. whosellm-0.1.1a1/tests/models/families/test_glm45v.py +59 -0
  27. whosellm-0.1.1a1/tests/models/families/test_glm46.py +78 -0
  28. whosellm-0.1.1a1/tests/models/families/test_gpt4_1.py +97 -0
  29. whosellm-0.1.1a1/tests/models/families/test_gpt5.py +116 -0
  30. whosellm-0.1.1a1/tests/models/families/test_o3.py +130 -0
  31. whosellm-0.1.1a1/tests/models/families/test_o4.py +91 -0
  32. whosellm-0.1.1a1/tests/models/families/test_qwen.py +655 -0
  33. whosellm-0.1.1a1/tests/test_auto_register.py +210 -0
  34. whosellm-0.1.1a1/tests/test_llmeta.py +86 -0
  35. whosellm-0.1.1a1/tests/test_model_version.py +353 -0
  36. whosellm-0.1.1a1/tests/test_provider.py +48 -0
  37. whosellm-0.1.1a1/tests/test_specific_patterns.py +219 -0
  38. whosellm-0.1.1a1/tests/test_variant_priority_config.py +245 -0
  39. whosellm-0.1.1a1/uv.lock +934 -0
  40. whosellm-0.1.1a1/whosellm/__init__.py +23 -0
  41. whosellm-0.1.1a1/whosellm/capabilities.py +66 -0
  42. whosellm-0.1.1a1/whosellm/model_version.py +161 -0
  43. whosellm-0.1.1a1/whosellm/models/__init__.py +28 -0
  44. whosellm-0.1.1a1/whosellm/models/base.py +532 -0
  45. whosellm-0.1.1a1/whosellm/models/config.py +166 -0
  46. whosellm-0.1.1a1/whosellm/models/dynamic_enum.py +129 -0
  47. whosellm-0.1.1a1/whosellm/models/families/__init__.py +33 -0
  48. whosellm-0.1.1a1/whosellm/models/families/alibaba.py +271 -0
  49. whosellm-0.1.1a1/whosellm/models/families/anthropic.py +188 -0
  50. whosellm-0.1.1a1/whosellm/models/families/deepseek/__init__.py +11 -0
  51. whosellm-0.1.1a1/whosellm/models/families/deepseek/deepseek_official.py +69 -0
  52. whosellm-0.1.1a1/whosellm/models/families/deepseek/tencent.py +145 -0
  53. whosellm-0.1.1a1/whosellm/models/families/openai/__init__.py +24 -0
  54. whosellm-0.1.1a1/whosellm/models/families/openai/openai_gpt_3_5.py +71 -0
  55. whosellm-0.1.1a1/whosellm/models/families/openai/openai_gpt_4.py +32 -0
  56. whosellm-0.1.1a1/whosellm/models/families/openai/openai_gpt_4_1.py +84 -0
  57. whosellm-0.1.1a1/whosellm/models/families/openai/openai_gpt_4o.py +124 -0
  58. whosellm-0.1.1a1/whosellm/models/families/openai/openai_gpt_5.py +95 -0
  59. whosellm-0.1.1a1/whosellm/models/families/openai/openai_o1.py +55 -0
  60. whosellm-0.1.1a1/whosellm/models/families/openai/openai_o3.py +95 -0
  61. whosellm-0.1.1a1/whosellm/models/families/openai/openai_o4.py +65 -0
  62. whosellm-0.1.1a1/whosellm/models/families/others.py +104 -0
  63. whosellm-0.1.1a1/whosellm/models/families/vidu.py +126 -0
  64. whosellm-0.1.1a1/whosellm/models/families/zhipu.py +316 -0
  65. whosellm-0.1.1a1/whosellm/models/patterns.py +98 -0
  66. whosellm-0.1.1a1/whosellm/models/registry.py +334 -0
  67. whosellm-0.1.1a1/whosellm/provider.py +62 -0
  68. whosellm-0.1.1a1/whosellm/py.typed +0 -0
@@ -0,0 +1,58 @@
1
+ # bump-my-version 配置文件 / bump-my-version configuration file
2
+ # 文档 / Documentation: https://callowayproject.github.io/bump-my-version/
3
+
4
+ [tool.bumpversion]
5
+ current_version = "0.1.1a1"
6
+ parse = """(?x)
7
+ (?P<major>0|[1-9]\\d*)\\.
8
+ (?P<minor>0|[1-9]\\d*)\\.
9
+ (?P<patch>0|[1-9]\\d*)
10
+ (?:(?P<pre_l>a|b|rc)(?P<pre_n>0|[1-9]\\d*))? # Pre-release
11
+ (?:\\.post(?P<post>0|[1-9]\\d*))? # Post-release
12
+ (?:\\.dev(?P<dev>0|[1-9]\\d*))? # Dev release
13
+ """
14
+ serialize = [
15
+ "{major}.{minor}.{patch}{pre_l}{pre_n}.post{post}.dev{dev}",
16
+ "{major}.{minor}.{patch}{pre_l}{pre_n}.post{post}",
17
+ "{major}.{minor}.{patch}{pre_l}{pre_n}.dev{dev}",
18
+ "{major}.{minor}.{patch}{pre_l}{pre_n}",
19
+ "{major}.{minor}.{patch}.post{post}.dev{dev}",
20
+ "{major}.{minor}.{patch}.post{post}",
21
+ "{major}.{minor}.{patch}.dev{dev}",
22
+ "{major}.{minor}.{patch}",
23
+ ]
24
+ search = "{current_version}"
25
+ replace = "{new_version}"
26
+ regex = false
27
+ ignore_missing_version = false
28
+ ignore_missing_files = false
29
+ tag = true
30
+ sign_tags = false
31
+ tag_name = "v{new_version}"
32
+ tag_message = "Bump version: {current_version} → {new_version}"
33
+ allow_dirty = false
34
+ commit = true
35
+ message = "Bump version: {current_version} → {new_version}"
36
+ commit_args = ""
37
+
38
+ [[tool.bumpversion.files]]
39
+ filename = "pyproject.toml"
40
+ search = "version = \"{current_version}\""
41
+ replace = "version = \"{new_version}\""
42
+
43
+ [[tool.bumpversion.files]]
44
+ filename = "whosellm/__init__.py"
45
+ search = "__version__ = \"{current_version}\""
46
+ replace = "__version__ = \"{new_version}\""
47
+
48
+ [tool.bumpversion.parts.pre_l]
49
+ values = ["a", "b", "rc"]
50
+
51
+ [tool.bumpversion.parts.pre_n]
52
+ first_value = 0
53
+
54
+ [tool.bumpversion.parts.post]
55
+ first_value = 0
56
+
57
+ [tool.bumpversion.parts.dev]
58
+ first_value = 0
@@ -0,0 +1,20 @@
1
+ # Coverage 配置文件 / Coverage configuration file
2
+
3
+ [run]
4
+ source = llmeta
5
+ omit =
6
+ */tests/*
7
+ */__pycache__/*
8
+ */site-packages/*
9
+ .venv/*
10
+
11
+ [report]
12
+ exclude_lines =
13
+ pragma: no cover
14
+ def __repr__
15
+ raise AssertionError
16
+ raise NotImplementedError
17
+ if __name__ == .__main__.:
18
+ if TYPE_CHECKING:
19
+ @abstractmethod
20
+ @abc.abstractmethod
@@ -0,0 +1,124 @@
1
+ # 文件名: publish.yml / File name: publish.yml
2
+ # 作者: 自动生成 / Author: Generated by Cascade
3
+ # 创建日期: 2025/11/09 / Created: 2025/11/09
4
+ # 描述: 基于 Release 触发的 whosellm 包构建与发布流程 / Release-triggered publish workflow for whosellm
5
+
6
+ name: Publish to PyPI
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+
17
+ concurrency:
18
+ group: publish-${{ github.ref }}
19
+ cancel-in-progress: true
20
+
21
+ jobs:
22
+ build:
23
+ name: Build distributions
24
+ runs-on: ubuntu-latest
25
+
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Setup Python 3.11
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: "3.11"
34
+
35
+ - name: Install uv
36
+ run: |
37
+ curl -LsSf https://astral.sh/uv/install.sh | sh
38
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
39
+
40
+ - name: Validate tag matches project version
41
+ env:
42
+ TAG_NAME: ${{ github.event.release.tag_name }}
43
+ run: |
44
+ python - <<'PY'
45
+ import os, sys, tomllib
46
+ tag = os.environ.get("TAG_NAME", "").lstrip("v")
47
+ if not tag:
48
+ print("No release tag provided", file=sys.stderr)
49
+ sys.exit(1)
50
+ with open("pyproject.toml", "rb") as f:
51
+ version = tomllib.load(f)["project"]["version"]
52
+ if version != tag:
53
+ print(f"Version mismatch: pyproject {version} != tag {tag}", file=sys.stderr)
54
+ sys.exit(2)
55
+ print(f"Version OK: {version}")
56
+ PY
57
+
58
+ - name: Install dependencies (runtime only)
59
+ run: |
60
+ uv sync --no-dev
61
+
62
+ - name: Build sdist and wheel
63
+ run: |
64
+ uv build
65
+
66
+ - name: Upload dist artifacts
67
+ uses: actions/upload-artifact@v4
68
+ with:
69
+ name: whosellm-dist
70
+ path: dist/*
71
+
72
+ publish-testpypi:
73
+ name: Publish to TestPyPI
74
+ needs: [build]
75
+ runs-on: ubuntu-latest
76
+ if: ${{ github.event.release.prerelease == true }}
77
+ environment:
78
+ name: testpypi
79
+ url: https://test.pypi.org/project/whosellm/
80
+
81
+ steps:
82
+ - name: Download artifacts
83
+ uses: actions/download-artifact@v4
84
+ with:
85
+ name: whosellm-dist
86
+ path: dist
87
+
88
+ - name: List distributions
89
+ run: ls -lh dist/
90
+
91
+ - name: Publish to TestPyPI
92
+ uses: pypa/gh-action-pypi-publish@release/v1
93
+ with:
94
+ repository-url: https://test.pypi.org/legacy/
95
+ skip-existing: true
96
+ verbose: true
97
+
98
+ publish-pypi:
99
+ name: Publish to PyPI
100
+ needs: [build]
101
+ runs-on: ubuntu-latest
102
+ if: ${{ github.event.release.prerelease == false && github.event.release.target_commitish == 'main' }}
103
+ environment:
104
+ name: pypi
105
+ url: https://pypi.org/project/whosellm/
106
+
107
+ permissions:
108
+ id-token: write
109
+
110
+ steps:
111
+ - name: Download artifacts
112
+ uses: actions/download-artifact@v4
113
+ with:
114
+ name: whosellm-dist
115
+ path: dist
116
+
117
+ - name: List distributions
118
+ run: ls -lh dist/
119
+
120
+ - name: Publish to PyPI
121
+ uses: pypa/gh-action-pypi-publish@release/v1
122
+ with:
123
+ skip-existing: true
124
+ verbose: true
@@ -0,0 +1,95 @@
1
+ # 文件名: tests.yml / File name: tests.yml
2
+ # 作者: 自动生成 / Author: Generated by Cascade
3
+ # 创建日期: 2025/11/09 / Created: 2025/11/09
4
+ # 描述: 针对 whosellm 项目的常规质量检查工作流 / Regular QA workflow for whosellm project
5
+
6
+ name: Tests
7
+
8
+ on:
9
+ push:
10
+ branches: ["main", "develop"]
11
+ pull_request:
12
+ branches: ["main", "develop"]
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ concurrency:
19
+ group: tests-${{ github.ref }}
20
+ cancel-in-progress: true
21
+
22
+ jobs:
23
+ qa:
24
+ name: Run quality checks (Python ${{ matrix.python-version }})
25
+ runs-on: ubuntu-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
30
+
31
+ steps:
32
+ - name: Checkout repository
33
+ uses: actions/checkout@v4
34
+
35
+ - name: Setup Python ${{ matrix.python-version }}
36
+ id: setup-python
37
+ uses: actions/setup-python@v5
38
+ with:
39
+ python-version: ${{ matrix.python-version }}
40
+ allow-prereleases: ${{ matrix.python-version == '3.14' }}
41
+
42
+ - name: Install system dependencies (ripgrep)
43
+ run: |
44
+ sudo apt-get update
45
+ sudo apt-get install -y ripgrep
46
+
47
+ - name: Install uv
48
+ run: |
49
+ curl -LsSf https://astral.sh/uv/install.sh | sh
50
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
51
+
52
+ - name: Cache uv cache
53
+ uses: actions/cache@v4
54
+ with:
55
+ path: ~/.cache/uv
56
+ key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock', '**/pyproject.toml') }}-py${{ matrix.python-version }}-v1
57
+ restore-keys: |
58
+ ${{ runner.os }}-uv-
59
+
60
+ - name: Install dependencies (dev + test extras)
61
+ run: |
62
+ uv --version
63
+ uv sync --extra dev --extra test
64
+
65
+ - name: Check code formatting (ruff)
66
+ if: matrix.python-version == '3.11'
67
+ run: |
68
+ uv run ruff format --check .
69
+
70
+ - name: Run linting (ruff)
71
+ if: matrix.python-version == '3.11'
72
+ run: |
73
+ uv run ruff check .
74
+
75
+ - name: Run type checking (mypy)
76
+ if: matrix.python-version == '3.11'
77
+ run: |
78
+ uv run mypy whosellm
79
+
80
+ - name: Run tests (pytest)
81
+ run: |
82
+ uv run pytest tests --tb=short
83
+
84
+ # 可选:覆盖率报告示例
85
+ # - name: Generate coverage report
86
+ # if: always()
87
+ # run: |
88
+ # uv run pytest tests --cov=whosellm --cov-report=xml
89
+ #
90
+ # - name: Upload coverage report
91
+ # if: always()
92
+ # uses: actions/upload-artifact@v4
93
+ # with:
94
+ # name: coverage-report
95
+ # path: coverage.xml
@@ -0,0 +1,58 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual Environment
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+
36
+ # Testing
37
+ .pytest_cache/
38
+ .coverage
39
+ htmlcov/
40
+ .tox/
41
+ .hypothesis/
42
+
43
+ # MyPy
44
+ .mypy_cache/
45
+ .dmypy.json
46
+ dmypy.json
47
+
48
+ # Ruff
49
+ .ruff_cache/
50
+
51
+ # OS
52
+ .DS_Store
53
+ Thumbs.db
54
+
55
+ # Project specific
56
+ *.log
57
+ .env
58
+ .env.local
@@ -0,0 +1,78 @@
1
+ ---
2
+ description: 添加与修正模型配置
3
+ ---
4
+
5
+ 目前的模型配置定义参考:
6
+
7
+ from dataclasses import dataclass, field
8
+
9
+ import parse # type: ignore[import-untyped]
10
+
11
+ from llmeta.capabilities import ModelCapabilities
12
+ from llmeta.models.base import ModelFamily
13
+ from llmeta.provider import Provider
14
+
15
+
16
+ @dataclass
17
+ class SpecificModelConfig:
18
+ """
19
+ 特定模型配置 / Specific model configuration
20
+
21
+ 用于预注册特定模型的详细配置
22
+ Used for pre-registering detailed configuration for specific models
23
+ """
24
+
25
+ # 模型版本 / Model version
26
+ version: str
27
+
28
+ # 模型变体 / Model variant
29
+ variant: str
30
+
31
+ # 自定义能力(可选) / Custom capabilities (optional)
32
+ capabilities: ModelCapabilities | None = None
33
+
34
+ # 子命名模式(可选) / Sub-patterns (optional)
35
+ # 必须是父 patterns 的子集 / Must be a subset of parent patterns
36
+ patterns: list[str] = field(default_factory=list)
37
+
38
+
39
+ @dataclass
40
+ class ModelFamilyConfig:
41
+ """
42
+ 模型家族配置 / Model family configuration
43
+
44
+ 集中管理一个模型家族的所有配置信息
45
+ Centrally manage all configuration for a model family
46
+ """
47
+
48
+ # 基本信息 / Basic information
49
+ family: ModelFamily
50
+ provider: Provider
51
+
52
+ # 命名模式 / Naming patterns
53
+ # 按优先级排序,更具体的在前 / Ordered by priority, more specific first
54
+ patterns: list[str]
55
+
56
+ # 默认值 / Defaults
57
+ version_default: str = "1.0"
58
+
59
+ # 默认能力 / Default capabilities
60
+ capabilities: ModelCapabilities = field(default_factory=ModelCapabilities)
61
+
62
+ # 预注册的特定模型(可选) / Pre-registered specific models (optional)
63
+ # 格式: {model_name: SpecificModelConfig}
64
+ # Format: {model_name: SpecificModelConfig}
65
+ specific_models: dict[str, SpecificModelConfig] = field(default_factory=dict)
66
+
67
+ ---
68
+
69
+ 目前已经有相应的添加模式在 llmeta/models/families
70
+
71
+ 但目前的配置并不是非常正常,目前的配置数据很多是Mock数据。我会复制给你官网相应的真实配置文档,你根据这个配置文档,来修改当前的Mock数据或者添加新的配置数据。
72
+
73
+ 我给出的文档中会尽可能多出现一些示例模型名称,你需要总结其模式。另外,模型的能力我会给出描述,你需要配置Capabilities。
74
+
75
+ 1. 我每次会提供一个(有时候可能有多个)从官网复制的模型说明,你需要根据提供内容来判断在当前哪个Provider提供丰富对应的配置,如果我提供的模型已经在配置中存在,则检查其capabilities是否正确。需要注意,你可以新建SpecialModels,或者新建模型家族,模型家族的分类有时候不一定非得按品牌来分,比如GPT模型众多,每个版本都形成一个独立家族,而有些品牌模型量比较少,可以一个品牌一个家族,不同版本区分。
76
+ 2. 完成配置后你需要自检,Patterns不要有冲突,因为匹配模式的时候有顺序,优先SpecialModels,然后按主配置来,SpecialsModels又按顺序尝试,因此要注意避免提前被匹配的情况。
77
+ 3. 测试用例需要在 tests/ 目录下,映射源代码目录结构。可以参考 @tests/models/families/test_gpt5.py。注意的时候注意写一些空间被错误捕获的Case来验证,因为目前的经验来看,非常容易因为Parsed模板提前捕获导致错误匹配。
78
+ 4. 每次添加或者修改配置后,会有些之前的测试用例无法通过,因为毕竟修改了配置。你需要在每次修改完配置后运行 uv run poe test。查看无法通过的用例,如果是因为测试数据过时的原因,则修复测试数据,如果是因为配置逻辑问题(比如Patterns顺序,或者SpcialModels顺序造成的),则修复配置
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: 当前项目的架构设计说明
3
+ ---
4
+
5
+ 背景:
6
+
7
+ 当前大模型的厂商(provider)/版本(3.5/4.0/4)/型号(flash/mini/o)混乱不堪
8
+ 不同厂商,不同版本,不同型号其能力又不尽相同
9
+
10
+ 比如以智谱AI的GLM-4V来讲,它支持视觉多模态,但其接口中传入的视频有如下要求:
11
+ GLM-4V-Plus视频大小限制为20M以内,视频时长不超过 30s。
12
+ GLM-4V-Plus-0111视频大小限制为 200M 以内。
13
+ 图片有如下要求:
14
+ 图片url或者base64编码。
15
+ 图像大小上传限制为每张图像 5M以下,且像素不超过 6000*6000。
16
+ 支持jpg、png、jpeg格式。
17
+ 说明: GLM-4V-Flash 不支持base64编码
18
+
19
+ 这些要求非常细碎,开发者将非常难以处理这些“变态”的要求。一个不小心就会触发警告,同时如果开发者有适配多个模型的需求,这些不同厂商API之间的要求将是恶梦。
20
+
21
+ 当前的项目目标是完成以下要求:
22
+
23
+ 1. 仅需要一个字符串即可完成这个模型配置的初始化。
24
+ 2. 初始化完成后,可以自动匹配到厂商/版本/型号,同时可以基于同一厂商下的不同版本/型号进行大小比较,支持运算符比较。
25
+ 3. 初始化完成后,提供其能力范围说明,初期能力范围主要着重「是否支持thinking(reasoning)模式, 是否支持图片,是否支持音频,是否支持视频,是否支持PDF」
26
+ 4. 针对具体的模型,提供一个对请求参数进行validate的可选实现,用于解决像GLM-4V-Plus这样的变态参数要求自动整改。这个实现会基于我们vrl-python库,使用VRL脚本语言实现。(使用 uv add vrl-python即可添加)
27
+
28
+ ---
29
+
30
+ 当前项目使用uv管理依赖
31
+ 使用ruff进行格式检查
32
+ 使用mypy进行类型检查
33
+ 使用bump-my-version管理版本
34
+
35
+ 测试的时候注意使用 uv run pytest 激活虚拟环境进行测试
36
+
37
+ ---
38
+
39
+ 已经实现的功能:
40
+
41
+ 1. 相同provider提供的相同版本的模型,会有型号的不同,比如GPT系列有 base turbo omni等,一般来讲,我们需要添加 gpt-4-turbo < gpt-4 < gpt-4o的判断能力。也就是不同的型号也有高低之分,因为这一般意味着每百万Token的价格区别。因此元数据需要有一个类似的字段,而且这个字段需要参数大小比较,同时每个模型家族这个字段的大小比较方法需要能自定义,建议使用tuple从左向右越来越大
42
+ 2. 当前只有Provider字段的时候我发现一个问题,同一个模型,比如Deepseek,可能是原厂提供,也可能由Tencent提供,不同的Provider其能力可能不一样。因此我们需要添加一个「模型家族」的字段和Provider区分开,同一个模型家族,可能有多个Provider,同时其Capibility可能不同。某个模型家族有默认的Provider,但同时,可以在模型名称前通过 Provider::ModelName 的形式来指定Provider。
43
+ 3. 模型家族,模型版本,模型型号一般不会轻易改变,但需要注意,多数模型会有一个日期,代表其小更新的发布,日期也需要参数比较。因此添加日期相关能力,参与比较时在版本,型号相同的情况下比较日期
44
+
45
+ 需要继续实现的功能:
46
+
47
+ 4. 因为不同公司的模型多如牛毛,我们无法一一添加,我们需要提供一个auto_register的方式,实现以下能力:
48
+ a. 用户初始化一个ModelVersion如果使用一个不存在的名称时,触发自动注册。
49
+ b. 仅仅需要提供一个模型名(可以选择带上Provider,不带则使用默认)。然后根据其归属的模型家族来初始化能力
50
+ c. 如果当前家族无任何可用的参考,用户又未指定能力,则抛出异常,告知用户添加失败,无法自动补充能力,需要用户手动注册添加。
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: 测试LLMeta
3
+ ---
4
+
5
+ 我会从网上找到各模型官方网站的信息,包括名称及其能力
6
+
7
+ 你需要在 @tests/test_llmeta.py 中写真实的测试用例,你根据我提供的信息(截图)来写断言。然后直接使用 LLMeta("xxx")初始化模型,断言能力是匹配的。
8
+
9
+ 断言能力尽可能全面。
10
+
11
+ 如果测试不通过,你需要分析是配置内容问题,还是配置执行问题(比如pattern执行顺序,优先级判断,或者parsed匹配异常等),根据具体问题进行修复。
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+ - **模型家族(ModelFamily)概念** - 区分模型家族和提供商,同一模型家族可能由多个Provider提供
9
+ - **型号优先级比较系统** - 支持同一家族下不同型号的智能比较
10
+ - GPT-4 系列: `gpt-4o-mini < gpt-4 < gpt-4-turbo < gpt-4o`
11
+ - GLM-4 系列: `glm-4-flash < glm-4 < glm-4-plus`
12
+ - GLM-4V 系列: `glm-4v-flash < glm-4v < glm-4v-plus < glm-4v-plus-0111`
13
+ - O1 系列: `o1-mini < o1-preview < o1`
14
+ - **Provider指定语法** - 支持 `Provider::ModelName` 语法来显式指定Provider
15
+ - **variant_priority字段** - 在 `ModelInfo` 中添加型号优先级元组,用于同版本不同型号的比较
16
+ - **发布日期支持** - 支持从模型名称中自动解析发布日期
17
+ - 支持 `YYYY-MM-DD` 格式(如 `gpt-4-turbo-2024-04-09`)
18
+ - 支持 `MMDD` 格式(如 `gpt-4-0125-preview`)
19
+ - 无日期的模型被认为是最新版本(指向 latest)
20
+ - **日期比较功能** - 在版本和型号相同时,通过日期进行精确比较
21
+ - **高级示例文件** - 添加 `examples/advanced_usage.py` 展示新功能的使用
22
+
23
+ ### Changed
24
+ - **比较逻辑优化** - 模型比较从基于Provider改为基于ModelFamily,更符合实际使用场景
25
+ - **版本比较增强** - 比较顺序:版本 > 型号优先级 > 发布日期
26
+ - **错误提示改进** - 不同家族模型比较时的错误提示更加清晰
27
+ - **测试框架兼容** - 测试类现在同时兼容 pytest 和 unittest,方便 PyCharm 运行
28
+
29
+ ### Updated
30
+ - 所有现有模型注册都添加了 `family` 和 `variant_priority` 字段
31
+ - OpenAI 模型定义(gpt-4, gpt-4-turbo, gpt-4o, gpt-4o-mini, gpt-3.5-turbo, o1, o1-mini, o1-preview)
32
+ - 新增带日期的模型:`gpt-4-turbo-2024-04-09`, `gpt-4-0125-preview`
33
+ - 智谱 AI 模型定义(glm-4, glm-4-plus, glm-4-flash, glm-4v, glm-4v-plus, glm-4v-plus-0111, glm-4v-flash, glm-3-turbo)
34
+ - 测试用例更新以验证新功能(新增3个日期相关测试)
35
+ - README 文档更新,添加新功能说明和使用示例
36
+
37
+ ## [0.1.0] - 2025-11-07
38
+
39
+ ### Added
40
+ - 初始版本发布
41
+ - 基础模型版本管理功能
42
+ - Provider 自动检测
43
+ - 模型能力描述系统
44
+ - 基础版本比较功能
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 JQQ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.