@adaline/provider 0.6.0 → 0.8.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/dist/index.d.mts CHANGED
@@ -1,274 +1,92 @@
1
+ import { GatewayBaseError, RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
1
2
  import { z } from 'zod';
2
- import { RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, PartialMessageType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingsType } from '@adaline/types';
3
3
 
4
- declare class ApiRequestError extends Error {
5
- readonly name = "Gateway_ApiRequestError";
4
+ declare class ProviderError extends GatewayBaseError {
5
+ readonly name: "ProviderError";
6
6
  readonly info: string;
7
7
  readonly cause: unknown;
8
- constructor({ info, error }: {
8
+ constructor({ info, cause }: {
9
9
  info: string;
10
- error: unknown;
11
- });
12
- static isApiRequestError(error: unknown): error is ApiRequestError;
13
- toJSON(): {
14
- name: string;
15
- message: string;
16
10
  cause: unknown;
17
- stack: string | undefined;
18
- info: string;
19
- };
20
- }
21
-
22
- declare class ApiResponseError extends Error {
23
- readonly name = "Gateway_ApiResponseError";
24
- readonly info: string;
25
- readonly cause: unknown;
26
- constructor({ info, error }: {
27
- info: string;
28
- error: unknown;
29
11
  });
30
- static isApiResponseError(error: unknown): error is ApiResponseError;
31
- toJSON(): {
32
- name: string;
33
- message: string;
34
- cause: unknown;
35
- stack: string | undefined;
36
- info: string;
37
- };
12
+ static isProviderError(error: unknown): error is ProviderError;
38
13
  }
39
14
 
40
- declare class DownloadError extends Error {
41
- readonly name = "Gateway_DownloadError";
15
+ declare class ModelError extends GatewayBaseError {
16
+ readonly name: "ModelError";
42
17
  readonly info: string;
43
18
  readonly cause: unknown;
44
- constructor({ info, error }: {
19
+ constructor({ info, cause }: {
45
20
  info: string;
46
- error: unknown;
47
- });
48
- static isDownloadError(error: unknown): error is DownloadError;
49
- toJSON(): {
50
- name: string;
51
- message: string;
52
21
  cause: unknown;
53
- stack: string | undefined;
54
- info: string;
55
- };
56
- }
57
-
58
- declare class InvalidAuthError extends Error {
59
- readonly name = "Gateway_InvalidAuthError";
60
- readonly info: string;
61
- readonly cause: unknown;
62
- constructor({ info, error }: {
63
- info: string;
64
- error: unknown;
65
22
  });
66
- static isInvalidAuthError(error: unknown): error is InvalidAuthError;
67
- toJSON(): {
68
- name: string;
69
- message: string;
70
- cause: unknown;
71
- stack: string | undefined;
72
- info: string;
73
- };
23
+ static isModelError(error: unknown): error is ModelError;
74
24
  }
75
25
 
76
- declare class InvalidConfigError extends Error {
77
- readonly name = "Gateway_InvalidConfigError";
26
+ declare class ModelResponseError extends GatewayBaseError {
27
+ readonly name: "ModelResponseError";
78
28
  readonly info: string;
79
29
  readonly cause: unknown;
80
- constructor({ info, error }: {
30
+ constructor({ info, cause }: {
81
31
  info: string;
82
- error: unknown;
83
- });
84
- static isInvalidConfigError(error: unknown): error is InvalidConfigError;
85
- toJSON(): {
86
- name: string;
87
- message: string;
88
32
  cause: unknown;
89
- stack: string | undefined;
90
- info: string;
91
- };
92
- }
93
-
94
- declare class InvalidEndpointError extends Error {
95
- readonly name = "Gateway_InvalidEndpointError";
96
- readonly info: string;
97
- readonly cause: unknown;
98
- constructor({ info, error }: {
99
- info: string;
100
- error: unknown;
101
33
  });
102
- static isInvalidEndpointError(error: unknown): error is InvalidEndpointError;
103
- toJSON(): {
104
- name: string;
105
- message: string;
106
- cause: unknown;
107
- stack: string | undefined;
108
- info: string;
109
- };
34
+ static isModelResponseError(error: unknown): error is ModelResponseError;
110
35
  }
111
36
 
112
- declare class InvalidMessagesError extends Error {
113
- readonly name = "Gateway_InvalidMessagesError";
37
+ declare class InvalidModelRequestError extends GatewayBaseError {
38
+ readonly name: "InvalidModelRequestError";
114
39
  readonly info: string;
115
40
  readonly cause: unknown;
116
- constructor({ info, error }: {
41
+ constructor({ info, cause }: {
117
42
  info: string;
118
- error: unknown;
119
- });
120
- static isInvalidMessagesError(error: unknown): error is InvalidMessagesError;
121
- toJSON(): {
122
- name: string;
123
- message: string;
124
43
  cause: unknown;
125
- stack: string | undefined;
126
- info: string;
127
- };
128
- }
129
-
130
- declare class InvalidModalityError extends Error {
131
- readonly name = "Gateway_InvalidModalityError";
132
- readonly info: string;
133
- readonly cause: unknown;
134
- constructor({ info, error }: {
135
- info: string;
136
- error: unknown;
137
44
  });
138
- static isInvalidModalityError(error: unknown): error is InvalidModalityError;
139
- toJSON(): {
140
- name: string;
141
- message: string;
142
- cause: unknown;
143
- stack: string | undefined;
144
- info: string;
145
- };
45
+ static isInvalidModelRequestError(error: unknown): error is InvalidModelRequestError;
146
46
  }
147
47
 
148
- declare class InvalidModelError extends Error {
149
- readonly name = "Gateway_InvalidModelError";
48
+ declare class InvalidConfigError extends GatewayBaseError {
49
+ readonly name: "InvalidConfigError";
150
50
  readonly info: string;
151
51
  readonly cause: unknown;
152
- constructor({ info, error }: {
52
+ constructor({ info, cause }: {
153
53
  info: string;
154
- error: unknown;
155
- });
156
- static isInvalidModelError(error: unknown): error is InvalidModelError;
157
- toJSON(): {
158
- name: string;
159
- message: string;
160
54
  cause: unknown;
161
- stack: string | undefined;
162
- info: string;
163
- };
164
- }
165
-
166
- declare class InvalidPromptError extends Error {
167
- readonly name = "Gateway_InvalidPromptError";
168
- readonly info: string;
169
- readonly cause: unknown;
170
- constructor({ info, error }: {
171
- info: string;
172
- error: unknown;
173
55
  });
174
- static isInvalidPromptError(error: unknown): error is InvalidPromptError;
175
- toJSON(): {
176
- name: string;
177
- message: string;
178
- cause: unknown;
179
- stack: string | undefined;
180
- info: string;
181
- };
56
+ static isInvalidConfigError(error: unknown): error is InvalidConfigError;
182
57
  }
183
58
 
184
- declare class InvalidRoleError extends Error {
185
- readonly name = "Gateway_InvalidRoleError";
59
+ declare class InvalidMessagesError extends GatewayBaseError {
60
+ readonly name: "InvalidMessagesError";
186
61
  readonly info: string;
187
62
  readonly cause: unknown;
188
- constructor({ info, error }: {
63
+ constructor({ info, cause }: {
189
64
  info: string;
190
- error: unknown;
191
- });
192
- static isInvalidRoleError(error: unknown): error is InvalidRoleError;
193
- toJSON(): {
194
- name: string;
195
- message: string;
196
65
  cause: unknown;
197
- stack: string | undefined;
198
- info: string;
199
- };
200
- }
201
-
202
- declare class InvalidToolsError extends Error {
203
- readonly name = "Gateway_InvalidToolsError";
204
- readonly info: string;
205
- readonly cause: unknown;
206
- constructor({ info, error }: {
207
- info: string;
208
- error: unknown;
209
66
  });
210
- static isInvalidToolsError(error: unknown): error is InvalidToolsError;
211
- toJSON(): {
212
- name: string;
213
- message: string;
214
- cause: unknown;
215
- stack: string | undefined;
216
- info: string;
217
- };
67
+ static isInvalidMessagesError(error: unknown): error is InvalidMessagesError;
218
68
  }
219
69
 
220
- declare class InvalidEmbeddingRequestsError extends Error {
221
- readonly name = "Gateway_InvalidEmbeddingRequestsError";
70
+ declare class InvalidToolsError extends GatewayBaseError {
71
+ readonly name: "InvalidToolsError";
222
72
  readonly info: string;
223
73
  readonly cause: unknown;
224
- constructor({ info, error }: {
74
+ constructor({ info, cause }: {
225
75
  info: string;
226
- error: unknown;
227
- });
228
- static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError;
229
- toJSON(): {
230
- name: string;
231
- message: string;
232
76
  cause: unknown;
233
- info: string;
234
- stack: string | undefined;
235
- };
236
- }
237
-
238
- declare class JsonParseError extends Error {
239
- readonly name = "Gateway_JsonParseError";
240
- readonly info: string;
241
- readonly cause: unknown;
242
- constructor({ info, error }: {
243
- info: string;
244
- error: unknown;
245
77
  });
246
- static isJsonParseError(error: unknown): error is JsonParseError;
247
- toJSON(): {
248
- name: string;
249
- message: string;
250
- cause: unknown;
251
- stack: string | undefined;
252
- info: string;
253
- };
78
+ static isInvalidToolsError(error: unknown): error is InvalidToolsError;
254
79
  }
255
80
 
256
- declare class ValidationError extends Error {
257
- readonly name = "Gateway_ValidationError";
81
+ declare class InvalidEmbeddingRequestsError extends GatewayBaseError {
82
+ readonly name: "InvalidEmbeddingRequestsError";
258
83
  readonly info: string;
259
84
  readonly cause: unknown;
260
- constructor({ info, error }: {
85
+ constructor({ info, cause }: {
261
86
  info: string;
262
- error: unknown;
263
- });
264
- static isValidationError(error: unknown): error is ValidationError;
265
- toJSON(): {
266
- name: string;
267
- message: string;
268
87
  cause: unknown;
269
- stack: string | undefined;
270
- info: string;
271
- };
88
+ });
89
+ static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError;
272
90
  }
273
91
 
274
92
  declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.ZodEnum<["system", "user", "assistant", "tool"]>, M extends z.ZodEnum<[string, ...string[]]> = z.ZodEnum<["text", "image", "tool-call", "tool-response"]>>(Roles?: R, Modalities?: M) => z.ZodObject<{
@@ -345,6 +163,24 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
345
163
  description: string;
346
164
  default: string;
347
165
  choices: string[];
166
+ }>, z.ZodObject<{
167
+ type: z.ZodLiteral<"select-boolean">;
168
+ param: z.ZodString;
169
+ title: z.ZodString;
170
+ description: z.ZodString;
171
+ default: z.ZodNullable<z.ZodBoolean>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: "select-boolean";
174
+ param: string;
175
+ title: string;
176
+ description: string;
177
+ default: boolean | null;
178
+ }, {
179
+ type: "select-boolean";
180
+ param: string;
181
+ title: string;
182
+ description: string;
183
+ default: boolean | null;
348
184
  }>, z.ZodObject<{
349
185
  type: z.ZodLiteral<"object-schema">;
350
186
  param: z.ZodString;
@@ -394,6 +230,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
394
230
  title: string;
395
231
  description: string;
396
232
  objectSchema?: any;
233
+ } | {
234
+ type: "select-boolean";
235
+ param: string;
236
+ title: string;
237
+ description: string;
238
+ default: boolean | null;
397
239
  }>;
398
240
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
399
241
  }, {
@@ -425,6 +267,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
425
267
  title: string;
426
268
  description: string;
427
269
  objectSchema?: any;
270
+ } | {
271
+ type: "select-boolean";
272
+ param: string;
273
+ title: string;
274
+ description: string;
275
+ default: boolean | null;
428
276
  }>;
429
277
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
430
278
  }>, {
@@ -456,6 +304,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
456
304
  title: string;
457
305
  description: string;
458
306
  objectSchema?: any;
307
+ } | {
308
+ type: "select-boolean";
309
+ param: string;
310
+ title: string;
311
+ description: string;
312
+ default: boolean | null;
459
313
  }>;
460
314
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
461
315
  }, {
@@ -487,6 +341,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
487
341
  title: string;
488
342
  description: string;
489
343
  objectSchema?: any;
344
+ } | {
345
+ type: "select-boolean";
346
+ param: string;
347
+ title: string;
348
+ description: string;
349
+ default: boolean | null;
490
350
  }>;
491
351
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
492
352
  }>;
@@ -564,6 +424,24 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
564
424
  description: string;
565
425
  default: string;
566
426
  choices: string[];
427
+ }>, z.ZodObject<{
428
+ type: z.ZodLiteral<"select-boolean">;
429
+ param: z.ZodString;
430
+ title: z.ZodString;
431
+ description: z.ZodString;
432
+ default: z.ZodNullable<z.ZodBoolean>;
433
+ }, "strip", z.ZodTypeAny, {
434
+ type: "select-boolean";
435
+ param: string;
436
+ title: string;
437
+ description: string;
438
+ default: boolean | null;
439
+ }, {
440
+ type: "select-boolean";
441
+ param: string;
442
+ title: string;
443
+ description: string;
444
+ default: boolean | null;
567
445
  }>, z.ZodObject<{
568
446
  type: z.ZodLiteral<"object-schema">;
569
447
  param: z.ZodString;
@@ -613,6 +491,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
613
491
  title: string;
614
492
  description: string;
615
493
  objectSchema?: any;
494
+ } | {
495
+ type: "select-boolean";
496
+ param: string;
497
+ title: string;
498
+ description: string;
499
+ default: boolean | null;
616
500
  }>;
617
501
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
618
502
  }, {
@@ -644,6 +528,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
644
528
  title: string;
645
529
  description: string;
646
530
  objectSchema?: any;
531
+ } | {
532
+ type: "select-boolean";
533
+ param: string;
534
+ title: string;
535
+ description: string;
536
+ default: boolean | null;
647
537
  }>;
648
538
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
649
539
  }>, {
@@ -675,6 +565,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
675
565
  title: string;
676
566
  description: string;
677
567
  objectSchema?: any;
568
+ } | {
569
+ type: "select-boolean";
570
+ param: string;
571
+ title: string;
572
+ description: string;
573
+ default: boolean | null;
678
574
  }>;
679
575
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
680
576
  }, {
@@ -706,6 +602,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
706
602
  title: string;
707
603
  description: string;
708
604
  objectSchema?: any;
605
+ } | {
606
+ type: "select-boolean";
607
+ param: string;
608
+ title: string;
609
+ description: string;
610
+ default: boolean | null;
709
611
  }>;
710
612
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
711
613
  }>;
@@ -783,6 +685,24 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
783
685
  description: string;
784
686
  default: string;
785
687
  choices: string[];
688
+ }>, z.ZodObject<{
689
+ type: z.ZodLiteral<"select-boolean">;
690
+ param: z.ZodString;
691
+ title: z.ZodString;
692
+ description: z.ZodString;
693
+ default: z.ZodNullable<z.ZodBoolean>;
694
+ }, "strip", z.ZodTypeAny, {
695
+ type: "select-boolean";
696
+ param: string;
697
+ title: string;
698
+ description: string;
699
+ default: boolean | null;
700
+ }, {
701
+ type: "select-boolean";
702
+ param: string;
703
+ title: string;
704
+ description: string;
705
+ default: boolean | null;
786
706
  }>, z.ZodObject<{
787
707
  type: z.ZodLiteral<"object-schema">;
788
708
  param: z.ZodString;
@@ -832,6 +752,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
832
752
  title: string;
833
753
  description: string;
834
754
  objectSchema?: any;
755
+ } | {
756
+ type: "select-boolean";
757
+ param: string;
758
+ title: string;
759
+ description: string;
760
+ default: boolean | null;
835
761
  }>;
836
762
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
837
763
  }, {
@@ -863,6 +789,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
863
789
  title: string;
864
790
  description: string;
865
791
  objectSchema?: any;
792
+ } | {
793
+ type: "select-boolean";
794
+ param: string;
795
+ title: string;
796
+ description: string;
797
+ default: boolean | null;
866
798
  }>;
867
799
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
868
800
  }>, {
@@ -894,6 +826,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
894
826
  title: string;
895
827
  description: string;
896
828
  objectSchema?: any;
829
+ } | {
830
+ type: "select-boolean";
831
+ param: string;
832
+ title: string;
833
+ description: string;
834
+ default: boolean | null;
897
835
  }>;
898
836
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
899
837
  }, {
@@ -925,6 +863,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
925
863
  title: string;
926
864
  description: string;
927
865
  objectSchema?: any;
866
+ } | {
867
+ type: "select-boolean";
868
+ param: string;
869
+ title: string;
870
+ description: string;
871
+ default: boolean | null;
928
872
  }>;
929
873
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
930
874
  }>;
@@ -1002,6 +946,24 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1002
946
  description: string;
1003
947
  default: string;
1004
948
  choices: string[];
949
+ }>, z.ZodObject<{
950
+ type: z.ZodLiteral<"select-boolean">;
951
+ param: z.ZodString;
952
+ title: z.ZodString;
953
+ description: z.ZodString;
954
+ default: z.ZodNullable<z.ZodBoolean>;
955
+ }, "strip", z.ZodTypeAny, {
956
+ type: "select-boolean";
957
+ param: string;
958
+ title: string;
959
+ description: string;
960
+ default: boolean | null;
961
+ }, {
962
+ type: "select-boolean";
963
+ param: string;
964
+ title: string;
965
+ description: string;
966
+ default: boolean | null;
1005
967
  }>, z.ZodObject<{
1006
968
  type: z.ZodLiteral<"object-schema">;
1007
969
  param: z.ZodString;
@@ -1051,6 +1013,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1051
1013
  title: string;
1052
1014
  description: string;
1053
1015
  objectSchema?: any;
1016
+ } | {
1017
+ type: "select-boolean";
1018
+ param: string;
1019
+ title: string;
1020
+ description: string;
1021
+ default: boolean | null;
1054
1022
  }>;
1055
1023
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1056
1024
  }, {
@@ -1082,6 +1050,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1082
1050
  title: string;
1083
1051
  description: string;
1084
1052
  objectSchema?: any;
1053
+ } | {
1054
+ type: "select-boolean";
1055
+ param: string;
1056
+ title: string;
1057
+ description: string;
1058
+ default: boolean | null;
1085
1059
  }>;
1086
1060
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1087
1061
  }>, {
@@ -1113,6 +1087,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1113
1087
  title: string;
1114
1088
  description: string;
1115
1089
  objectSchema?: any;
1090
+ } | {
1091
+ type: "select-boolean";
1092
+ param: string;
1093
+ title: string;
1094
+ description: string;
1095
+ default: boolean | null;
1116
1096
  }>;
1117
1097
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1118
1098
  }, {
@@ -1144,6 +1124,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1144
1124
  title: string;
1145
1125
  description: string;
1146
1126
  objectSchema?: any;
1127
+ } | {
1128
+ type: "select-boolean";
1129
+ param: string;
1130
+ title: string;
1131
+ description: string;
1132
+ default: boolean | null;
1147
1133
  }>;
1148
1134
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1149
1135
  }>;
@@ -1221,6 +1207,24 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1221
1207
  description: string;
1222
1208
  default: string;
1223
1209
  choices: string[];
1210
+ }>, z.ZodObject<{
1211
+ type: z.ZodLiteral<"select-boolean">;
1212
+ param: z.ZodString;
1213
+ title: z.ZodString;
1214
+ description: z.ZodString;
1215
+ default: z.ZodNullable<z.ZodBoolean>;
1216
+ }, "strip", z.ZodTypeAny, {
1217
+ type: "select-boolean";
1218
+ param: string;
1219
+ title: string;
1220
+ description: string;
1221
+ default: boolean | null;
1222
+ }, {
1223
+ type: "select-boolean";
1224
+ param: string;
1225
+ title: string;
1226
+ description: string;
1227
+ default: boolean | null;
1224
1228
  }>, z.ZodObject<{
1225
1229
  type: z.ZodLiteral<"object-schema">;
1226
1230
  param: z.ZodString;
@@ -1270,6 +1274,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1270
1274
  title: string;
1271
1275
  description: string;
1272
1276
  objectSchema?: any;
1277
+ } | {
1278
+ type: "select-boolean";
1279
+ param: string;
1280
+ title: string;
1281
+ description: string;
1282
+ default: boolean | null;
1273
1283
  }>;
1274
1284
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1275
1285
  }, {
@@ -1301,6 +1311,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1301
1311
  title: string;
1302
1312
  description: string;
1303
1313
  objectSchema?: any;
1314
+ } | {
1315
+ type: "select-boolean";
1316
+ param: string;
1317
+ title: string;
1318
+ description: string;
1319
+ default: boolean | null;
1304
1320
  }>;
1305
1321
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1306
1322
  }>, {
@@ -1332,6 +1348,12 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1332
1348
  title: string;
1333
1349
  description: string;
1334
1350
  objectSchema?: any;
1351
+ } | {
1352
+ type: "select-boolean";
1353
+ param: string;
1354
+ title: string;
1355
+ description: string;
1356
+ default: boolean | null;
1335
1357
  }>;
1336
1358
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1337
1359
  }, {
@@ -1363,13 +1385,19 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
1363
1385
  title: string;
1364
1386
  description: string;
1365
1387
  objectSchema?: any;
1388
+ } | {
1389
+ type: "select-boolean";
1390
+ param: string;
1391
+ title: string;
1392
+ description: string;
1393
+ default: boolean | null;
1366
1394
  }>;
