visual-ai-assertions 0.11.0 → 0.13.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 +35 -27
- package/dist/index.cjs +50 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -205,7 +205,8 @@ const result = await ai.compare(before, after, {
|
|
|
205
205
|
instructions: ["Ignore date/time differences"],
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
// With AI-generated diff image (supported
|
|
208
|
+
// With AI-generated diff image (supported by gemini-3-flash-preview and gemini-3.5-flash;
|
|
209
|
+
// only gemini-3-flash-preview auto-enables it — pass diffImage: true explicitly for 3.5-flash)
|
|
209
210
|
const result = await ai.compare(before, after, {
|
|
210
211
|
diffImage: true,
|
|
211
212
|
});
|
|
@@ -490,12 +491,12 @@ const ai = visualAI({
|
|
|
490
491
|
|
|
491
492
|
When omitted, each provider uses its default behavior. The `"xhigh"` level enables maximum reasoning depth.
|
|
492
493
|
|
|
493
|
-
| Provider
|
|
494
|
-
|
|
|
495
|
-
| Anthropic Opus 4.7 | `thinking.type: "adaptive"` + `output_config.effort` | `effort: "xhigh"` |
|
|
496
|
-
| Anthropic (other)
|
|
497
|
-
| OpenAI
|
|
498
|
-
| Google
|
|
494
|
+
| Provider | Native Parameter | `"xhigh"` maps to |
|
|
495
|
+
| ----------------------------------------- | ----------------------------------------------------- | -------------------- |
|
|
496
|
+
| Anthropic (Fable 5/Opus 4.8/4.7/Sonnet 5) | `thinking.type: "adaptive"` + `output_config.effort` | `effort: "xhigh"` |
|
|
497
|
+
| Anthropic (other) | `thinking.type: "adaptive"` + `output_config.effort` | `effort: "max"` |
|
|
498
|
+
| OpenAI | `reasoning.effort` (Responses API) | `effort: "xhigh"` |
|
|
499
|
+
| Google | `thinkingConfig.thinkingBudget` (1024 / 8192 / 24576) | `24576` (max budget) |
|
|
499
500
|
|
|
500
501
|
## Supported Models
|
|
501
502
|
|
|
@@ -503,32 +504,39 @@ All listed models support image/vision input. Pass any model ID to the `model` c
|
|
|
503
504
|
|
|
504
505
|
### Anthropic
|
|
505
506
|
|
|
506
|
-
| Model | Model ID | Input $/MTok | Output $/MTok | Notes
|
|
507
|
-
| ----------------- | ------------------- | ------------ | ------------- |
|
|
508
|
-
| Claude
|
|
509
|
-
| Claude Opus 4.
|
|
510
|
-
| Claude
|
|
511
|
-
| Claude
|
|
507
|
+
| Model | Model ID | Input $/MTok | Output $/MTok | Notes |
|
|
508
|
+
| ----------------- | ------------------- | ------------ | ------------- | ------------------------------------------- |
|
|
509
|
+
| Claude Fable 5 | `claude-fable-5` | $10 | $50 | Most capable; long-horizon agentic work |
|
|
510
|
+
| Claude Opus 4.8 | `claude-opus-4-8` | $5 | $25 | Most capable Opus tier; supports `xhigh` |
|
|
511
|
+
| Claude Opus 4.7 | `claude-opus-4-7` | $5 | $25 | Previous Opus; supports `xhigh` effort tier |
|
|
512
|
+
| Claude Opus 4.6 | `claude-opus-4-6` | $5 | $25 | Previous flagship, 128K max output |
|
|
513
|
+
| Claude Sonnet 5 | `claude-sonnet-5` | $3 | $15 | Near-Opus quality on coding/agentic work |
|
|
514
|
+
| Claude Sonnet 4.6 | `claude-sonnet-4-6` | $3 | $15 | **Default** — best value |
|
|
515
|
+
| Claude Haiku 4.5 | `claude-haiku-4-5` | $1 | $5 | Fastest, budget-friendly |
|
|
512
516
|
|
|
513
517
|
### OpenAI
|
|
514
518
|
|
|
515
|
-
| Model
|
|
516
|
-
|
|
|
517
|
-
| GPT-5.
|
|
518
|
-
| GPT-5.
|
|
519
|
-
| GPT-5.
|
|
520
|
-
| GPT-5.
|
|
521
|
-
| GPT-5.4
|
|
522
|
-
| GPT-5.4
|
|
523
|
-
| GPT-5
|
|
519
|
+
| Model | Model ID | Input $/MTok | Output $/MTok | Notes |
|
|
520
|
+
| ------------- | --------------- | ------------ | ------------- | --------------------------------- |
|
|
521
|
+
| GPT-5.6 Sol | `gpt-5.6-sol` | $5 | $30 | Newest flagship, frontier tier |
|
|
522
|
+
| GPT-5.6 Terra | `gpt-5.6-terra` | $2.50 | $15 | Newest balanced, everyday tier |
|
|
523
|
+
| GPT-5.6 Luna | `gpt-5.6-luna` | $1 | $6 | Newest, fastest/cheapest tier |
|
|
524
|
+
| GPT-5.5 | `gpt-5.5` | $5 | $30 | Previous flagship, 1M context |
|
|
525
|
+
| GPT-5.4 Pro | `gpt-5.4-pro` | $30 | $180 | Most capable, extended context |
|
|
526
|
+
| GPT-5.4 | `gpt-5.4` | $2.50 | $15 | Best vision quality |
|
|
527
|
+
| GPT-5.2 | `gpt-5.2` | $1.75 | $14 | Balanced quality and cost |
|
|
528
|
+
| GPT-5.4 mini | `gpt-5.4-mini` | $0.75 | $4.50 | **Default** — fast and affordable |
|
|
529
|
+
| GPT-5.4 nano | `gpt-5.4-nano` | $0.20 | $1.25 | Cheapest older-generation option |
|
|
530
|
+
| GPT-5 mini | `gpt-5-mini` | $0.25 | $2 | Fast and cheap |
|
|
524
531
|
|
|
525
532
|
### Google
|
|
526
533
|
|
|
527
|
-
| Model | Model ID
|
|
528
|
-
| --------------------- |
|
|
529
|
-
| Gemini 3.
|
|
530
|
-
| Gemini 3.1
|
|
531
|
-
| Gemini 3 Flash
|
|
534
|
+
| Model | Model ID | Input $/MTok | Output $/MTok | Notes |
|
|
535
|
+
| --------------------- | ------------------------ | ------------ | ------------- | --------------------------------- |
|
|
536
|
+
| Gemini 3.5 Flash | `gemini-3.5-flash` | $1.50 | $9 | Strongest agentic & coding model |
|
|
537
|
+
| Gemini 3.1 Pro | `gemini-3.1-pro-preview` | $2 | $12 | Preview — most advanced reasoning |
|
|
538
|
+
| Gemini 3.1 Flash Lite | `gemini-3.1-flash-lite` | $0.25 | $1.50 | GA — lightweight and cheap |
|
|
539
|
+
| Gemini 3 Flash | `gemini-3-flash-preview` | $0.50 | $3 | **Default** — fast and capable |
|
|
532
540
|
|
|
533
541
|
## License
|
|
534
542
|
|
package/dist/index.cjs
CHANGED
|
@@ -80,12 +80,18 @@ var Provider = {
|
|
|
80
80
|
};
|
|
81
81
|
var Model = {
|
|
82
82
|
Anthropic: {
|
|
83
|
+
FABLE_5: "claude-fable-5",
|
|
84
|
+
OPUS_4_8: "claude-opus-4-8",
|
|
83
85
|
OPUS_4_7: "claude-opus-4-7",
|
|
84
86
|
OPUS_4_6: "claude-opus-4-6",
|
|
87
|
+
SONNET_5: "claude-sonnet-5",
|
|
85
88
|
SONNET_4_6: "claude-sonnet-4-6",
|
|
86
89
|
HAIKU_4_5: "claude-haiku-4-5"
|
|
87
90
|
},
|
|
88
91
|
OpenAI: {
|
|
92
|
+
GPT_5_6_SOL: "gpt-5.6-sol",
|
|
93
|
+
GPT_5_6_TERRA: "gpt-5.6-terra",
|
|
94
|
+
GPT_5_6_LUNA: "gpt-5.6-luna",
|
|
89
95
|
GPT_5_5: "gpt-5.5",
|
|
90
96
|
GPT_5_4: "gpt-5.4",
|
|
91
97
|
GPT_5_4_PRO: "gpt-5.4-pro",
|
|
@@ -95,8 +101,9 @@ var Model = {
|
|
|
95
101
|
GPT_5_MINI: "gpt-5-mini"
|
|
96
102
|
},
|
|
97
103
|
Google: {
|
|
104
|
+
GEMINI_3_5_FLASH: "gemini-3.5-flash",
|
|
98
105
|
GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview",
|
|
99
|
-
|
|
106
|
+
GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite",
|
|
100
107
|
GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview"
|
|
101
108
|
}
|
|
102
109
|
};
|
|
@@ -572,9 +579,15 @@ function parseRetryAfter(value) {
|
|
|
572
579
|
}
|
|
573
580
|
|
|
574
581
|
// src/providers/anthropic.ts
|
|
582
|
+
var XHIGH_CAPABLE_MODELS = /* @__PURE__ */ new Set([
|
|
583
|
+
Model.Anthropic.FABLE_5,
|
|
584
|
+
Model.Anthropic.OPUS_4_8,
|
|
585
|
+
Model.Anthropic.OPUS_4_7,
|
|
586
|
+
Model.Anthropic.SONNET_5
|
|
587
|
+
]);
|
|
575
588
|
function mapEffort(level, model) {
|
|
576
589
|
if (level !== "xhigh") return level;
|
|
577
|
-
return model
|
|
590
|
+
return XHIGH_CAPABLE_MODELS.has(model) ? "xhigh" : "max";
|
|
578
591
|
}
|
|
579
592
|
var AnthropicDriver = class {
|
|
580
593
|
client;
|
|
@@ -957,6 +970,18 @@ function resolveConfig(config) {
|
|
|
957
970
|
// src/core/pricing.ts
|
|
958
971
|
var PER_MILLION = 1e6;
|
|
959
972
|
var PRICING_TABLE = {
|
|
973
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.FABLE_5}`]: {
|
|
974
|
+
inputPricePerToken: 10 / PER_MILLION,
|
|
975
|
+
outputPricePerToken: 50 / PER_MILLION
|
|
976
|
+
},
|
|
977
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.OPUS_4_8}`]: {
|
|
978
|
+
inputPricePerToken: 5 / PER_MILLION,
|
|
979
|
+
outputPricePerToken: 25 / PER_MILLION
|
|
980
|
+
},
|
|
981
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.SONNET_5}`]: {
|
|
982
|
+
inputPricePerToken: 3 / PER_MILLION,
|
|
983
|
+
outputPricePerToken: 15 / PER_MILLION
|
|
984
|
+
},
|
|
960
985
|
[`${Provider.ANTHROPIC}:${Model.Anthropic.OPUS_4_7}`]: {
|
|
961
986
|
inputPricePerToken: 5 / PER_MILLION,
|
|
962
987
|
outputPricePerToken: 25 / PER_MILLION
|
|
@@ -973,6 +998,18 @@ var PRICING_TABLE = {
|
|
|
973
998
|
inputPricePerToken: 1 / PER_MILLION,
|
|
974
999
|
outputPricePerToken: 5 / PER_MILLION
|
|
975
1000
|
},
|
|
1001
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_SOL}`]: {
|
|
1002
|
+
inputPricePerToken: 5 / PER_MILLION,
|
|
1003
|
+
outputPricePerToken: 30 / PER_MILLION
|
|
1004
|
+
},
|
|
1005
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_TERRA}`]: {
|
|
1006
|
+
inputPricePerToken: 2.5 / PER_MILLION,
|
|
1007
|
+
outputPricePerToken: 15 / PER_MILLION
|
|
1008
|
+
},
|
|
1009
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_LUNA}`]: {
|
|
1010
|
+
inputPricePerToken: 1 / PER_MILLION,
|
|
1011
|
+
outputPricePerToken: 6 / PER_MILLION
|
|
1012
|
+
},
|
|
976
1013
|
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_5}`]: {
|
|
977
1014
|
inputPricePerToken: 5 / PER_MILLION,
|
|
978
1015
|
outputPricePerToken: 30 / PER_MILLION
|
|
@@ -1001,11 +1038,15 @@ var PRICING_TABLE = {
|
|
|
1001
1038
|
inputPricePerToken: 0.25 / PER_MILLION,
|
|
1002
1039
|
outputPricePerToken: 2 / PER_MILLION
|
|
1003
1040
|
},
|
|
1041
|
+
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_5_FLASH}`]: {
|
|
1042
|
+
inputPricePerToken: 1.5 / PER_MILLION,
|
|
1043
|
+
outputPricePerToken: 9 / PER_MILLION
|
|
1044
|
+
},
|
|
1004
1045
|
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_1_PRO_PREVIEW}`]: {
|
|
1005
1046
|
inputPricePerToken: 2 / PER_MILLION,
|
|
1006
1047
|
outputPricePerToken: 12 / PER_MILLION
|
|
1007
1048
|
},
|
|
1008
|
-
[`${Provider.GOOGLE}:${Model.Google.
|
|
1049
|
+
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_1_FLASH_LITE}`]: {
|
|
1009
1050
|
inputPricePerToken: 0.25 / PER_MILLION,
|
|
1010
1051
|
outputPricePerToken: 1.5 / PER_MILLION
|
|
1011
1052
|
},
|
|
@@ -1087,15 +1128,19 @@ async function timedSendMessage(driver, images, prompt, options) {
|
|
|
1087
1128
|
|
|
1088
1129
|
// src/core/diff.ts
|
|
1089
1130
|
var import_sharp = __toESM(require("sharp"), 1);
|
|
1131
|
+
var DIFF_ALLOWED_MODELS = /* @__PURE__ */ new Set([
|
|
1132
|
+
Model.Google.GEMINI_3_FLASH_PREVIEW,
|
|
1133
|
+
Model.Google.GEMINI_3_5_FLASH
|
|
1134
|
+
]);
|
|
1090
1135
|
async function generateAiDiff(imgA, imgB, model, driver) {
|
|
1091
1136
|
if (!driver.generateImage) {
|
|
1092
1137
|
throw new VisualAIConfigError(
|
|
1093
1138
|
"AI-generated diff images require a provider that supports image generation. Currently only the Google (Gemini) provider supports this."
|
|
1094
1139
|
);
|
|
1095
1140
|
}
|
|
1096
|
-
if (model
|
|
1141
|
+
if (!DIFF_ALLOWED_MODELS.has(model)) {
|
|
1097
1142
|
throw new VisualAIConfigError(
|
|
1098
|
-
|
|
1143
|
+
`Annotated diff images are only supported with these Google models: ${[...DIFF_ALLOWED_MODELS].join(", ")}.`
|
|
1099
1144
|
);
|
|
1100
1145
|
}
|
|
1101
1146
|
const response = await driver.generateImage([imgA, imgB], buildAiDiffPrompt(), {
|