@adaline/gateway 0.12.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 CHANGED
@@ -51,18 +51,16 @@ declare class HttpRequestError extends GatewayBaseError {
51
51
  interface HttpClientConfig {
52
52
  timeoutInMilliseconds?: number;
53
53
  axiosInstance?: AxiosInstance;
54
- proxyUrl?: string;
54
+ proxyUrl?: URL | undefined;
55
55
  }
56
56
  declare class IsomorphicHttpClient implements HttpClient {
57
57
  private defaultTimeout?;
58
58
  private client;
59
- private httpProxyAgent?;
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>, // TODO: remove 'undefined', fix in stream-chat.handler.ts
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>>;
@@ -152,6 +150,27 @@ declare class SimpleQueue<Request, Response> implements Queue<Request, Response>
152
150
  private processQueue;
153
151
  }
154
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
+
155
174
  declare const CompleteChatHandlerRequest: z.ZodObject<{
156
175
  cache: z.ZodType<Cache<{
157
176
  request: {
@@ -375,12 +394,6 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
375
394
  metadataForCallbacks?: any;
376
395
  }>>;
377
396
  model: z.ZodType<ChatModelV1<{
378
- name: string;
379
- description: string;
380
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
381
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
382
- maxInputTokens: number;
383
- maxOutputTokens: number;
384
397
  config: {
385
398
  def: Record<string, {
386
399
  type: "multi-string";
@@ -419,13 +432,13 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
419
432
  }>;
420
433
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
421
434
  };
422
- }>, z.ZodTypeDef, ChatModelV1<{
423
435
  name: string;
424
436
  description: string;
425
437
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
426
438
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
427
439
  maxInputTokens: number;
428
440
  maxOutputTokens: number;
441
+ }>, z.ZodTypeDef, ChatModelV1<{
429
442
  config: {
430
443
  def: Record<string, {
431
444
  type: "multi-string";
@@ -464,6 +477,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
464
477
  }>;
465
478
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
466
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;
467
486
  }>>;
468
487
  config: z.ZodRecord<z.ZodString, z.ZodAny>;
469
488
  messages: z.ZodArray<z.ZodObject<{
@@ -703,17 +722,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
703
722
  metadata?: any;
704
723
  }>]>, "many">>;
705
724
  enableCache: z.ZodBoolean;
725
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
706
726
  callbacks: z.ZodOptional<z.ZodArray<z.ZodType<CompleteChatCallbackType<any>, z.ZodTypeDef, CompleteChatCallbackType<any>>, "atleastone">>;
707
727
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
708
728
  }, "strip", z.ZodTypeAny, {
709
729
  config: Record<string, any>;
710
730
  model: ChatModelV1<{
711
- name: string;
712
- description: string;
713
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
714
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
715
- maxInputTokens: number;
716
- maxOutputTokens: number;
717
731
  config: {
718
732
  def: Record<string, {
719
733
  type: "multi-string";
@@ -752,6 +766,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
752
766
  }>;
753
767
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
754
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;
755
775
  }>;
756
776
  messages: {
757
777
  role: "system" | "user" | "assistant" | "tool";
@@ -912,17 +932,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
912
932
  };
913
933
  metadata?: any;
914
934
  }[] | undefined;
935
+ customHeaders?: Record<string, string> | undefined;
915
936
  metadataForCallbacks?: any;
916
937
  callbacks?: [CompleteChatCallbackType<any>, ...CompleteChatCallbackType<any>[]] | undefined;
917
938
  }, {
918
939
  config: Record<string, any>;
919
940
  model: ChatModelV1<{
920
- name: string;
921
- description: string;
922
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
923
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
924
- maxInputTokens: number;
925
- maxOutputTokens: number;
926
941
  config: {
927
942
  def: Record<string, {
928
943
  type: "multi-string";
@@ -961,6 +976,12 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
961
976
  }>;
962
977
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
963
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;
964
985
  }>;
965
986
  messages: {
966
987
  role: "system" | "user" | "assistant" | "tool";
@@ -1121,6 +1142,7 @@ declare const CompleteChatHandlerRequest: z.ZodObject<{
1121
1142
  };
1122
1143
  metadata?: any;
1123
1144
  }[] | undefined;
1145
+ customHeaders?: Record<string, string> | undefined;
1124
1146
  metadataForCallbacks?: any;
1125
1147
  callbacks?: [CompleteChatCallbackType<any>, ...CompleteChatCallbackType<any>[]] | undefined;
1126
1148
  }>;
@@ -2234,6 +2256,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
2234
2256
  metadata?: undefined;
2235
2257
  }>]>;
2236
2258
  enableCache: z.ZodBoolean;
2259
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2237
2260
  callbacks: z.ZodOptional<z.ZodArray<z.ZodType<GetEmbeddingsCallbackType<any>, z.ZodTypeDef, GetEmbeddingsCallbackType<any>>, "atleastone">>;
2238
2261
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
2239
2262
  }, "strip", z.ZodTypeAny, {
@@ -2333,6 +2356,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
2333
2356
  requests: number[][];
2334
2357
  metadata?: undefined;
2335
2358
  };