1367
1395
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1368
1396
  }>;
1369
1397
  }>[k_1]; }>;
1370
1398
  type ChatModelSchemaType<R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum, M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum> = z.infer<ReturnType<typeof ChatModelSchema<R, M>>>;
1371
1399
 
1372
- declare const Headers: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>;
1400
+ declare const Headers: z.ZodRecord<z.ZodString, z.ZodString>;
1373
1401
  type HeadersType = z.infer<typeof Headers>;
1374
1402
 
1375
1403
  declare const Params: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodArray<z.ZodAny, "many">, z.ZodNull, z.ZodUndefined]>>;
@@ -1378,8 +1406,8 @@ type ParamsType = z.infer<typeof Params>;
1378
1406
  declare const Url: z.ZodString;
1379
1407
  type UrlType = z.infer<typeof Url>;
1380
1408
 
1381
- declare const ConfigItemLiterals: readonly ["range", "multi-string", "select-string", "object-schema"];
1382
- declare const ConfigItemEnum: z.ZodEnum<["range", "multi-string", "select-string", "object-schema"]>;
1409
+ declare const ConfigItemLiterals: readonly ["range", "multi-string", "select-string", "object-schema", "select-boolean"];
1410
+ declare const ConfigItemEnum: z.ZodEnum<["range", "multi-string", "select-string", "object-schema", "select-boolean"]>;
1383
1411
  type ConfigItemEnumType = z.infer<typeof ConfigItemEnum>;
