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/dist/index.d.cts
CHANGED
|
@@ -18,12 +18,18 @@ declare const Provider: {
|
|
|
18
18
|
/** Known model names grouped by provider. */
|
|
19
19
|
declare const Model: {
|
|
20
20
|
readonly Anthropic: {
|
|
21
|
+
readonly FABLE_5: "claude-fable-5";
|
|
22
|
+
readonly OPUS_4_8: "claude-opus-4-8";
|
|
21
23
|
readonly OPUS_4_7: "claude-opus-4-7";
|
|
22
24
|
readonly OPUS_4_6: "claude-opus-4-6";
|
|
25
|
+
readonly SONNET_5: "claude-sonnet-5";
|
|
23
26
|
readonly SONNET_4_6: "claude-sonnet-4-6";
|
|
24
27
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
25
28
|
};
|
|
26
29
|
readonly OpenAI: {
|
|
30
|
+
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
31
|
+
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
32
|
+
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
27
33
|
readonly GPT_5_5: "gpt-5.5";
|
|
28
34
|
readonly GPT_5_4: "gpt-5.4";
|
|
29
35
|
readonly GPT_5_4_PRO: "gpt-5.4-pro";
|
|
@@ -33,8 +39,9 @@ declare const Model: {
|
|
|
33
39
|
readonly GPT_5_MINI: "gpt-5-mini";
|
|
34
40
|
};
|
|
35
41
|
readonly Google: {
|
|
42
|
+
readonly GEMINI_3_5_FLASH: "gemini-3.5-flash";
|
|
36
43
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
37
|
-
readonly
|
|
44
|
+
readonly GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite";
|
|
38
45
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
39
46
|
};
|
|
40
47
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,12 +18,18 @@ declare const Provider: {
|
|
|
18
18
|
/** Known model names grouped by provider. */
|
|
19
19
|
declare const Model: {
|
|
20
20
|
readonly Anthropic: {
|
|
21
|
+
readonly FABLE_5: "claude-fable-5";
|
|
22
|
+
readonly OPUS_4_8: "claude-opus-4-8";
|
|
21
23
|
readonly OPUS_4_7: "claude-opus-4-7";
|
|
22
24
|
readonly OPUS_4_6: "claude-opus-4-6";
|
|
25
|
+
readonly SONNET_5: "claude-sonnet-5";
|
|
23
26
|
readonly SONNET_4_6: "claude-sonnet-4-6";
|
|
24
27
|
readonly HAIKU_4_5: "claude-haiku-4-5";
|
|
25
28
|
};
|
|
26
29
|
readonly OpenAI: {
|
|
30
|
+
readonly GPT_5_6_SOL: "gpt-5.6-sol";
|
|
31
|
+
readonly GPT_5_6_TERRA: "gpt-5.6-terra";
|
|
32
|
+
readonly GPT_5_6_LUNA: "gpt-5.6-luna";
|
|
27
33
|
readonly GPT_5_5: "gpt-5.5";
|
|
28
34
|
readonly GPT_5_4: "gpt-5.4";
|
|
29
35
|
readonly GPT_5_4_PRO: "gpt-5.4-pro";
|
|
@@ -33,8 +39,9 @@ declare const Model: {
|
|
|
33
39
|
readonly GPT_5_MINI: "gpt-5-mini";
|
|
34
40
|
};
|
|
35
41
|
readonly Google: {
|
|
42
|
+
readonly GEMINI_3_5_FLASH: "gemini-3.5-flash";
|
|
36
43
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
37
|
-
readonly
|
|
44
|
+
readonly GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite";
|
|
38
45
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
39
46
|
};
|
|
40
47
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,12 +12,18 @@ var Provider = {
|
|
|
12
12
|
};
|
|
13
13
|
var Model = {
|
|
14
14
|
Anthropic: {
|
|
15
|
+
FABLE_5: "claude-fable-5",
|
|
16
|
+
OPUS_4_8: "claude-opus-4-8",
|
|
15
17
|
OPUS_4_7: "claude-opus-4-7",
|
|
16
18
|
OPUS_4_6: "claude-opus-4-6",
|
|
19
|
+
SONNET_5: "claude-sonnet-5",
|
|
17
20
|
SONNET_4_6: "claude-sonnet-4-6",
|
|
18
21
|
HAIKU_4_5: "claude-haiku-4-5"
|
|
19
22
|
},
|
|
20
23
|
OpenAI: {
|
|
24
|
+
GPT_5_6_SOL: "gpt-5.6-sol",
|
|
25
|
+
GPT_5_6_TERRA: "gpt-5.6-terra",
|
|
26
|
+
GPT_5_6_LUNA: "gpt-5.6-luna",
|
|
21
27
|
GPT_5_5: "gpt-5.5",
|
|
22
28
|
GPT_5_4: "gpt-5.4",
|
|
23
29
|
GPT_5_4_PRO: "gpt-5.4-pro",
|
|
@@ -27,8 +33,9 @@ var Model = {
|
|
|
27
33
|
GPT_5_MINI: "gpt-5-mini"
|
|
28
34
|
},
|
|
29
35
|
Google: {
|
|
36
|
+
GEMINI_3_5_FLASH: "gemini-3.5-flash",
|
|
30
37
|
GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview",
|
|
31
|
-
|
|
38
|
+
GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite",
|
|
32
39
|
GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview"
|
|
33
40
|
}
|
|
34
41
|
};
|
|
@@ -504,9 +511,15 @@ function parseRetryAfter(value) {
|
|
|
504
511
|
}
|
|
505
512
|
|
|
506
513
|
// src/providers/anthropic.ts
|
|
514
|
+
var XHIGH_CAPABLE_MODELS = /* @__PURE__ */ new Set([
|
|
515
|
+
Model.Anthropic.FABLE_5,
|
|
516
|
+
Model.Anthropic.OPUS_4_8,
|
|
517
|
+
Model.Anthropic.OPUS_4_7,
|
|
518
|
+
Model.Anthropic.SONNET_5
|
|
519
|
+
]);
|
|
507
520
|
function mapEffort(level, model) {
|
|
508
521
|
if (level !== "xhigh") return level;
|
|
509
|
-
return model
|
|
522
|
+
return XHIGH_CAPABLE_MODELS.has(model) ? "xhigh" : "max";
|
|
510
523
|
}
|
|
511
524
|
var AnthropicDriver = class {
|
|
512
525
|
client;
|
|
@@ -889,6 +902,18 @@ function resolveConfig(config) {
|
|
|
889
902
|
// src/core/pricing.ts
|
|
890
903
|
var PER_MILLION = 1e6;
|
|
891
904
|
var PRICING_TABLE = {
|
|
905
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.FABLE_5}`]: {
|
|
906
|
+
inputPricePerToken: 10 / PER_MILLION,
|
|
907
|
+
outputPricePerToken: 50 / PER_MILLION
|
|
908
|
+
},
|
|
909
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.OPUS_4_8}`]: {
|
|
910
|
+
inputPricePerToken: 5 / PER_MILLION,
|
|
911
|
+
outputPricePerToken: 25 / PER_MILLION
|
|
912
|
+
},
|
|
913
|
+
[`${Provider.ANTHROPIC}:${Model.Anthropic.SONNET_5}`]: {
|
|
914
|
+
inputPricePerToken: 3 / PER_MILLION,
|
|
915
|
+
outputPricePerToken: 15 / PER_MILLION
|
|
916
|
+
},
|
|
892
917
|
[`${Provider.ANTHROPIC}:${Model.Anthropic.OPUS_4_7}`]: {
|
|
893
918
|
inputPricePerToken: 5 / PER_MILLION,
|
|
894
919
|
outputPricePerToken: 25 / PER_MILLION
|
|
@@ -905,6 +930,18 @@ var PRICING_TABLE = {
|
|
|
905
930
|
inputPricePerToken: 1 / PER_MILLION,
|
|
906
931
|
outputPricePerToken: 5 / PER_MILLION
|
|
907
932
|
},
|
|
933
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_SOL}`]: {
|
|
934
|
+
inputPricePerToken: 5 / PER_MILLION,
|
|
935
|
+
outputPricePerToken: 30 / PER_MILLION
|
|
936
|
+
},
|
|
937
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_TERRA}`]: {
|
|
938
|
+
inputPricePerToken: 2.5 / PER_MILLION,
|
|
939
|
+
outputPricePerToken: 15 / PER_MILLION
|
|
940
|
+
},
|
|
941
|
+
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_6_LUNA}`]: {
|
|
942
|
+
inputPricePerToken: 1 / PER_MILLION,
|
|
943
|
+
outputPricePerToken: 6 / PER_MILLION
|
|
944
|
+
},
|
|
908
945
|
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_5}`]: {
|
|
909
946
|
inputPricePerToken: 5 / PER_MILLION,
|
|
910
947
|
outputPricePerToken: 30 / PER_MILLION
|
|
@@ -933,11 +970,15 @@ var PRICING_TABLE = {
|
|
|
933
970
|
inputPricePerToken: 0.25 / PER_MILLION,
|
|
934
971
|
outputPricePerToken: 2 / PER_MILLION
|
|
935
972
|
},
|
|
973
|
+
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_5_FLASH}`]: {
|
|
974
|
+
inputPricePerToken: 1.5 / PER_MILLION,
|
|
975
|
+
outputPricePerToken: 9 / PER_MILLION
|
|
976
|
+
},
|
|
936
977
|
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_1_PRO_PREVIEW}`]: {
|
|
937
978
|
inputPricePerToken: 2 / PER_MILLION,
|
|
938
979
|
outputPricePerToken: 12 / PER_MILLION
|
|
939
980
|
},
|
|
940
|
-
[`${Provider.GOOGLE}:${Model.Google.
|
|
981
|
+
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_1_FLASH_LITE}`]: {
|
|
941
982
|
inputPricePerToken: 0.25 / PER_MILLION,
|
|
942
983
|
outputPricePerToken: 1.5 / PER_MILLION
|
|
943
984
|
},
|
|
@@ -1019,15 +1060,19 @@ async function timedSendMessage(driver, images, prompt, options) {
|
|
|
1019
1060
|
|
|
1020
1061
|
// src/core/diff.ts
|
|
1021
1062
|
import sharp from "sharp";
|
|
1063
|
+
var DIFF_ALLOWED_MODELS = /* @__PURE__ */ new Set([
|
|
1064
|
+
Model.Google.GEMINI_3_FLASH_PREVIEW,
|
|
1065
|
+
Model.Google.GEMINI_3_5_FLASH
|
|
1066
|
+
]);
|
|
1022
1067
|
async function generateAiDiff(imgA, imgB, model, driver) {
|
|
1023
1068
|
if (!driver.generateImage) {
|
|
1024
1069
|
throw new VisualAIConfigError(
|
|
1025
1070
|
"AI-generated diff images require a provider that supports image generation. Currently only the Google (Gemini) provider supports this."
|
|
1026
1071
|
);
|
|
1027
1072
|
}
|
|
1028
|
-
if (model
|
|
1073
|
+
if (!DIFF_ALLOWED_MODELS.has(model)) {
|
|
1029
1074
|
throw new VisualAIConfigError(
|
|
1030
|
-
|
|
1075
|
+
`Annotated diff images are only supported with these Google models: ${[...DIFF_ALLOWED_MODELS].join(", ")}.`
|
|
1031
1076
|
);
|
|
1032
1077
|
}
|
|
1033
1078
|
const response = await driver.generateImage([imgA, imgB], buildAiDiffPrompt(), {
|