@keo-ai/axiom 0.2.7 → 0.2.8

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.
package/README.md CHANGED
@@ -194,16 +194,21 @@ for await (const chunk of LLM.streamPredict({ model: 'qwen-max', prompt: '讲个
194
194
  |------|----------|-----------|------|
195
195
  | `qwen-max` | ❌ 不支持 | ✅ | **默认模型** |
196
196
  | `qwen3.7-max` | ✅ 映射支持 | ✅ | `low`/`medium`/`high` 映射为 `enable_thinking` |
197
+ | `qwen3.7-flash` | ✅ 映射支持 | ✅ | 同上 |
197
198
  | `qwen-plus` | ✅ 映射支持 | ✅ | 同上 |
198
199
  | `qwen-turbo` | ✅ 映射支持 | ✅ | 同上 |
199
- | `deepseek-v4-pro` | ✅ 原生支持 | ✅ | `low`/`medium`/`high` 直接传递 |
200
- | `deepseek-v4-flash` | ✅ 原生支持 | ✅ | 同上 |
201
- | `kimi-k2.6` | ✅ 原生支持 | ✅ | 同上 |
200
+ | `deepseek-v4-pro` | ✅ 映射支持 | ✅ | 同上(百炼走「混合思考模式」,由 `enable_thinking` 控制) |
201
+ | `deepseek-v4-flash` | ✅ 映射支持 | ✅ | 同上 |
202
+ | `kimi-k2.6` | ✅ 映射支持 | ✅ | `low`/`medium`/`high` 映射为 `extra_body.thinking.type` |
202
203
  | `qwq-plus` | ❌ 不支持 | ✅ | 固定推理行为,不可调节 |
203
204
  | `glm-5.1` | ❌ 不支持 | ❌ | 不支持推理参数,不支持 json 模式 |
204
205
  | `qwen-vl-plus` | ❌ 不支持 | ✅ | 视觉模型,不支持推理参数 |
205
206
 
206
- > 推理深度的支持方式由 Provider 内部维护。百炼 Provider 中,Qwen 系列通过 `extra_body.enable_thinking` 映射实现(`low` 关闭,`medium`/`high` 开启),DeepSeek / Kimi 则原生透传 `reasoning_effort`。
207
+ > 推理深度的支持方式由 Provider 内部维护。百炼 Provider 中:
208
+ > - Qwen 系列与 DeepSeek v4 系列均通过 `extra_body.enable_thinking` 映射实现(`low` 关闭,`medium`/`high` 开启);
209
+ > - Kimi 则通过 `extra_body.thinking.type` 映射(`low` 关闭,`medium`/`high` 开启)。
210
+ >
211
+ > 两种模式在百炼兼容接口下都退化为布尔开关,`medium` / `high` 之间的差异无法体现。
207
212
  >
208
213
  > 目前所有模型均路由到百炼 Provider。后续接入其他厂商时,通过 `MODEL_REGISTRY` 扩展映射即可。
209
214
 
@@ -56,10 +56,11 @@ class BailianProvider {
56
56
  if (((_b = body.response_format) === null || _b === void 0 ? void 0 : _b.type) === 'json_object' && !caps.jsonMode) {
57
57
  throw new Error(`[adapt] Model "${body.model}" does not support response_format json_object`);
58
58
  }
59
- // 百炼平台:Qwen 系列通过 enable_thinking 实现 reasoning_effort
60
- // Kimi(Moonshot)通过 extra_body.thinking.type 实现(默认开启)
59
+ // 百炼平台:Qwen 系列与 DeepSeek v4 系列均为「混合思考模式」,
60
+ // 通过 extra_body.enable_thinking 控制思考开关(low 关闭,medium/high 开启);
61
+ // Kimi(Moonshot)则通过 extra_body.thinking.type 实现(默认开启)。
61
62
  if (body.reasoning_effort !== undefined) {
62
- if (['qwen-plus', 'qwen-turbo', 'qwen3.7-max'].includes(body.model)) {
63
+ if (['qwen-plus', 'qwen-turbo', 'qwen3.7-max', 'qwen3.7-flash', 'deepseek-v4-pro', 'deepseek-v4-flash'].includes(body.model)) {
63
64
  const { reasoning_effort } = body, rest = __rest(body, ["reasoning_effort"]);
64
65
  return Object.assign(Object.assign({}, rest), { extra_body: Object.assign(Object.assign({}, ((_c = rest.extra_body) !== null && _c !== void 0 ? _c : {})), { enable_thinking: reasoning_effort !== 'low' }) });
65
66
  }
@@ -69,7 +70,7 @@ class BailianProvider {
69
70
  // 需要显式传 thinking.type:low 禁用,medium/high 显式开启
70
71
  return Object.assign(Object.assign({}, rest), { extra_body: Object.assign(Object.assign({}, ((_d = rest.extra_body) !== null && _d !== void 0 ? _d : {})), { thinking: { type: reasoning_effort === 'low' ? 'disabled' : 'enabled' } }) });
71
72
  }
72
- // deepseek-v4-pro / deepseek-v4-flash 原生支持 reasoning_effort,直接传递
73
+ // 其它不支持 reasoning_effort 的模型会由前面的能力校验抛异常
73
74
  }
74
75
  return body;
75
76
  }
@@ -212,6 +213,7 @@ class BailianProvider {
212
213
  exports.BailianProvider = BailianProvider;
213
214
  BailianProvider.SUPPORTED_MODELS = new Set([
214
215
  'qwen3.7-max',
216
+ 'qwen3.7-flash',
215
217
  'qwen-plus',
216
218
  'qwen-turbo',
217
219
  'qwq-plus',
@@ -224,9 +226,12 @@ BailianProvider.SUPPORTED_MODELS = new Set([
224
226
  BailianProvider.MODEL_CAPABILITIES = {
225
227
  'qwen-max': { jsonMode: true, reasoningEffort: false },
226
228
  'qwen3.7-max': { jsonMode: true, reasoningEffort: true },
229
+ 'qwen3.7-flash': { jsonMode: true, reasoningEffort: true },
227
230
  'qwen-plus': { jsonMode: true, reasoningEffort: true },
228
231
  'qwen-turbo': { jsonMode: true, reasoningEffort: true },
229
232
  'qwq-plus': { jsonMode: true, reasoningEffort: false },
233
+ // DeepSeek v4 系列在百炼走「混合思考模式」:由 enable_thinking 控制开关,
234
+ // 通过 adaptRequest 映射为 extra_body.enable_thinking(与 Qwen 同一分支)。
230
235
  'deepseek-v4-pro': { jsonMode: true, reasoningEffort: true },
231
236
  'deepseek-v4-flash': { jsonMode: true, reasoningEffort: true },
232
237
  'kimi-k2.6': { jsonMode: true, reasoningEffort: true },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 支持的模型枚举。项目层通过此枚举选择模型,Axiom 内部路由到对应 Provider。
3
3
  */
4
- export type Model = 'qwen3.7-max' | 'qwen-plus' | 'qwen-turbo' | 'qwq-plus' | 'deepseek-v4-pro' | 'deepseek-v4-flash' | 'kimi-k2.6' | 'glm-5.1' | 'qwen-vl-plus';
4
+ export type Model = 'qwen3.7-max' | 'qwen3.7-flash' | 'qwen-plus' | 'qwen-turbo' | 'qwq-plus' | 'deepseek-v4-pro' | 'deepseek-v4-flash' | 'kimi-k2.6' | 'glm-5.1' | 'qwen-vl-plus';
5
5
  /** 模型到 Provider 的映射配置 */
6
6
  export interface ModelConfig {
7
7
  readonly model: string;
@@ -16,7 +16,10 @@ export declare const MODEL_REGISTRY: Readonly<Record<Model, ReadonlyArray<ModelC
16
16
  export interface ModelCapabilities {
17
17
  /** 是否原生支持 response_format: { type: 'json_object' } */
18
18
  readonly jsonMode: boolean;
19
- /** 是否支持 reasoning_effort 参数 */
19
+ /**
20
+ * 是否支持调节推理深度。开启后由 Provider 的 `adaptRequest` 决定如何映射到底层字段
21
+ * (如 Qwen / DeepSeek → `extra_body.enable_thinking`、Kimi → `extra_body.thinking.type`)。
22
+ */
20
23
  readonly reasoningEffort: boolean;
21
24
  }
22
25
  /**
@@ -7,6 +7,7 @@ exports.MODEL_REGISTRY = void 0;
7
7
  */
8
8
  exports.MODEL_REGISTRY = {
9
9
  'qwen3.7-max': [{ model: 'qwen3.7-max', provider: 'bailian' }],
10
+ 'qwen3.7-flash': [{ model: 'qwen3.7-flash', provider: 'bailian' }],
10
11
  'qwen-plus': [{ model: 'qwen-plus', provider: 'bailian' }],
11
12
  'qwen-turbo': [{ model: 'qwen-turbo', provider: 'bailian' }],
12
13
  'qwq-plus': [{ model: 'qwq-plus', provider: 'bailian' }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keo-ai/axiom",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "基于 LLM 的预测与推理库,支持多 Provider 切换",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,9 @@
10
10
  "license": "MIT",
11
11
  "scripts": {
12
12
  "build": "tsc",
13
- "test": "vitest run --exclude '**/*.integration.test.ts'"
13
+ "typecheck": "tsc --noEmit",
14
+ "test": "vitest run --exclude '**/*.integration.test.ts'",
15
+ "test:integration": "vitest run --config vitest.integration.config.ts"
14
16
  },
15
17
  "dependencies": {
16
18
  "dotenv": "^17.4.2"