1384
1412
  declare const ConfigItemDef: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1385
1413
  type: z.ZodLiteral<"range">;
@@ -1447,6 +1475,24 @@ declare const ConfigItemDef: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1447
1475
  description: string;
1448
1476
  default: string;
1449
1477
  choices: string[];
1478
+ }>, z.ZodObject<{
1479
+ type: z.ZodLiteral<"select-boolean">;
1480
+ param: z.ZodString;
1481
+ title: z.ZodString;
1482
+ description: z.ZodString;
1483
+ default: z.ZodNullable<z.ZodBoolean>;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ type: "select-boolean";
1486
+ param: string;
1487
+ title: string;
1488
+ description: string;
1489
+ default: boolean | null;
1490
+ }, {
1491
+ type: "select-boolean";
1492
+ param: string;
1493
+ title: string;
1494
+ description: string;
1495
+ default: boolean | null;
1450
1496
  }>, z.ZodObject<{
1451
1497
  type: z.ZodLiteral<"object-schema">;
1452
1498
  param: z.ZodString;
@@ -1586,6 +1632,40 @@ declare const SelectStringConfigItem: (data: Omit<SelectStringConfigItemDefType,
1586
1632
  schema: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
1587
1633
  };
1588
1634
 
1635
+ declare const SelectBooleanConfigItemTypeLiteral: "select-boolean";
1636
+ declare const SelectBooleanConfigItemDef: z.ZodObject<{
1637
+ type: z.ZodLiteral<"select-boolean">;
1638
+ param: z.ZodString;
1639
+ title: z.ZodString;
1640
+ description: z.ZodString;
1641
+ default: z.ZodNullable<z.ZodBoolean>;
1642
+ }, "strip", z.ZodTypeAny, {
1643
+ type: "select-boolean";
1644
+ param: string;
1645
+ title: string;
1646
+ description: string;
1647
+ default: boolean | null;
1648
+ }, {
1649
+ type: "select-boolean";
1650
+ param: string;
1651
+ title: string;
1652
+ description: string;
1653
+ default: boolean | null;
1654
+ }>;
1655
+ type SelectBooleanConfigItemDefType = z.infer<typeof SelectBooleanConfigItemDef>;
1656
+ declare const SelectBooleanConfigItemSchema: (defaultValue: boolean | null) => z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodBoolean>>>;
1657
+ type SelectBooleanConfigItemSchemaType = z.infer<ReturnType<typeof SelectBooleanConfigItemSchema>>;
1658
+ declare const SelectBooleanConfigItem: (data: Omit<SelectBooleanConfigItemDefType, "type">) => {
1659
+ def: {
1660
+ type: "select-boolean";
1661
+ param: string;
1662
+ title: string;
1663
+ description: string;
1664
+ default: boolean | null;
1665
+ };
1666
+ schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodBoolean>>>;
1667
+ };
1668
+
1589
1669
  declare const ObjectSchemaConfigItemTypeLiteral: "object-schema";
1590
1670
  declare const ObjectSchemaConfigItemDef: z.ZodObject<{
1591
1671
  type: z.ZodLiteral<"object-schema">;
@@ -1627,22 +1707,32 @@ declare const ObjectSchemaConfigItem: (data: Omit<ObjectSchemaConfigItemType, "t
1627
1707
  interface ChatModelV1<MS extends ChatModelSchemaType = ChatModelSchemaType> {
1628
1708
  readonly version: "v1";
1629
1709
  readonly modelSchema: MS;
1630
- getTokenCount: (messages: MessageType[]) => number;
1631
- getDefaultBaseUrl: () => UrlType;
1632
- getDefaultHeaders: () => HeadersType;
1633
- getDefaultParams: () => ParamsType;
1634
- transformConfig: (config: ConfigType, messages?: MessageType[], tools?: ToolType[]) => ParamsType;
1635
- transformMessages: (messages: MessageType[]) => ParamsType;
1636
- transformTools: (tools: ToolType[]) => ParamsType;
1637
- getCompleteChatUrl: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => UrlType;
1638
- getCompleteChatHeaders: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => HeadersType;
1639
- getCompleteChatData: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => ParamsType;
1640
- transformCompleteChatResponse: (response: any) => MessageType[];
1641
- getStreamChatUrl: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => UrlType;
1642
- getStreamChatHeaders: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => HeadersType;
1643
- getStreamChatData: (config: ConfigType, messages: MessageType[], tools?: ToolType[]) => ParamsType;
1644
- transformStreamChatResponseChunk: (chunk: string, buffer: string) => AsyncGenerator<{
1645
- partialMessages: PartialMessageType[];
1710
+ getDefaultBaseUrl(): UrlType;
1711
+ getDefaultHeaders(): HeadersType;
1712
+ getDefaultParams(): ParamsType;
1713
+ getRetryDelay(responseHeaders: HeadersType): {
1714
+ shouldRetry: boolean;
1715
+ delayMs: number;
1716
+ };
1717
+ getTokenCount(messages: MessageType[]): number;
1718
+ transformModelRequest(request: any): {
1719
+ modelName: string | undefined;
1720
+ config: ConfigType | undefined;
1721
+ messages: MessageType[] | undefined;
1722
+ tools: ToolType[] | undefined;
1723
+ };
1724
+ transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
1725
+ transformMessages(messages: MessageType[]): ParamsType;
1726
+ transformTools(tools: ToolType[]): ParamsType;
1727
+ getCompleteChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
1728
+ getCompleteChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
1729
+ getCompleteChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
1730
+ transformCompleteChatResponse(response: any): ChatResponseType;
1731
+ getStreamChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
1732
+ getStreamChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
1733
+ getStreamChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
1734
+ transformStreamChatResponseChunk(chunk: string, buffer: string): AsyncGenerator<{
1735
+ partialResponse: PartialChatResponseType;
1646
1736
  buffer: string;
1647
1737
  }>;
1648
1738
  }
@@ -1720,6 +1810,24 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1720
1810
  description: string;
1721
1811
  default: string;
1722
1812
  choices: string[];
1813
+ }>, z.ZodObject<{
1814
+ type: z.ZodLiteral<"select-boolean">;
1815
+ param: z.ZodString;
1816
+ title: z.ZodString;
1817
+ description: z.ZodString;
1818
+ default: z.ZodNullable<z.ZodBoolean>;
1819
+ }, "strip", z.ZodTypeAny, {
1820
+ type: "select-boolean";
1821
+ param: string;
1822
+ title: string;
1823
+ description: string;
1824
+ default: boolean | null;
1825
+ }, {
1826
+ type: "select-boolean";
1827
+ param: string;
1828
+ title: string;
1829
+ description: string;
1830
+ default: boolean | null;
1723
1831
  }>, z.ZodObject<{
1724
1832
  type: z.ZodLiteral<"object-schema">;
1725
1833
  param: z.ZodString;
@@ -1769,6 +1877,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1769
1877
  title: string;
1770
1878
  description: string;
1771
1879
  objectSchema?: any;
1880
+ } | {
1881
+ type: "select-boolean";
1882
+ param: string;
1883
+ title: string;
1884
+ description: string;
1885
+ default: boolean | null;
1772
1886
  }>;
1773
1887
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1774
1888
  }, {
@@ -1800,6 +1914,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1800
1914
  title: string;
1801
1915
  description: string;
1802
1916
  objectSchema?: any;
1917
+ } | {
1918
+ type: "select-boolean";
1919
+ param: string;
1920
+ title: string;
1921
+ description: string;
1922
+ default: boolean | null;
1803
1923
  }>;
1804
1924
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1805
1925
  }>, {
@@ -1831,6 +1951,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1831
1951
  title: string;
1832
1952
  description: string;
1833
1953
  objectSchema?: any;
1954
+ } | {
1955
+ type: "select-boolean";
1956
+ param: string;
1957
+ title: string;
1958
+ description: string;
1959
+ default: boolean | null;
1834
1960
  }>;
1835
1961
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1836
1962
  }, {
@@ -1862,6 +1988,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1862
1988
  title: string;
1863
1989
  description: string;
1864
1990
  objectSchema?: any;
1991
+ } | {
1992
+ type: "select-boolean";
1993
+ param: string;
1994
+ title: string;
1995
+ description: string;
1996
+ default: boolean | null;
1865
1997
  }>;
