feat(models): move manual reasoning efforts into a catalog override
PR #69 added efforts for meta/muse-spark-* directly to the generated catalog, which the drift check flags and the daily sync job reverts. Keep src/commandcode-catalog.ts byte-identical to upstream and merge a separate src/commandcode-catalog-overrides.ts over it at load time. A test fails as soon as upstream publishes efforts for an overridden model so the override gets removed instead of shadowing the CLI catalog. Verified against the live endpoint: pi --thinking xhigh sends reasoning_effort="xhigh" for meta/muse-spark-1.2-contributor and the request succeeds; --thinking off sends none. Closes #69
This commit is contained in:
+25
-1
@@ -4,7 +4,11 @@ import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { describe, it } from "node:test"
|
||||
|
||||
import { COMMAND_CODE_CLI_VERSION } from "../src/commandcode-catalog.ts"
|
||||
import { MODEL_EFFORT_OVERRIDES } from "../src/commandcode-catalog-overrides.ts"
|
||||
import {
|
||||
COMMAND_CODE_CLI_VERSION,
|
||||
MODEL_EFFORTS as CATALOG_MODEL_EFFORTS,
|
||||
} from "../src/commandcode-catalog.ts"
|
||||
import {
|
||||
apiForModelId,
|
||||
baseUrlForModel,
|
||||
@@ -192,6 +196,26 @@ describe("commandCodeModelsFromApiResponse()", () => {
|
||||
}
|
||||
})
|
||||
|
||||
it("merges manual effort overrides over the generated catalog", () => {
|
||||
const validEfforts = new Set(["minimal", "low", "medium", "high", "xhigh", "max"])
|
||||
assert.ok(Object.keys(MODEL_EFFORT_OVERRIDES).length > 0)
|
||||
for (const [modelId, efforts] of Object.entries(MODEL_EFFORT_OVERRIDES)) {
|
||||
assert.equal(MODEL_REASONING[modelId], true, `${modelId} override needs a reasoning flag`)
|
||||
assert.equal(
|
||||
CATALOG_MODEL_EFFORTS[modelId],
|
||||
undefined,
|
||||
`${modelId} now has upstream efforts; drop the manual override`,
|
||||
)
|
||||
assert.ok(efforts.length > 0)
|
||||
assert.ok(efforts.every((effort) => validEfforts.has(effort)))
|
||||
assert.deepEqual(MODEL_EFFORTS[modelId], efforts)
|
||||
assert.deepEqual(thinkingMetadataForModel(modelId)?.thinking?.efforts, efforts)
|
||||
}
|
||||
for (const [modelId, efforts] of Object.entries(CATALOG_MODEL_EFFORTS)) {
|
||||
assert.deepEqual(MODEL_EFFORTS[modelId], efforts, `${modelId} upstream efforts changed`)
|
||||
}
|
||||
})
|
||||
|
||||
it("builds separate canonical pi and OMP metadata", () => {
|
||||
for (const [modelId, efforts] of Object.entries(MODEL_EFFORTS)) {
|
||||
const metadata = thinkingMetadataForModel(modelId)
|
||||
|
||||
Reference in New Issue
Block a user