|
1 | 1 | // Ollama tests cover provider policy api plugin behavior. |
2 | 2 | import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-types"; |
3 | 3 | import { describe, expect, it } from "vitest"; |
4 | | -import { normalizeConfig, resolveThinkingProfile } from "./provider-policy-api.js"; |
| 4 | +import { |
| 5 | + normalizeConfig, |
| 6 | + projectConfiguredModelRow, |
| 7 | + resolveThinkingProfile, |
| 8 | +} from "./provider-policy-api.js"; |
5 | 9 | import { OLLAMA_DEFAULT_BASE_URL } from "./src/defaults.js"; |
6 | 10 |
|
7 | 11 | function createModel(id: string, name: string): ModelDefinitionConfig { |
@@ -60,6 +64,48 @@ describe("ollama provider policy public artifact", () => { |
60 | 64 | ).toStrictEqual({}); |
61 | 65 | }); |
62 | 66 |
|
| 67 | + it.each(["ollama", " OLLAMA-CLOUD "])("skips runtime row normalization for %s", (provider) => { |
| 68 | + expect( |
| 69 | + projectConfiguredModelRow({ |
| 70 | + provider, |
| 71 | + modelId: "qwen3.5:9b", |
| 72 | + model: { |
| 73 | + provider: provider.trim().toLowerCase(), |
| 74 | + id: "qwen3.5:9b", |
| 75 | + api: "ollama", |
| 76 | + baseUrl: OLLAMA_DEFAULT_BASE_URL, |
| 77 | + input: ["text"], |
| 78 | + name: "Qwen 3.5 9B", |
| 79 | + reasoning: true, |
| 80 | + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, |
| 81 | + contextWindow: 128_000, |
| 82 | + maxTokens: 8_192, |
| 83 | + }, |
| 84 | + }), |
| 85 | + ).toBeNull(); |
| 86 | + }); |
| 87 | + |
| 88 | + it("keeps unrelated providers on the runtime normalization path", () => { |
| 89 | + expect( |
| 90 | + projectConfiguredModelRow({ |
| 91 | + provider: "openai", |
| 92 | + modelId: "gpt-5.5", |
| 93 | + model: { |
| 94 | + provider: "openai", |
| 95 | + id: "gpt-5.5", |
| 96 | + api: "openai-responses", |
| 97 | + baseUrl: "https://api.openai.com/v1", |
| 98 | + input: ["text"], |
| 99 | + name: "GPT-5.5", |
| 100 | + reasoning: true, |
| 101 | + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, |
| 102 | + contextWindow: 128_000, |
| 103 | + maxTokens: 8_192, |
| 104 | + }, |
| 105 | + }), |
| 106 | + ).toBeUndefined(); |
| 107 | + }); |
| 108 | + |
63 | 109 | it("exposes max thinking for reasoning-capable models without full plugin activation", () => { |
64 | 110 | expect(resolveThinkingProfile({ reasoning: true })).toEqual({ |
65 | 111 | levels: [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }, { id: "max" }], |
|
0 commit comments