1866
1998
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1867
1999
  }>;
@@ -1900,6 +2032,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1900
2032
  title: string;
1901
2033
  description: string;
1902
2034
  objectSchema?: any;
2035
+ } | {
2036
+ type: "select-boolean";
2037
+ param: string;
2038
+ title: string;
2039
+ description: string;
2040
+ default: boolean | null;
1903
2041
  }>;
1904
2042
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1905
2043
  };
@@ -1938,6 +2076,12 @@ declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]>
1938
2076
  title: string;
1939
2077
  description: string;
1940
2078
  objectSchema?: any;
2079
+ } | {
2080
+ type: "select-boolean";
2081
+ param: string;
2082
+ title: string;
2083
+ description: string;
2084
+ default: boolean | null;
1941
2085
  }>;
1942
2086
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
1943
2087
  };
@@ -1947,16 +2091,25 @@ type EmbeddingModelSchemaType<M extends z.ZodEnum<[string, ...string[]]> = typeo
1947
2091
  interface EmbeddingModelV1<MS extends EmbeddingModelSchemaType = EmbeddingModelSchemaType> {
1948
2092
  readonly version: "v1";
1949
2093
  readonly modelSchema: MS;
1950
- getTokenCount: (requests: EmbeddingRequestsType) => number;
1951
- getDefaultBaseUrl: () => UrlType;
1952
- getDefaultHeaders: () => HeadersType;
1953
- getDefaultParams: () => ParamsType;
1954
- transformConfig: (config: ConfigType, requests?: EmbeddingRequestsType) => ParamsType;
1955
- transformEmbeddingRequests: (requests: EmbeddingRequestsType) => ParamsType;
1956
- getGetEmbeddingsUrl: (config: ConfigType, requests: EmbeddingRequestsType) => UrlType;
1957
- getGetEmbeddingsHeaders: (config: ConfigType, requests: EmbeddingRequestsType) => HeadersType;
1958
- getGetEmbeddingsData: (config: ConfigType, requests: EmbeddingRequestsType) => ParamsType;
1959
- transformGetEmbeddingsResponse: (response: any) => EmbeddingsType;
2094
+ getDefaultBaseUrl(): UrlType;
2095
+ getDefaultHeaders(): HeadersType;
2096
+ getDefaultParams(): ParamsType;
2097
+ getRetryDelay(responseHeaders: HeadersType): {
2098
+ shouldRetry: boolean;
2099
+ delayMs: number;
2100
+ };
2101
+ getTokenCount(requests: EmbeddingRequestsType): number;
2102
+ transformModelRequest(request: any): {
2103
+ modelName: string | undefined;
2104
+ config: ConfigType | undefined;
2105
+ embeddingRequests: EmbeddingRequestsType | undefined;
2106
+ };
2107
+ transformConfig(config: ConfigType, requests?: EmbeddingRequestsType): ParamsType;
2108
+ transformEmbeddingRequests(requests: EmbeddingRequestsType): ParamsType;
2109
+ getGetEmbeddingsUrl(config?: ConfigType, requests?: EmbeddingRequestsType): Promise<UrlType>;
2110
+ getGetEmbeddingsHeaders(config?: ConfigType, requests?: EmbeddingRequestsType): Promise<HeadersType>;
2111
+ getGetEmbeddingsData(config: ConfigType, requests: EmbeddingRequestsType): Promise<ParamsType>;
2112
+ transformGetEmbeddingsResponse(response: any): EmbeddingResponseType;
1960
2113
  }
