visual-ai-assertions 0.12.0 → 0.13.1
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 +33 -27
- package/dist/index.cjs +49 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +49 -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";
|
|
@@ -35,7 +41,7 @@ declare const Model: {
|
|
|
35
41
|
readonly Google: {
|
|
36
42
|
readonly GEMINI_3_5_FLASH: "gemini-3.5-flash";
|
|
37
43
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
38
|
-
readonly
|
|
44
|
+
readonly GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite";
|
|
39
45
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
40
46
|
};
|
|
41
47
|
};
|
|
@@ -414,8 +420,12 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
414
420
|
/**
|
|
415
421
|
* For video inputs, the indices of frames the model relied on to answer.
|
|
416
422
|
* Indices are 0-based and refer to entries in `frames.timestampsSeconds`.
|
|
423
|
+
*
|
|
424
|
+
* Nullable because providers with strict structured-output schemas (e.g. OpenAI)
|
|
425
|
+
* must mark every field required and represent "no value" as `null` rather than
|
|
426
|
+
* omitting the key, even for image inputs that were never asked to populate it.
|
|
417
427
|
*/
|
|
418
|
-
frameReferences: z.ZodOptional<z.ZodArray<z.ZodNumber, "many"
|
|
428
|
+
frameReferences: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
|
|
419
429
|
usage: z.ZodOptional<z.ZodObject<{
|
|
420
430
|
inputTokens: z.ZodNumber;
|
|
421
431
|
outputTokens: z.ZodNumber;
|
|
@@ -451,7 +461,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
451
461
|
estimatedCost?: number | undefined;
|
|
452
462
|
durationSeconds?: number | undefined;
|
|
453
463
|
} | undefined;
|
|
454
|
-
frameReferences?: number[] | undefined;
|
|
464
|
+
frameReferences?: number[] | null | undefined;
|
|
455
465
|
}, {
|
|
456
466
|
issues: {
|
|
457
467
|
priority: "critical" | "major" | "minor";
|
|
@@ -467,11 +477,12 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
467
477
|
estimatedCost?: number | undefined;
|
|
468
478
|
durationSeconds?: number | undefined;
|
|
469
479
|
} | undefined;
|
|
470
|
-
frameReferences?: number[] | undefined;
|
|
480
|
+
frameReferences?: number[] | null | undefined;
|
|
471
481
|
}>;
|
|
472
482
|
/** Result returned by `ask()`. */
|
|
473
|
-
type AskResult = z.infer<typeof AskResultSchema> & {
|
|
483
|
+
type AskResult = Omit<z.infer<typeof AskResultSchema>, "frameReferences"> & {
|
|
474
484
|
/** Present only when the input was a video. Describes which frames the model saw. */
|
|
485
|
+
frameReferences?: number[];
|
|
475
486
|
frames?: VideoFramesMetadata;
|
|
476
487
|
};
|
|
477
488
|
/** Supported input shapes for image arguments accepted by the client. */
|
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";
|
|
@@ -35,7 +41,7 @@ declare const Model: {
|
|
|
35
41
|
readonly Google: {
|
|
36
42
|
readonly GEMINI_3_5_FLASH: "gemini-3.5-flash";
|
|
37
43
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
38
|
-
readonly
|
|
44
|
+
readonly GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite";
|
|
39
45
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
40
46
|
};
|
|
41
47
|
};
|
|
@@ -414,8 +420,12 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
414
420
|
/**
|
|
415
421
|
* For video inputs, the indices of frames the model relied on to answer.
|
|
416
422
|
* Indices are 0-based and refer to entries in `frames.timestampsSeconds`.
|
|
423
|
+
*
|
|
424
|
+
* Nullable because providers with strict structured-output schemas (e.g. OpenAI)
|
|
425
|
+
* must mark every field required and represent "no value" as `null` rather than
|
|
426
|
+
* omitting the key, even for image inputs that were never asked to populate it.
|
|
417
427
|
*/
|
|
418
|
-
frameReferences: z.ZodOptional<z.ZodArray<z.ZodNumber, "many"
|
|
428
|
+
frameReferences: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
|
|
419
429
|
usage: z.ZodOptional<z.ZodObject<{
|
|
420
430
|
inputTokens: z.ZodNumber;
|
|
421
431
|
outputTokens: z.ZodNumber;
|
|
@@ -451,7 +461,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
451
461
|
estimatedCost?: number | undefined;
|
|
452
462
|
durationSeconds?: number | undefined;
|
|
453
463
|
} | undefined;
|
|
454
|
-
frameReferences?: number[] | undefined;
|
|
464
|
+
frameReferences?: number[] | null | undefined;
|
|
455
465
|
}, {
|
|
456
466
|
issues: {
|
|
457
467
|
priority: "critical" | "major" | "minor";
|
|
@@ -467,11 +477,12 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
467
477
|
estimatedCost?: number | undefined;
|
|
468
478
|
durationSeconds?: number | undefined;
|
|
469
479
|
} | undefined;
|
|
470
|
-
frameReferences?: number[] | undefined;
|
|
480
|
+
frameReferences?: number[] | null | undefined;
|
|
471
481
|
}>;
|
|
472
482
|
/** Result returned by `ask()`. */
|
|
473
|
-
type AskResult = z.infer<typeof AskResultSchema> & {
|
|
483
|
+
type AskResult = Omit<z.infer<typeof AskResultSchema>, "frameReferences"> & {
|
|
474
484
|
/** Present only when the input was a video. Describes which frames the model saw. */
|
|
485
|
+
frameReferences?: number[];
|
|
475
486
|
frames?: VideoFramesMetadata;
|
|
476
487
|
};
|
|
477
488
|
/** Supported input shapes for image arguments accepted by the client. */
|
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",
|
|
@@ -29,7 +35,7 @@ var Model = {
|
|
|
29
35
|
Google: {
|
|
30
36
|
GEMINI_3_5_FLASH: "gemini-3.5-flash",
|
|
31
37
|
GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview",
|
|
32
|
-
|
|
38
|
+
GEMINI_3_1_FLASH_LITE: "gemini-3.1-flash-lite",
|
|
33
39
|
GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview"
|
|
34
40
|
}
|
|
35
41
|
};
|
|
@@ -505,9 +511,15 @@ function parseRetryAfter(value) {
|
|
|
505
511
|
}
|
|
506
512
|
|
|
507
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
|
+
]);
|
|
508
520
|
function mapEffort(level, model) {
|
|
509
521
|
if (level !== "xhigh") return level;
|
|
510
|
-
return model
|
|
522
|
+
return XHIGH_CAPABLE_MODELS.has(model) ? "xhigh" : "max";
|
|
511
523
|
}
|
|
512
524
|
var AnthropicDriver = class {
|
|
513
525
|
client;
|
|
@@ -890,6 +902,18 @@ function resolveConfig(config) {
|
|
|
890
902
|
// src/core/pricing.ts
|
|
891
903
|
var PER_MILLION = 1e6;
|
|
892
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
|
+
},
|
|
893
917
|
[`${Provider.ANTHROPIC}:${Model.Anthropic.OPUS_4_7}`]: {
|
|
894
918
|
inputPricePerToken: 5 / PER_MILLION,
|
|
895
919
|
outputPricePerToken: 25 / PER_MILLION
|
|
@@ -906,6 +930,18 @@ var PRICING_TABLE = {
|
|
|
906
930
|
inputPricePerToken: 1 / PER_MILLION,
|
|
907
931
|
outputPricePerToken: 5 / PER_MILLION
|
|
908
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
|
+
},
|
|
909
945
|
[`${Provider.OPENAI}:${Model.OpenAI.GPT_5_5}`]: {
|
|
910
946
|
inputPricePerToken: 5 / PER_MILLION,
|
|
911
947
|
outputPricePerToken: 30 / PER_MILLION
|
|
@@ -942,7 +978,7 @@ var PRICING_TABLE = {
|
|
|
942
978
|
inputPricePerToken: 2 / PER_MILLION,
|
|
943
979
|
outputPricePerToken: 12 / PER_MILLION
|
|
944
980
|
},
|
|
945
|
-
[`${Provider.GOOGLE}:${Model.Google.
|
|
981
|
+
[`${Provider.GOOGLE}:${Model.Google.GEMINI_3_1_FLASH_LITE}`]: {
|
|
946
982
|
inputPricePerToken: 0.25 / PER_MILLION,
|
|
947
983
|
outputPricePerToken: 1.5 / PER_MILLION
|
|
948
984
|
},
|
|
@@ -1749,8 +1785,12 @@ var AskResultSchema = z.object({
|
|
|
1749
1785
|
/**
|
|
1750
1786
|
* For video inputs, the indices of frames the model relied on to answer.
|
|
1751
1787
|
* Indices are 0-based and refer to entries in `frames.timestampsSeconds`.
|
|
1788
|
+
*
|
|
1789
|
+
* Nullable because providers with strict structured-output schemas (e.g. OpenAI)
|
|
1790
|
+
* must mark every field required and represent "no value" as `null` rather than
|
|
1791
|
+
* omitting the key, even for image inputs that were never asked to populate it.
|
|
1752
1792
|
*/
|
|
1753
|
-
frameReferences: z.array(z.number().int().nonnegative()).optional(),
|
|
1793
|
+
frameReferences: z.array(z.number().int().nonnegative()).nullable().optional(),
|
|
1754
1794
|
usage: UsageInfoSchema.optional()
|
|
1755
1795
|
});
|
|
1756
1796
|
|
|
@@ -1802,7 +1842,11 @@ function parseCheckResponse(raw) {
|
|
|
1802
1842
|
return reconcileCheckResult(result);
|
|
1803
1843
|
}
|
|
1804
1844
|
function parseAskResponse(raw) {
|
|
1805
|
-
|
|
1845
|
+
const result = parseResponse(raw, AskResponseSchema);
|
|
1846
|
+
return {
|
|
1847
|
+
...result,
|
|
1848
|
+
frameReferences: result.frameReferences ?? void 0
|
|
1849
|
+
};
|
|
1806
1850
|
}
|
|
1807
1851
|
function parseCompareResponse(raw) {
|
|
1808
1852
|
return parseResponse(raw, CompareResponseSchema);
|