visual-ai-assertions 0.25.0 → 0.27.0
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.
- package/README.md +146 -76
- package/dist/index.cjs +225 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -13
- package/dist/index.d.ts +47 -13
- package/dist/index.js +225 -137
- package/dist/index.js.map +1 -1
- package/package.json +2 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/** Supported reasoning effort levels. */
|
|
4
|
+
/**
|
|
5
|
+
* Abstract reasoning-effort hint. Each provider driver maps it to its native
|
|
6
|
+
* mechanism; levels a provider lacks clamp to its nearest tier.
|
|
7
|
+
*
|
|
8
|
+
* `minimal` is **not universally accepted**. OpenAI rejects it per-model with
|
|
9
|
+
* HTTP 400 ("Unsupported value: 'minimal' is not supported with the
|
|
10
|
+
* '<model>' model"), observed on `gpt-6-astra` and `gpt-6.1-sol`, whose
|
|
11
|
+
* supported set is low/medium/high/xhigh/max, and on `gpt-6-sol` and
|
|
12
|
+
* `gpt-6-luna`, which accept none/low/medium/high/xhigh/max. Gemini defines
|
|
13
|
+
* the tier but some models (e.g. Gemini 3.1 Pro) reject it, so Google and
|
|
14
|
+
* OpenRouter clamp it to `low` rather than send it. Use `minimal` only
|
|
15
|
+
* against an OpenAI model known to accept it; `low` is the portable floor.
|
|
16
|
+
*/
|
|
4
17
|
declare const ReasoningEffort: {
|
|
18
|
+
readonly MINIMAL: "minimal";
|
|
5
19
|
readonly LOW: "low";
|
|
6
20
|
readonly MEDIUM: "medium";
|
|
7
21
|
readonly HIGH: "high";
|
|
@@ -34,16 +48,22 @@ declare const Model: {
|
|
|
34
48
|
readonly Anthropic: {
|
|
35
49
|
readonly FABLE_5_1: "claude-fable-5-1";
|
|
36
50
|
readonly FABLE_5: "claude-fable-5";
|
|
51
|
+
readonly OPUS_5_5: "claude-opus-5-5";
|
|
37
52
|
readonly OPUS_5: "claude-opus-5";
|
|
38
53
|
readonly OPUS_4_8: "claude-opus-4-8";
|
|
39
54
|
readonly OPUS_4_7: "claude-opus-4-7";
|
|
40
55
|
readonly OPUS_4_6: "claude-opus-4-6";
|
|
56
|
+
readonly SONNET_5_5: "claude-sonnet-5-5";
|
|
41
57
|
readonly SONNET_5: "claude-sonnet-5";
|
|
42
58
|
readonly SONNET_4_6: "claude-sonnet-4-6";
|
|
59
|
+
readonly HAIKU_5_5: "claude-haiku-5-5";
|
|
43
60
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
44
61
|
};
|
|
45
62
|
readonly OpenAI: {
|
|
46
63
|
readonly GPT_6_ASTRA: "gpt-6-astra";
|
|
64
|
+
readonly GPT_6_1_SOL: "gpt-6.1-sol";
|
|
65
|
+
readonly GPT_6_SOL: "gpt-6-sol";
|
|
66
|
+
readonly GPT_6_LUNA: "gpt-6-luna";
|
|
47
67
|
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
48
68
|
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
49
69
|
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
@@ -72,6 +92,7 @@ declare const Model: {
|
|
|
72
92
|
*/
|
|
73
93
|
readonly OpenRouter: {
|
|
74
94
|
readonly MUSE_SPARK_1_3: "meta/muse-spark-1.3";
|
|
95
|
+
readonly GROK_4_7: "x-ai/grok-4.7";
|
|
75
96
|
readonly GROK_4_6: "x-ai/grok-4.6";
|
|
76
97
|
readonly GROK_4_5: "x-ai/grok-4.5";
|
|
77
98
|
readonly KIMI_K3: "moonshotai/kimi-k3";
|
|
@@ -80,16 +101,28 @@ declare const Model: {
|
|
|
80
101
|
readonly QWEN_3_7_PLUS: "qwen/qwen3.7-plus";
|
|
81
102
|
readonly QWEN_3_6_FLASH: "qwen/qwen3.6-flash";
|
|
82
103
|
readonly GLM_5_3_FLASH: "z-ai/glm-5.3-flash";
|
|
104
|
+
readonly MIMO_V2_6_PRO: "xiaomi/mimo-v2.6-pro";
|
|
83
105
|
};
|
|
84
106
|
};
|
|
85
107
|
/** Union of all built-in model name literals exposed by `Model`. */
|
|
86
108
|
type KnownModelName = (typeof Model.Anthropic)[keyof typeof Model.Anthropic] | (typeof Model.OpenAI)[keyof typeof Model.OpenAI] | (typeof Model.Google)[keyof typeof Model.Google] | (typeof Model.OpenRouter)[keyof typeof Model.OpenRouter];
|
|
87
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Default model selection used when a caller omits `config.model`.
|
|
111
|
+
*
|
|
112
|
+
* Two of these carry constraints the older defaults did not:
|
|
113
|
+
* - `gpt-6.1-sol` rejects `reasoningEffort: "minimal"` (and `none`) with HTTP
|
|
114
|
+
* 400; `low` is the floor. See the `ReasoningEffort` note above.
|
|
115
|
+
* - `meta/muse-spark-1.3` is age-gated on OpenRouter and returns HTTP 403 until
|
|
116
|
+
* the account completes the 18+ confirmation at
|
|
117
|
+
* openrouter.ai/settings/preferences. It also reasons by default (~370-814
|
|
118
|
+
* reasoning tokens per call) even with no effort configured, so cost per call
|
|
119
|
+
* runs above what its headline rate suggests.
|
|
120
|
+
*/
|
|
88
121
|
declare const DEFAULT_MODELS: {
|
|
89
|
-
readonly anthropic: "claude-sonnet-
|
|
90
|
-
readonly openai: "gpt-
|
|
91
|
-
readonly google: "gemini-3-flash
|
|
92
|
-
readonly openrouter: "
|
|
122
|
+
readonly anthropic: "claude-sonnet-5-5";
|
|
123
|
+
readonly openai: "gpt-6.1-sol";
|
|
124
|
+
readonly google: "gemini-3.8-flash";
|
|
125
|
+
readonly openrouter: "meta/muse-spark-1.3";
|
|
93
126
|
};
|
|
94
127
|
/** Built-in content checks available through `client.content()`. */
|
|
95
128
|
declare const Content: {
|
|
@@ -178,13 +211,13 @@ declare const StatementResultSchema: z.ZodObject<{
|
|
|
178
211
|
statement: string;
|
|
179
212
|
pass: boolean;
|
|
180
213
|
reasoning: string;
|
|
181
|
-
confidence?: "
|
|
214
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
182
215
|
timestampSeconds?: number | null | undefined;
|
|
183
216
|
}, {
|
|
184
217
|
statement: string;
|
|
185
218
|
pass: boolean;
|
|
186
219
|
reasoning: string;
|
|
187
|
-
confidence?: "
|
|
220
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
188
221
|
timestampSeconds?: number | null | undefined;
|
|
189
222
|
}>;
|
|
190
223
|
/** Outcome of a single statement evaluated by `check()`. */
|
|
@@ -303,13 +336,13 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
303
336
|
statement: string;
|
|
304
337
|
pass: boolean;
|
|
305
338
|
reasoning: string;
|
|
306
|
-
confidence?: "
|
|
339
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
307
340
|
timestampSeconds?: number | null | undefined;
|
|
308
341
|
}, {
|
|
309
342
|
statement: string;
|
|
310
343
|
pass: boolean;
|
|
311
344
|
reasoning: string;
|
|
312
|
-
confidence?: "
|
|
345
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
313
346
|
timestampSeconds?: number | null | undefined;
|
|
314
347
|
}>, "many">;
|
|
315
348
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -325,7 +358,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
325
358
|
statement: string;
|
|
326
359
|
pass: boolean;
|
|
327
360
|
reasoning: string;
|
|
328
|
-
confidence?: "
|
|
361
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
329
362
|
timestampSeconds?: number | null | undefined;
|
|
330
363
|
}[];
|
|
331
364
|
usage?: {
|
|
@@ -350,7 +383,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
350
383
|
statement: string;
|
|
351
384
|
pass: boolean;
|
|
352
385
|
reasoning: string;
|
|
353
|
-
confidence?: "
|
|
386
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
354
387
|
timestampSeconds?: number | null | undefined;
|
|
355
388
|
}[];
|
|
356
389
|
usage?: {
|
|
@@ -968,8 +1001,9 @@ interface VisualAIClient {
|
|
|
968
1001
|
* @param imageA Baseline image source.
|
|
969
1002
|
* @param imageB Candidate image source.
|
|
970
1003
|
* @param options Optional comparison prompt, instructions, and diff-image settings.
|
|
971
|
-
*
|
|
972
|
-
* pass `{ diffImage: false }` to opt out.
|
|
1004
|
+
* Gemini flash models (`DIFF_ALLOWED_MODELS`) generate an annotated diff image
|
|
1005
|
+
* by default; pass `{ diffImage: false }` to opt out. Flash-Lite and Pro tiers
|
|
1006
|
+
* produce none even when asked.
|
|
973
1007
|
* @returns A structured comparison result with optional diff image metadata.
|
|
974
1008
|
* @throws {VisualAIImageError} When either image cannot be loaded or decoded.
|
|
975
1009
|
* @throws {VisualAIError} When the provider rejects the request or returns invalid output.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/** Supported reasoning effort levels. */
|
|
4
|
+
/**
|
|
5
|
+
* Abstract reasoning-effort hint. Each provider driver maps it to its native
|
|
6
|
+
* mechanism; levels a provider lacks clamp to its nearest tier.
|
|
7
|
+
*
|
|
8
|
+
* `minimal` is **not universally accepted**. OpenAI rejects it per-model with
|
|
9
|
+
* HTTP 400 ("Unsupported value: 'minimal' is not supported with the
|
|
10
|
+
* '<model>' model"), observed on `gpt-6-astra` and `gpt-6.1-sol`, whose
|
|
11
|
+
* supported set is low/medium/high/xhigh/max, and on `gpt-6-sol` and
|
|
12
|
+
* `gpt-6-luna`, which accept none/low/medium/high/xhigh/max. Gemini defines
|
|
13
|
+
* the tier but some models (e.g. Gemini 3.1 Pro) reject it, so Google and
|
|
14
|
+
* OpenRouter clamp it to `low` rather than send it. Use `minimal` only
|
|
15
|
+
* against an OpenAI model known to accept it; `low` is the portable floor.
|
|
16
|
+
*/
|
|
4
17
|
declare const ReasoningEffort: {
|
|
18
|
+
readonly MINIMAL: "minimal";
|
|
5
19
|
readonly LOW: "low";
|
|
6
20
|
readonly MEDIUM: "medium";
|
|
7
21
|
readonly HIGH: "high";
|
|
@@ -34,16 +48,22 @@ declare const Model: {
|
|
|
34
48
|
readonly Anthropic: {
|
|
35
49
|
readonly FABLE_5_1: "claude-fable-5-1";
|
|
36
50
|
readonly FABLE_5: "claude-fable-5";
|
|
51
|
+
readonly OPUS_5_5: "claude-opus-5-5";
|
|
37
52
|
readonly OPUS_5: "claude-opus-5";
|
|
38
53
|
readonly OPUS_4_8: "claude-opus-4-8";
|
|
39
54
|
readonly OPUS_4_7: "claude-opus-4-7";
|
|
40
55
|
readonly OPUS_4_6: "claude-opus-4-6";
|
|
56
|
+
readonly SONNET_5_5: "claude-sonnet-5-5";
|
|
41
57
|
readonly SONNET_5: "claude-sonnet-5";
|
|
42
58
|
readonly SONNET_4_6: "claude-sonnet-4-6";
|
|
59
|
+
readonly HAIKU_5_5: "claude-haiku-5-5";
|
|
43
60
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
44
61
|
};
|
|
45
62
|
readonly OpenAI: {
|
|
46
63
|
readonly GPT_6_ASTRA: "gpt-6-astra";
|
|
64
|
+
readonly GPT_6_1_SOL: "gpt-6.1-sol";
|
|
65
|
+
readonly GPT_6_SOL: "gpt-6-sol";
|
|
66
|
+
readonly GPT_6_LUNA: "gpt-6-luna";
|
|
47
67
|
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
48
68
|
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
49
69
|
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
@@ -72,6 +92,7 @@ declare const Model: {
|
|
|
72
92
|
*/
|
|
73
93
|
readonly OpenRouter: {
|
|
74
94
|
readonly MUSE_SPARK_1_3: "meta/muse-spark-1.3";
|
|
95
|
+
readonly GROK_4_7: "x-ai/grok-4.7";
|
|
75
96
|
readonly GROK_4_6: "x-ai/grok-4.6";
|
|
76
97
|
readonly GROK_4_5: "x-ai/grok-4.5";
|
|
77
98
|
readonly KIMI_K3: "moonshotai/kimi-k3";
|
|
@@ -80,16 +101,28 @@ declare const Model: {
|
|
|
80
101
|
readonly QWEN_3_7_PLUS: "qwen/qwen3.7-plus";
|
|
81
102
|
readonly QWEN_3_6_FLASH: "qwen/qwen3.6-flash";
|
|
82
103
|
readonly GLM_5_3_FLASH: "z-ai/glm-5.3-flash";
|
|
104
|
+
readonly MIMO_V2_6_PRO: "xiaomi/mimo-v2.6-pro";
|
|
83
105
|
};
|
|
84
106
|
};
|
|
85
107
|
/** Union of all built-in model name literals exposed by `Model`. */
|
|
86
108
|
type KnownModelName = (typeof Model.Anthropic)[keyof typeof Model.Anthropic] | (typeof Model.OpenAI)[keyof typeof Model.OpenAI] | (typeof Model.Google)[keyof typeof Model.Google] | (typeof Model.OpenRouter)[keyof typeof Model.OpenRouter];
|
|
87
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Default model selection used when a caller omits `config.model`.
|
|
111
|
+
*
|
|
112
|
+
* Two of these carry constraints the older defaults did not:
|
|
113
|
+
* - `gpt-6.1-sol` rejects `reasoningEffort: "minimal"` (and `none`) with HTTP
|
|
114
|
+
* 400; `low` is the floor. See the `ReasoningEffort` note above.
|
|
115
|
+
* - `meta/muse-spark-1.3` is age-gated on OpenRouter and returns HTTP 403 until
|
|
116
|
+
* the account completes the 18+ confirmation at
|
|
117
|
+
* openrouter.ai/settings/preferences. It also reasons by default (~370-814
|
|
118
|
+
* reasoning tokens per call) even with no effort configured, so cost per call
|
|
119
|
+
* runs above what its headline rate suggests.
|
|
120
|
+
*/
|
|
88
121
|
declare const DEFAULT_MODELS: {
|
|
89
|
-
readonly anthropic: "claude-sonnet-
|
|
90
|
-
readonly openai: "gpt-
|
|
91
|
-
readonly google: "gemini-3-flash
|
|
92
|
-
readonly openrouter: "
|
|
122
|
+
readonly anthropic: "claude-sonnet-5-5";
|
|
123
|
+
readonly openai: "gpt-6.1-sol";
|
|
124
|
+
readonly google: "gemini-3.8-flash";
|
|
125
|
+
readonly openrouter: "meta/muse-spark-1.3";
|
|
93
126
|
};
|
|
94
127
|
/** Built-in content checks available through `client.content()`. */
|
|
95
128
|
declare const Content: {
|
|
@@ -178,13 +211,13 @@ declare const StatementResultSchema: z.ZodObject<{
|
|
|
178
211
|
statement: string;
|
|
179
212
|
pass: boolean;
|
|
180
213
|
reasoning: string;
|
|
181
|
-
confidence?: "
|
|
214
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
182
215
|
timestampSeconds?: number | null | undefined;
|
|
183
216
|
}, {
|
|
184
217
|
statement: string;
|
|
185
218
|
pass: boolean;
|
|
186
219
|
reasoning: string;
|
|
187
|
-
confidence?: "
|
|
220
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
188
221
|
timestampSeconds?: number | null | undefined;
|
|
189
222
|
}>;
|
|
190
223
|
/** Outcome of a single statement evaluated by `check()`. */
|
|
@@ -303,13 +336,13 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
303
336
|
statement: string;
|
|
304
337
|
pass: boolean;
|
|
305
338
|
reasoning: string;
|
|
306
|
-
confidence?: "
|
|
339
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
307
340
|
timestampSeconds?: number | null | undefined;
|
|
308
341
|
}, {
|
|
309
342
|
statement: string;
|
|
310
343
|
pass: boolean;
|
|
311
344
|
reasoning: string;
|
|
312
|
-
confidence?: "
|
|
345
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
313
346
|
timestampSeconds?: number | null | undefined;
|
|
314
347
|
}>, "many">;
|
|
315
348
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -325,7 +358,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
325
358
|
statement: string;
|
|
326
359
|
pass: boolean;
|
|
327
360
|
reasoning: string;
|
|
328
|
-
confidence?: "
|
|
361
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
329
362
|
timestampSeconds?: number | null | undefined;
|
|
330
363
|
}[];
|
|
331
364
|
usage?: {
|
|
@@ -350,7 +383,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
350
383
|
statement: string;
|
|
351
384
|
pass: boolean;
|
|
352
385
|
reasoning: string;
|
|
353
|
-
confidence?: "
|
|
386
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
354
387
|
timestampSeconds?: number | null | undefined;
|
|
355
388
|
}[];
|
|
356
389
|
usage?: {
|
|
@@ -968,8 +1001,9 @@ interface VisualAIClient {
|
|
|
968
1001
|
* @param imageA Baseline image source.
|
|
969
1002
|
* @param imageB Candidate image source.
|
|
970
1003
|
* @param options Optional comparison prompt, instructions, and diff-image settings.
|
|
971
|
-
*
|
|
972
|
-
* pass `{ diffImage: false }` to opt out.
|
|
1004
|
+
* Gemini flash models (`DIFF_ALLOWED_MODELS`) generate an annotated diff image
|
|
1005
|
+
* by default; pass `{ diffImage: false }` to opt out. Flash-Lite and Pro tiers
|
|
1006
|
+
* produce none even when asked.
|
|
973
1007
|
* @returns A structured comparison result with optional diff image metadata.
|
|
974
1008
|
* @throws {VisualAIImageError} When either image cannot be loaded or decoded.
|
|
975
1009
|
* @throws {VisualAIError} When the provider rejects the request or returns invalid output.
|