2359
+ customHeaders?: Record<string, string> | undefined;
2336
2360
  metadataForCallbacks?: any;
2337
2361
  callbacks?: [GetEmbeddingsCallbackType<any>, ...GetEmbeddingsCallbackType<any>[]] | undefined;
2338
2362
  }, {
@@ -2432,6 +2456,7 @@ declare const GetEmbeddingsHandlerRequest: z.ZodObject<{
2432
2456
  requests: number[][];
2433
2457
  metadata?: undefined;
2434
2458
  };
2459
+ customHeaders?: Record<string, string> | undefined;
2435
2460
  metadataForCallbacks?: any;
2436
2461
  callbacks?: [GetEmbeddingsCallbackType<any>, ...GetEmbeddingsCallbackType<any>[]] | undefined;
2437
2462
  }>;
@@ -2666,12 +2691,6 @@ declare function handleGetEmbeddings(request: GetEmbeddingsHandlerRequestType, c
2666
2691
 
2667
2692
  declare const StreamChatHandlerRequest: z.ZodObject<{
2668
2693
  model: z.ZodType<ChatModelV1<{
2669
- name: string;
2670
- description: string;
2671
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
2672
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
2673
- maxInputTokens: number;
2674
- maxOutputTokens: number;
2675
2694
  config: {
2676
2695
  def: Record<string, {
2677
2696
  type: "multi-string";
@@ -2710,13 +2729,13 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
2710
2729
  }>;
2711
2730
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
2712
2731
  };
2713
- }>, z.ZodTypeDef, ChatModelV1<{
2714
2732
  name: string;
2715
2733
  description: string;
2716
2734
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
2717
2735
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
2718
2736
  maxInputTokens: number;
2719
2737
  maxOutputTokens: number;
2738
+ }>, z.ZodTypeDef, ChatModelV1<{
2720
2739
  config: {
2721
2740
  def: Record<string, {
2722
2741
  type: "multi-string";
@@ -2755,6 +2774,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
2755
2774
  }>;
2756
2775
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
2757
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;
2758
2783
  }>>;
2759
2784
  config: z.ZodRecord<z.ZodString, z.ZodAny>;
2760
2785
  messages: z.ZodArray<z.ZodObject<{
@@ -2993,17 +3018,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
2993
3018
  };
2994
3019
  metadata?: any;
2995
3020
  }>]>, "many">>;
3021
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2996
3022
  callbacks: z.ZodOptional<z.ZodArray<z.ZodType<StreamChatCallbackType<any>, z.ZodTypeDef, StreamChatCallbackType<any>>, "atleastone">>;
2997
3023
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
2998
3024
  }, "strip", z.ZodTypeAny, {
2999
3025
  config: Record<string, any>;
3000
3026
  model: ChatModelV1<{
3001
- name: string;
3002
- description: string;
3003
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
3004
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
3005
- maxInputTokens: number;
3006
- maxOutputTokens: number;
3007
3027
  config: {
3008
3028
  def: Record<string, {
3009
3029
  type: "multi-string";
@@ -3042,6 +3062,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
3042
3062
  }>;
3043
3063
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
3044
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;
3045
3071
  }>;
3046
3072
  messages: {
3047
3073
  role: "system" | "user" | "assistant" | "tool";
@@ -3090,17 +3116,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
3090
3116
  };
3091
3117
  metadata?: any;
3092
3118
  }[] | undefined;
3119
+ customHeaders?: Record<string, string> | undefined;
3093
3120
  metadataForCallbacks?: any;
3094
3121
  callbacks?: [StreamChatCallbackType<any>, ...StreamChatCallbackType<any>[]] | undefined;
3095
3122
  }, {
3096
3123
  config: Record<string, any>;
3097
3124
  model: ChatModelV1<{
3098
- name: string;
3099
- description: string;
3100
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
3101
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
3102
- maxInputTokens: number;
3103
- maxOutputTokens: number;
3104
3125
  config: {
3105
3126
  def: Record<string, {
3106
3127
  type: "multi-string";
@@ -3139,6 +3160,12 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
3139
3160
  }>;
3140
3161
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
3141
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;
3142
3169
  }>;
3143
3170
  messages: {
3144
3171
  role: "system" | "user" | "assistant" | "tool";
@@ -3187,6 +3214,7 @@ declare const StreamChatHandlerRequest: z.ZodObject<{
3187
3214
  };
3188
3215
  metadata?: any;
3189
3216
  }[] | undefined;
3217
+ customHeaders?: Record<string, string> | undefined;
3190
3218
  metadataForCallbacks?: any;
3191
3219
  callbacks?: [StreamChatCallbackType<any>, ...StreamChatCallbackType<any>[]] | undefined;
3192
3220
  }>;
@@ -3909,7 +3937,7 @@ type StreamChatCallbackType<M = any> = {
3909
3937
  onStreamFirstResponse?: (metadata?: M, response?: StreamChatHandlerResponseType, chunk?: unknown) => Promise<void> | void;
3910
3938
  onStreamNewResponse?: (metadata?: M, response?: StreamChatHandlerResponseType, chunk?: unknown) => Promise<void> | void;
3911
3939
  onStreamEnd?: (metadata?: M, response?: StreamChatHandlerResponseType) => Promise<void> | void;
3912
- onStreamError?: (metadata?: M, error?: GatewayError) => Promise<void> | void;
3940
+ onStreamError?: (metadata?: M, error?: GatewayError | HttpRequestError) => Promise<void> | void;
3913
3941
  };
3914
3942
 
3915
3943
  declare function handleStreamChat<M>(request: StreamChatHandlerRequestType, client: HttpClient): AsyncGenerator<StreamChatHandlerResponseType, void, unknown>;
@@ -3948,6 +3976,7 @@ declare const GatewayOptions: z.ZodObject<{
3948
3976
  }>>;
3949
3977
  dangerouslyAllowBrowser: z.ZodOptional<z.ZodBoolean>;
3950
3978
  httpClient: z.ZodOptional<z.ZodType<HttpClient, z.ZodTypeDef, HttpClient>>;
3979
+ proxyUrl: z.ZodOptional<z.ZodString>;
3951
3980
  completeChatCache: z.ZodOptional<z.ZodType<Cache<{
3952
3981
  request: {
3953
3982
  config: Record<string, any>;
@@ -4263,6 +4292,7 @@ declare const GatewayOptions: z.ZodObject<{
4263
4292
  } | undefined;
4264
4293
  dangerouslyAllowBrowser?: boolean | undefined;
4265
4294
  httpClient?: HttpClient | undefined;
4295
+ proxyUrl?: string | undefined;
4266
4296
  completeChatCache?: Cache<{
4267
4297
  request: {
4268
4298
  config: Record<string, any>;
@@ -4429,6 +4459,7 @@ declare const GatewayOptions: z.ZodObject<{
4429
4459
  } | undefined;
4430
4460
  dangerouslyAllowBrowser?: boolean | undefined;
4431
4461
  httpClient?: HttpClient | undefined;
4462
+ proxyUrl?: string | undefined;
4432
4463
  completeChatCache?: Cache<{
4433
4464
  request: {
4434
4465
  config: Record<string, any>;
@@ -4587,12 +4618,6 @@ declare const GatewayOptions: z.ZodObject<{
4587
4618
  type GatewayOptionsType = z.infer<typeof GatewayOptions>;
4588
4619
  declare const GatewayCompleteChatRequest: z.ZodObject<{
4589
4620
  model: z.ZodType<ChatModelV1<{
4590
- name: string;
4591
- description: string;
4592
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
4593
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
4594
- maxInputTokens: number;
4595
- maxOutputTokens: number;
4596
4621
  config: {
4597
4622
  def: Record<string, {
4598
4623
  type: "multi-string";
@@ -4631,13 +4656,13 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
4631
4656
  }>;
4632
4657
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
4633
4658
  };
4634
- }>, z.ZodTypeDef, ChatModelV1<{
4635
4659
  name: string;
4636
4660
  description: string;
4637
4661
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
4638
4662
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
4639
4663
  maxInputTokens: number;
4640
4664
  maxOutputTokens: number;
4665
+ }>, z.ZodTypeDef, ChatModelV1<{
4641
4666
  config: {
4642
4667
  def: Record<string, {
4643
4668
  type: "multi-string";
@@ -4676,6 +4701,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
4676
4701
  }>;
4677
4702
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
4678
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;
4679
4710
  }>>;
4680
4711
  config: z.ZodRecord<z.ZodString, z.ZodAny>;
4681
4712
  messages: z.ZodArray<z.ZodObject<{
@@ -4916,23 +4947,20 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
4916
4947
  }>]>, "many">>;
4917
4948
  options: z.ZodOptional<z.ZodObject<{
4918
4949
  enableCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
4950
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
4919
4951
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
4920
4952
  }, "strip", z.ZodTypeAny, {
4921
4953
  enableCache: boolean;
4954
+ customHeaders?: Record<string, string> | undefined;
4922
4955
  metadataForCallbacks?: any;
4923
4956
  }, {
4924
4957
  enableCache?: boolean | undefined;
4958
+ customHeaders?: Record<string, string> | undefined;
4925
4959
  metadataForCallbacks?: any;
4926
4960
  }>>;
4927
4961
  }, "strip", z.ZodTypeAny, {
4928
4962
  config: Record<string, any>;
4929
4963
  model: ChatModelV1<{
4930
- name: string;
4931
- description: string;
4932
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
4933
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
4934
- maxInputTokens: number;
4935
- maxOutputTokens: number;
4936
4964
  config: {
4937
4965
  def: Record<string, {
4938
4966
  type: "multi-string";
@@ -4971,6 +4999,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
4971
4999
  }>;
4972
5000
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
4973
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;
4974
5008
  }>;
4975
5009
  messages: {
4976
5010
  role: "system" | "user" | "assistant" | "tool";
@@ -5009,6 +5043,7 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
5009
5043
  }[];
5010
5044
  options?: {
5011
5045
  enableCache: boolean;
5046
+ customHeaders?: Record<string, string> | undefined;
5012
5047
  metadataForCallbacks?: any;
5013
5048
  } | undefined;
5014
5049
  tools?: {
@@ -5026,12 +5061,6 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
5026
5061
  }, {
5027
5062
  config: Record<string, any>;
5028
5063
  model: ChatModelV1<{
5029
- name: string;
5030
- description: string;
5031
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
5032
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
5033
- maxInputTokens: number;
5034
- maxOutputTokens: number;
5035
5064
  config: {
5036
5065
  def: Record<string, {
5037
5066
  type: "multi-string";
@@ -5070,6 +5099,12 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
5070
5099
  }>;
5071
5100
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
5072
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;
5073
5108
  }>;
5074
5109
  messages: {
5075
5110
  role: "system" | "user" | "assistant" | "tool";
@@ -5108,6 +5143,7 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
5108
5143
  }[];
5109
5144
  options?: {
5110
5145
  enableCache?: boolean | undefined;
5146
+ customHeaders?: Record<string, string> | undefined;
5111
5147
  metadataForCallbacks?: any;
5112
5148
  } | undefined;
5113
5149
  tools?: {
@@ -5126,12 +5162,6 @@ declare const GatewayCompleteChatRequest: z.ZodObject<{
5126
5162
  type GatewayCompleteChatRequestType = z.infer<typeof GatewayCompleteChatRequest>;
5127
5163
  declare const GatewayStreamChatRequest: z.ZodObject<{
5128
5164
  model: z.ZodType<ChatModelV1<{
5129
- name: string;
5130
- description: string;
5131
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
5132
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
5133
- maxInputTokens: number;
5134
- maxOutputTokens: number;
5135
5165
  config: {
5136
5166
  def: Record<string, {
5137
5167
  type: "multi-string";
@@ -5170,13 +5200,13 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5170
5200
  }>;
5171
5201
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
5172
5202
  };
5173
- }>, z.ZodTypeDef, ChatModelV1<{
5174
5203
  name: string;
5175
5204
  description: string;
5176
5205
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
5177
5206
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
5178
5207
  maxInputTokens: number;
5179
5208
  maxOutputTokens: number;
5209
+ }>, z.ZodTypeDef, ChatModelV1<{
5180
5210
  config: {
5181
5211
  def: Record<string, {
5182
5212
  type: "multi-string";
@@ -5215,6 +5245,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5215
5245
  }>;
5216
5246
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
5217
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;
5218
5254
  }>>;
5219
5255
  config: z.ZodRecord<z.ZodString, z.ZodAny>;
5220
5256
  messages: z.ZodArray<z.ZodObject<{
@@ -5454,21 +5490,18 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5454
5490
  metadata?: any;
5455
5491
  }>]>, "many">>;
5456
5492
  options: z.ZodOptional<z.ZodObject<{
5493
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
5457
5494
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
5458
5495
  }, "strip", z.ZodTypeAny, {
5496
+ customHeaders?: Record<string, string> | undefined;
5459
5497
  metadataForCallbacks?: any;
5460
5498
  }, {
5499
+ customHeaders?: Record<string, string> | undefined;
5461
5500
  metadataForCallbacks?: any;
5462
5501
  }>>;
5463
5502
  }, "strip", z.ZodTypeAny, {
5464
5503
  config: Record<string, any>;
5465
5504
  model: ChatModelV1<{
5466
- name: string;
5467
- description: string;
5468
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
5469
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
5470
- maxInputTokens: number;
5471
- maxOutputTokens: number;
5472
5505
  config: {
5473
5506
  def: Record<string, {
5474
5507
  type: "multi-string";
@@ -5507,6 +5540,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5507
5540
  }>;
5508
5541
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
5509
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;
5510
5549
  }>;
5511
5550
  messages: {
5512
5551
  role: "system" | "user" | "assistant" | "tool";
@@ -5544,6 +5583,7 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5544
5583
  metadata?: undefined;
5545
5584
  }[];
5546
5585
  options?: {
5586
+ customHeaders?: Record<string, string> | undefined;
5547
5587
  metadataForCallbacks?: any;
5548
5588
  } | undefined;
5549
5589
  tools?: {
@@ -5561,12 +5601,6 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5561
5601
  }, {
5562
5602
  config: Record<string, any>;
5563
5603
  model: ChatModelV1<{
5564
- name: string;
5565
- description: string;
5566
- roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
5567
- modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
5568
- maxInputTokens: number;
5569
- maxOutputTokens: number;
5570
5604
  config: {
5571
5605
  def: Record<string, {
5572
5606
  type: "multi-string";
@@ -5605,6 +5639,12 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5605
5639
  }>;
5606
5640
  schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
5607
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;
5608
5648
  }>;
5609
5649
  messages: {
5610
5650
  role: "system" | "user" | "assistant" | "tool";
@@ -5642,6 +5682,7 @@ declare const GatewayStreamChatRequest: z.ZodObject<{
5642
5682
  metadata?: undefined;
5643
5683
  }[];
5644
5684
  options?: {
5685
+ customHeaders?: Record<string, string> | undefined;
5645
5686
  metadataForCallbacks?: any;
5646
5687
  } | undefined;
5647
5688
  tools?: {
@@ -5776,12 +5817,15 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
5776
5817
  }>]>;
5777
5818
  options: z.ZodOptional<z.ZodObject<{
5778
5819
  enableCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
5820
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
5779
5821
  metadataForCallbacks: z.ZodOptional<z.ZodAny>;
5780
5822
  }, "strip", z.ZodTypeAny, {
5781
5823
  enableCache: boolean;
5824
+ customHeaders?: Record<string, string> | undefined;
5782
5825
  metadataForCallbacks?: any;
5783
5826
  }, {
5784
5827
  enableCache?: boolean | undefined;
5828
+ customHeaders?: Record<string, string> | undefined;
5785
5829
  metadataForCallbacks?: any;
5786
5830
  }>>;
5787
5831
  }, "strip", z.ZodTypeAny, {
@@ -5842,6 +5886,7 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
5842
5886
  };
5843
5887
  options?: {
5844
5888
  enableCache: boolean;
5889
+ customHeaders?: Record<string, string> | undefined;
5845
5890
  metadataForCallbacks?: any;
5846
5891
  } | undefined;
5847
5892
  }, {
@@ -5902,6 +5947,7 @@ declare const GatewayGetEmbeddingsRequest: z.ZodObject<{
5902
5947
  };
5903
5948
  options?: {
5904
5949
  enableCache?: boolean | undefined;
5950
+ customHeaders?: Record<string, string> | undefined;
5905
5951
  metadataForCallbacks?: any;
5906
5952
  } | undefined;
5907
5953
  }>;
@@ -5912,6 +5958,7 @@ declare class Gateway {
5912
5958
  private httpClient;
5913
5959
  private queues;
5914
5960
  private caches;
5961
+ private analytics;
5915
5962
  constructor(options: GatewayOptionsType);
5916
5963
  completeChat(request: GatewayCompleteChatRequestType): Promise<CompleteChatHandlerResponseType>;
5917
5964
  private executeCompleteChat;
@@ -5921,4 +5968,4 @@ declare class Gateway {
5921
5968
  static GatewayError: typeof GatewayError;
5922
5969
  }
5923
5970
 
5924
- 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 };