1961
2114
 
1962
2115
  interface ProviderV1<O extends Record<string, any> = Record<string, any>> {
@@ -2016,7 +2169,10 @@ declare const removeUndefinedEntries: <T = unknown>(record: Record<string, T | u
2016
2169
 
2017
2170
  declare const convertBase64ToUint8Array: (base64String: string) => Uint8Array;
2018
2171
  declare const convertUint8ArrayToBase64: (array: Uint8Array) => string;
2172
+ declare const encodedBase64ToString: (base64: string) => string;
2019
2173
 
2020
2174
  declare const urlWithoutTrailingSlash: (url: string) => string;
2021
2175
 
2022
- export { ApiRequestError, ApiResponseError, CONFIG, ChatModelSchema, type ChatModelSchemaType, type ChatModelV1, ConfigItemDef, type ConfigItemDefType, ConfigItemEnum, type ConfigItemEnumType, ConfigItemLiterals, DownloadError, EmbeddingModelSchema, type EmbeddingModelSchemaType, type EmbeddingModelV1, Headers, type HeadersType, InvalidAuthError, InvalidConfigError, InvalidEmbeddingRequestsError, InvalidEndpointError, InvalidMessagesError, InvalidModalityError, InvalidModelError, InvalidPromptError, InvalidRoleError, InvalidToolsError, JsonParseError, MultiStringConfigItem, MultiStringConfigItemDef, MultiStringConfigItemSchema, type MultiStringConfigItemSchemaType, type MultiStringConfigItemType, MultiStringConfigItemTypeLiteral, ObjectSchemaConfigItem, ObjectSchemaConfigItemDef, ObjectSchemaConfigItemSchema, type ObjectSchemaConfigItemSchemaType, type ObjectSchemaConfigItemType, ObjectSchemaConfigItemTypeLiteral, Params, type ParamsType, type ProviderV1, RangeConfigItem, RangeConfigItemDef, type RangeConfigItemDefType, RangeConfigItemSchema, type RangeConfigItemSchemaType, RangeConfigItemTypeLiteral, SelectStringConfigItem, SelectStringConfigItemDef, type SelectStringConfigItemDefType, SelectStringConfigItemSchema, type SelectStringConfigItemSchemaType, SelectStringConfigItemTypeLiteral, Url, type UrlType, ValidationError, convertBase64ToUint8Array, convertUint8ArrayToBase64, getErrorMessage, removeUndefinedEntries, urlWithoutTrailingSlash };
2176
+ declare const isRunningInBrowser: () => boolean;
2177
+
2178
+ export { CONFIG, ChatModelSchema, type ChatModelSchemaType, type ChatModelV1, ConfigItemDef, type ConfigItemDefType, ConfigItemEnum, type ConfigItemEnumType, ConfigItemLiterals, EmbeddingModelSchema, type EmbeddingModelSchemaType, type EmbeddingModelV1, Headers, type HeadersType, InvalidConfigError, InvalidEmbeddingRequestsError, InvalidMessagesError, InvalidModelRequestError, InvalidToolsError, ModelError, ModelResponseError, MultiStringConfigItem, MultiStringConfigItemDef, MultiStringConfigItemSchema, type MultiStringConfigItemSchemaType, type MultiStringConfigItemType, MultiStringConfigItemTypeLiteral, ObjectSchemaConfigItem, ObjectSchemaConfigItemDef, ObjectSchemaConfigItemSchema, type ObjectSchemaConfigItemSchemaType, type ObjectSchemaConfigItemType, ObjectSchemaConfigItemTypeLiteral, Params, type ParamsType, ProviderError, type ProviderV1, RangeConfigItem, RangeConfigItemDef, type RangeConfigItemDefType, RangeConfigItemSchema, type RangeConfigItemSchemaType, RangeConfigItemTypeLiteral, SelectBooleanConfigItem, SelectBooleanConfigItemDef, type SelectBooleanConfigItemDefType, SelectBooleanConfigItemSchema, type SelectBooleanConfigItemSchemaType, SelectBooleanConfigItemTypeLiteral, SelectStringConfigItem, SelectStringConfigItemDef, type SelectStringConfigItemDefType, SelectStringConfigItemSchema, type SelectStringConfigItemSchemaType, SelectStringConfigItemTypeLiteral, Url, type UrlType, convertBase64ToUint8Array, convertUint8ArrayToBase64, encodedBase64ToString, getErrorMessage, isRunningInBrowser, removeUndefinedEntries, urlWithoutTrailingSlash };