@adaline/gateway 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +130 -85
- package/dist/index.d.ts +130 -85
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -51,18 +51,16 @@ declare class HttpRequestError extends GatewayBaseError {
|
|
|
51
51
|
interface HttpClientConfig {
|
|
52
52
|
timeoutInMilliseconds?: number;
|
|
53
53
|
axiosInstance?: AxiosInstance;
|
|
54
|
-
proxyUrl?:
|
|
54
|
+
proxyUrl?: URL | undefined;
|
|
55
55
|
}
|
|
56
56
|
declare class IsomorphicHttpClient implements HttpClient {
|
|
57
57
|
private defaultTimeout?;
|
|
58
58
|
private client;
|
|
59
|
-
private
|
|
60
|
-
private httpsProxyAgent?;
|
|
59
|
+
private proxyUrl?;
|
|
61
60
|
constructor(config: HttpClientConfig);
|
|
62
61
|
isNodeEnvironment: () => boolean;
|
|
63
62
|
private makeRequest;
|
|
64
|
-
stream<T>(url: string, method: "get" | "post", data?: Record<string, unknown>, headers?: Record<string, string>,
|
|
65
|
-
options?: {
|
|
63
|
+
stream<T>(url: string, method: "get" | "post", data?: Record<string, unknown>, headers?: Record<string, string>, options?: {
|
|
66
64
|
abortSignal?: AbortSignal;
|
|
67
65
|
}): AsyncGenerator<T, void, unknown>;
|
|
68
66
|
get<T>(url: string, params?: Record<string, unknown>, headers?: Record<string, string | undefined>): Promise<HttpClientResponse<T>>;
|
|
@@ -83,7 +81,6 @@ declare class QueueTaskTimeoutError extends GatewayBaseError {
|
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
interface Cache<T> {
|
|
86
|
-
getCacheKey(data: any): string;
|
|
87
84
|
get(key: string): Promise<T | undefined>;
|
|
88
85
|
set(key: string, value: T): Promise<void>;
|
|
89
86
|
delete(key: string): Promise<void>;
|
|
@@ -93,7 +90,6 @@ interface Cache<T> {
|
|
|
93
90
|
declare class LRUCache<T extends object> implements Cache<T> {
|
|
94
91
|
private cache;
|
|
95
92
|
constructor(maxEntries?: number);
|
|
96
|
-
getCacheKey(data: any): string;
|
|
97
93
|
get(key: string): Promise<T | undefined>;
|
|
98
94
|
set(key: string, value: T): Promise<void>;
|
|
99
95
|
delete(key: string): Promise<void>;
|
|
@@ -154,6 +150,27 @@ declare class SimpleQueue<Request, Response> implements Queue<Request, Response>
|
|
|
154
150
|
private processQueue;
|
|
155
151
|
}
|
|
156
152
|
|
|
153
|
+
type AnalyticsEvent = {
|
|
154
|
+
event: string;
|
|
155
|
+
timestamp: string;
|
|
156
|
+
dimensions: {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
interface AnalyticsRecorder {
|
|
161
|
+
record(event: AnalyticsEvent["event"], dimensions: AnalyticsEvent["dimensions"]): void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare class PostAnalytics implements AnalyticsRecorder {
|
|
165
|
+
private events;
|
|
166
|
+
private batchSize;
|
|
167
|
+
private endpointUrl;
|
|
168
|
+
constructor(endpointUrl: string, batchSize: number);
|
|
169
|
+
record(event: AnalyticsEvent["event"], dimensions: AnalyticsEvent["dimensions"]): void;
|
|
170
|
+
private flushEvents;
|
|
171
|
+
private sendEvents;
|
|
172
|
+
}
|
|
173
|
+
|
|
157
174
|
declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
158
175
|
cache: z.ZodType<Cache<{
|
|
159
176
|
request: {
|
|
@@ -377,12 +394,6 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
377
394
|
metadataForCallbacks?: any;
|
|
378
395
|
}>>;
|
|
379
396
|
model: z.ZodType<ChatModelV1<{
|
|
380
|
-
name: string;
|
|
381
|
-
description: string;
|
|
382
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
383
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
384
|
-
maxInputTokens: number;
|
|
385
|
-
maxOutputTokens: number;
|
|
386
397
|
config: {
|
|
387
398
|
def: Record<string, {
|
|
388
399
|
type: "multi-string";
|
|
@@ -421,13 +432,13 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
421
432
|
}>;
|
|
422
433
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
423
434
|
};
|
|
424
|
-
}>, z.ZodTypeDef, ChatModelV1<{
|
|
425
435
|
name: string;
|
|
426
436
|
description: string;
|
|
427
437
|
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
428
438
|
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
429
439
|
maxInputTokens: number;
|
|
430
440
|
maxOutputTokens: number;
|
|
441
|
+
}>, z.ZodTypeDef, ChatModelV1<{
|
|
431
442
|
config: {
|
|
432
443
|
def: Record<string, {
|
|
433
444
|
type: "multi-string";
|
|
@@ -466,6 +477,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
466
477
|
}>;
|
|
467
478
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
468
479
|
};
|
|
480
|
+
name: string;
|
|
481
|
+
description: string;
|
|
482
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
483
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
484
|
+
maxInputTokens: number;
|
|
485
|
+
maxOutputTokens: number;
|
|
469
486
|
}>>;
|
|
470
487
|
config: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
471
488
|
messages: z.ZodArray<z.ZodObject<{
|
|
@@ -705,17 +722,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
705
722
|
metadata?: any;
|
|
706
723
|
}>]>, "many">>;
|
|
707
724
|
enableCache: z.ZodBoolean;
|
|
725
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
708
726
|
callbacks: z.ZodOptional<z.ZodArray<z.ZodType<CompleteChatCallbackType<any>, z.ZodTypeDef, CompleteChatCallbackType<any>>, "atleastone">>;
|
|
709
727
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
710
728
|
}, "strip", z.ZodTypeAny, {
|
|
711
729
|
config: Record<string, any>;
|
|
712
730
|
model: ChatModelV1<{
|
|
713
|
-
name: string;
|
|
714
|
-
description: string;
|
|
715
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
716
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
717
|
-
maxInputTokens: number;
|
|
718
|
-
maxOutputTokens: number;
|
|
719
731
|
config: {
|
|
720
732
|
def: Record<string, {
|
|
721
733
|
type: "multi-string";
|
|
@@ -754,6 +766,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
754
766
|
}>;
|
|
755
767
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
756
768
|
};
|
|
769
|
+
name: string;
|
|
770
|
+
description: string;
|
|
771
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
772
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
773
|
+
maxInputTokens: number;
|
|
774
|
+
maxOutputTokens: number;
|
|
757
775
|
}>;
|
|
758
776
|
messages: {
|
|
759
777
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -914,17 +932,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
914
932
|
};
|
|
915
933
|
metadata?: any;
|
|
916
934
|
}[] | undefined;
|
|
935
|
+
customHeaders?: Record<string, string> | undefined;
|
|
917
936
|
metadataForCallbacks?: any;
|
|
918
937
|
callbacks?: [CompleteChatCallbackType<any>, ...CompleteChatCallbackType<any>[]] | undefined;
|
|
919
938
|
}, {
|
|
920
939
|
config: Record<string, any>;
|
|
921
940
|
model: ChatModelV1<{
|
|
922
|
-
name: string;
|
|
923
|
-
description: string;
|
|
924
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
925
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
926
|
-
maxInputTokens: number;
|
|
927
|
-
maxOutputTokens: number;
|
|
928
941
|
config: {
|
|
929
942
|
def: Record<string, {
|
|
930
943
|
type: "multi-string";
|
|
@@ -963,6 +976,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
963
976
|
}>;
|
|
964
977
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
965
978
|
};
|
|
979
|
+
name: string;
|
|
980
|
+
description: string;
|
|
981
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
982
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
983
|
+
maxInputTokens: number;
|
|
984
|
+
maxOutputTokens: number;
|
|
966
985
|
}>;
|
|
967
986
|
messages: {
|
|
968
987
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -1123,6 +1142,7 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
|
|
|
1123
1142
|
};
|
|
1124
1143
|
metadata?: any;
|
|
1125
1144
|
}[] | undefined;
|
|
1145
|
+
customHeaders?: Record<string, string> | undefined;
|
|
1126
1146
|
metadataForCallbacks?: any;
|
|
1127
1147
|
callbacks?: [CompleteChatCallbackType<any>, ...CompleteChatCallbackType<any>[]] | undefined;
|
|
1128
1148
|
}>;
|
|
@@ -2236,6 +2256,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
|
|
|
2236
2256
|
metadata?: undefined;
|
|
2237
2257
|
}>]>;
|
|
2238
2258
|
enableCache: z.ZodBoolean;
|
|
2259
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2239
2260
|
callbacks: z.ZodOptional<z.ZodArray<z.ZodType<GetEmbeddingsCallbackType<any>, z.ZodTypeDef, GetEmbeddingsCallbackType<any>>, "atleastone">>;
|
|
2240
2261
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
2241
2262
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2335,6 +2356,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
|
|
|
2335
2356
|
requests: number[][];
|
|
2336
2357
|
metadata?: undefined;
|
|
2337
2358
|
};
|
|
2359
|
+
customHeaders?: Record<string, string> | undefined;
|
|
2338
2360
|
metadataForCallbacks?: any;
|
|
2339
2361
|
callbacks?: [GetEmbeddingsCallbackType<any>, ...GetEmbeddingsCallbackType<any>[]] | undefined;
|
|
2340
2362
|
}, {
|
|
@@ -2434,6 +2456,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
|
|
|
2434
2456
|
requests: number[][];
|
|
2435
2457
|
metadata?: undefined;
|
|
2436
2458
|
};
|
|
2459
|
+
customHeaders?: Record<string, string> | undefined;
|
|
2437
2460
|
metadataForCallbacks?: any;
|
|
2438
2461
|
callbacks?: [GetEmbeddingsCallbackType<any>, ...GetEmbeddingsCallbackType<any>[]] | undefined;
|
|
2439
2462
|
}>;
|
|
@@ -2668,12 +2691,6 @@ declare function handleGetEmbeddings(request: GetEmbeddingsHandlerRequestType, c
|
|
|
2668
2691
|
|
|
2669
2692
|
declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
2670
2693
|
model: z.ZodType<ChatModelV1<{
|
|
2671
|
-
name: string;
|
|
2672
|
-
description: string;
|
|
2673
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
2674
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
2675
|
-
maxInputTokens: number;
|
|
2676
|
-
maxOutputTokens: number;
|
|
2677
2694
|
config: {
|
|
2678
2695
|
def: Record<string, {
|
|
2679
2696
|
type: "multi-string";
|
|
@@ -2712,13 +2729,13 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
2712
2729
|
}>;
|
|
2713
2730
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
2714
2731
|
};
|
|
2715
|
-
}>, z.ZodTypeDef, ChatModelV1<{
|
|
2716
2732
|
name: string;
|
|
2717
2733
|
description: string;
|
|
2718
2734
|
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
2719
2735
|
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
2720
2736
|
maxInputTokens: number;
|
|
2721
2737
|
maxOutputTokens: number;
|
|
2738
|
+
}>, z.ZodTypeDef, ChatModelV1<{
|
|
2722
2739
|
config: {
|
|
2723
2740
|
def: Record<string, {
|
|
2724
2741
|
type: "multi-string";
|
|
@@ -2757,6 +2774,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
2757
2774
|
}>;
|
|
2758
2775
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
2759
2776
|
};
|
|
2777
|
+
name: string;
|
|
2778
|
+
description: string;
|
|
2779
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
2780
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
2781
|
+
maxInputTokens: number;
|
|
2782
|
+
maxOutputTokens: number;
|
|
2760
2783
|
}>>;
|
|
2761
2784
|
config: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
2762
2785
|
messages: z.ZodArray<z.ZodObject<{
|
|
@@ -2995,17 +3018,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
2995
3018
|
};
|
|
2996
3019
|
metadata?: any;
|
|
2997
3020
|
}>]>, "many">>;
|
|
3021
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2998
3022
|
callbacks: z.ZodOptional<z.ZodArray<z.ZodType<StreamChatCallbackType<any>, z.ZodTypeDef, StreamChatCallbackType<any>>, "atleastone">>;
|
|
2999
3023
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
3000
3024
|
}, "strip", z.ZodTypeAny, {
|
|
3001
3025
|
config: Record<string, any>;
|
|
3002
3026
|
model: ChatModelV1<{
|
|
3003
|
-
name: string;
|
|
3004
|
-
description: string;
|
|
3005
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
3006
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
3007
|
-
maxInputTokens: number;
|
|
3008
|
-
maxOutputTokens: number;
|
|
3009
3027
|
config: {
|
|
3010
3028
|
def: Record<string, {
|
|
3011
3029
|
type: "multi-string";
|
|
@@ -3044,6 +3062,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
3044
3062
|
}>;
|
|
3045
3063
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
3046
3064
|
};
|
|
3065
|
+
name: string;
|
|
3066
|
+
description: string;
|
|
3067
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
3068
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
3069
|
+
maxInputTokens: number;
|
|
3070
|
+
maxOutputTokens: number;
|
|
3047
3071
|
}>;
|
|
3048
3072
|
messages: {
|
|
3049
3073
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -3092,17 +3116,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
3092
3116
|
};
|
|
3093
3117
|
metadata?: any;
|
|
3094
3118
|
}[] | undefined;
|
|
3119
|
+
customHeaders?: Record<string, string> | undefined;
|
|
3095
3120
|
metadataForCallbacks?: any;
|
|
3096
3121
|
callbacks?: [StreamChatCallbackType<any>, ...StreamChatCallbackType<any>[]] | undefined;
|
|
3097
3122
|
}, {
|
|
3098
3123
|
config: Record<string, any>;
|
|
3099
3124
|
model: ChatModelV1<{
|
|
3100
|
-
name: string;
|
|
3101
|
-
description: string;
|
|
3102
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
3103
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
3104
|
-
maxInputTokens: number;
|
|
3105
|
-
maxOutputTokens: number;
|
|
3106
3125
|
config: {
|
|
3107
3126
|
def: Record<string, {
|
|
3108
3127
|
type: "multi-string";
|
|
@@ -3141,6 +3160,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
3141
3160
|
}>;
|
|
3142
3161
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
3143
3162
|
};
|
|
3163
|
+
name: string;
|
|
3164
|
+
description: string;
|
|
3165
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
3166
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
3167
|
+
maxInputTokens: number;
|
|
3168
|
+
maxOutputTokens: number;
|
|
3144
3169
|
}>;
|
|
3145
3170
|
messages: {
|
|
3146
3171
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -3189,6 +3214,7 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
|
|
|
3189
3214
|
};
|
|
3190
3215
|
metadata?: any;
|
|
3191
3216
|
}[] | undefined;
|
|
3217
|
+
customHeaders?: Record<string, string> | undefined;
|
|
3192
3218
|
metadataForCallbacks?: any;
|
|
3193
3219
|
callbacks?: [StreamChatCallbackType<any>, ...StreamChatCallbackType<any>[]] | undefined;
|
|
3194
3220
|
}>;
|
|
@@ -3911,7 +3937,7 @@ type StreamChatCallbackType<M = any> = {
|
|
|
3911
3937
|
onStreamFirstResponse?: (metadata?: M, response?: StreamChatHandlerResponseType, chunk?: unknown) => Promise<void> | void;
|
|
3912
3938
|
onStreamNewResponse?: (metadata?: M, response?: StreamChatHandlerResponseType, chunk?: unknown) => Promise<void> | void;
|
|
3913
3939
|
onStreamEnd?: (metadata?: M, response?: StreamChatHandlerResponseType) => Promise<void> | void;
|
|
3914
|
-
onStreamError?: (metadata?: M, error?: GatewayError) => Promise<void> | void;
|
|
3940
|
+
onStreamError?: (metadata?: M, error?: GatewayError | HttpRequestError) => Promise<void> | void;
|
|
3915
3941
|
};
|
|
3916
3942
|
|
|
3917
3943
|
declare function handleStreamChat<M>(request: StreamChatHandlerRequestType, client: HttpClient): AsyncGenerator<StreamChatHandlerResponseType, void, unknown>;
|
|
@@ -3950,6 +3976,7 @@ declare const GatewayOptions: z.ZodObject<{
|
|
|
3950
3976
|
}>>;
|
|
3951
3977
|
dangerouslyAllowBrowser: z.ZodOptional<z.ZodBoolean>;
|
|
3952
3978
|
httpClient: z.ZodOptional<z.ZodType<HttpClient, z.ZodTypeDef, HttpClient>>;
|
|
3979
|
+
proxyUrl: z.ZodOptional<z.ZodString>;
|
|
3953
3980
|
completeChatCache: z.ZodOptional<z.ZodType<Cache<{
|
|
3954
3981
|
request: {
|
|
3955
3982
|
config: Record<string, any>;
|
|
@@ -4265,6 +4292,7 @@ declare const GatewayOptions: z.ZodObject<{
|
|
|
4265
4292
|
} | undefined;
|
|
4266
4293
|
dangerouslyAllowBrowser?: boolean | undefined;
|
|
4267
4294
|
httpClient?: HttpClient | undefined;
|
|
4295
|
+
proxyUrl?: string | undefined;
|
|
4268
4296
|
completeChatCache?: Cache<{
|
|
4269
4297
|
request: {
|
|
4270
4298
|
config: Record<string, any>;
|
|
@@ -4431,6 +4459,7 @@ declare const GatewayOptions: z.ZodObject<{
|
|
|
4431
4459
|
} | undefined;
|
|
4432
4460
|
dangerouslyAllowBrowser?: boolean | undefined;
|
|
4433
4461
|
httpClient?: HttpClient | undefined;
|
|
4462
|
+
proxyUrl?: string | undefined;
|
|
4434
4463
|
completeChatCache?: Cache<{
|
|
4435
4464
|
request: {
|
|
4436
4465
|
config: Record<string, any>;
|
|
@@ -4589,12 +4618,6 @@ declare const GatewayOptions: z.ZodObject<{
|
|
|
4589
4618
|
type GatewayOptionsType = z.infer<typeof GatewayOptions>;
|
|
4590
4619
|
declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
4591
4620
|
model: z.ZodType<ChatModelV1<{
|
|
4592
|
-
name: string;
|
|
4593
|
-
description: string;
|
|
4594
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
4595
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
4596
|
-
maxInputTokens: number;
|
|
4597
|
-
maxOutputTokens: number;
|
|
4598
4621
|
config: {
|
|
4599
4622
|
def: Record<string, {
|
|
4600
4623
|
type: "multi-string";
|
|
@@ -4633,13 +4656,13 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
4633
4656
|
}>;
|
|
4634
4657
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
4635
4658
|
};
|
|
4636
|
-
}>, z.ZodTypeDef, ChatModelV1<{
|
|
4637
4659
|
name: string;
|
|
4638
4660
|
description: string;
|
|
4639
4661
|
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
4640
4662
|
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
4641
4663
|
maxInputTokens: number;
|
|
4642
4664
|
maxOutputTokens: number;
|
|
4665
|
+
}>, z.ZodTypeDef, ChatModelV1<{
|
|
4643
4666
|
config: {
|
|
4644
4667
|
def: Record<string, {
|
|
4645
4668
|
type: "multi-string";
|
|
@@ -4678,6 +4701,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
4678
4701
|
}>;
|
|
4679
4702
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
4680
4703
|
};
|
|
4704
|
+
name: string;
|
|
4705
|
+
description: string;
|
|
4706
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
4707
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
4708
|
+
maxInputTokens: number;
|
|
4709
|
+
maxOutputTokens: number;
|
|
4681
4710
|
}>>;
|
|
4682
4711
|
config: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
4683
4712
|
messages: z.ZodArray<z.ZodObject<{
|
|
@@ -4918,23 +4947,20 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
4918
4947
|
}>]>, "many">>;
|
|
4919
4948
|
options: z.ZodOptional<z.ZodObject<{
|
|
4920
4949
|
enableCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
4950
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4921
4951
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
4922
4952
|
}, "strip", z.ZodTypeAny, {
|
|
4923
4953
|
enableCache: boolean;
|
|
4954
|
+
customHeaders?: Record<string, string> | undefined;
|
|
4924
4955
|
metadataForCallbacks?: any;
|
|
4925
4956
|
}, {
|
|
4926
4957
|
enableCache?: boolean | undefined;
|
|
4958
|
+
customHeaders?: Record<string, string> | undefined;
|
|
4927
4959
|
metadataForCallbacks?: any;
|
|
4928
4960
|
}>>;
|
|
4929
4961
|
}, "strip", z.ZodTypeAny, {
|
|
4930
4962
|
config: Record<string, any>;
|
|
4931
4963
|
model: ChatModelV1<{
|
|
4932
|
-
name: string;
|
|
4933
|
-
description: string;
|
|
4934
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
4935
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
4936
|
-
maxInputTokens: number;
|
|
4937
|
-
maxOutputTokens: number;
|
|
4938
4964
|
config: {
|
|
4939
4965
|
def: Record<string, {
|
|
4940
4966
|
type: "multi-string";
|
|
@@ -4973,6 +4999,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
4973
4999
|
}>;
|
|
4974
5000
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
4975
5001
|
};
|
|
5002
|
+
name: string;
|
|
5003
|
+
description: string;
|
|
5004
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5005
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5006
|
+
maxInputTokens: number;
|
|
5007
|
+
maxOutputTokens: number;
|
|
4976
5008
|
}>;
|
|
4977
5009
|
messages: {
|
|
4978
5010
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -5011,6 +5043,7 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
5011
5043
|
}[];
|
|
5012
5044
|
options?: {
|
|
5013
5045
|
enableCache: boolean;
|
|
5046
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5014
5047
|
metadataForCallbacks?: any;
|
|
5015
5048
|
} | undefined;
|
|
5016
5049
|
tools?: {
|
|
@@ -5028,12 +5061,6 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
5028
5061
|
}, {
|
|
5029
5062
|
config: Record<string, any>;
|
|
5030
5063
|
model: ChatModelV1<{
|
|
5031
|
-
name: string;
|
|
5032
|
-
description: string;
|
|
5033
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5034
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5035
|
-
maxInputTokens: number;
|
|
5036
|
-
maxOutputTokens: number;
|
|
5037
5064
|
config: {
|
|
5038
5065
|
def: Record<string, {
|
|
5039
5066
|
type: "multi-string";
|
|
@@ -5072,6 +5099,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
5072
5099
|
}>;
|
|
5073
5100
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
5074
5101
|
};
|
|
5102
|
+
name: string;
|
|
5103
|
+
description: string;
|
|
5104
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5105
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5106
|
+
maxInputTokens: number;
|
|
5107
|
+
maxOutputTokens: number;
|
|
5075
5108
|
}>;
|
|
5076
5109
|
messages: {
|
|
5077
5110
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -5110,6 +5143,7 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
5110
5143
|
}[];
|
|
5111
5144
|
options?: {
|
|
5112
5145
|
enableCache?: boolean | undefined;
|
|
5146
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5113
5147
|
metadataForCallbacks?: any;
|
|
5114
5148
|
} | undefined;
|
|
5115
5149
|
tools?: {
|
|
@@ -5128,12 +5162,6 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
|
|
|
5128
5162
|
type GatewayCompleteChatRequestType = z.infer<typeof GatewayCompleteChatRequest>;
|
|
5129
5163
|
declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
5130
5164
|
model: z.ZodType<ChatModelV1<{
|
|
5131
|
-
name: string;
|
|
5132
|
-
description: string;
|
|
5133
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5134
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5135
|
-
maxInputTokens: number;
|
|
5136
|
-
maxOutputTokens: number;
|
|
5137
5165
|
config: {
|
|
5138
5166
|
def: Record<string, {
|
|
5139
5167
|
type: "multi-string";
|
|
@@ -5172,13 +5200,13 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5172
5200
|
}>;
|
|
5173
5201
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
5174
5202
|
};
|
|
5175
|
-
}>, z.ZodTypeDef, ChatModelV1<{
|
|
5176
5203
|
name: string;
|
|
5177
5204
|
description: string;
|
|
5178
5205
|
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5179
5206
|
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5180
5207
|
maxInputTokens: number;
|
|
5181
5208
|
maxOutputTokens: number;
|
|
5209
|
+
}>, z.ZodTypeDef, ChatModelV1<{
|
|
5182
5210
|
config: {
|
|
5183
5211
|
def: Record<string, {
|
|
5184
5212
|
type: "multi-string";
|
|
@@ -5217,6 +5245,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5217
5245
|
}>;
|
|
5218
5246
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
5219
5247
|
};
|
|
5248
|
+
name: string;
|
|
5249
|
+
description: string;
|
|
5250
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5251
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5252
|
+
maxInputTokens: number;
|
|
5253
|
+
maxOutputTokens: number;
|
|
5220
5254
|
}>>;
|
|
5221
5255
|
config: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
5222
5256
|
messages: z.ZodArray<z.ZodObject<{
|
|
@@ -5456,21 +5490,18 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5456
5490
|
metadata?: any;
|
|
5457
5491
|
}>]>, "many">>;
|
|
5458
5492
|
options: z.ZodOptional<z.ZodObject<{
|
|
5493
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5459
5494
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
5460
5495
|
}, "strip", z.ZodTypeAny, {
|
|
5496
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5461
5497
|
metadataForCallbacks?: any;
|
|
5462
5498
|
}, {
|
|
5499
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5463
5500
|
metadataForCallbacks?: any;
|
|
5464
5501
|
}>>;
|
|
5465
5502
|
}, "strip", z.ZodTypeAny, {
|
|
5466
5503
|
config: Record<string, any>;
|
|
5467
5504
|
model: ChatModelV1<{
|
|
5468
|
-
name: string;
|
|
5469
|
-
description: string;
|
|
5470
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5471
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5472
|
-
maxInputTokens: number;
|
|
5473
|
-
maxOutputTokens: number;
|
|
5474
5505
|
config: {
|
|
5475
5506
|
def: Record<string, {
|
|
5476
5507
|
type: "multi-string";
|
|
@@ -5509,6 +5540,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5509
5540
|
}>;
|
|
5510
5541
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
5511
5542
|
};
|
|
5543
|
+
name: string;
|
|
5544
|
+
description: string;
|
|
5545
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5546
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5547
|
+
maxInputTokens: number;
|
|
5548
|
+
maxOutputTokens: number;
|
|
5512
5549
|
}>;
|
|
5513
5550
|
messages: {
|
|
5514
5551
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -5546,6 +5583,7 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5546
5583
|
metadata?: undefined;
|
|
5547
5584
|
}[];
|
|
5548
5585
|
options?: {
|
|
5586
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5549
5587
|
metadataForCallbacks?: any;
|
|
5550
5588
|
} | undefined;
|
|
5551
5589
|
tools?: {
|
|
@@ -5563,12 +5601,6 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5563
5601
|
}, {
|
|
5564
5602
|
config: Record<string, any>;
|
|
5565
5603
|
model: ChatModelV1<{
|
|
5566
|
-
name: string;
|
|
5567
|
-
description: string;
|
|
5568
|
-
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5569
|
-
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5570
|
-
maxInputTokens: number;
|
|
5571
|
-
maxOutputTokens: number;
|
|
5572
5604
|
config: {
|
|
5573
5605
|
def: Record<string, {
|
|
5574
5606
|
type: "multi-string";
|
|
@@ -5607,6 +5639,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5607
5639
|
}>;
|
|
5608
5640
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
5609
5641
|
};
|
|
5642
|
+
name: string;
|
|
5643
|
+
description: string;
|
|
5644
|
+
roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
|
|
5645
|
+
modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
|
|
5646
|
+
maxInputTokens: number;
|
|
5647
|
+
maxOutputTokens: number;
|
|
5610
5648
|
}>;
|
|
5611
5649
|
messages: {
|
|
5612
5650
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -5644,6 +5682,7 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
|
|
|
5644
5682
|
metadata?: undefined;
|
|
5645
5683
|
}[];
|
|
5646
5684
|
options?: {
|
|
5685
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5647
5686
|
metadataForCallbacks?: any;
|
|
5648
5687
|
} | undefined;
|
|
5649
5688
|
tools?: {
|
|
@@ -5778,12 +5817,15 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
|
|
|
5778
5817
|
}>]>;
|
|
5779
5818
|
options: z.ZodOptional<z.ZodObject<{
|
|
5780
5819
|
enableCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
5820
|
+
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5781
5821
|
metadataForCallbacks: z.ZodOptional<z.ZodAny>;
|
|
5782
5822
|
}, "strip", z.ZodTypeAny, {
|
|
5783
5823
|
enableCache: boolean;
|
|
5824
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5784
5825
|
metadataForCallbacks?: any;
|
|
5785
5826
|
}, {
|
|
5786
5827
|
enableCache?: boolean | undefined;
|
|
5828
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5787
5829
|
metadataForCallbacks?: any;
|
|
5788
5830
|
}>>;
|
|
5789
5831
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -5844,6 +5886,7 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
|
|
|
5844
5886
|
};
|
|
5845
5887
|
options?: {
|
|
5846
5888
|
enableCache: boolean;
|
|
5889
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5847
5890
|
metadataForCallbacks?: any;
|
|
5848
5891
|
} | undefined;
|
|
5849
5892
|
}, {
|
|
@@ -5904,6 +5947,7 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
|
|
|
5904
5947
|
};
|
|
5905
5948
|
options?: {
|
|
5906
5949
|
enableCache?: boolean | undefined;
|
|
5950
|
+
customHeaders?: Record<string, string> | undefined;
|
|
5907
5951
|
metadataForCallbacks?: any;
|
|
5908
5952
|
} | undefined;
|
|
5909
5953
|
}>;
|
|
@@ -5914,6 +5958,7 @@ declare class Gateway {
|
|
|
5914
5958
|
private httpClient;
|
|
5915
5959
|
private queues;
|
|
5916
5960
|
private caches;
|
|
5961
|
+
private analytics;
|
|
5917
5962
|
constructor(options: GatewayOptionsType);
|
|
5918
5963
|
completeChat(request: GatewayCompleteChatRequestType): Promise<CompleteChatHandlerResponseType>;
|
|
5919
5964
|
private executeCompleteChat;
|
|
@@ -5923,4 +5968,4 @@ declare class Gateway {
|
|
|
5923
5968
|
static GatewayError: typeof GatewayError;
|
|
5924
5969
|
}
|
|
5925
5970
|
|
|
5926
|
-
export { type Cache, type CompleteChatCallbackType, CompleteChatHandlerRequest, type CompleteChatHandlerRequestType, CompleteChatHandlerResponse, type CompleteChatHandlerResponseType, Gateway, GatewayError, type GatewayOptionsType, type GetEmbeddingsCallbackType, GetEmbeddingsHandlerRequest, type GetEmbeddingsHandlerRequestType, GetEmbeddingsHandlerResponse, type GetEmbeddingsHandlerResponseType, type HttpClient, HttpClientError, type HttpClientResponse, HttpRequestError, IsomorphicHttpClient, LRUCache, type Queue, QueueOptions, type QueueOptionsType, type QueueTask, QueueTaskTimeoutError, SimpleQueue, type StreamChatCallbackType, StreamChatHandlerRequest, type StreamChatHandlerRequestType, StreamChatHandlerResponse, type StreamChatHandlerResponseType, handleCompleteChat, handleGetEmbeddings, handleStreamChat };
|
|
5971
|
+
export { type AnalyticsEvent, type AnalyticsRecorder, type Cache, type CompleteChatCallbackType, CompleteChatHandlerRequest, type CompleteChatHandlerRequestType, CompleteChatHandlerResponse, type CompleteChatHandlerResponseType, Gateway, GatewayError, type GatewayOptionsType, type GetEmbeddingsCallbackType, GetEmbeddingsHandlerRequest, type GetEmbeddingsHandlerRequestType, GetEmbeddingsHandlerResponse, type GetEmbeddingsHandlerResponseType, type HttpClient, HttpClientError, type HttpClientResponse, HttpRequestError, IsomorphicHttpClient, LRUCache, PostAnalytics, type Queue, QueueOptions, type QueueOptionsType, type QueueTask, QueueTaskTimeoutError, SimpleQueue, type StreamChatCallbackType, StreamChatHandlerRequest, type StreamChatHandlerRequestType, StreamChatHandlerResponse, type StreamChatHandlerResponseType, handleCompleteChat, handleGetEmbeddings, handleStreamChat };
|