Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(plugins): 模型配置页支持 vLLM 等本地端点的思考下发与角色兼容

hairyf605606618617
diff --git a/packages/dsh-tauri-model-config/README.md b/packages/dsh-tauri-model-config/README.md
index 9fed2117..fb056a9a 100644
--- a/packages/dsh-tauri-model-config/README.md
+++ b/packages/dsh-tauri-model-config/README.md
@@ -22,7 +22,7 @@
| 面板标题右侧(`.zGbnIq_title`) | **打开配置文件**:用系统默认程序打开 `$DSH_HOME/settings.yaml`;文件尚未创建时改为打开它所在目录 |
| 单个模型行(`.zGbnIq_modelRow`) | **获取配置**:仅在该条目只有 `id`/`name`/`description` 时出现,按 `id` 从提供方端点读取该模型的上下文与输出上限 |
| 模型目录标题(`.zGbnIq_modelCatalogHeading`) | 追加 `flex: 1`(按钮集中到右侧),并在右侧加入 **自动配置所有模型**;pi-ai 提供方与官方 DeepSeek 模型目录都有这个入口 |
-| 单个模型高级区(`.zGbnIq_modelAdvanced`) | **支持图片输入** 开关 → `input` 声明;**思考模式** 开关 → `reasoningEfforts` 声明,打开后可按档位勾选 |
+| 单个模型高级区(`.zGbnIq_modelAdvanced`) | **支持图片输入** 开关 → `input` 声明;**思考模式** 开关 → `reasoningEfforts` 声明,打开后可按档位勾选;**本地端点思考** 开关 → `compat` 声明(仅路由显式声明 `openai-completions` 时出现) |
高级区里的开关统一由 `.zGbnIq_modelSwitchRow` 包裹(`display: flex` + `height: 32px` + 垂直居中),与相邻的 32px 文本输入框对齐。
@@ -54,6 +54,10 @@
- 容量以端点披露为准;端点什么都没说时用能力表的值,已有值永不被能力表覆盖。
- 图片与思考先看能力表,表没给出「能」的结论时由家族规则按命名补一条(只做加法,不做减法:
把模型误判成只能读文字会让用户发不出图片,代价比多勾一个开关大)。
+- 能力表的 `0` 是「数据集没有给出这项事实」,不是「不支持」:没表态的模态与档位不写进条目,
+ 该字段保持「继承默认」。因此「自动配置所有模型」不会把部署真实具备、或用户已经声明的思考与
+ 图片能力改写成显式的 `reasoningEfforts: false` / `input: ['text']`——本地端点上的模型常常比
+ 数据集新,写死的否定声明会直接关掉它。
- **单行「获取配置」**:只补空缺字段,不覆盖已有值。
- **「自动配置所有模型」**:按按钮语义重新配置,端点披露的容量会覆盖行内旧值;端点没披露的字段保持不动。
@@ -81,6 +85,32 @@
开关只表达两种**显式声明**:`false`(不支持)与档位对象(支持)。`reasoningEfforts` 缺席表示「继承默认」,
此时开关读为关,与图片开关同一口径。
+### 本地端点思考
+
+声明了档位不等于档位能到端点。pi-ai 默认把档位放进顶层的 `reasoning_effort`,并在模型有思考能力时
+把系统提示的角色从 `system` 换成 `developer`;而 vLLM 这类 OpenAI 兼容端点从 `chat_template_kwargs`
+读思考参数、也不认 `developer`,于是出现「档位选了没反应」与「整轮 400 `Unexpected message role.`」。
+
+**本地端点思考** 开关把这类端点需要的三项事实一次写进该模型的 `compat`:
+
+```yaml
+compat:
+ supportsDeveloperRole: false
+ thinkingFormat: chat-template
+ chatTemplateKwargs:
+ reasoning_effort:
+ $var: thinking.effort
+```
+
+前两项分别解决角色与下发格式,第三项用 pi-ai 的请求态占位符把下拉框选中的档位动态填进参数,
+不需要重述端点的 chat template。开关读为开的条件是 `thinkingFormat: chat-template` 与
+`supportsDeveloperRole: false` 同时成立,因此只写了一半的手写条目在开关上仍读为关,打开时会补齐。
+关闭只摘掉这三项,条目里其它 `compat` 键与 chat template 参数原样保留。
+
+`compat` 在 pi-ai 里是逐协议校验的,`thinkingFormat` 与 `chatTemplateKwargs` 只有
+`openai-completions` 收,写到 Responses / Anthropic 路由的模型上会让整段配置解析失败,所以这个开关
+只在路由显式声明 `openai-completions` 时出现;目录路由(协议由内置目录决定,插件看不到)不提供。
+
## 已知约束
- 模型配置文件按 `$DSH_HOME`(非空白)→ `~/.dsh` 解析后取 `settings.yaml`,与官方 `resolveDshHome` 及桌面壳一致;如果 profile 的 `cordis.yml` 为 `settings-file` 配了自定义 `path`,这里无法感知。
@@ -88,3 +118,4 @@
- 图片能力既不在官方发现通道的返回里,也没有跨厂商的端点字段:它来自模型能力表,表里没有的靠家族规则。两者都是社区口径的近似值,用户随时可以在高级区改;单行「获取配置」也不会覆盖手写值。
- 能力表需要一次网络请求(约 2.6 MB 的原始数据集,压成 72 KB 落盘,一天内不再请求)。离线且从未下载过时,只剩家族规则能补图片/思考,容量仍由端点清单提供。
- 档位只提供官方词表内的勾选,线值固定等于档位名;端点要求特殊线值时改设置文档即可。
+- 「本地端点思考」写的是一组固定的 `compat`:参数名 `reasoning_effort`、下发格式 `chat-template`。端点要求别的参数名(例如 `enable_thinking`)或别的下发格式时,改设置文档即可;开关只表达它写入的这一组。
diff --git a/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx b/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
index 117cc016..135ed463 100644
--- a/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
+++ b/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
@@ -11,7 +11,9 @@ import {
hasModelConfig,
imageInputValue,
supportsImageInput,
+ supportsTemplateThinking,
supportsThinking,
+ templateThinkingCompat,
THINKING_LEVELS,
thinkingEffortsOf,
toggleThinkingLevel,
@@ -115,6 +117,15 @@ const CAPACITY_HINT: Readonly<Record<CapacityField, string>> = {
maxTokens: '32K',
}
+/**
+ * 「本地端点思考」开关只对 chat completions 协议有意义。
+ *
+ * pi-ai 的 compat 是逐协议校验的:`thinkingFormat` 与 `chatTemplateKwargs` 只有
+ * `openai-completions` 收,写到 Responses 或 Anthropic 路由的模型上会让整段配置解析失败。
+ * 路由没显式声明协议时(目录路由)无法判断,就不提供这个开关。
+ */
+const TEMPLATE_COMPAT_PROTOCOL = 'openai-completions'
+
function capacitySpelling(value: number | undefined): string {
return value === undefined ? '' : formatCapacity(value)
}
@@ -453,6 +464,24 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
</div>
</div>
</div>
+ {probe.api === TEMPLATE_COMPAT_PROTOCOL
+ ? (
+ <div className={styles.modelField}>
+ <span className={styles.modelFieldLabel} title={t('templateThinkingHint')}>
+ {t('templateThinking')}
+ </span>
+ <div className={styles.modelSwitchRow}>
+ <Switch
+ checked={supportsTemplateThinking(model)}
+ disabled={disabled}
+ label={`${t('templateThinking')} ${index + 1}`}
+ title={t('templateThinkingHint')}
+ onChange={(next) => { patch(index, { compat: templateThinkingCompat(model, next) }) }}
+ />
+ </div>
+ </div>
+ )
+ : null}
{supportsThinking(model)
? (
<div className={styles.modelEfforts} role="group" aria-label={`${t('thinkingLevels')} ${index + 1}`}>
diff --git a/packages/dsh-tauri-model-config/src/client/models/locales.ts b/packages/dsh-tauri-model-config/src/client/models/locales.ts
index 12953e12..45b75d51 100644
--- a/packages/dsh-tauri-model-config/src/client/models/locales.ts
+++ b/packages/dsh-tauri-model-config/src/client/models/locales.ts
@@ -109,6 +109,8 @@ export const en = {
thinkingMode: 'Thinking mode',
thinkingLevels: 'Thinking levels',
thinkingModeHint: 'Declare whether this model thinks, then tick the levels it offers',
+ templateThinking: 'Local endpoint thinking',
+ templateThinkingHint: 'vLLM-style OpenAI-compatible servers read the effort from chat_template_kwargs and accept only the system role; writes compat thinkingFormat=chat-template, chatTemplateKwargs.reasoning_effort={$var: thinking.effort} and supportsDeveloperRole=false',
fetchModelConfig: 'Fetch config',
fetchModelConfigHint: 'Fill in this model\'s limits from the endpoint and its image/thinking capabilities from the model capability table',
autoConfigureModels: 'Configure all models',
@@ -233,6 +235,8 @@ export const zh: { [Key in keyof typeof en]: string } = {
thinkingMode: '思考模式',
thinkingLevels: '思考档位',
thinkingModeHint: '声明该模型是否支持思考,并勾选它提供的档位',
+ templateThinking: '本地端点思考',
+ templateThinkingHint: 'vLLM 等 OpenAI 兼容端点从 chat_template_kwargs 读取思考档位,且只认 system 角色;开启后写入 compat:thinkingFormat=chat-template、chatTemplateKwargs.reasoning_effort={$var: thinking.effort}、supportsDeveloperRole=false',
fetchModelConfig: '获取配置',
fetchModelConfigHint: '从提供方端点读取该模型的上下文与输出上限,并按模型能力表补齐图片与思考档位',
autoConfigureModels: '自动配置所有模型',
diff --git a/packages/dsh-tauri-model-config/src/client/service/model-config.utils.test.ts b/packages/dsh-tauri-model-config/src/client/service/model-config.utils.test.ts
index 66869438..12d216f9 100644
--- a/packages/dsh-tauri-model-config/src/client/service/model-config.utils.test.ts
+++ b/packages/dsh-tauri-model-config/src/client/service/model-config.utils.test.ts
@@ -8,7 +8,9 @@ import {
mergeModelCards,
modelConfigNotice,
supportsImageInput,
+ supportsTemplateThinking,
supportsThinking,
+ templateThinkingCompat,
THINKING_LEVELS,
thinkingEffortsOf,
toggleThinkingLevel,
@@ -119,6 +121,64 @@ describe('thinking levels', () => {
})
})
+describe('template thinking compat', () => {
+ it('reads the switch as on only when the effort travels through the chat template', () => {
+ expect(supportsTemplateThinking({ id: 'm' })).toBe(false)
+ expect(supportsTemplateThinking({ id: 'm', compat: { thinkingFormat: 'chat-template' } })).toBe(false)
+ expect(supportsTemplateThinking({
+ id: 'm',
+ compat: { thinkingFormat: 'chat-template', supportsDeveloperRole: false },
+ })).toBe(true)
+ expect(supportsTemplateThinking({ id: 'm', compat: 'chat-template' })).toBe(false)
+ })
+
+ it('writes the three switches a vLLM-style endpoint needs', () => {
+ expect(templateThinkingCompat({ id: 'm' }, true)).toEqual({
+ supportsDeveloperRole: false,
+ thinkingFormat: 'chat-template',
+ chatTemplateKwargs: { reasoning_effort: { $var: 'thinking.effort' } },
+ })
+ })
+
+ it('keeps the compat entries it does not own', () => {
+ const model = {
+ id: 'm',
+ compat: {
+ supportsStore: false,
+ chatTemplateKwargs: { enable_thinking: true },
+ chatTemplateArgs: {},
+ },
+ }
+ expect(templateThinkingCompat(model, true)).toEqual({
+ supportsStore: false,
+ chatTemplateArgs: {},
+ supportsDeveloperRole: false,
+ thinkingFormat: 'chat-template',
+ chatTemplateKwargs: { enable_thinking: true, reasoning_effort: { $var: 'thinking.effort' } },
+ })
+ })
+
+ it('removes only the switches it wrote, dropping emptied containers', () => {
+ const written = {
+ id: 'm',
+ compat: {
+ supportsDeveloperRole: false,
+ thinkingFormat: 'chat-template',
+ chatTemplateKwargs: { reasoning_effort: { $var: 'thinking.effort' } },
+ },
+ }
+ expect(templateThinkingCompat(written, false)).toBeUndefined()
+ expect(templateThinkingCompat({ id: 'm', compat: { supportsStore: false } }, false))
+ .toEqual({ supportsStore: false })
+ })
+
+ it('does not mutate the compat it was handed', () => {
+ const model = { id: 'm', compat: { chatTemplateKwargs: { enable_thinking: true } } }
+ templateThinkingCompat(model, true)
+ expect(model.compat).toEqual({ chatTemplateKwargs: { enable_thinking: true } })
+ })
+})
+
describe('mergeModelCards', () => {
it('fills only the fields the row leaves empty', () => {
const merged = mergeModelCards(
@@ -195,7 +255,6 @@ describe('mergeModelCards with presets', () => {
contextWindow: 200000,
maxTokens: 16384,
input: ['text', 'image'],
- reasoningEfforts: false,
})
})
@@ -211,7 +270,6 @@ describe('mergeModelCards with presets', () => {
contextWindow: 128000,
maxTokens: 16384,
input: ['text', 'image'],
- reasoningEfforts: false,
})
expect(merged.undisclosed).toEqual([])
})
@@ -234,14 +292,24 @@ describe('mergeModelCards with presets', () => {
expect(merged.models[0]?.reasoningEfforts).toEqual({ off: null, low: 'low', medium: 'medium', high: 'high' })
})
- it('keeps the declared capabilities on a single-row fill and replaces them on a reconfigure', () => {
+ it('keeps the capabilities a row already declares on a single-row fill', () => {
const row = { id: 'gpt-4o', input: ['text'], reasoningEfforts: { off: null, low: 'low' } }
const filled = mergeModelCards([row], [], { targets: ['gpt-4o'] }).models[0]
expect(filled?.input).toEqual(['text'])
expect(filled?.reasoningEfforts).toEqual({ off: null, low: 'low' })
- const reconfigured = mergeModelCards([row], [], { targets: ['gpt-4o'], overwrite: true }).models[0]
+ })
+
+ it('replaces the declared capabilities on a reconfigure', () => {
+ const row = { id: 'o3', input: ['text'], reasoningEfforts: { off: null, low: 'low' } }
+ const reconfigured = mergeModelCards([row], [], { targets: ['o3'], overwrite: true }).models[0]
expect(reconfigured?.input).toEqual(['text', 'image'])
- expect(reconfigured?.reasoningEfforts).toBe(false)
+ expect(reconfigured?.reasoningEfforts).toEqual({ off: null, low: 'low', medium: 'medium', high: 'high' })
+ })
+
+ it('never rewrites a capability the table did not state as unsupported', () => {
+ const row = { id: 'gpt-4o', reasoningEfforts: { off: null, low: 'low' } }
+ const reconfigured = mergeModelCards([row], [], { targets: ['gpt-4o'], overwrite: true }).models[0]
+ expect(reconfigured?.reasoningEfforts).toEqual({ off: null, low: 'low' })
})
})
diff --git a/packages/dsh-tauri-model-config/src/client/service/model-config.utils.ts b/packages/dsh-tauri-model-config/src/client/service/model-config.utils.ts
index 36699703..9acdf747 100644
--- a/packages/dsh-tauri-model-config/src/client/service/model-config.utils.ts
+++ b/packages/dsh-tauri-model-config/src/client/service/model-config.utils.ts
@@ -16,6 +16,26 @@ export const DEFAULT_THINKING_EFFORTS: Readonly<Record<string, string | null>> =
high: 'high',
}
+/**
+ * vLLM 这类 OpenAI 兼容端点读取思考档位的方式:参数走 chat template,而不是顶层的
+ * `reasoning_effort`。档位本身用 pi-ai 的请求态占位符动态填入,因此不必重述模板。
+ */
+const TEMPLATE_THINKING_FORMAT = 'chat-template'
+const TEMPLATE_THINKING_KWARG = 'reasoning_effort'
+const TEMPLATE_THINKING_EFFORT_VAR = 'thinking.effort'
+
+/** 任意值读成普通对象;缺席、数组与标量都读作空表。 */
+function recordOf(value: unknown): Record<string, unknown> {
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
+ return {}
+ return value as Record<string, unknown>
+}
+
+/** 该条目当前的 compat 声明;缺席或非对象读作空表。 */
+function compatOf(model: DeepSeekModelDraft): Record<string, unknown> {
+ return recordOf(model.compat)
+}
+
/**
* 该条目是否还只是「身份」——只有 id/name/description,没有任何能力配置。
* 「获取配置」按钮只在这种条目上出现:已经配置过的行不提供一个会把用户手写值
@@ -94,6 +114,51 @@ export function toggleThinkingLevel(
return Object.keys(next).length === 0 ? false : next
}
+/**
+ * 该条目是否已声明按 chat template 下发思考。
+ *
+ * 两个键一起读:只写 `thinkingFormat` 的条目(例如手写的)在开关上仍读为关,打开时会把端点
+ * 不认 `developer` 角色所必需的 `supportsDeveloperRole: false` 一并补上。
+ */
+export function supportsTemplateThinking(model: DeepSeekModelDraft): boolean {
+ const compat = compatOf(model)
+ return compat.thinkingFormat === TEMPLATE_THINKING_FORMAT && compat.supportsDeveloperRole === false
+}
+
+/**
+ * 开关状态对应的 `compat` 声明值。
+ *
+ * 打开时写入 vLLM 这类 OpenAI 兼容端点需要的三项事实:思考参数走 `chat_template_kwargs`、档位
+ * 由下拉框动态填入、系统提示保持 `system` 角色(这类端点不认 `developer`,否则整轮请求 400)。
+ * 关闭只摘掉这三项,条目里其它 compat 键与 chat template 参数原样保留;compat 被摘空时返回
+ * undefined,让调用方删掉整个字段。
+ * @param model - 该条目当前的声明。
+ * @param next - 打开为写入,关闭为摘除。
+ * @returns 新的 compat 值,或 undefined(整个字段都不该存在)。
+ */
+export function templateThinkingCompat(
+ model: DeepSeekModelDraft,
+ next: boolean,
+): Record<string, unknown> | undefined {
+ const compat = { ...compatOf(model) }
+ const kwargs = { ...recordOf(compat.chatTemplateKwargs) }
+ delete kwargs[TEMPLATE_THINKING_KWARG]
+ if (next) {
+ compat.chatTemplateKwargs = { ...kwargs, [TEMPLATE_THINKING_KWARG]: { $var: TEMPLATE_THINKING_EFFORT_VAR } }
+ compat.thinkingFormat = TEMPLATE_THINKING_FORMAT
+ compat.supportsDeveloperRole = false
+ }
+ else {
+ delete compat.thinkingFormat
+ delete compat.supportsDeveloperRole
+ if (Object.keys(kwargs).length === 0)
+ delete compat.chatTemplateKwargs
+ else
+ compat.chatTemplateKwargs = kwargs
+ }
+ return Object.keys(compat).length === 0 ? undefined : compat
+}
+
export interface ModelConfigMerge {
models: DeepSeekModelDraft[]
/** 至少写入了一个字段的条目数。 */
@@ -153,7 +218,7 @@ export function mergeModelCards(
if (preset?.input !== undefined && (overwrite || model.input === undefined))
patch.input = [...preset.input]
if (preset?.efforts !== undefined && (overwrite || model.reasoningEfforts === undefined))
- patch.reasoningEfforts = preset.efforts === false ? false : { ...preset.efforts }
+ patch.reasoningEfforts = { ...preset.efforts }
if (Object.keys(patch).length === 0) {
if (found === undefined && id.length > 0)
undisclosed.push(id)
diff --git a/packages/dsh-tauri-model-config/src/client/service/model-presets.test.ts b/packages/dsh-tauri-model-config/src/client/service/model-presets.test.ts
index d3e6dffc..41dea2cf 100644
--- a/packages/dsh-tauri-model-config/src/client/service/model-presets.test.ts
+++ b/packages/dsh-tauri-model-config/src/client/service/model-presets.test.ts
@@ -4,21 +4,27 @@ import { presetFor, presetTableSize, setPresetTable } from './model-presets'
const GRADED = { off: null, low: 'low', medium: 'medium', high: 'high' }
const VISION = ['text', 'image']
-const TEXT_ONLY = ['text']
describe('presetFor with the downloaded table', () => {
beforeEach(() => setPresetTable(PRESET_FIXTURE))
it('reads vision and thinking off the table', () => {
expect(presetFor('gpt-4o')?.input).toEqual(VISION)
- expect(presetFor('gpt-4o')?.efforts).toBe(false)
expect(presetFor('o3')?.input).toEqual(VISION)
expect(presetFor('o3')?.efforts).toEqual(GRADED)
- expect(presetFor('deepseek-reasoner')?.input).toEqual(TEXT_ONLY)
expect(presetFor('deepseek-reasoner')?.efforts).toEqual(GRADED)
expect(presetFor('mimo-v2-flash')?.efforts).toEqual(GRADED)
})
+ it('leaves a fact the table does not state undeclared instead of writing it off', () => {
+ expect(presetFor('gpt-4o')).toEqual({ input: VISION, contextWindow: 128000, maxTokens: 16384 })
+ expect(presetFor('deepseek-reasoner')).toEqual({
+ efforts: GRADED,
+ contextWindow: 131072,
+ maxTokens: 65536,
+ })
+ })
+
it('carries the table capacities', () => {
expect(presetFor('gpt-4o')?.contextWindow).toBe(128000)
expect(presetFor('gpt-4o')?.maxTokens).toBe(16384)
diff --git a/packages/dsh-tauri-model-config/src/client/service/model-presets.ts b/packages/dsh-tauri-model-config/src/client/service/model-presets.ts
index d7ce3c42..2fe9ab24 100644
--- a/packages/dsh-tauri-model-config/src/client/service/model-presets.ts
+++ b/packages/dsh-tauri-model-config/src/client/service/model-presets.ts
@@ -5,13 +5,19 @@ import type { PresetRow, PresetTable } from '../../shared/model-presets'
*
* 表由宿主侧从 LiteLLM 的模型价目/容量表现取(见 `src/host/service/model-presets.ts`),给出
* 「支持图片 / 支持思考 / 上下文上限 / 输出上限」四项事实;表里没收录的型号再由家族规则补一条
- * 结论。预设只是起步值:端点披露的容量优先,用户可以随时在高级区改。
+ * 结论。预设只是起步值:端点披露的容量优先,用户可以随时在高级区改;两项能力只写「能」的结论,
+ * 数据集没表态的那一项留空,不会被写成显式的「不支持」。
*/
-/** 预设给出的能力;缺席的字段表示预设没有结论。 */
+/**
+ * 预设给出的能力;缺席的字段表示预设没有结论。
+ *
+ * `input` 只可能声明「收图片」,`efforts` 只可能声明「有档位」——预设不做减法:数据集没表态
+ * 的模态与档位不写进模型条目,让它们保持「继承默认」,而不是被写成显式的「不支持」。
+ */
export interface ModelCapabilityPreset {
input?: readonly string[]
- efforts?: Readonly<Record<string, string | null>> | false
+ efforts?: Readonly<Record<string, string | null>>
contextWindow?: number
maxTokens?: number
}
@@ -76,14 +82,25 @@ function ruleFacts(id: string): { vision: boolean, reasoning: boolean } | undefi
return matched ? { vision, reasoning } : undefined
}
+/**
+ * 把数据集的一行与家族规则合成一条预设。
+ *
+ * 只写「能」的结论:数据集把 0 用作「没有给出这项事实」,家族规则也只按命名补「能」,所以两者
+ * 都没给出结论时该字段缺席。把「未知」写成 `input: ['text']` / `reasoningEfforts: false` 会替用户
+ * 否决掉部署真实具备的能力——本地端点上的模型往往比数据集新,自动配置又会覆盖行内旧值,代价是把
+ * 已经声明的思考与图片能力直接关掉。
+ * @param row - 数据集里该模型的一行事实。
+ * @param rule - 家族规则给出的结论,没有规则命中时为 undefined。
+ * @returns 只含正向结论的预设。
+ */
function combine(row: PresetRow | undefined, rule: { vision: boolean, reasoning: boolean } | undefined): ModelCapabilityPreset {
const vision = row?.[0] === 1 || rule?.vision === true
const reasoning = row?.[1] === 1 || rule?.reasoning === true
const maxInput = row?.[2] ?? 0
const maxOutput = row?.[3] ?? 0
return {
- input: vision ? ['text', 'image'] : ['text'],
- efforts: reasoning ? { ...GRADED } : false,
+ ...vision ? { input: ['text', 'image'] } : {},
+ ...reasoning ? { efforts: { ...GRADED } } : {},
...maxInput === 0 ? {} : { contextWindow: maxInput },
...maxOutput === 0 ? {} : { maxTokens: maxOutput },
}