@shop-os/modelkit 0.2.12 → 0.2.13
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/CHANGELOG.md +13 -0
- package/README.md +12 -0
- package/dist/catalog.cjs +419 -147
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +289 -1
- package/dist/catalog.d.ts +289 -1
- package/dist/catalog.js +419 -147
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +5687 -5189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +366 -38
- package/dist/index.d.ts +366 -38
- package/dist/index.js +5658 -5169
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -507,15 +507,375 @@ declare const SurfaceSchema: z.ZodEnum<{
|
|
|
507
507
|
}>;
|
|
508
508
|
declare const SURFACES: ("cowork" | "space_builder")[];
|
|
509
509
|
declare const ExposureSchema: z.ZodType<Surface[], unknown>;
|
|
510
|
+
declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
511
|
+
id: z.ZodString;
|
|
512
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
513
|
+
label: z.ZodString;
|
|
514
|
+
type: z.ZodEnum<{
|
|
515
|
+
text: "text";
|
|
516
|
+
image: "image";
|
|
517
|
+
video: "video";
|
|
518
|
+
audio: "audio";
|
|
519
|
+
upscale: "upscale";
|
|
520
|
+
"bg-remove": "bg-remove";
|
|
521
|
+
}>;
|
|
522
|
+
adapter: z.ZodEnum<{
|
|
523
|
+
"ai-sdk-text": "ai-sdk-text";
|
|
524
|
+
"google-image": "google-image";
|
|
525
|
+
"openai-image": "openai-image";
|
|
526
|
+
"google-genai": "google-genai";
|
|
527
|
+
ark: "ark";
|
|
528
|
+
fal: "fal";
|
|
529
|
+
replicate: "replicate";
|
|
530
|
+
prodia: "prodia";
|
|
531
|
+
higgsfield: "higgsfield";
|
|
532
|
+
"xai-video": "xai-video";
|
|
533
|
+
}>;
|
|
534
|
+
providerModelId: z.ZodString;
|
|
535
|
+
lifecycle: z.ZodEnum<{
|
|
536
|
+
active: "active";
|
|
537
|
+
deprecated: "deprecated";
|
|
538
|
+
retired: "retired";
|
|
539
|
+
}>;
|
|
540
|
+
replacedBy: z.ZodOptional<z.ZodString>;
|
|
541
|
+
exposure: z.ZodType<Surface[], unknown, z.core.$ZodTypeInternals<Surface[], unknown>>;
|
|
542
|
+
constraints: z.ZodObject<{
|
|
543
|
+
aspectRatios: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
544
|
+
"1:1": "1:1";
|
|
545
|
+
"16:9": "16:9";
|
|
546
|
+
"9:16": "9:16";
|
|
547
|
+
"4:3": "4:3";
|
|
548
|
+
"3:4": "3:4";
|
|
549
|
+
"3:2": "3:2";
|
|
550
|
+
"2:3": "2:3";
|
|
551
|
+
"4:5": "4:5";
|
|
552
|
+
"5:4": "5:4";
|
|
553
|
+
"21:9": "21:9";
|
|
554
|
+
"9:21": "9:21";
|
|
555
|
+
"97:30": "97:30";
|
|
556
|
+
adaptive: "adaptive";
|
|
557
|
+
}>>>;
|
|
558
|
+
sizes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
559
|
+
512: "512";
|
|
560
|
+
"1K": "1K";
|
|
561
|
+
"2K": "2K";
|
|
562
|
+
"4K": "4K";
|
|
563
|
+
}>>>;
|
|
564
|
+
resolutions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
565
|
+
"360p": "360p";
|
|
566
|
+
"480p": "480p";
|
|
567
|
+
"720p": "720p";
|
|
568
|
+
"768p": "768p";
|
|
569
|
+
"1080p": "1080p";
|
|
570
|
+
"2k": "2k";
|
|
571
|
+
"4k": "4k";
|
|
572
|
+
}>>>;
|
|
573
|
+
durations: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
574
|
+
min: z.ZodNumber;
|
|
575
|
+
max: z.ZodNumber;
|
|
576
|
+
}, z.core.$loose>, z.ZodArray<z.ZodNumber>]>>;
|
|
577
|
+
durationPresets: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
578
|
+
qualityOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
579
|
+
exactSizes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
580
|
+
references: z.ZodOptional<z.ZodObject<{
|
|
581
|
+
images: z.ZodOptional<z.ZodNumber>;
|
|
582
|
+
imagesWithVideo: z.ZodOptional<z.ZodNumber>;
|
|
583
|
+
videos: z.ZodOptional<z.ZodNumber>;
|
|
584
|
+
audios: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
586
|
+
audioOnly: z.ZodOptional<z.ZodBoolean>;
|
|
587
|
+
}, z.core.$loose>>;
|
|
588
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
589
|
+
references: "references";
|
|
590
|
+
firstFrame: "firstFrame";
|
|
591
|
+
sourceVideo: "sourceVideo";
|
|
592
|
+
}>>>;
|
|
593
|
+
supports: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
594
|
+
upscale: "upscale";
|
|
595
|
+
quality: "quality";
|
|
596
|
+
seed: "seed";
|
|
597
|
+
count: "count";
|
|
598
|
+
outputFormat: "outputFormat";
|
|
599
|
+
scaleFactor: "scaleFactor";
|
|
600
|
+
safetySettings: "safetySettings";
|
|
601
|
+
temperature: "temperature";
|
|
602
|
+
lastFrame: "lastFrame";
|
|
603
|
+
generateAudio: "generateAudio";
|
|
604
|
+
negativePrompt: "negativePrompt";
|
|
605
|
+
cfgScale: "cfgScale";
|
|
606
|
+
promptExpansion: "promptExpansion";
|
|
607
|
+
watermark: "watermark";
|
|
608
|
+
safetyChecker: "safetyChecker";
|
|
609
|
+
taskType: "taskType";
|
|
610
|
+
instrumental: "instrumental";
|
|
611
|
+
}>>>;
|
|
612
|
+
ratioIgnoredWith: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
613
|
+
firstFrame: "firstFrame";
|
|
614
|
+
sourceVideo: "sourceVideo";
|
|
615
|
+
}>>>;
|
|
616
|
+
}, z.core.$loose>;
|
|
617
|
+
defaults: z.ZodObject<{
|
|
618
|
+
references: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
619
|
+
url: z.ZodString;
|
|
620
|
+
label: z.ZodOptional<z.ZodString>;
|
|
621
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
622
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
623
|
+
mime: z.ZodString;
|
|
624
|
+
label: z.ZodOptional<z.ZodString>;
|
|
625
|
+
}, z.core.$loose>]>>>;
|
|
626
|
+
aspectRatio: z.ZodOptional<z.ZodEnum<{
|
|
627
|
+
"1:1": "1:1";
|
|
628
|
+
"16:9": "16:9";
|
|
629
|
+
"9:16": "9:16";
|
|
630
|
+
"4:3": "4:3";
|
|
631
|
+
"3:4": "3:4";
|
|
632
|
+
"3:2": "3:2";
|
|
633
|
+
"2:3": "2:3";
|
|
634
|
+
"4:5": "4:5";
|
|
635
|
+
"5:4": "5:4";
|
|
636
|
+
"21:9": "21:9";
|
|
637
|
+
"9:21": "9:21";
|
|
638
|
+
"97:30": "97:30";
|
|
639
|
+
adaptive: "adaptive";
|
|
640
|
+
}>>;
|
|
641
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
642
|
+
512: "512";
|
|
643
|
+
"1K": "1K";
|
|
644
|
+
"2K": "2K";
|
|
645
|
+
"4K": "4K";
|
|
646
|
+
}>>;
|
|
647
|
+
exactSize: z.ZodOptional<z.ZodString>;
|
|
648
|
+
quality: z.ZodOptional<z.ZodEnum<{
|
|
649
|
+
auto: "auto";
|
|
650
|
+
low: "low";
|
|
651
|
+
medium: "medium";
|
|
652
|
+
high: "high";
|
|
653
|
+
xhigh: "xhigh";
|
|
654
|
+
max: "max";
|
|
655
|
+
}>>;
|
|
656
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
657
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
658
|
+
outputFormat: z.ZodOptional<z.ZodEnum<{
|
|
659
|
+
png: "png";
|
|
660
|
+
jpeg: "jpeg";
|
|
661
|
+
webp: "webp";
|
|
662
|
+
}>>;
|
|
663
|
+
scaleFactor: z.ZodOptional<z.ZodNumber>;
|
|
664
|
+
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
665
|
+
category: z.ZodString;
|
|
666
|
+
threshold: z.ZodString;
|
|
667
|
+
}, z.core.$loose>>>;
|
|
668
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
669
|
+
upscale: z.ZodOptional<z.ZodObject<{
|
|
670
|
+
enhanceModel: z.ZodOptional<z.ZodString>;
|
|
671
|
+
subjectDetection: z.ZodOptional<z.ZodString>;
|
|
672
|
+
faceEnhancement: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
faceEnhancementCreativity: z.ZodOptional<z.ZodNumber>;
|
|
674
|
+
faceEnhancementStrength: z.ZodOptional<z.ZodNumber>;
|
|
675
|
+
}, z.core.$loose>>;
|
|
676
|
+
firstFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
677
|
+
url: z.ZodString;
|
|
678
|
+
label: z.ZodOptional<z.ZodString>;
|
|
679
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
680
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
681
|
+
mime: z.ZodString;
|
|
682
|
+
label: z.ZodOptional<z.ZodString>;
|
|
683
|
+
}, z.core.$loose>]>>;
|
|
684
|
+
lastFrame: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
685
|
+
url: z.ZodString;
|
|
686
|
+
label: z.ZodOptional<z.ZodString>;
|
|
687
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
688
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
689
|
+
mime: z.ZodString;
|
|
690
|
+
label: z.ZodOptional<z.ZodString>;
|
|
691
|
+
}, z.core.$loose>]>>;
|
|
692
|
+
sourceVideo: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
693
|
+
url: z.ZodString;
|
|
694
|
+
label: z.ZodOptional<z.ZodString>;
|
|
695
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
696
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
697
|
+
mime: z.ZodString;
|
|
698
|
+
label: z.ZodOptional<z.ZodString>;
|
|
699
|
+
}, z.core.$loose>]>>;
|
|
700
|
+
referenceImages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
701
|
+
url: z.ZodString;
|
|
702
|
+
label: z.ZodOptional<z.ZodString>;
|
|
703
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
704
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
705
|
+
mime: z.ZodString;
|
|
706
|
+
label: z.ZodOptional<z.ZodString>;
|
|
707
|
+
}, z.core.$loose>]>>>;
|
|
708
|
+
referenceVideos: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
709
|
+
url: z.ZodString;
|
|
710
|
+
label: z.ZodOptional<z.ZodString>;
|
|
711
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
712
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
713
|
+
mime: z.ZodString;
|
|
714
|
+
label: z.ZodOptional<z.ZodString>;
|
|
715
|
+
}, z.core.$loose>]>>>;
|
|
716
|
+
referenceAudios: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
717
|
+
url: z.ZodString;
|
|
718
|
+
label: z.ZodOptional<z.ZodString>;
|
|
719
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
720
|
+
bytes: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
721
|
+
mime: z.ZodString;
|
|
722
|
+
label: z.ZodOptional<z.ZodString>;
|
|
723
|
+
}, z.core.$loose>]>>>;
|
|
724
|
+
resolution: z.ZodOptional<z.ZodEnum<{
|
|
725
|
+
"360p": "360p";
|
|
726
|
+
"480p": "480p";
|
|
727
|
+
"720p": "720p";
|
|
728
|
+
"768p": "768p";
|
|
729
|
+
"1080p": "1080p";
|
|
730
|
+
"2k": "2k";
|
|
731
|
+
"4k": "4k";
|
|
732
|
+
}>>;
|
|
733
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
734
|
+
generateAudio: z.ZodOptional<z.ZodBoolean>;
|
|
735
|
+
negativePrompt: z.ZodOptional<z.ZodString>;
|
|
736
|
+
cfgScale: z.ZodOptional<z.ZodNumber>;
|
|
737
|
+
promptExpansion: z.ZodOptional<z.ZodEnum<{
|
|
738
|
+
quality: "quality";
|
|
739
|
+
fast: "fast";
|
|
740
|
+
balanced: "balanced";
|
|
741
|
+
}>>;
|
|
742
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
743
|
+
safetyChecker: z.ZodOptional<z.ZodBoolean>;
|
|
744
|
+
taskType: z.ZodOptional<z.ZodEnum<{
|
|
745
|
+
reference: "reference";
|
|
746
|
+
edit: "edit";
|
|
747
|
+
extend: "extend";
|
|
748
|
+
}>>;
|
|
749
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
750
|
+
standard: "standard";
|
|
751
|
+
pro: "pro";
|
|
752
|
+
}>>;
|
|
753
|
+
instrumental: z.ZodOptional<z.ZodBoolean>;
|
|
754
|
+
}, z.core.$loose>;
|
|
755
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<ProviderOptionValue, unknown, z.core.$ZodTypeInternals<ProviderOptionValue, unknown>>>>>;
|
|
756
|
+
usage: z.ZodObject<{
|
|
757
|
+
unit: z.ZodEnum<{
|
|
758
|
+
tokens: "tokens";
|
|
759
|
+
images: "images";
|
|
760
|
+
seconds: "seconds";
|
|
761
|
+
reported_cost_usd: "reported_cost_usd";
|
|
762
|
+
compute_seconds: "compute_seconds";
|
|
763
|
+
}>;
|
|
764
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
765
|
+
providerLabel: z.ZodOptional<z.ZodString>;
|
|
766
|
+
}, z.core.$loose>;
|
|
767
|
+
pricingKind: z.ZodEnum<{
|
|
768
|
+
token: "token";
|
|
769
|
+
image_size: "image_size";
|
|
770
|
+
video_per_second: "video_per_second";
|
|
771
|
+
flat: "flat";
|
|
772
|
+
}>;
|
|
773
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
774
|
+
provider: z.ZodString;
|
|
775
|
+
description: z.ZodString;
|
|
776
|
+
logo: z.ZodOptional<z.ZodString>;
|
|
777
|
+
costTier: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
|
|
778
|
+
recommended: z.ZodOptional<z.ZodBoolean>;
|
|
779
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
780
|
+
chat: z.ZodOptional<z.ZodObject<{
|
|
781
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<ProviderOptionValue, unknown, z.core.$ZodTypeInternals<ProviderOptionValue, unknown>>>>>;
|
|
782
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
783
|
+
}, z.core.$loose>>;
|
|
784
|
+
}, z.core.$loose>>;
|
|
785
|
+
capabilities: z.ZodOptional<z.ZodObject<{
|
|
786
|
+
acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
|
|
787
|
+
framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
|
|
788
|
+
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
789
|
+
vision: z.ZodOptional<z.ZodBoolean>;
|
|
790
|
+
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
791
|
+
}, z.core.$loose>>;
|
|
792
|
+
}, z.core.$loose>;
|
|
510
793
|
declare const CatalogModelSchema: z.ZodType<CatalogModel>;
|
|
511
794
|
declare const CatalogSchema: z.ZodType<CatalogModel[]>;
|
|
512
795
|
|
|
796
|
+
declare const VIDEO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "aspectRatio", "resolution", "firstFrame", "lastFrame", "seed", "negativePrompt", "generateAudio", "cfgScale", "promptExpansion", "referenceImages"];
|
|
797
|
+
declare const AUDIO_INPUT_SPEC_KEYS: readonly ["prompt", "durationSeconds", "seed", "negativePrompt", "references", "sourceVideo", "instrumental"];
|
|
798
|
+
type InputSpecKey = (typeof VIDEO_INPUT_SPEC_KEYS)[number] | (typeof AUDIO_INPUT_SPEC_KEYS)[number];
|
|
799
|
+
declare const INPUT_SPEC_SUPPORTS_KEYS: readonly SupportedOption[];
|
|
800
|
+
declare const InputSpecSchema: z.ZodObject<{
|
|
801
|
+
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
802
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
|
|
803
|
+
static: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
804
|
+
}, z.core.$strict>;
|
|
805
|
+
type InputSpec = z.infer<typeof InputSpecSchema>;
|
|
806
|
+
interface InputSpecIssue {
|
|
807
|
+
path: PropertyKey[];
|
|
808
|
+
message: string;
|
|
809
|
+
}
|
|
810
|
+
interface ValidateRow {
|
|
811
|
+
type: string;
|
|
812
|
+
adapter: string;
|
|
813
|
+
constraints: {
|
|
814
|
+
supports?: readonly SupportedOption[] | undefined;
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
declare function isInputSpecKey(key: string): key is InputSpecKey;
|
|
818
|
+
declare function validateInputSpec(raw: ProviderOptionValue, row: ValidateRow): {
|
|
819
|
+
ok: true;
|
|
820
|
+
spec: InputSpec;
|
|
821
|
+
} | {
|
|
822
|
+
ok: false;
|
|
823
|
+
issues: InputSpecIssue[];
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
declare const ANTHROPIC_TRANSPORTS: readonly ["direct", "bedrock"];
|
|
827
|
+
type AnthropicTransport = (typeof ANTHROPIC_TRANSPORTS)[number];
|
|
828
|
+
|
|
829
|
+
/** Everything an adapter needs for one call. Resolved by the core before dispatch. */
|
|
830
|
+
interface AdapterContext {
|
|
831
|
+
model: CatalogModel;
|
|
832
|
+
keys: ProviderKeys;
|
|
833
|
+
routing: Routing;
|
|
834
|
+
/** Resolved transport of an Anthropic text row (see anthropic-transport.ts); unset means direct. */
|
|
835
|
+
anthropicTransport?: AnthropicTransport;
|
|
836
|
+
endpoints?: AdapterEndpoints;
|
|
837
|
+
fetch: typeof fetch;
|
|
838
|
+
logger: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
839
|
+
signal?: AbortSignal;
|
|
840
|
+
call: CallContext;
|
|
841
|
+
warnings: Warning[];
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* One adapter per provider API. The request the adapter receives has already
|
|
845
|
+
* passed resolveOptions: every option is inside the catalog constraints and the
|
|
846
|
+
* catalog defaults are filled in.
|
|
847
|
+
*/
|
|
848
|
+
interface Adapter {
|
|
849
|
+
id: string;
|
|
850
|
+
generateImage?(req: ImageRequest, ctx: AdapterContext): Promise<ImageResult>;
|
|
851
|
+
generateVideo?(req: VideoRequest, ctx: AdapterContext): Promise<VideoJob>;
|
|
852
|
+
generateAudio?(req: AudioRequest, ctx: AdapterContext): Promise<AudioResult>;
|
|
853
|
+
/**
|
|
854
|
+
* Turn a media reference into an AI SDK file part the provider's language
|
|
855
|
+
* model accepts. Google uploads large videos through the Files API.
|
|
856
|
+
*/
|
|
857
|
+
prepareMediaPart?(ref: MediaRef, mediaType: string, ctx: AdapterContext): Promise<MediaPart>;
|
|
858
|
+
/** Text: return an AI SDK LanguageModel for streamText / generateText. */
|
|
859
|
+
languageModel?(ctx: AdapterContext): LanguageModelV3;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
type DataOnlyRow = Pick<CatalogModel, "type" | "adapter" | "providerModelId" | "providerOptions" | "constraints">;
|
|
863
|
+
type DataOnlyVerdict = {
|
|
864
|
+
ok: true;
|
|
865
|
+
} | {
|
|
866
|
+
ok: false;
|
|
867
|
+
reason: string;
|
|
868
|
+
};
|
|
869
|
+
declare function adapterServesType(adapter: Adapter | undefined, type: DataOnlyRow["type"]): boolean;
|
|
870
|
+
declare function dataOnlyCapable(row: DataOnlyRow): DataOnlyVerdict;
|
|
871
|
+
|
|
513
872
|
type CatalogOrigin = "remote" | "last-good" | "snapshot";
|
|
514
873
|
interface PrimeCatalogResult {
|
|
515
874
|
origin: CatalogOrigin;
|
|
516
875
|
rowCount: number;
|
|
517
876
|
revision?: string;
|
|
518
877
|
error?: string;
|
|
878
|
+
droppedRows?: number;
|
|
519
879
|
}
|
|
520
880
|
interface LiveCatalogState {
|
|
521
881
|
catalog: Catalog;
|
|
@@ -553,6 +913,10 @@ interface CatalogEnvelope {
|
|
|
553
913
|
rows: CatalogModel[];
|
|
554
914
|
revision?: string;
|
|
555
915
|
}
|
|
916
|
+
interface QuarantineResult {
|
|
917
|
+
rows: CatalogModel[];
|
|
918
|
+
dropped: number;
|
|
919
|
+
}
|
|
556
920
|
/** Fetch, validate, swap into liveCatalog. Never throws. Second call returns the same promise. */
|
|
557
921
|
declare function primeCatalog(source: CatalogSource): Promise<PrimeCatalogResult>;
|
|
558
922
|
/** Test seam: stop the refresh timer, reset liveCatalog to MODELS and clear the memo. */
|
|
@@ -607,42 +971,6 @@ declare function pollUntil<T>(check: () => Promise<T | undefined>, opts: {
|
|
|
607
971
|
maxIntervalMs?: number;
|
|
608
972
|
}): Promise<T>;
|
|
609
973
|
|
|
610
|
-
declare const ANTHROPIC_TRANSPORTS: readonly ["direct", "bedrock"];
|
|
611
|
-
type AnthropicTransport = (typeof ANTHROPIC_TRANSPORTS)[number];
|
|
612
|
-
|
|
613
|
-
/** Everything an adapter needs for one call. Resolved by the core before dispatch. */
|
|
614
|
-
interface AdapterContext {
|
|
615
|
-
model: CatalogModel;
|
|
616
|
-
keys: ProviderKeys;
|
|
617
|
-
routing: Routing;
|
|
618
|
-
/** Resolved transport of an Anthropic text row (see anthropic-transport.ts); unset means direct. */
|
|
619
|
-
anthropicTransport?: AnthropicTransport;
|
|
620
|
-
endpoints?: AdapterEndpoints;
|
|
621
|
-
fetch: typeof fetch;
|
|
622
|
-
logger: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
623
|
-
signal?: AbortSignal;
|
|
624
|
-
call: CallContext;
|
|
625
|
-
warnings: Warning[];
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* One adapter per provider API. The request the adapter receives has already
|
|
629
|
-
* passed resolveOptions: every option is inside the catalog constraints and the
|
|
630
|
-
* catalog defaults are filled in.
|
|
631
|
-
*/
|
|
632
|
-
interface Adapter {
|
|
633
|
-
id: string;
|
|
634
|
-
generateImage?(req: ImageRequest, ctx: AdapterContext): Promise<ImageResult>;
|
|
635
|
-
generateVideo?(req: VideoRequest, ctx: AdapterContext): Promise<VideoJob>;
|
|
636
|
-
generateAudio?(req: AudioRequest, ctx: AdapterContext): Promise<AudioResult>;
|
|
637
|
-
/**
|
|
638
|
-
* Turn a media reference into an AI SDK file part the provider's language
|
|
639
|
-
* model accepts. Google uploads large videos through the Files API.
|
|
640
|
-
*/
|
|
641
|
-
prepareMediaPart?(ref: MediaRef, mediaType: string, ctx: AdapterContext): Promise<MediaPart>;
|
|
642
|
-
/** Text: return an AI SDK LanguageModel for streamText / generateText. */
|
|
643
|
-
languageModel?(ctx: AdapterContext): LanguageModelV3;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
974
|
/**
|
|
647
975
|
* The AI SDK `LanguageModel` type. A string is a catalog id or alias; a provider
|
|
648
976
|
* instance (`openai("gpt-4o")`) runs through the SDK unchanged, with usage
|
|
@@ -773,7 +1101,7 @@ declare const replicateAdapter: Adapter;
|
|
|
773
1101
|
|
|
774
1102
|
declare const xaiVideoAdapter: Adapter;
|
|
775
1103
|
|
|
776
|
-
declare const DEFAULT_ADAPTERS:
|
|
1104
|
+
declare const DEFAULT_ADAPTERS: Record<AdapterId, Adapter>;
|
|
777
1105
|
|
|
778
1106
|
/**
|
|
779
1107
|
* All adapters registered. Keys default to process.env (pro = bare names,
|
|
@@ -810,4 +1138,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
810
1138
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
811
1139
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
812
1140
|
|
|
813
|
-
export { ADAPTER_IDS, ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
1141
|
+
export { ADAPTER_IDS, ADAPTER_KEYS, AUDIO_INPUT_SPEC_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type CatalogTextModel, DEFAULT_ADAPTERS, type DataOnlyRow, type DataOnlyVerdict, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, INPUT_SPEC_SUPPORTS_KEYS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type InputSpec, type InputSpecIssue, type InputSpecKey, InputSpecSchema, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, type ReferenceLimits, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_INPUT_SPEC_KEYS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, adapterServesType, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, dataOnlyCapable, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, hasAwsCredentials, higgsfieldAdapter, isInputSpecKey, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, validateInputSpec, withRetry, xaiVideoAdapter };
|