@keo-ai/axiom 0.2.3 → 0.2.4

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.
@@ -48,7 +48,7 @@ class BailianProvider {
48
48
  return BailianProvider.SUPPORTED_MODELS.has(model);
49
49
  }
50
50
  adaptRequest(body) {
51
- var _a, _b, _c;
51
+ var _a, _b, _c, _d;
52
52
  const caps = (_a = BailianProvider.MODEL_CAPABILITIES[body.model]) !== null && _a !== void 0 ? _a : { jsonMode: false, reasoningEffort: false };
53
53
  if (body.reasoning_effort !== undefined && !caps.reasoningEffort) {
54
54
  throw new Error(`[adapt] Model "${body.model}" does not support reasoning_effort`);
@@ -57,12 +57,21 @@ class BailianProvider {
57
57
  throw new Error(`[adapt] Model "${body.model}" does not support response_format json_object`);
58
58
  }
59
59
  // 百炼平台:Qwen 系列通过 enable_thinking 实现 reasoning_effort
60
+ // Kimi(Moonshot)通过 extra_body.thinking.type 实现(默认开启)
60
61
  if (body.reasoning_effort !== undefined) {
61
62
  if (['qwen-plus', 'qwen-turbo', 'qwen3.7-max'].includes(body.model)) {
62
63
  const { reasoning_effort } = body, rest = __rest(body, ["reasoning_effort"]);
63
64
  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' }) });
64
65
  }
65
- // deepseek-v4-pro / deepseek-v4-flash / kimi-k2.6 原生支持,直接传递
66
+ if (body.model === 'kimi-k2.6') {
67
+ const { reasoning_effort } = body, rest = __rest(body, ["reasoning_effort"]);
68
+ // Kimi 默认开启思考;只有 low 显式禁用,medium/high 走默认(不传 thinking 字段)
69
+ if (reasoning_effort === 'low') {
70
+ return Object.assign(Object.assign({}, rest), { extra_body: Object.assign(Object.assign({}, ((_d = rest.extra_body) !== null && _d !== void 0 ? _d : {})), { thinking: { type: 'disabled' } }) });
71
+ }
72
+ return rest;
73
+ }
74
+ // deepseek-v4-pro / deepseek-v4-flash 原生支持 reasoning_effort,直接传递
66
75
  }
67
76
  return body;
68
77
  }
@@ -198,6 +207,7 @@ class BailianProvider {
198
207
  : undefined,
199
208
  stream: request.stream,
200
209
  stream_options: request.streamOptions,
210
+ reasoning_effort: request.reasoningEffort,
201
211
  };
202
212
  }
203
213
  }
@@ -19,6 +19,8 @@ export interface LLMRequest {
19
19
  };
20
20
  readonly model?: string;
21
21
  readonly responseFormat?: 'text' | 'json';
22
+ /** 推理深度。各 Provider 按自身能力映射到底层协议字段(如 enable_thinking / reasoning_effort) */
23
+ readonly reasoningEffort?: 'low' | 'medium' | 'high';
22
24
  }
23
25
  /**
24
26
  * LLM 调用的 token 消耗统计。
@@ -65,6 +65,7 @@ function toLLMRequest(config, messages) {
65
65
  maxTokens: config.maxTokens,
66
66
  topP: config.topP,
67
67
  responseFormat: config.responseFormat,
68
+ reasoningEffort: config.reasoningEffort,
68
69
  };
69
70
  }
70
71
  function unwrapResponse(response, responseFormat) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keo-ai/axiom",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "基于 LLM 的预测与推理库,支持多 Provider 切换",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",