@opencode/ai 2.1.2 → 2.1.4
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/dist/cache-policy.js +6 -5
- package/dist/experimental/evaluation.d.ts +7 -6
- package/dist/experimental/evaluation.js +3 -11
- package/dist/experimental/realtime.d.ts +59 -0
- package/dist/experimental/realtime.js +21 -13
- package/dist/experimental.d.ts +1 -1
- package/dist/generation.js +1 -1
- package/dist/image-client.d.ts +11 -9
- package/dist/image.d.ts +158 -150
- package/dist/image.js +2 -2
- package/dist/llm.d.ts +2 -4
- package/dist/llm.js +2 -2
- package/dist/media-model.d.ts +2 -2
- package/dist/media-model.js +1 -1
- package/dist/promise.d.ts +121 -121
- package/dist/promise.js +3 -5
- package/dist/protocols/alibaba-chat.d.ts +18 -18
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-messages.d.ts +12 -12
- package/dist/protocols/alibaba-messages.js +1 -1
- package/dist/protocols/alibaba-responses.d.ts +38 -38
- package/dist/protocols/anthropic-messages.d.ts +40 -44
- package/dist/protocols/anthropic-messages.js +13 -15
- package/dist/protocols/bedrock-converse.d.ts +36 -85
- package/dist/protocols/bedrock-converse.js +6 -6
- package/dist/protocols/bedrock-event-stream.d.ts +6 -1
- package/dist/protocols/bedrock-event-stream.js +9 -8
- package/dist/protocols/cartesia-speech.d.ts +32 -32
- package/dist/protocols/cohere-chat.d.ts +13 -10
- package/dist/protocols/cohere-chat.js +2 -2
- package/dist/protocols/deepgram-speech.d.ts +32 -32
- package/dist/protocols/elevenlabs-speech.d.ts +32 -32
- package/dist/protocols/gemini.d.ts +46 -36
- package/dist/protocols/gemini.js +12 -15
- package/dist/protocols/google-interactions.d.ts +14 -13
- package/dist/protocols/google-interactions.js +16 -11
- package/dist/protocols/google-speech.d.ts +32 -32
- package/dist/protocols/google-transcription.d.ts +32 -32
- package/dist/protocols/meta-messages.d.ts +23 -23
- package/dist/protocols/meta-responses.d.ts +84 -84
- package/dist/protocols/mistral-chat.d.ts +81 -78
- package/dist/protocols/mistral-chat.js +3 -5
- package/dist/protocols/open-responses-channel.js +47 -46
- package/dist/protocols/open-responses-continuation.d.ts +8 -2
- package/dist/protocols/open-responses-continuation.js +3 -1
- package/dist/protocols/open-responses.d.ts +419 -419
- package/dist/protocols/open-responses.js +11 -10
- package/dist/protocols/openai-chat.d.ts +68 -67
- package/dist/protocols/openai-chat.js +7 -8
- package/dist/protocols/openai-compatible-chat.d.ts +13 -14
- package/dist/protocols/openai-compatible-responses.d.ts +39 -40
- package/dist/protocols/openai-images.d.ts +32 -32
- package/dist/protocols/openai-responses.d.ts +253 -253
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +32 -32
- package/dist/protocols/openai-transcription.d.ts +32 -32
- package/dist/protocols/openai-transcription.js +12 -7
- package/dist/protocols/utils/open-responses-options.d.ts +8 -8
- package/dist/protocols/utils/open-responses-options.js +4 -6
- package/dist/protocols/utils/partial-json-options.d.ts +0 -1
- package/dist/protocols/utils/partial-json-options.js +0 -1
- package/dist/protocols/utils/partial-json.js +5 -4
- package/dist/protocols/utils/tool-schema.d.ts +0 -3
- package/dist/protocols/utils/tool-schema.js +0 -4
- package/dist/protocols/utils/tool-stream.d.ts +1 -1
- package/dist/protocols/venice-chat.d.ts +52 -53
- package/dist/protocols/venice-chat.js +6 -5
- package/dist/protocols/xai-images.js +3 -4
- package/dist/protocols/xai-responses.d.ts +81 -81
- package/dist/protocols/zai-chat.d.ts +33 -30
- package/dist/protocols/zai-chat.js +8 -3
- package/dist/protocols/zai-messages.d.ts +21 -19
- package/dist/protocols/zai-messages.js +3 -2
- package/dist/provider-error.js +8 -7
- package/dist/providers/alibaba.d.ts +74 -74
- package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
- package/dist/providers/amazon-bedrock.d.ts +16 -13
- package/dist/providers/anthropic-compatible.d.ts +13 -13
- package/dist/providers/anthropic.d.ts +13 -13
- package/dist/providers/azure.d.ts +112 -112
- package/dist/providers/baseten.d.ts +24 -24
- package/dist/providers/cerebras.d.ts +24 -24
- package/dist/providers/cloudflare-ai-gateway.d.ts +237 -234
- package/dist/providers/cloudflare-ai-gateway.js +3 -6
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
- package/dist/providers/cohere.d.ts +78 -74
- package/dist/providers/deepinfra.d.ts +24 -24
- package/dist/providers/deepseek.d.ts +24 -24
- package/dist/providers/digitalocean.d.ts +36 -36
- package/dist/providers/fireworks.d.ts +24 -24
- package/dist/providers/google-vertex-chat.d.ts +12 -12
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +20 -20
- package/dist/providers/google-vertex-mistral.d.ts +14 -14
- package/dist/providers/google-vertex-responses.d.ts +38 -38
- package/dist/providers/google-vertex.d.ts +17 -17
- package/dist/providers/google-vertex.js +2 -2
- package/dist/providers/google.d.ts +79 -79
- package/dist/providers/groq.d.ts +24 -24
- package/dist/providers/meta.d.ts +189 -189
- package/dist/providers/minimax.d.ts +202 -202
- package/dist/providers/mistral.d.ts +28 -28
- package/dist/providers/moonshot.d.ts +202 -202
- package/dist/providers/open-responses-options.d.ts +0 -1
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +38 -38
- package/dist/providers/openai-compatible.d.ts +12 -12
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai-options.d.ts +3 -4
- package/dist/providers/openai-options.js +0 -1
- package/dist/providers/openai.d.ts +103 -103
- package/dist/providers/openrouter.d.ts +171 -112
- package/dist/providers/openrouter.js +40 -33
- package/dist/providers/togetherai.d.ts +24 -24
- package/dist/providers/venice.d.ts +195 -20
- package/dist/providers/xai.d.ts +12 -12
- package/dist/providers/zai-coding-plan.d.ts +152 -72
- package/dist/providers/zai.d.ts +84 -19
- package/dist/route/auth-options.d.ts +0 -3
- package/dist/route/auth.d.ts +0 -2
- package/dist/route/auth.js +0 -2
- package/dist/route/client.d.ts +0 -218
- package/dist/route/client.js +3 -7
- package/dist/route/executor-service.js +1 -1
- package/dist/route/transport/http.js +5 -8
- package/dist/schema/errors.d.ts +1 -1
- package/dist/schema/errors.js +1 -1
- package/dist/schema/messages.js +4 -7
- package/dist/speech-client.d.ts +11 -9
- package/dist/speech.d.ts +158 -150
- package/dist/speech.js +2 -2
- package/dist/transcription-client.d.ts +11 -9
- package/dist/transcription.d.ts +158 -150
- package/dist/transcription.js +2 -2
- package/dist/video-client.d.ts +11 -9
- package/dist/video.d.ts +124 -116
- package/dist/video.js +2 -2
- package/package.json +7 -6
- package/dist/protocols/utils/openai-options.d.ts +0 -16
- package/dist/protocols/utils/openai-options.js +0 -15
package/dist/image.d.ts
CHANGED
|
@@ -14,14 +14,22 @@ export declare class ImageModel<Options extends ImageOptions = ImageOptions> ext
|
|
|
14
14
|
static fromRoute<Options extends ImageOptions, Frame, State>(route: MediaModel.StreamRouteInput<ImageRequestFor<Options>, ImageEvent, Frame, State>, input: MediaRoute.ModelInput): ImageModel<Options>;
|
|
15
15
|
static fromRoute<Options extends ImageOptions, Token>(route: MediaModel.QueuedRouteInput<ImageRequestFor<Options>, ImageResponse, Token>, input: MediaRoute.ModelInput): ImageModel<Options>;
|
|
16
16
|
}
|
|
17
|
-
export declare const ImageModelSchema: Schema.declare<ImageModel<
|
|
17
|
+
export declare const ImageModelSchema: Schema.declare<ImageModel<{
|
|
18
|
+
readonly [x: string]: unknown;
|
|
19
|
+
}>, ImageModel<{
|
|
20
|
+
readonly [x: string]: unknown;
|
|
21
|
+
}>>;
|
|
18
22
|
export type ImageSize = `${number}x${number}`;
|
|
19
23
|
export declare const ImageSize: Schema.declare<`${number}x${number}`, `${number}x${number}`>;
|
|
20
24
|
export type ImageAspectRatio = Media.AspectRatio;
|
|
21
25
|
export declare const ImageAspectRatio: Schema.declare<`${number}:${number}`, `${number}:${number}`>;
|
|
22
26
|
export type ImageFormat = OpenString<"png" | "jpeg" | "webp">;
|
|
23
27
|
declare const ImageRequest_base: Schema.Class<ImageRequest, Schema.Struct<{
|
|
24
|
-
readonly model: Schema.declare<ImageModel<
|
|
28
|
+
readonly model: Schema.declare<ImageModel<{
|
|
29
|
+
readonly [x: string]: unknown;
|
|
30
|
+
}>, ImageModel<{
|
|
31
|
+
readonly [x: string]: unknown;
|
|
32
|
+
}>>;
|
|
25
33
|
readonly prompt: Schema.String;
|
|
26
34
|
/** Edit sources or style/subject references, in order. */
|
|
27
35
|
readonly images: Schema.optional<Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
@@ -589,14 +597,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
589
597
|
}>;
|
|
590
598
|
};
|
|
591
599
|
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
592
|
-
readonly type: "generation-queued";
|
|
593
|
-
readonly id: string;
|
|
594
|
-
readonly position?: number | undefined;
|
|
595
|
-
} | {
|
|
596
|
-
readonly type: "generation-progress";
|
|
597
|
-
readonly id: string;
|
|
598
|
-
readonly progress?: number | undefined;
|
|
599
|
-
} | {
|
|
600
600
|
readonly type: "image-partial";
|
|
601
601
|
readonly index: number;
|
|
602
602
|
readonly image: Media.Asset;
|
|
@@ -604,17 +604,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
604
604
|
readonly type: "image";
|
|
605
605
|
readonly index: number;
|
|
606
606
|
readonly image: Media.Asset;
|
|
607
|
+
} | {
|
|
608
|
+
readonly type: "generation-queued";
|
|
609
|
+
readonly id: string;
|
|
610
|
+
readonly position?: number | undefined;
|
|
611
|
+
} | {
|
|
612
|
+
readonly type: "generation-progress";
|
|
613
|
+
readonly id: string;
|
|
614
|
+
readonly progress?: number | undefined;
|
|
607
615
|
} | {
|
|
608
616
|
readonly type: "finish";
|
|
609
617
|
readonly usage?: {
|
|
610
|
-
readonly type: "tokens";
|
|
611
|
-
readonly input?: number | undefined;
|
|
612
|
-
readonly output?: number | undefined;
|
|
613
|
-
readonly total?: number | undefined;
|
|
614
|
-
readonly details?: {
|
|
615
|
-
readonly [x: string]: unknown;
|
|
616
|
-
} | undefined;
|
|
617
|
-
} | {
|
|
618
618
|
readonly type: "seconds";
|
|
619
619
|
readonly seconds: number;
|
|
620
620
|
} | {
|
|
@@ -626,6 +626,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
626
626
|
} | {
|
|
627
627
|
readonly type: "compute";
|
|
628
628
|
readonly seconds: number;
|
|
629
|
+
} | {
|
|
630
|
+
readonly type: "tokens";
|
|
631
|
+
readonly input?: number | undefined;
|
|
632
|
+
readonly output?: number | undefined;
|
|
633
|
+
readonly total?: number | undefined;
|
|
634
|
+
readonly details?: {
|
|
635
|
+
readonly [x: string]: unknown;
|
|
636
|
+
} | undefined;
|
|
629
637
|
} | undefined;
|
|
630
638
|
readonly notices?: readonly {
|
|
631
639
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -642,18 +650,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
642
650
|
};
|
|
643
651
|
} | undefined;
|
|
644
652
|
}) => value is Extract<{
|
|
645
|
-
readonly type: "generation-queued";
|
|
646
|
-
readonly id: string;
|
|
647
|
-
readonly position?: number | undefined;
|
|
648
|
-
}, {
|
|
649
|
-
readonly type: Keys;
|
|
650
|
-
}> | Extract<{
|
|
651
|
-
readonly type: "generation-progress";
|
|
652
|
-
readonly id: string;
|
|
653
|
-
readonly progress?: number | undefined;
|
|
654
|
-
}, {
|
|
655
|
-
readonly type: Keys;
|
|
656
|
-
}> | Extract<{
|
|
657
653
|
readonly type: "image-partial";
|
|
658
654
|
readonly index: number;
|
|
659
655
|
readonly image: Media.Asset;
|
|
@@ -665,17 +661,21 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
665
661
|
readonly image: Media.Asset;
|
|
666
662
|
}, {
|
|
667
663
|
readonly type: Keys;
|
|
664
|
+
}> | Extract<{
|
|
665
|
+
readonly type: "generation-queued";
|
|
666
|
+
readonly id: string;
|
|
667
|
+
readonly position?: number | undefined;
|
|
668
|
+
}, {
|
|
669
|
+
readonly type: Keys;
|
|
670
|
+
}> | Extract<{
|
|
671
|
+
readonly type: "generation-progress";
|
|
672
|
+
readonly id: string;
|
|
673
|
+
readonly progress?: number | undefined;
|
|
674
|
+
}, {
|
|
675
|
+
readonly type: Keys;
|
|
668
676
|
}> | Extract<{
|
|
669
677
|
readonly type: "finish";
|
|
670
678
|
readonly usage?: {
|
|
671
|
-
readonly type: "tokens";
|
|
672
|
-
readonly input?: number | undefined;
|
|
673
|
-
readonly output?: number | undefined;
|
|
674
|
-
readonly total?: number | undefined;
|
|
675
|
-
readonly details?: {
|
|
676
|
-
readonly [x: string]: unknown;
|
|
677
|
-
} | undefined;
|
|
678
|
-
} | {
|
|
679
679
|
readonly type: "seconds";
|
|
680
680
|
readonly seconds: number;
|
|
681
681
|
} | {
|
|
@@ -687,6 +687,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
687
687
|
} | {
|
|
688
688
|
readonly type: "compute";
|
|
689
689
|
readonly seconds: number;
|
|
690
|
+
} | {
|
|
691
|
+
readonly type: "tokens";
|
|
692
|
+
readonly input?: number | undefined;
|
|
693
|
+
readonly output?: number | undefined;
|
|
694
|
+
readonly total?: number | undefined;
|
|
695
|
+
readonly details?: {
|
|
696
|
+
readonly [x: string]: unknown;
|
|
697
|
+
} | undefined;
|
|
690
698
|
} | undefined;
|
|
691
699
|
readonly notices?: readonly {
|
|
692
700
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -709,14 +717,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
709
717
|
finish: (u: unknown) => u is {
|
|
710
718
|
readonly type: "finish";
|
|
711
719
|
readonly usage?: {
|
|
712
|
-
readonly type: "tokens";
|
|
713
|
-
readonly input?: number | undefined;
|
|
714
|
-
readonly output?: number | undefined;
|
|
715
|
-
readonly total?: number | undefined;
|
|
716
|
-
readonly details?: {
|
|
717
|
-
readonly [x: string]: unknown;
|
|
718
|
-
} | undefined;
|
|
719
|
-
} | {
|
|
720
720
|
readonly type: "seconds";
|
|
721
721
|
readonly seconds: number;
|
|
722
722
|
} | {
|
|
@@ -728,6 +728,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
728
728
|
} | {
|
|
729
729
|
readonly type: "compute";
|
|
730
730
|
readonly seconds: number;
|
|
731
|
+
} | {
|
|
732
|
+
readonly type: "tokens";
|
|
733
|
+
readonly input?: number | undefined;
|
|
734
|
+
readonly output?: number | undefined;
|
|
735
|
+
readonly total?: number | undefined;
|
|
736
|
+
readonly details?: {
|
|
737
|
+
readonly [x: string]: unknown;
|
|
738
|
+
} | undefined;
|
|
731
739
|
} | undefined;
|
|
732
740
|
readonly notices?: readonly {
|
|
733
741
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -870,14 +878,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
870
878
|
}>>>;
|
|
871
879
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
872
880
|
}> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
|
|
873
|
-
readonly type: "generation-queued";
|
|
874
|
-
readonly id: string;
|
|
875
|
-
readonly position?: number | undefined;
|
|
876
|
-
} | {
|
|
877
|
-
readonly type: "generation-progress";
|
|
878
|
-
readonly id: string;
|
|
879
|
-
readonly progress?: number | undefined;
|
|
880
|
-
} | {
|
|
881
881
|
readonly type: "image-partial";
|
|
882
882
|
readonly index: number;
|
|
883
883
|
readonly image: Media.Asset;
|
|
@@ -885,17 +885,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
885
885
|
readonly type: "image";
|
|
886
886
|
readonly index: number;
|
|
887
887
|
readonly image: Media.Asset;
|
|
888
|
+
} | {
|
|
889
|
+
readonly type: "generation-queued";
|
|
890
|
+
readonly id: string;
|
|
891
|
+
readonly position?: number | undefined;
|
|
892
|
+
} | {
|
|
893
|
+
readonly type: "generation-progress";
|
|
894
|
+
readonly id: string;
|
|
895
|
+
readonly progress?: number | undefined;
|
|
888
896
|
} | {
|
|
889
897
|
readonly type: "finish";
|
|
890
898
|
readonly usage?: {
|
|
891
|
-
readonly type: "tokens";
|
|
892
|
-
readonly input?: number | undefined;
|
|
893
|
-
readonly output?: number | undefined;
|
|
894
|
-
readonly total?: number | undefined;
|
|
895
|
-
readonly details?: {
|
|
896
|
-
readonly [x: string]: unknown;
|
|
897
|
-
} | undefined;
|
|
898
|
-
} | {
|
|
899
899
|
readonly type: "seconds";
|
|
900
900
|
readonly seconds: number;
|
|
901
901
|
} | {
|
|
@@ -907,6 +907,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
907
907
|
} | {
|
|
908
908
|
readonly type: "compute";
|
|
909
909
|
readonly seconds: number;
|
|
910
|
+
} | {
|
|
911
|
+
readonly type: "tokens";
|
|
912
|
+
readonly input?: number | undefined;
|
|
913
|
+
readonly output?: number | undefined;
|
|
914
|
+
readonly total?: number | undefined;
|
|
915
|
+
readonly details?: {
|
|
916
|
+
readonly [x: string]: unknown;
|
|
917
|
+
} | undefined;
|
|
910
918
|
} | undefined;
|
|
911
919
|
readonly notices?: readonly {
|
|
912
920
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1027,14 +1035,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1027
1035
|
}>>>;
|
|
1028
1036
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1029
1037
|
}> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
|
|
1030
|
-
readonly type: "generation-queued";
|
|
1031
|
-
readonly id: string;
|
|
1032
|
-
readonly position?: number | undefined;
|
|
1033
|
-
} | {
|
|
1034
|
-
readonly type: "generation-progress";
|
|
1035
|
-
readonly id: string;
|
|
1036
|
-
readonly progress?: number | undefined;
|
|
1037
|
-
} | {
|
|
1038
1038
|
readonly type: "image-partial";
|
|
1039
1039
|
readonly index: number;
|
|
1040
1040
|
readonly image: Media.Asset;
|
|
@@ -1042,17 +1042,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1042
1042
|
readonly type: "image";
|
|
1043
1043
|
readonly index: number;
|
|
1044
1044
|
readonly image: Media.Asset;
|
|
1045
|
+
} | {
|
|
1046
|
+
readonly type: "generation-queued";
|
|
1047
|
+
readonly id: string;
|
|
1048
|
+
readonly position?: number | undefined;
|
|
1049
|
+
} | {
|
|
1050
|
+
readonly type: "generation-progress";
|
|
1051
|
+
readonly id: string;
|
|
1052
|
+
readonly progress?: number | undefined;
|
|
1045
1053
|
} | {
|
|
1046
1054
|
readonly type: "finish";
|
|
1047
1055
|
readonly usage?: {
|
|
1048
|
-
readonly type: "tokens";
|
|
1049
|
-
readonly input?: number | undefined;
|
|
1050
|
-
readonly output?: number | undefined;
|
|
1051
|
-
readonly total?: number | undefined;
|
|
1052
|
-
readonly details?: {
|
|
1053
|
-
readonly [x: string]: unknown;
|
|
1054
|
-
} | undefined;
|
|
1055
|
-
} | {
|
|
1056
1056
|
readonly type: "seconds";
|
|
1057
1057
|
readonly seconds: number;
|
|
1058
1058
|
} | {
|
|
@@ -1064,6 +1064,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1064
1064
|
} | {
|
|
1065
1065
|
readonly type: "compute";
|
|
1066
1066
|
readonly seconds: number;
|
|
1067
|
+
} | {
|
|
1068
|
+
readonly type: "tokens";
|
|
1069
|
+
readonly input?: number | undefined;
|
|
1070
|
+
readonly output?: number | undefined;
|
|
1071
|
+
readonly total?: number | undefined;
|
|
1072
|
+
readonly details?: {
|
|
1073
|
+
readonly [x: string]: unknown;
|
|
1074
|
+
} | undefined;
|
|
1067
1075
|
} | undefined;
|
|
1068
1076
|
readonly notices?: readonly {
|
|
1069
1077
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1186,14 +1194,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1186
1194
|
}>>>;
|
|
1187
1195
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1188
1196
|
}> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "image" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
|
|
1189
|
-
readonly type: "generation-queued";
|
|
1190
|
-
readonly id: string;
|
|
1191
|
-
readonly position?: number | undefined;
|
|
1192
|
-
} | {
|
|
1193
|
-
readonly type: "generation-progress";
|
|
1194
|
-
readonly id: string;
|
|
1195
|
-
readonly progress?: number | undefined;
|
|
1196
|
-
} | {
|
|
1197
1197
|
readonly type: "image-partial";
|
|
1198
1198
|
readonly index: number;
|
|
1199
1199
|
readonly image: Media.Asset;
|
|
@@ -1201,17 +1201,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1201
1201
|
readonly type: "image";
|
|
1202
1202
|
readonly index: number;
|
|
1203
1203
|
readonly image: Media.Asset;
|
|
1204
|
+
} | {
|
|
1205
|
+
readonly type: "generation-queued";
|
|
1206
|
+
readonly id: string;
|
|
1207
|
+
readonly position?: number | undefined;
|
|
1208
|
+
} | {
|
|
1209
|
+
readonly type: "generation-progress";
|
|
1210
|
+
readonly id: string;
|
|
1211
|
+
readonly progress?: number | undefined;
|
|
1204
1212
|
} | {
|
|
1205
1213
|
readonly type: "finish";
|
|
1206
1214
|
readonly usage?: {
|
|
1207
|
-
readonly type: "tokens";
|
|
1208
|
-
readonly input?: number | undefined;
|
|
1209
|
-
readonly output?: number | undefined;
|
|
1210
|
-
readonly total?: number | undefined;
|
|
1211
|
-
readonly details?: {
|
|
1212
|
-
readonly [x: string]: unknown;
|
|
1213
|
-
} | undefined;
|
|
1214
|
-
} | {
|
|
1215
1215
|
readonly type: "seconds";
|
|
1216
1216
|
readonly seconds: number;
|
|
1217
1217
|
} | {
|
|
@@ -1223,6 +1223,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1223
1223
|
} | {
|
|
1224
1224
|
readonly type: "compute";
|
|
1225
1225
|
readonly seconds: number;
|
|
1226
|
+
} | {
|
|
1227
|
+
readonly type: "tokens";
|
|
1228
|
+
readonly input?: number | undefined;
|
|
1229
|
+
readonly output?: number | undefined;
|
|
1230
|
+
readonly total?: number | undefined;
|
|
1231
|
+
readonly details?: {
|
|
1232
|
+
readonly [x: string]: unknown;
|
|
1233
|
+
} | undefined;
|
|
1226
1234
|
} | undefined;
|
|
1227
1235
|
readonly notices?: readonly {
|
|
1228
1236
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1239,14 +1247,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1239
1247
|
};
|
|
1240
1248
|
} | undefined;
|
|
1241
1249
|
}, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
|
|
1242
|
-
readonly type: "generation-queued";
|
|
1243
|
-
readonly id: string;
|
|
1244
|
-
readonly position?: number | undefined;
|
|
1245
|
-
} | {
|
|
1246
|
-
readonly type: "generation-progress";
|
|
1247
|
-
readonly id: string;
|
|
1248
|
-
readonly progress?: number | undefined;
|
|
1249
|
-
} | {
|
|
1250
1250
|
readonly type: "image-partial";
|
|
1251
1251
|
readonly index: number;
|
|
1252
1252
|
readonly image: Media.Asset;
|
|
@@ -1254,17 +1254,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1254
1254
|
readonly type: "image";
|
|
1255
1255
|
readonly index: number;
|
|
1256
1256
|
readonly image: Media.Asset;
|
|
1257
|
+
} | {
|
|
1258
|
+
readonly type: "generation-queued";
|
|
1259
|
+
readonly id: string;
|
|
1260
|
+
readonly position?: number | undefined;
|
|
1261
|
+
} | {
|
|
1262
|
+
readonly type: "generation-progress";
|
|
1263
|
+
readonly id: string;
|
|
1264
|
+
readonly progress?: number | undefined;
|
|
1257
1265
|
} | {
|
|
1258
1266
|
readonly type: "finish";
|
|
1259
1267
|
readonly usage?: {
|
|
1260
|
-
readonly type: "tokens";
|
|
1261
|
-
readonly input?: number | undefined;
|
|
1262
|
-
readonly output?: number | undefined;
|
|
1263
|
-
readonly total?: number | undefined;
|
|
1264
|
-
readonly details?: {
|
|
1265
|
-
readonly [x: string]: unknown;
|
|
1266
|
-
} | undefined;
|
|
1267
|
-
} | {
|
|
1268
1268
|
readonly type: "seconds";
|
|
1269
1269
|
readonly seconds: number;
|
|
1270
1270
|
} | {
|
|
@@ -1276,6 +1276,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1276
1276
|
} | {
|
|
1277
1277
|
readonly type: "compute";
|
|
1278
1278
|
readonly seconds: number;
|
|
1279
|
+
} | {
|
|
1280
|
+
readonly type: "tokens";
|
|
1281
|
+
readonly input?: number | undefined;
|
|
1282
|
+
readonly output?: number | undefined;
|
|
1283
|
+
readonly total?: number | undefined;
|
|
1284
|
+
readonly details?: {
|
|
1285
|
+
readonly [x: string]: unknown;
|
|
1286
|
+
} | undefined;
|
|
1279
1287
|
} | undefined;
|
|
1280
1288
|
readonly notices?: readonly {
|
|
1281
1289
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1396,14 +1404,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1396
1404
|
}>>>;
|
|
1397
1405
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1398
1406
|
}> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "image" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
|
|
1399
|
-
readonly type: "generation-queued";
|
|
1400
|
-
readonly id: string;
|
|
1401
|
-
readonly position?: number | undefined;
|
|
1402
|
-
} | {
|
|
1403
|
-
readonly type: "generation-progress";
|
|
1404
|
-
readonly id: string;
|
|
1405
|
-
readonly progress?: number | undefined;
|
|
1406
|
-
} | {
|
|
1407
1407
|
readonly type: "image-partial";
|
|
1408
1408
|
readonly index: number;
|
|
1409
1409
|
readonly image: Media.Asset;
|
|
@@ -1411,17 +1411,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1411
1411
|
readonly type: "image";
|
|
1412
1412
|
readonly index: number;
|
|
1413
1413
|
readonly image: Media.Asset;
|
|
1414
|
+
} | {
|
|
1415
|
+
readonly type: "generation-queued";
|
|
1416
|
+
readonly id: string;
|
|
1417
|
+
readonly position?: number | undefined;
|
|
1418
|
+
} | {
|
|
1419
|
+
readonly type: "generation-progress";
|
|
1420
|
+
readonly id: string;
|
|
1421
|
+
readonly progress?: number | undefined;
|
|
1414
1422
|
} | {
|
|
1415
1423
|
readonly type: "finish";
|
|
1416
1424
|
readonly usage?: {
|
|
1417
|
-
readonly type: "tokens";
|
|
1418
|
-
readonly input?: number | undefined;
|
|
1419
|
-
readonly output?: number | undefined;
|
|
1420
|
-
readonly total?: number | undefined;
|
|
1421
|
-
readonly details?: {
|
|
1422
|
-
readonly [x: string]: unknown;
|
|
1423
|
-
} | undefined;
|
|
1424
|
-
} | {
|
|
1425
1425
|
readonly type: "seconds";
|
|
1426
1426
|
readonly seconds: number;
|
|
1427
1427
|
} | {
|
|
@@ -1433,6 +1433,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1433
1433
|
} | {
|
|
1434
1434
|
readonly type: "compute";
|
|
1435
1435
|
readonly seconds: number;
|
|
1436
|
+
} | {
|
|
1437
|
+
readonly type: "tokens";
|
|
1438
|
+
readonly input?: number | undefined;
|
|
1439
|
+
readonly output?: number | undefined;
|
|
1440
|
+
readonly total?: number | undefined;
|
|
1441
|
+
readonly details?: {
|
|
1442
|
+
readonly [x: string]: unknown;
|
|
1443
|
+
} | undefined;
|
|
1436
1444
|
} | undefined;
|
|
1437
1445
|
readonly notices?: readonly {
|
|
1438
1446
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1449,14 +1457,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1449
1457
|
};
|
|
1450
1458
|
} | undefined;
|
|
1451
1459
|
}, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
1452
|
-
readonly type: "generation-queued";
|
|
1453
|
-
readonly id: string;
|
|
1454
|
-
readonly position?: number | undefined;
|
|
1455
|
-
} | {
|
|
1456
|
-
readonly type: "generation-progress";
|
|
1457
|
-
readonly id: string;
|
|
1458
|
-
readonly progress?: number | undefined;
|
|
1459
|
-
} | {
|
|
1460
1460
|
readonly type: "image-partial";
|
|
1461
1461
|
readonly index: number;
|
|
1462
1462
|
readonly image: Media.Asset;
|
|
@@ -1464,17 +1464,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1464
1464
|
readonly type: "image";
|
|
1465
1465
|
readonly index: number;
|
|
1466
1466
|
readonly image: Media.Asset;
|
|
1467
|
+
} | {
|
|
1468
|
+
readonly type: "generation-queued";
|
|
1469
|
+
readonly id: string;
|
|
1470
|
+
readonly position?: number | undefined;
|
|
1471
|
+
} | {
|
|
1472
|
+
readonly type: "generation-progress";
|
|
1473
|
+
readonly id: string;
|
|
1474
|
+
readonly progress?: number | undefined;
|
|
1467
1475
|
} | {
|
|
1468
1476
|
readonly type: "finish";
|
|
1469
1477
|
readonly usage?: {
|
|
1470
|
-
readonly type: "tokens";
|
|
1471
|
-
readonly input?: number | undefined;
|
|
1472
|
-
readonly output?: number | undefined;
|
|
1473
|
-
readonly total?: number | undefined;
|
|
1474
|
-
readonly details?: {
|
|
1475
|
-
readonly [x: string]: unknown;
|
|
1476
|
-
} | undefined;
|
|
1477
|
-
} | {
|
|
1478
1478
|
readonly type: "seconds";
|
|
1479
1479
|
readonly seconds: number;
|
|
1480
1480
|
} | {
|
|
@@ -1486,6 +1486,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1486
1486
|
} | {
|
|
1487
1487
|
readonly type: "compute";
|
|
1488
1488
|
readonly seconds: number;
|
|
1489
|
+
} | {
|
|
1490
|
+
readonly type: "tokens";
|
|
1491
|
+
readonly input?: number | undefined;
|
|
1492
|
+
readonly output?: number | undefined;
|
|
1493
|
+
readonly total?: number | undefined;
|
|
1494
|
+
readonly details?: {
|
|
1495
|
+
readonly [x: string]: unknown;
|
|
1496
|
+
} | undefined;
|
|
1489
1497
|
} | undefined;
|
|
1490
1498
|
readonly notices?: readonly {
|
|
1491
1499
|
readonly type: "filtered" | "moderated" | "other";
|
|
@@ -1528,14 +1536,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1528
1536
|
finish: (u: unknown) => u is {
|
|
1529
1537
|
readonly type: "finish";
|
|
1530
1538
|
readonly usage?: {
|
|
1531
|
-
readonly type: "tokens";
|
|
1532
|
-
readonly input?: number | undefined;
|
|
1533
|
-
readonly output?: number | undefined;
|
|
1534
|
-
readonly total?: number | undefined;
|
|
1535
|
-
readonly details?: {
|
|
1536
|
-
readonly [x: string]: unknown;
|
|
1537
|
-
} | undefined;
|
|
1538
|
-
} | {
|
|
1539
1539
|
readonly type: "seconds";
|
|
1540
1540
|
readonly seconds: number;
|
|
1541
1541
|
} | {
|
|
@@ -1547,6 +1547,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1547
1547
|
} | {
|
|
1548
1548
|
readonly type: "compute";
|
|
1549
1549
|
readonly seconds: number;
|
|
1550
|
+
} | {
|
|
1551
|
+
readonly type: "tokens";
|
|
1552
|
+
readonly input?: number | undefined;
|
|
1553
|
+
readonly output?: number | undefined;
|
|
1554
|
+
readonly total?: number | undefined;
|
|
1555
|
+
readonly details?: {
|
|
1556
|
+
readonly [x: string]: unknown;
|
|
1557
|
+
} | undefined;
|
|
1550
1558
|
} | undefined;
|
|
1551
1559
|
readonly notices?: readonly {
|
|
1552
1560
|
readonly type: "filtered" | "moderated" | "other";
|
package/dist/image.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Generation, ProgressEvent, QueuedEvent } from "./generation.js";
|
|
|
3
3
|
import { Media } from "./media.js";
|
|
4
4
|
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
5
5
|
import { MediaRoute } from "./route/media.js";
|
|
6
|
-
import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
|
|
6
|
+
import { AIError, HttpOptions, MediaUsage, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
|
|
7
7
|
import { ImageClient, Service } from "./image-client.js";
|
|
8
8
|
export class ImageModel extends MediaModel {
|
|
9
9
|
static fromRoute(route, input) {
|
|
@@ -32,7 +32,7 @@ export class ImageRequest extends Schema.Class("Image.Request")({
|
|
|
32
32
|
aspectRatio: Schema.optional(ImageAspectRatio),
|
|
33
33
|
seed: Schema.optional(Schema.Number),
|
|
34
34
|
format: Schema.optional(Schema.String),
|
|
35
|
-
providerOptions: Schema.optional(
|
|
35
|
+
providerOptions: Schema.optional(ProviderOptions),
|
|
36
36
|
http: Schema.optional(HttpOptions),
|
|
37
37
|
}) {
|
|
38
38
|
}
|
package/dist/llm.d.ts
CHANGED
|
@@ -14,10 +14,8 @@ export type RequestInput<SelectedLanguageModel extends LanguageModel = LanguageM
|
|
|
14
14
|
readonly providerOptions?: NoInfer<LanguageModelProviderOptions<SelectedLanguageModel>>;
|
|
15
15
|
readonly http?: HttpOptions.Input;
|
|
16
16
|
};
|
|
17
|
-
export declare function generate<const Model extends LanguageModel>(input: RequestInput<Model
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function stream<const Model extends LanguageModel>(input: RequestInput<Model>, options?: StreamOptions): Stream.Stream<LLMEvent, AIError, Service>;
|
|
20
|
-
export declare function stream(input: LLMRequest, options?: StreamOptions): Stream.Stream<LLMEvent, AIError, Service>;
|
|
17
|
+
export declare function generate<const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: StreamOptions): Effect.Effect<LLMResponse, AIError, Service>;
|
|
18
|
+
export declare function stream<const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: StreamOptions): Stream.Stream<LLMEvent, AIError, Service>;
|
|
21
19
|
export declare const request: <const SelectedLanguageModel extends LanguageModel>(input: RequestInput<SelectedLanguageModel>) => LLMRequest<SelectedLanguageModel>;
|
|
22
20
|
type GenerateObjectBase<SelectedLanguageModel extends LanguageModel = LanguageModel> = Omit<RequestInput<SelectedLanguageModel>, "tools" | "toolChoice">;
|
|
23
21
|
export declare class GenerateObjectResponse<T> {
|
package/dist/llm.js
CHANGED
|
@@ -46,8 +46,8 @@ const runGenerateObject = Effect.fn("LLM.generateObject")(function* (options, to
|
|
|
46
46
|
toolChoice: ToolChoice.named(GENERATE_OBJECT_TOOL_NAME),
|
|
47
47
|
});
|
|
48
48
|
const response = yield* LLMClient.generate(generateRequest);
|
|
49
|
-
const call = response.toolCalls.find((event) =>
|
|
50
|
-
if (!call
|
|
49
|
+
const call = response.toolCalls.find((event) => event.name === GENERATE_OBJECT_TOOL_NAME);
|
|
50
|
+
if (!call)
|
|
51
51
|
return yield* new AIError({
|
|
52
52
|
reason: new InvalidProviderOutputError({
|
|
53
53
|
message: `generateObject: model did not call the forced \`${GENERATE_OBJECT_TOOL_NAME}\` tool`,
|
package/dist/media-model.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Effect } from "effect";
|
|
|
2
2
|
import { Endpoint } from "./route/endpoint.js";
|
|
3
3
|
import { MediaRoute } from "./route/media.js";
|
|
4
4
|
import type { MediaProtocol } from "./route/media-protocol.js";
|
|
5
|
-
import { AIError, HttpOptions, ModelID, ProviderID } from "./schema/index.js";
|
|
5
|
+
import { AIError, HttpOptions, ModelID, ProviderID, type ProviderOptions } from "./schema/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* What every media model carries: ids, the configured route, and deployment `http` overlays. Modality classes
|
|
8
8
|
* (`ImageModel`, `VideoModel`, `SpeechModel`, `TranscriptionModel`) extend it with their route type and a nominal
|
|
@@ -17,7 +17,7 @@ export declare class MediaModel<Route, Options> {
|
|
|
17
17
|
constructor(input: MediaModel.Input<Route>);
|
|
18
18
|
}
|
|
19
19
|
export declare namespace MediaModel {
|
|
20
|
-
type Options =
|
|
20
|
+
type Options = ProviderOptions;
|
|
21
21
|
interface Input<Route> {
|
|
22
22
|
readonly id: string | ModelID;
|
|
23
23
|
readonly provider: string | ProviderID;
|
package/dist/media-model.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { Endpoint } from "./route/endpoint.js";
|
|
3
3
|
import { MediaRoute } from "./route/media.js";
|
|
4
|
-
import { AIError, HttpOptions, InvalidRequestError, ModelID, ProviderID } from "./schema/index.js";
|
|
4
|
+
import { AIError, HttpOptions, InvalidRequestError, ModelID, ProviderID, } from "./schema/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* What every media model carries: ids, the configured route, and deployment `http` overlays. Modality classes
|
|
7
7
|
* (`ImageModel`, `VideoModel`, `SpeechModel`, `TranscriptionModel`) extend it with their route type and a nominal
|