visual-ai-assertions 0.25.0 → 0.26.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 +96 -76
- package/dist/index.cjs +216 -136
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -13
- package/dist/index.d.ts +46 -13
- package/dist/index.js +216 -136
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
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,21 @@ 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";
|
|
43
59
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
44
60
|
};
|
|
45
61
|
readonly OpenAI: {
|
|
46
62
|
readonly GPT_6_ASTRA: "gpt-6-astra";
|
|
63
|
+
readonly GPT_6_1_SOL: "gpt-6.1-sol";
|
|
64
|
+
readonly GPT_6_SOL: "gpt-6-sol";
|
|
65
|
+
readonly GPT_6_LUNA: "gpt-6-luna";
|
|
47
66
|
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
48
67
|
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
49
68
|
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
@@ -72,6 +91,7 @@ declare const Model: {
|
|
|
72
91
|
*/
|
|
73
92
|
readonly OpenRouter: {
|
|
74
93
|
readonly MUSE_SPARK_1_3: "meta/muse-spark-1.3";
|
|
94
|
+
readonly GROK_4_7: "x-ai/grok-4.7";
|
|
75
95
|
readonly GROK_4_6: "x-ai/grok-4.6";
|
|
76
96
|
readonly GROK_4_5: "x-ai/grok-4.5";
|
|
77
97
|
readonly KIMI_K3: "moonshotai/kimi-k3";
|
|
@@ -80,16 +100,28 @@ declare const Model: {
|
|
|
80
100
|
readonly QWEN_3_7_PLUS: "qwen/qwen3.7-plus";
|
|
81
101
|
readonly QWEN_3_6_FLASH: "qwen/qwen3.6-flash";
|
|
82
102
|
readonly GLM_5_3_FLASH: "z-ai/glm-5.3-flash";
|
|
103
|
+
readonly MIMO_V2_6_PRO: "xiaomi/mimo-v2.6-pro";
|
|
83
104
|
};
|
|
84
105
|
};
|
|
85
106
|
/** Union of all built-in model name literals exposed by `Model`. */
|
|
86
107
|
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
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Default model selection used when a caller omits `config.model`.
|
|
110
|
+
*
|
|
111
|
+
* Two of these carry constraints the older defaults did not:
|
|
112
|
+
* - `gpt-6.1-sol` rejects `reasoningEffort: "minimal"` (and `none`) with HTTP
|
|
113
|
+
* 400; `low` is the floor. See the `ReasoningEffort` note above.
|
|
114
|
+
* - `meta/muse-spark-1.3` is age-gated on OpenRouter and returns HTTP 403 until
|
|
115
|
+
* the account completes the 18+ confirmation at
|
|
116
|
+
* openrouter.ai/settings/preferences. It also reasons by default (~370-814
|
|
117
|
+
* reasoning tokens per call) even with no effort configured, so cost per call
|
|
118
|
+
* runs above what its headline rate suggests.
|
|
119
|
+
*/
|
|
88
120
|
declare const DEFAULT_MODELS: {
|
|
89
|
-
readonly anthropic: "claude-sonnet-
|
|
90
|
-
readonly openai: "gpt-
|
|
91
|
-
readonly google: "gemini-3-flash
|
|
92
|
-
readonly openrouter: "
|
|
121
|
+
readonly anthropic: "claude-sonnet-5-5";
|
|
122
|
+
readonly openai: "gpt-6.1-sol";
|
|
123
|
+
readonly google: "gemini-3.8-flash";
|
|
124
|
+
readonly openrouter: "meta/muse-spark-1.3";
|
|
93
125
|
};
|
|
94
126
|
/** Built-in content checks available through `client.content()`. */
|
|
95
127
|
declare const Content: {
|
|
@@ -178,13 +210,13 @@ declare const StatementResultSchema: z.ZodObject<{
|
|
|
178
210
|
statement: string;
|
|
179
211
|
pass: boolean;
|
|
180
212
|
reasoning: string;
|
|
181
|
-
confidence?: "
|
|
213
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
182
214
|
timestampSeconds?: number | null | undefined;
|
|
183
215
|
}, {
|
|
184
216
|
statement: string;
|
|
185
217
|
pass: boolean;
|
|
186
218
|
reasoning: string;
|
|
187
|
-
confidence?: "
|
|
219
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
188
220
|
timestampSeconds?: number | null | undefined;
|
|
189
221
|
}>;
|
|
190
222
|
/** Outcome of a single statement evaluated by `check()`. */
|
|
@@ -303,13 +335,13 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
303
335
|
statement: string;
|
|
304
336
|
pass: boolean;
|
|
305
337
|
reasoning: string;
|
|
306
|
-
confidence?: "
|
|
338
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
307
339
|
timestampSeconds?: number | null | undefined;
|
|
308
340
|
}, {
|
|
309
341
|
statement: string;
|
|
310
342
|
pass: boolean;
|
|
311
343
|
reasoning: string;
|
|
312
|
-
confidence?: "
|
|
344
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
313
345
|
timestampSeconds?: number | null | undefined;
|
|
314
346
|
}>, "many">;
|
|
315
347
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -325,7 +357,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
325
357
|
statement: string;
|
|
326
358
|
pass: boolean;
|
|
327
359
|
reasoning: string;
|
|
328
|
-
confidence?: "
|
|
360
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
329
361
|
timestampSeconds?: number | null | undefined;
|
|
330
362
|
}[];
|
|
331
363
|
usage?: {
|
|
@@ -350,7 +382,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
350
382
|
statement: string;
|
|
351
383
|
pass: boolean;
|
|
352
384
|
reasoning: string;
|
|
353
|
-
confidence?: "
|
|
385
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
354
386
|
timestampSeconds?: number | null | undefined;
|
|
355
387
|
}[];
|
|
356
388
|
usage?: {
|
|
@@ -968,8 +1000,9 @@ interface VisualAIClient {
|
|
|
968
1000
|
* @param imageA Baseline image source.
|
|
969
1001
|
* @param imageB Candidate image source.
|
|
970
1002
|
* @param options Optional comparison prompt, instructions, and diff-image settings.
|
|
971
|
-
*
|
|
972
|
-
* pass `{ diffImage: false }` to opt out.
|
|
1003
|
+
* Gemini flash models (`DIFF_ALLOWED_MODELS`) generate an annotated diff image
|
|
1004
|
+
* by default; pass `{ diffImage: false }` to opt out. Flash-Lite and Pro tiers
|
|
1005
|
+
* produce none even when asked.
|
|
973
1006
|
* @returns A structured comparison result with optional diff image metadata.
|
|
974
1007
|
* @throws {VisualAIImageError} When either image cannot be loaded or decoded.
|
|
975
1008
|
* @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,21 @@ 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";
|
|
43
59
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
44
60
|
};
|
|
45
61
|
readonly OpenAI: {
|
|
46
62
|
readonly GPT_6_ASTRA: "gpt-6-astra";
|
|
63
|
+
readonly GPT_6_1_SOL: "gpt-6.1-sol";
|
|
64
|
+
readonly GPT_6_SOL: "gpt-6-sol";
|
|
65
|
+
readonly GPT_6_LUNA: "gpt-6-luna";
|
|
47
66
|
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
48
67
|
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
49
68
|
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
@@ -72,6 +91,7 @@ declare const Model: {
|
|
|
72
91
|
*/
|
|
73
92
|
readonly OpenRouter: {
|
|
74
93
|
readonly MUSE_SPARK_1_3: "meta/muse-spark-1.3";
|
|
94
|
+
readonly GROK_4_7: "x-ai/grok-4.7";
|
|
75
95
|
readonly GROK_4_6: "x-ai/grok-4.6";
|
|
76
96
|
readonly GROK_4_5: "x-ai/grok-4.5";
|
|
77
97
|
readonly KIMI_K3: "moonshotai/kimi-k3";
|
|
@@ -80,16 +100,28 @@ declare const Model: {
|
|
|
80
100
|
readonly QWEN_3_7_PLUS: "qwen/qwen3.7-plus";
|
|
81
101
|
readonly QWEN_3_6_FLASH: "qwen/qwen3.6-flash";
|
|
82
102
|
readonly GLM_5_3_FLASH: "z-ai/glm-5.3-flash";
|
|
103
|
+
readonly MIMO_V2_6_PRO: "xiaomi/mimo-v2.6-pro";
|
|
83
104
|
};
|
|
84
105
|
};
|
|
85
106
|
/** Union of all built-in model name literals exposed by `Model`. */
|
|
86
107
|
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
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Default model selection used when a caller omits `config.model`.
|
|
110
|
+
*
|
|
111
|
+
* Two of these carry constraints the older defaults did not:
|
|
112
|
+
* - `gpt-6.1-sol` rejects `reasoningEffort: "minimal"` (and `none`) with HTTP
|
|
113
|
+
* 400; `low` is the floor. See the `ReasoningEffort` note above.
|
|
114
|
+
* - `meta/muse-spark-1.3` is age-gated on OpenRouter and returns HTTP 403 until
|
|
115
|
+
* the account completes the 18+ confirmation at
|
|
116
|
+
* openrouter.ai/settings/preferences. It also reasons by default (~370-814
|
|
117
|
+
* reasoning tokens per call) even with no effort configured, so cost per call
|
|
118
|
+
* runs above what its headline rate suggests.
|
|
119
|
+
*/
|
|
88
120
|
declare const DEFAULT_MODELS: {
|
|
89
|
-
readonly anthropic: "claude-sonnet-
|
|
90
|
-
readonly openai: "gpt-
|
|
91
|
-
readonly google: "gemini-3-flash
|
|
92
|
-
readonly openrouter: "
|
|
121
|
+
readonly anthropic: "claude-sonnet-5-5";
|
|
122
|
+
readonly openai: "gpt-6.1-sol";
|
|
123
|
+
readonly google: "gemini-3.8-flash";
|
|
124
|
+
readonly openrouter: "meta/muse-spark-1.3";
|
|
93
125
|
};
|
|
94
126
|
/** Built-in content checks available through `client.content()`. */
|
|
95
127
|
declare const Content: {
|
|
@@ -178,13 +210,13 @@ declare const StatementResultSchema: z.ZodObject<{
|
|
|
178
210
|
statement: string;
|
|
179
211
|
pass: boolean;
|
|
180
212
|
reasoning: string;
|
|
181
|
-
confidence?: "
|
|
213
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
182
214
|
timestampSeconds?: number | null | undefined;
|
|
183
215
|
}, {
|
|
184
216
|
statement: string;
|
|
185
217
|
pass: boolean;
|
|
186
218
|
reasoning: string;
|
|
187
|
-
confidence?: "
|
|
219
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
188
220
|
timestampSeconds?: number | null | undefined;
|
|
189
221
|
}>;
|
|
190
222
|
/** Outcome of a single statement evaluated by `check()`. */
|
|
@@ -303,13 +335,13 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
303
335
|
statement: string;
|
|
304
336
|
pass: boolean;
|
|
305
337
|
reasoning: string;
|
|
306
|
-
confidence?: "
|
|
338
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
307
339
|
timestampSeconds?: number | null | undefined;
|
|
308
340
|
}, {
|
|
309
341
|
statement: string;
|
|
310
342
|
pass: boolean;
|
|
311
343
|
reasoning: string;
|
|
312
|
-
confidence?: "
|
|
344
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
313
345
|
timestampSeconds?: number | null | undefined;
|
|
314
346
|
}>, "many">;
|
|
315
347
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -325,7 +357,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
325
357
|
statement: string;
|
|
326
358
|
pass: boolean;
|
|
327
359
|
reasoning: string;
|
|
328
|
-
confidence?: "
|
|
360
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
329
361
|
timestampSeconds?: number | null | undefined;
|
|
330
362
|
}[];
|
|
331
363
|
usage?: {
|
|
@@ -350,7 +382,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
350
382
|
statement: string;
|
|
351
383
|
pass: boolean;
|
|
352
384
|
reasoning: string;
|
|
353
|
-
confidence?: "
|
|
385
|
+
confidence?: "low" | "medium" | "high" | undefined;
|
|
354
386
|
timestampSeconds?: number | null | undefined;
|
|
355
387
|
}[];
|
|
356
388
|
usage?: {
|
|
@@ -968,8 +1000,9 @@ interface VisualAIClient {
|
|
|
968
1000
|
* @param imageA Baseline image source.
|
|
969
1001
|
* @param imageB Candidate image source.
|
|
970
1002
|
* @param options Optional comparison prompt, instructions, and diff-image settings.
|
|
971
|
-
*
|
|
972
|
-
* pass `{ diffImage: false }` to opt out.
|
|
1003
|
+
* Gemini flash models (`DIFF_ALLOWED_MODELS`) generate an annotated diff image
|
|
1004
|
+
* by default; pass `{ diffImage: false }` to opt out. Flash-Lite and Pro tiers
|
|
1005
|
+
* produce none even when asked.
|
|
973
1006
|
* @returns A structured comparison result with optional diff image metadata.
|
|
974
1007
|
* @throws {VisualAIImageError} When either image cannot be loaded or decoded.
|
|
975
1008
|
* @throws {VisualAIError} When the provider rejects the request or returns invalid output.
|