feat: added build-time compatibility in ModelSpec/buildModel pipeline
- Centralized catalog and registry handling on `ModelSpec` and `buildModel`, resolving compatibility at model build time. - Removed runtime compatibility detectors and switched provider request flows to direct `model.compat` reads. - Added compat fields (`supportsReasoningParams`, `alwaysSendMaxTokens`, `strictResponsesPairing`, `whenThinking`). - Persisted explicit compatibility overrides through `compatConfig` in discovery and cache merge paths.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi } from "bun:test";
|
||||
import type { Model } from "@oh-my-pi/pi-ai";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types";
|
||||
import { executeBuiltinSlashCommand } from "@oh-my-pi/pi-coding-agent/slash-commands/builtin-registry";
|
||||
import { buildNamedToolChoice } from "@oh-my-pi/pi-coding-agent/utils/tool-choice";
|
||||
@@ -98,7 +99,7 @@ describe("/force slash command", () => {
|
||||
});
|
||||
|
||||
it("builds a named Ollama choice for local forced tools", () => {
|
||||
const model = {
|
||||
const model = buildModel({
|
||||
id: "ggml-org/gemma-3-1b-it/GGUF",
|
||||
name: "Gemma 3 1B",
|
||||
api: "ollama-chat",
|
||||
@@ -109,7 +110,7 @@ describe("/force slash command", () => {
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 32_768,
|
||||
maxTokens: 8_192,
|
||||
} satisfies Model<"ollama-chat">;
|
||||
}) satisfies Model<"ollama-chat">;
|
||||
|
||||
expect(buildNamedToolChoice("write", model)).toEqual({ type: "function", name: "write" });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user