seed-model-providers 1.0.0__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.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: seed-model-providers
3
+ Version: 1.0.0
4
+ Summary: Unified model provider catalog and protocol resolution for Seed/CodeAgent — extracted from seed.core.model_providers
5
+ Author: Seed Contributors
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Requires-Dist: requests>=2.28.0
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest>=7.0; extra == "dev"
11
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
12
+ Provides-Extra: tokenizer
13
+ Requires-Dist: tokenizers>=0.19.0; extra == "tokenizer"
@@ -0,0 +1,50 @@
1
+ # seed-model-providers
2
+
3
+ 统一的模型提供商目录(catalog)与协议调度层。
4
+
5
+ 提取自 `seed.core.model_providers`,作为独立包供 seed、seed-tools、codeagent 等共同使用。
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ pip install -e .
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ```python
16
+ from seed_model_providers import (
17
+ resolve_provider_for_preset,
18
+ resolve_chat_protocol,
19
+ list_provider_catalog,
20
+ normalize_chat_usage,
21
+ apply_provider_chat_headers,
22
+ call_image_generations,
23
+ )
24
+ ```
25
+
26
+ ## 能力
27
+
28
+ - 供应商 catalog 注册(DeepSeek, OpenAI, Anthropic, Google Gemini, 阿里云百炼/Qwen, Moonshot/Kimi, 智谱 GLM, OpenRouter, Groq, MiniMax, 火山方舟, SGLang, Ollama, Agnes AI 等)
29
+ - Chat 协议自动路由(deepseek / dashscope / moonshot / **zhipu** / minimax / sglang / openai)
30
+ - **usage 归一化**(`normalize_chat_usage`)与 **OpenRouter 请求头**(`apply_provider_chat_headers`)
31
+ - 思考模式多轮回传(DashScope preserve_thinking、Kimi keep=all、智谱 clear_thinking=false)
32
+ - Preset 映射与 UI 联动(materialize / enrich)
33
+ - 多模态生成(图像/音乐/视频)的统一调用接口
34
+
35
+ ## 文档
36
+
37
+ | 文档 | 说明 |
38
+ |------|------|
39
+ | [`docs/PROVIDER_PROTOCOLS.md`](docs/PROVIDER_PROTOCOLS.md) | Chat 协议、usage、OpenRouter、思考模式、与上下文指示器关系 |
40
+ | [`docs/MODEL_CATALOG.md`](docs/MODEL_CATALOG.md) | 内置 model 下拉列表(PROVIDER_CATALOG) |
41
+ | [`docs/audit-model-providers-2026-06-16.md`](docs/audit-model-providers-2026-06-16.md) | 历史审计记录 |
42
+
43
+ CodeAgent 侧入口:[`codeagent/docs/MODEL_PROVIDERS.md`](../codeagent/docs/MODEL_PROVIDERS.md)
44
+
45
+ ## 测试
46
+
47
+ ```bash
48
+ pip install -e ".[dev]"
49
+ PYTHONPATH="../seed:." pytest tests/ -q
50
+ ```
@@ -0,0 +1,36 @@
1
+ [project]
2
+ name = "seed-model-providers"
3
+ version = "1.0.0"
4
+ description = "Unified model provider catalog and protocol resolution for Seed/CodeAgent — extracted from seed.core.model_providers"
5
+ requires-python = ">=3.9"
6
+ license = { text = "MIT" }
7
+ authors = [{ name = "Seed Contributors" }]
8
+ dependencies = [
9
+ "requests>=2.28.0",
10
+ ]
11
+
12
+ [project.optional-dependencies]
13
+ dev = ["pytest>=7.0", "ruff>=0.4.0"]
14
+ tokenizer = ["tokenizers>=0.19.0"]
15
+
16
+ [build-system]
17
+ requires = ["setuptools>=64"]
18
+ build-backend = "setuptools.build_meta"
19
+
20
+ [tool.setuptools.packages.find]
21
+ where = ["."]
22
+ include = ["seed_model_providers*"]
23
+
24
+ [tool.pytest.ini_options]
25
+ minversion = "7.0"
26
+ testpaths = ["tests"]
27
+ pythonpath = ["."]
28
+ addopts = "-v --tb=short"
29
+
30
+ [tool.ruff]
31
+ line-length = 120
32
+ target-version = "py39"
33
+
34
+ [tool.ruff.lint]
35
+ select = ["E", "F", "I", "N", "W", "UP", "SIM"]
36
+ ignore = ["E501"]
@@ -0,0 +1,124 @@
1
+ """
2
+ seed-model-providers — Unified model provider catalog and protocol resolution.
3
+
4
+ Originally extracted from ``seed.core.model_providers``.
5
+
6
+ Use::
7
+
8
+ from seed_model_providers import (
9
+ resolve_provider_for_preset,
10
+ resolve_chat_protocol,
11
+ list_provider_catalog,
12
+ call_image_generations,
13
+ ...
14
+ )
15
+ """
16
+
17
+ from seed_model_providers.model_providers import (
18
+ # Catalog / metadata
19
+ USE_TYPE_LABELS,
20
+ PROVIDER_CATALOG,
21
+ list_provider_catalog,
22
+ provider_requires_api_key,
23
+ list_models_for_provider,
24
+ get_provider_spec,
25
+ # Provider / preset resolution
26
+ normalize_provider_id,
27
+ infer_provider_from_url,
28
+ resolve_provider_for_preset,
29
+ resolve_chat_protocol,
30
+ resolve_image_protocol,
31
+ resolve_music_protocol,
32
+ resolve_video_protocol,
33
+ uses_full_reasoning_content_echo,
34
+ uses_deepseek_chat_protocol,
35
+ # Preset mapping / UI helpers
36
+ materialize_preset_from_form,
37
+ enrich_presets_for_ui,
38
+ enrich_preset_defaults,
39
+ preset_display_name,
40
+ preset_display_fields,
41
+ preset_auto_name,
42
+ preset_auto_id,
43
+ infer_preset_use_type,
44
+ infer_use_type_for_provider_model,
45
+ model_label_for_provider,
46
+ normalize_deepseek_chat_model,
47
+ normalize_volcengine_image_model,
48
+ # Chat protocol helpers
49
+ apply_chat_thinking_extra_body,
50
+ apply_chat_stream_options,
51
+ apply_provider_chat_headers,
52
+ should_send_reasoning_content,
53
+ normalize_reasoning_effort,
54
+ normalize_chat_usage,
55
+ default_max_request_body_bytes,
56
+ # Image generation
57
+ call_image_generations,
58
+ normalize_image_size,
59
+ # Music generation
60
+ call_music_generations,
61
+ call_minimax_music_generation,
62
+ # Video generation
63
+ call_video_generations,
64
+ call_agnes_video_generation,
65
+ call_minimax_video_generation,
66
+ normalize_video_num_frames,
67
+ )
68
+ from seed_model_providers.net import (
69
+ is_local_url,
70
+ is_local_host,
71
+ requests_proxies_for,
72
+ httpx_trust_env_for,
73
+ )
74
+
75
+ __all__ = [
76
+ "USE_TYPE_LABELS",
77
+ "PROVIDER_CATALOG",
78
+ "list_provider_catalog",
79
+ "provider_requires_api_key",
80
+ "list_models_for_provider",
81
+ "get_provider_spec",
82
+ "normalize_provider_id",
83
+ "infer_provider_from_url",
84
+ "resolve_provider_for_preset",
85
+ "resolve_chat_protocol",
86
+ "resolve_image_protocol",
87
+ "resolve_music_protocol",
88
+ "resolve_video_protocol",
89
+ "uses_deepseek_chat_protocol",
90
+ "uses_full_reasoning_content_echo",
91
+ "materialize_preset_from_form",
92
+ "enrich_presets_for_ui",
93
+ "enrich_preset_defaults",
94
+ "preset_display_name",
95
+ "preset_display_fields",
96
+ "preset_auto_name",
97
+ "preset_auto_id",
98
+ "infer_preset_use_type",
99
+ "infer_use_type_for_provider_model",
100
+ "model_label_for_provider",
101
+ "normalize_deepseek_chat_model",
102
+ "normalize_volcengine_image_model",
103
+ "apply_chat_thinking_extra_body",
104
+ "apply_chat_stream_options",
105
+ "apply_provider_chat_headers",
106
+ "should_send_reasoning_content",
107
+ "normalize_reasoning_effort",
108
+ "normalize_chat_usage",
109
+ "default_max_request_body_bytes",
110
+ "call_image_generations",
111
+ "normalize_image_size",
112
+ "call_music_generations",
113
+ "call_minimax_music_generation",
114
+ "call_video_generations",
115
+ "call_agnes_video_generation",
116
+ "call_minimax_video_generation",
117
+ "normalize_video_num_frames",
118
+ "is_local_url",
119
+ "is_local_host",
120
+ "requests_proxies_for",
121
+ "httpx_trust_env_for",
122
+ ]
123
+
124
+ __version__ = "1.0.0"
@@ -0,0 +1,12 @@
1
+ # pip3 install transformers
2
+ # python3 deepseek_tokenizer.py
3
+ import transformers
4
+
5
+ chat_tokenizer_dir = "./"
6
+
7
+ tokenizer = transformers.AutoTokenizer.from_pretrained(
8
+ chat_tokenizer_dir, trust_remote_code=True
9
+ )
10
+
11
+ result = tokenizer.encode("Hello!")
12
+ print(result)