@adaline/provider 0.24.0 → 0.25.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 +137 -1
- package/dist/index.d.ts +137 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GatewayBaseError, RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
|
|
1
|
+
import { GatewayBaseError, RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, ChatModelPriceType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare class ProviderError extends GatewayBaseError {
|
|
@@ -351,6 +351,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
351
351
|
}>;
|
|
352
352
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
353
353
|
}>;
|
|
354
|
+
price: z.ZodType<{
|
|
355
|
+
modelName: string;
|
|
356
|
+
currency: string;
|
|
357
|
+
tokenRanges: {
|
|
358
|
+
minTokens: number;
|
|
359
|
+
prices: {
|
|
360
|
+
base: {
|
|
361
|
+
inputPricePerMillion: number;
|
|
362
|
+
outputPricePerMillion: number;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
maxTokens?: number | null | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
}, z.ZodTypeDef, {
|
|
368
|
+
modelName: string;
|
|
369
|
+
currency: string;
|
|
370
|
+
tokenRanges: {
|
|
371
|
+
minTokens: number;
|
|
372
|
+
prices: {
|
|
373
|
+
base: {
|
|
374
|
+
inputPricePerMillion: number;
|
|
375
|
+
outputPricePerMillion: number;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
maxTokens?: number | null | undefined;
|
|
379
|
+
}[];
|
|
380
|
+
}>;
|
|
354
381
|
}, "strip", z.ZodTypeAny, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
355
382
|
name: z.ZodString;
|
|
356
383
|
description: z.ZodString;
|
|
@@ -613,6 +640,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
613
640
|
}>;
|
|
614
641
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
615
642
|
}>;
|
|
643
|
+
price: z.ZodType<{
|
|
644
|
+
modelName: string;
|
|
645
|
+
currency: string;
|
|
646
|
+
tokenRanges: {
|
|
647
|
+
minTokens: number;
|
|
648
|
+
prices: {
|
|
649
|
+
base: {
|
|
650
|
+
inputPricePerMillion: number;
|
|
651
|
+
outputPricePerMillion: number;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
maxTokens?: number | null | undefined;
|
|
655
|
+
}[];
|
|
656
|
+
}, z.ZodTypeDef, {
|
|
657
|
+
modelName: string;
|
|
658
|
+
currency: string;
|
|
659
|
+
tokenRanges: {
|
|
660
|
+
minTokens: number;
|
|
661
|
+
prices: {
|
|
662
|
+
base: {
|
|
663
|
+
inputPricePerMillion: number;
|
|
664
|
+
outputPricePerMillion: number;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
maxTokens?: number | null | undefined;
|
|
668
|
+
}[];
|
|
669
|
+
}>;
|
|
616
670
|
}>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
617
671
|
name: z.ZodString;
|
|
618
672
|
description: z.ZodString;
|
|
@@ -875,6 +929,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
875
929
|
}>;
|
|
876
930
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
877
931
|
}>;
|
|
932
|
+
price: z.ZodType<{
|
|
933
|
+
modelName: string;
|
|
934
|
+
currency: string;
|
|
935
|
+
tokenRanges: {
|
|
936
|
+
minTokens: number;
|
|
937
|
+
prices: {
|
|
938
|
+
base: {
|
|
939
|
+
inputPricePerMillion: number;
|
|
940
|
+
outputPricePerMillion: number;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
maxTokens?: number | null | undefined;
|
|
944
|
+
}[];
|
|
945
|
+
}, z.ZodTypeDef, {
|
|
946
|
+
modelName: string;
|
|
947
|
+
currency: string;
|
|
948
|
+
tokenRanges: {
|
|
949
|
+
minTokens: number;
|
|
950
|
+
prices: {
|
|
951
|
+
base: {
|
|
952
|
+
inputPricePerMillion: number;
|
|
953
|
+
outputPricePerMillion: number;
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
maxTokens?: number | null | undefined;
|
|
957
|
+
}[];
|
|
958
|
+
}>;
|
|
878
959
|
}>, any>[k]; }, { [k_1 in keyof z.baseObjectInputType<{
|
|
879
960
|
name: z.ZodString;
|
|
880
961
|
description: z.ZodString;
|
|
@@ -1137,6 +1218,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
1137
1218
|
}>;
|
|
1138
1219
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
1139
1220
|
}>;
|
|
1221
|
+
price: z.ZodType<{
|
|
1222
|
+
modelName: string;
|
|
1223
|
+
currency: string;
|
|
1224
|
+
tokenRanges: {
|
|
1225
|
+
minTokens: number;
|
|
1226
|
+
prices: {
|
|
1227
|
+
base: {
|
|
1228
|
+
inputPricePerMillion: number;
|
|
1229
|
+
outputPricePerMillion: number;
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
maxTokens?: number | null | undefined;
|
|
1233
|
+
}[];
|
|
1234
|
+
}, z.ZodTypeDef, {
|
|
1235
|
+
modelName: string;
|
|
1236
|
+
currency: string;
|
|
1237
|
+
tokenRanges: {
|
|
1238
|
+
minTokens: number;
|
|
1239
|
+
prices: {
|
|
1240
|
+
base: {
|
|
1241
|
+
inputPricePerMillion: number;
|
|
1242
|
+
outputPricePerMillion: number;
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
maxTokens?: number | null | undefined;
|
|
1246
|
+
}[];
|
|
1247
|
+
}>;
|
|
1140
1248
|
}>]: z.baseObjectInputType<{
|
|
1141
1249
|
name: z.ZodString;
|
|
1142
1250
|
description: z.ZodString;
|
|
@@ -1399,6 +1507,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
1399
1507
|
}>;
|
|
1400
1508
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
1401
1509
|
}>;
|
|
1510
|
+
price: z.ZodType<{
|
|
1511
|
+
modelName: string;
|
|
1512
|
+
currency: string;
|
|
1513
|
+
tokenRanges: {
|
|
1514
|
+
minTokens: number;
|
|
1515
|
+
prices: {
|
|
1516
|
+
base: {
|
|
1517
|
+
inputPricePerMillion: number;
|
|
1518
|
+
outputPricePerMillion: number;
|
|
1519
|
+
};
|
|
1520
|
+
};
|
|
1521
|
+
maxTokens?: number | null | undefined;
|
|
1522
|
+
}[];
|
|
1523
|
+
}, z.ZodTypeDef, {
|
|
1524
|
+
modelName: string;
|
|
1525
|
+
currency: string;
|
|
1526
|
+
tokenRanges: {
|
|
1527
|
+
minTokens: number;
|
|
1528
|
+
prices: {
|
|
1529
|
+
base: {
|
|
1530
|
+
inputPricePerMillion: number;
|
|
1531
|
+
outputPricePerMillion: number;
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
maxTokens?: number | null | undefined;
|
|
1535
|
+
}[];
|
|
1536
|
+
}>;
|
|
1402
1537
|
}>[k_1]; }>;
|
|
1403
1538
|
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>>>;
|
|
1404
1539
|
|
|
@@ -1748,6 +1883,7 @@ interface ChatModelV1<MS extends ChatModelSchemaType = ChatModelSchemaType> {
|
|
|
1748
1883
|
}>;
|
|
1749
1884
|
getProxyCompleteChatUrl(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<UrlType>;
|
|
1750
1885
|
getProxyCompleteChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
|
|
1886
|
+
getModelPricing(): ChatModelPriceType;
|
|
1751
1887
|
}
|
|
1752
1888
|
|
|
1753
1889
|
declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]> = z.ZodEnum<["text", "token"]>>(Modalities?: M) => z.ZodObject<{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GatewayBaseError, RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
|
|
1
|
+
import { GatewayBaseError, RoleEnum, ModalityEnum, MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, ChatModelPriceType, EmbeddingModalityEnum, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare class ProviderError extends GatewayBaseError {
|
|
@@ -351,6 +351,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
351
351
|
}>;
|
|
352
352
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
353
353
|
}>;
|
|
354
|
+
price: z.ZodType<{
|
|
355
|
+
modelName: string;
|
|
356
|
+
currency: string;
|
|
357
|
+
tokenRanges: {
|
|
358
|
+
minTokens: number;
|
|
359
|
+
prices: {
|
|
360
|
+
base: {
|
|
361
|
+
inputPricePerMillion: number;
|
|
362
|
+
outputPricePerMillion: number;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
maxTokens?: number | null | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
}, z.ZodTypeDef, {
|
|
368
|
+
modelName: string;
|
|
369
|
+
currency: string;
|
|
370
|
+
tokenRanges: {
|
|
371
|
+
minTokens: number;
|
|
372
|
+
prices: {
|
|
373
|
+
base: {
|
|
374
|
+
inputPricePerMillion: number;
|
|
375
|
+
outputPricePerMillion: number;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
maxTokens?: number | null | undefined;
|
|
379
|
+
}[];
|
|
380
|
+
}>;
|
|
354
381
|
}, "strip", z.ZodTypeAny, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
355
382
|
name: z.ZodString;
|
|
356
383
|
description: z.ZodString;
|
|
@@ -613,6 +640,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
613
640
|
}>;
|
|
614
641
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
615
642
|
}>;
|
|
643
|
+
price: z.ZodType<{
|
|
644
|
+
modelName: string;
|
|
645
|
+
currency: string;
|
|
646
|
+
tokenRanges: {
|
|
647
|
+
minTokens: number;
|
|
648
|
+
prices: {
|
|
649
|
+
base: {
|
|
650
|
+
inputPricePerMillion: number;
|
|
651
|
+
outputPricePerMillion: number;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
maxTokens?: number | null | undefined;
|
|
655
|
+
}[];
|
|
656
|
+
}, z.ZodTypeDef, {
|
|
657
|
+
modelName: string;
|
|
658
|
+
currency: string;
|
|
659
|
+
tokenRanges: {
|
|
660
|
+
minTokens: number;
|
|
661
|
+
prices: {
|
|
662
|
+
base: {
|
|
663
|
+
inputPricePerMillion: number;
|
|
664
|
+
outputPricePerMillion: number;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
maxTokens?: number | null | undefined;
|
|
668
|
+
}[];
|
|
669
|
+
}>;
|
|
616
670
|
}>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
617
671
|
name: z.ZodString;
|
|
618
672
|
description: z.ZodString;
|
|
@@ -875,6 +929,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
875
929
|
}>;
|
|
876
930
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
877
931
|
}>;
|
|
932
|
+
price: z.ZodType<{
|
|
933
|
+
modelName: string;
|
|
934
|
+
currency: string;
|
|
935
|
+
tokenRanges: {
|
|
936
|
+
minTokens: number;
|
|
937
|
+
prices: {
|
|
938
|
+
base: {
|
|
939
|
+
inputPricePerMillion: number;
|
|
940
|
+
outputPricePerMillion: number;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
maxTokens?: number | null | undefined;
|
|
944
|
+
}[];
|
|
945
|
+
}, z.ZodTypeDef, {
|
|
946
|
+
modelName: string;
|
|
947
|
+
currency: string;
|
|
948
|
+
tokenRanges: {
|
|
949
|
+
minTokens: number;
|
|
950
|
+
prices: {
|
|
951
|
+
base: {
|
|
952
|
+
inputPricePerMillion: number;
|
|
953
|
+
outputPricePerMillion: number;
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
maxTokens?: number | null | undefined;
|
|
957
|
+
}[];
|
|
958
|
+
}>;
|
|
878
959
|
}>, any>[k]; }, { [k_1 in keyof z.baseObjectInputType<{
|
|
879
960
|
name: z.ZodString;
|
|
880
961
|
description: z.ZodString;
|
|
@@ -1137,6 +1218,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
1137
1218
|
}>;
|
|
1138
1219
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
1139
1220
|
}>;
|
|
1221
|
+
price: z.ZodType<{
|
|
1222
|
+
modelName: string;
|
|
1223
|
+
currency: string;
|
|
1224
|
+
tokenRanges: {
|
|
1225
|
+
minTokens: number;
|
|
1226
|
+
prices: {
|
|
1227
|
+
base: {
|
|
1228
|
+
inputPricePerMillion: number;
|
|
1229
|
+
outputPricePerMillion: number;
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
maxTokens?: number | null | undefined;
|
|
1233
|
+
}[];
|
|
1234
|
+
}, z.ZodTypeDef, {
|
|
1235
|
+
modelName: string;
|
|
1236
|
+
currency: string;
|
|
1237
|
+
tokenRanges: {
|
|
1238
|
+
minTokens: number;
|
|
1239
|
+
prices: {
|
|
1240
|
+
base: {
|
|
1241
|
+
inputPricePerMillion: number;
|
|
1242
|
+
outputPricePerMillion: number;
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
maxTokens?: number | null | undefined;
|
|
1246
|
+
}[];
|
|
1247
|
+
}>;
|
|
1140
1248
|
}>]: z.baseObjectInputType<{
|
|
1141
1249
|
name: z.ZodString;
|
|
1142
1250
|
description: z.ZodString;
|
|
@@ -1399,6 +1507,33 @@ declare const ChatModelSchema: <R extends z.ZodEnum<[string, ...string[]]> = z.Z
|
|
|
1399
1507
|
}>;
|
|
1400
1508
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
1401
1509
|
}>;
|
|
1510
|
+
price: z.ZodType<{
|
|
1511
|
+
modelName: string;
|
|
1512
|
+
currency: string;
|
|
1513
|
+
tokenRanges: {
|
|
1514
|
+
minTokens: number;
|
|
1515
|
+
prices: {
|
|
1516
|
+
base: {
|
|
1517
|
+
inputPricePerMillion: number;
|
|
1518
|
+
outputPricePerMillion: number;
|
|
1519
|
+
};
|
|
1520
|
+
};
|
|
1521
|
+
maxTokens?: number | null | undefined;
|
|
1522
|
+
}[];
|
|
1523
|
+
}, z.ZodTypeDef, {
|
|
1524
|
+
modelName: string;
|
|
1525
|
+
currency: string;
|
|
1526
|
+
tokenRanges: {
|
|
1527
|
+
minTokens: number;
|
|
1528
|
+
prices: {
|
|
1529
|
+
base: {
|
|
1530
|
+
inputPricePerMillion: number;
|
|
1531
|
+
outputPricePerMillion: number;
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
maxTokens?: number | null | undefined;
|
|
1535
|
+
}[];
|
|
1536
|
+
}>;
|
|
1402
1537
|
}>[k_1]; }>;
|
|
1403
1538
|
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>>>;
|
|
1404
1539
|
|
|
@@ -1748,6 +1883,7 @@ interface ChatModelV1<MS extends ChatModelSchemaType = ChatModelSchemaType> {
|
|
|
1748
1883
|
}>;
|
|
1749
1884
|
getProxyCompleteChatUrl(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<UrlType>;
|
|
1750
1885
|
getProxyCompleteChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
|
|
1886
|
+
getModelPricing(): ChatModelPriceType;
|
|
1751
1887
|
}
|
|
1752
1888
|
|
|
1753
1889
|
declare const EmbeddingModelSchema: <M extends z.ZodEnum<[string, ...string[]]> = z.ZodEnum<["text", "token"]>>(Modalities?: M) => z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
var types = require('@adaline/types');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
|
|
6
|
-
var Y=Object.defineProperty;var M=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?Y(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))X.call(n,t)&&R(e,t,n[t]);if(M)for(var t of M(n))$.call(n,t)&&R(e,t,n[t]);return e};var v="ProviderError",j=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},v);this.name=v;this.info=t,this.cause=o;}static isProviderError(t){return t instanceof e}};var z="ModelError",P=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},z);this.name=z;this.info=t,this.cause=o;}static isModelError(t){return t instanceof e}};var D="ModelResponseError",B=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},D);this.name=D;this.cause=o,this.info=t;}static isModelResponseError(t){return t instanceof e}};var A="InvalidModelRequestError",N=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},A);this.name=A;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof e}};var L="InvalidConfigError",_=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},L);this.name=L;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof e}};var G="InvalidMessagesError",U=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},G);this.name=G;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof e}};var q="InvalidToolsError",Z=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},q);this.name=q;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof e}};var F="InvalidEmbeddingRequestsError",K=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},F);this.name=F;this.info=t,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof e}};var y="multi-string",C=zod.z.object({type:zod.z.literal(y),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),max:zod.z.number().int().positive()}),se=e=>zod.z.array(zod.z.string()).max(e).default([]).optional(),et=e=>({def:C.parse(a({type:y},e)),schema:se(e.max)});var h="object-schema",x=zod.z.object({type:zod.z.literal(h),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),ae=e=>e.optional(),it=e=>({def:x.parse(a({type:h},e)),schema:ae(e.objectSchema)});var S="range",w=zod.z.object({type:zod.z.literal(S),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),min:zod.z.number().int(),max:zod.z.number().int(),step:zod.z.number().positive(),default:zod.z.number()}),ce=(e,n,t,o)=>zod.z.number().min(e).max(n).step(t).default(o).optional(),ct=e=>({def:w.parse(a({type:S},e)),schema:ce(e.min,e.max,e.step,e.default)});var b="select-boolean",k=zod.z.object({type:zod.z.literal(b),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.boolean().nullable()}),me=e=>zod.z.boolean().nullable().default(e).optional(),ft=e=>({def:k.parse(a({type:b},e)),schema:me(e.default)});var T="select-string",O=zod.z.object({type:zod.z.literal(T),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string(),choices:zod.z.array(zod.z.string())}),pe=(e,n)=>zod.z.enum(n).nullable().default(e).optional(),yt=e=>({def:O.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],wt=zod.z.enum(le),I=zod.z.discriminatedUnion("type",[w,C,O,k,x]);var vt=(e=types.RoleEnum,n=types.ModalityEnum)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(e,zod.z.string().min(1).optional()),modalities:zod.z.array(n).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),maxReasoningTokens:zod.z.number().int().positive().min(1).optional(),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),I),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(t=>{var d,g;let o=Object.keys(t.def),s=Object.keys((g=(d=t.schema)==null?void 0:d.shape)!=null?g:{});return o.every(E=>s.includes(E))&&s.every(E=>o.includes(E))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var Bt=(e=types.EmbeddingModalityEnum)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(e).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),I),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(n=>{var s,d;let t=Object.keys(n.def),o=Object.keys((d=(s=n.schema)==null?void 0:s.shape)!=null?d:{});return t.every(g=>o.includes(g))&&o.every(g=>t.includes(g))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var Lt=zod.z.record(zod.z.string());var Ut=zod.z.record(zod.z.union([zod.z.boolean(),zod.z.string(),zod.z.number(),zod.z.object({}),zod.z.array(zod.z.any()),zod.z.null(),zod.z.undefined()]));var Ft=zod.z.string().url();var ye={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},he={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},Se={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},be=e=>({type:"multi",title:"Stop sequence",description:`Enter up to ${e} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Te={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},Ie={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},Ee={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},Ce={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},xe={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},we={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},ke={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},Oe={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},Me={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Re={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},ve={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},je={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},ze={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},Pe={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},Ht={TEMPERATURE:ye,MAX_TOKENS:he,STOP:be,TOP_A:Te,TOP_P:Ie,TOP_K:Ee,MIN_P:Ce,FREQUENCY_PENALTY:xe,PRESENCE_PENALTY:we,REPETITION_PENALTY:Oe,SEED:ke,LOG_PROBS:Me,TOP_LOG_PROBS:Re,ECHO:ve,RESPONSE_FORMAT:je,RESPONSE_FORMAT_WITH_SCHEMA:ze,RESPONSE_SCHEMA:Pe,MAX_REASONING_TOKENS:Se};var De={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Be={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Wt={DIMENSIONS:De,ENCODING_FORMAT:Be};var Xt=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var Qt=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var nn=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},on=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},rn=e=>{if(W()){let n=atob(e),t=new Uint8Array(n.length);for(let s=0;s<n.length;s++)t[s]=n.charCodeAt(s);return new TextDecoder("utf-8").decode(t)}else return Buffer.from(e,"base64").toString("utf-8")},sn=e=>e.split(";")[0].split("/")[1];var cn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
6
|
+
var Y=Object.defineProperty;var O=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?Y(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))X.call(n,t)&&R(e,t,n[t]);if(O)for(var t of O(n))$.call(n,t)&&R(e,t,n[t]);return e};var v="ProviderError",j=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},v);this.name=v;this.info=t,this.cause=o;}static isProviderError(t){return t instanceof e}};var P="ModelError",z=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},P);this.name=P;this.info=t,this.cause=o;}static isModelError(t){return t instanceof e}};var D="ModelResponseError",B=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},D);this.name=D;this.cause=o,this.info=t;}static isModelResponseError(t){return t instanceof e}};var A="InvalidModelRequestError",N=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},A);this.name=A;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof e}};var L="InvalidConfigError",_=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},L);this.name=L;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof e}};var G="InvalidMessagesError",U=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},G);this.name=G;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof e}};var q="InvalidToolsError",Z=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},q);this.name=q;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof e}};var F="InvalidEmbeddingRequestsError",K=class e extends types.GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},F);this.name=F;this.info=t,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof e}};var y="multi-string",C=zod.z.object({type:zod.z.literal(y),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),max:zod.z.number().int().positive()}),se=e=>zod.z.array(zod.z.string()).max(e).default([]).optional(),et=e=>({def:C.parse(a({type:y},e)),schema:se(e.max)});var h="object-schema",x=zod.z.object({type:zod.z.literal(h),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),ae=e=>e.optional(),it=e=>({def:x.parse(a({type:h},e)),schema:ae(e.objectSchema)});var S="range",w=zod.z.object({type:zod.z.literal(S),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),min:zod.z.number().int(),max:zod.z.number().int(),step:zod.z.number().positive(),default:zod.z.number()}),ce=(e,n,t,o)=>zod.z.number().min(e).max(n).step(t).default(o).optional(),ct=e=>({def:w.parse(a({type:S},e)),schema:ce(e.min,e.max,e.step,e.default)});var b="select-boolean",k=zod.z.object({type:zod.z.literal(b),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.boolean().nullable()}),me=e=>zod.z.boolean().nullable().default(e).optional(),ft=e=>({def:k.parse(a({type:b},e)),schema:me(e.default)});var T="select-string",M=zod.z.object({type:zod.z.literal(T),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string(),choices:zod.z.array(zod.z.string())}),pe=(e,n)=>zod.z.enum(n).nullable().default(e).optional(),yt=e=>({def:M.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],wt=zod.z.enum(le),I=zod.z.discriminatedUnion("type",[w,C,M,k,x]);var jt=(e=types.RoleEnum,n=types.ModalityEnum)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(e,zod.z.string().min(1).optional()),modalities:zod.z.array(n).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),maxReasoningTokens:zod.z.number().int().positive().min(1).optional(),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),I),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(t=>{var d,g;let o=Object.keys(t.def),s=Object.keys((g=(d=t.schema)==null?void 0:d.shape)!=null?g:{});return o.every(E=>s.includes(E))&&s.every(E=>o.includes(E))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"}),price:zod.z.custom()});var At=(e=types.EmbeddingModalityEnum)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(e).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),I),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(n=>{var s,d;let t=Object.keys(n.def),o=Object.keys((d=(s=n.schema)==null?void 0:s.shape)!=null?d:{});return t.every(g=>o.includes(g))&&o.every(g=>t.includes(g))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var _t=zod.z.record(zod.z.string());var qt=zod.z.record(zod.z.union([zod.z.boolean(),zod.z.string(),zod.z.number(),zod.z.object({}),zod.z.array(zod.z.any()),zod.z.null(),zod.z.undefined()]));var Kt=zod.z.string().url();var ye={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},he={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},Se={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},be=e=>({type:"multi",title:"Stop sequence",description:`Enter up to ${e} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Te={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},Ie={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},Ee={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},Ce={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},xe={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},we={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},ke={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},Me={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},Oe={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Re={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},ve={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},je={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},Pe={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},ze={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},Jt={TEMPERATURE:ye,MAX_TOKENS:he,STOP:be,TOP_A:Te,TOP_P:Ie,TOP_K:Ee,MIN_P:Ce,FREQUENCY_PENALTY:xe,PRESENCE_PENALTY:we,REPETITION_PENALTY:Me,SEED:ke,LOG_PROBS:Oe,TOP_LOG_PROBS:Re,ECHO:ve,RESPONSE_FORMAT:je,RESPONSE_FORMAT_WITH_SCHEMA:Pe,RESPONSE_SCHEMA:ze,MAX_REASONING_TOKENS:Se};var De={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Be={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Yt={DIMENSIONS:De,ENCODING_FORMAT:Be};var $t=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var Vt=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var on=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},rn=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},sn=e=>{if(W()){let n=atob(e),t=new Uint8Array(n.length);for(let s=0;s<n.length;s++)t[s]=n.charCodeAt(s);return new TextDecoder("utf-8").decode(t)}else return Buffer.from(e,"base64").toString("utf-8")},an=e=>e.split(";")[0].split("/")[1];var mn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
7
7
|
|
|
8
|
-
exports.CHAT_CONFIG =
|
|
9
|
-
exports.ChatModelSchema =
|
|
8
|
+
exports.CHAT_CONFIG = Jt;
|
|
9
|
+
exports.ChatModelSchema = jt;
|
|
10
10
|
exports.ConfigItemDef = I;
|
|
11
11
|
exports.ConfigItemEnum = wt;
|
|
12
12
|
exports.ConfigItemLiterals = le;
|
|
13
|
-
exports.EMBEDDING_CONFIG =
|
|
14
|
-
exports.EmbeddingModelSchema =
|
|
15
|
-
exports.Headers =
|
|
13
|
+
exports.EMBEDDING_CONFIG = Yt;
|
|
14
|
+
exports.EmbeddingModelSchema = At;
|
|
15
|
+
exports.Headers = _t;
|
|
16
16
|
exports.InvalidConfigError = _;
|
|
17
17
|
exports.InvalidEmbeddingRequestsError = K;
|
|
18
18
|
exports.InvalidMessagesError = U;
|
|
19
19
|
exports.InvalidModelRequestError = N;
|
|
20
20
|
exports.InvalidToolsError = Z;
|
|
21
|
-
exports.ModelError =
|
|
21
|
+
exports.ModelError = z;
|
|
22
22
|
exports.ModelResponseError = B;
|
|
23
23
|
exports.MultiStringConfigItem = et;
|
|
24
24
|
exports.MultiStringConfigItemDef = C;
|
|
@@ -28,7 +28,7 @@ exports.ObjectSchemaConfigItem = it;
|
|
|
28
28
|
exports.ObjectSchemaConfigItemDef = x;
|
|
29
29
|
exports.ObjectSchemaConfigItemSchema = ae;
|
|
30
30
|
exports.ObjectSchemaConfigItemTypeLiteral = h;
|
|
31
|
-
exports.Params =
|
|
31
|
+
exports.Params = qt;
|
|
32
32
|
exports.ProviderError = j;
|
|
33
33
|
exports.RangeConfigItem = ct;
|
|
34
34
|
exports.RangeConfigItemDef = w;
|
|
@@ -39,17 +39,17 @@ exports.SelectBooleanConfigItemDef = k;
|
|
|
39
39
|
exports.SelectBooleanConfigItemSchema = me;
|
|
40
40
|
exports.SelectBooleanConfigItemTypeLiteral = b;
|
|
41
41
|
exports.SelectStringConfigItem = yt;
|
|
42
|
-
exports.SelectStringConfigItemDef =
|
|
42
|
+
exports.SelectStringConfigItemDef = M;
|
|
43
43
|
exports.SelectStringConfigItemSchema = pe;
|
|
44
44
|
exports.SelectStringConfigItemTypeLiteral = T;
|
|
45
|
-
exports.Url =
|
|
46
|
-
exports.convertBase64ToUint8Array =
|
|
47
|
-
exports.convertUint8ArrayToBase64 =
|
|
48
|
-
exports.encodedBase64ToString =
|
|
49
|
-
exports.getErrorMessage =
|
|
50
|
-
exports.getMimeTypeFromBase64 =
|
|
45
|
+
exports.Url = Kt;
|
|
46
|
+
exports.convertBase64ToUint8Array = on;
|
|
47
|
+
exports.convertUint8ArrayToBase64 = rn;
|
|
48
|
+
exports.encodedBase64ToString = sn;
|
|
49
|
+
exports.getErrorMessage = $t;
|
|
50
|
+
exports.getMimeTypeFromBase64 = an;
|
|
51
51
|
exports.isRunningInBrowser = W;
|
|
52
|
-
exports.removeUndefinedEntries =
|
|
53
|
-
exports.urlWithoutTrailingSlash =
|
|
52
|
+
exports.removeUndefinedEntries = Vt;
|
|
53
|
+
exports.urlWithoutTrailingSlash = mn;
|
|
54
54
|
//# sourceMappingURL=index.js.map
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors/provider.error.ts","../src/errors/model.error.ts","../src/errors/model-response.error.ts","../src/errors/invalid-model-request.error.ts","../src/errors/invalid-config.error.ts","../src/errors/invalid-messages.error.ts","../src/errors/invalid-tools.error.ts","../src/errors/invalid-embedding-requests.error.ts","../src/types/config/multi-string-config-item.ts","../src/types/config/object-schema-config-item.ts","../src/types/config/range-config-item.ts","../src/types/config/select-boolean-config-item.ts","../src/types/config/select-string-config-item.ts","../src/types/config/config-item.ts","../src/model/chat-model/chat-model.schema.v1.ts","../src/model/embedding-model/embedding-model.schema.v1.ts","../src/types/headers.ts","../src/types/params.ts","../src/types/url.ts","../src/utils/common-config.def.chat-model.ts","../src/utils/common-config.def.word-embedding.ts","../src/utils/get-error-message.ts","../src/utils/remove-undefined-entries.ts","../src/utils/is-running-in-browser.ts","../src/utils/base64.ts","../src/utils/url.ts"],"names":["ProviderErrorLiteral","ProviderError","_ProviderError","GatewayBaseError","info","cause","error","ModelErrorLiteral","ModelError","_ModelError","ModelResponseErrorLiteral","ModelResponseError","_ModelResponseError","InvalidModelRequestErrorLiteral","InvalidModelRequestError","_InvalidModelRequestError","InvalidConfigErrorLiteral","InvalidConfigError","_InvalidConfigError","InvalidMessagesErrorLiteral","InvalidMessagesError","_InvalidMessagesError","InvalidToolsErrorLiteral","InvalidToolsError","_InvalidToolsError","InvalidEmbeddingRequestsErrorLiteral","InvalidEmbeddingRequestsError","_InvalidEmbeddingRequestsError","MultiStringConfigItemTypeLiteral","MultiStringConfigItemDef","z","MultiStringConfigItemSchema","max","MultiStringConfigItem","data","__spreadValues","ObjectSchemaConfigItemTypeLiteral","ObjectSchemaConfigItemDef","ObjectSchemaConfigItemSchema","schema","ObjectSchemaConfigItem","RangeConfigItemTypeLiteral","RangeConfigItemDef","RangeConfigItemSchema","min","step","defaultValue","RangeConfigItem","SelectBooleanConfigItemTypeLiteral","SelectBooleanConfigItemDef","SelectBooleanConfigItemSchema","SelectBooleanConfigItem","SelectStringConfigItemTypeLiteral","SelectStringConfigItemDef","SelectStringConfigItemSchema","choices","SelectStringConfigItem","ConfigItemLiterals","ConfigItemEnum","ConfigItemDef","ChatModelSchema","Roles","RoleEnum","Modalities","ModalityEnum","config","_a","_b","defKeys","schemaKeys","key","EmbeddingModelSchema","EmbeddingModalityEnum","Headers","Params","Url","TEMPERATURE","MAX_TOKENS","MAX_REASONING_TOKENS","STOP","TOP_A","TOP_P","TOP_K","MIN_P","FREQUENCY_PENALTY","PRESENCE_PENALTY","SEED","REPETITION_PENALTY","LOG_PROBS","TOP_LOG_PROBS","ECHO","RESPONSE_FORMAT","RESPONSE_FORMAT_WITH_SCHEMA","RESPONSE_SCHEMA","CHAT_CONFIG","DIMENSIONS","ENCODING_FORMAT","EMBEDDING_CONFIG","getErrorMessage","removeUndefinedEntries","record","_","value","isRunningInBrowser","convertBase64ToUint8Array","base64String","base64Url","latin1string","byte","convertUint8ArrayToBase64","array","i","encodedBase64ToString","base64","binaryString","bytes","getMimeTypeFromBase64","urlWithoutTrailingSlash","url"],"mapp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AAM,EAC1BE,CAAQ,CAAA,IAAI,WAAWD,CAAa,CAAA,MAAM,CAChD,CAAA,IAAA,IAASH,CAAI,CAAA,CAAA,CAAGA,EAAIG,CAAa,CAAA,MAAA,CAAQH,IACvCI,CAAMJ,CAAAA,CAAC,EAAIG,CAAa,CAAA,UAAA,CAAWH,CAAC,CAAA,CAGtC,OADgB,IAAI,YAAY,OAAO,CAAA,CACxB,OAAOI,CAAK,CAC7B,MACS,OAAA,MAAA,CAAO,IAAKF,CAAAA,CAAAA,CAAQ,QAAQ,CAAA,CAAE,SAAS,OAAO,CAEzD,EAEMG,EAAyBH,CAAAA,CAAAA,EACNA,EAAO,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACV,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,ECpCxCI,IAAAA,EAAAA,CAA2BC,GACxBA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAK,CAAA,OAAA,CAAQ,KAAO,CAAA,EAAA","file":"index.js","sourcesContent":["import { GatewayBaseError } from \"@adaline/types\";\n\nconst ProviderErrorLiteral = \"ProviderError\" as const;\nexport class ProviderError extends GatewayBaseError {\n readonly name = ProviderErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ProviderErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isProviderError(error: unknown): error is ProviderError {\n return error instanceof ProviderError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelErrorLiteral = \"ModelError\" as const;\nexport class ModelError extends GatewayBaseError {\n readonly name = ModelErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isModelError(error: unknown): error is ModelError {\n return error instanceof ModelError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelResponseErrorLiteral = \"ModelResponseError\" as const;\nexport class ModelResponseError extends GatewayBaseError {\n readonly name = ModelResponseErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelResponseErrorLiteral);\n this.cause = cause;\n this.info = info;\n }\n\n static isModelResponseError(error: unknown): error is ModelResponseError {\n return error instanceof ModelResponseError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidModelRequestErrorLiteral = \"InvalidModelRequestError\" as const;\nexport class InvalidModelRequestError extends GatewayBaseError {\n readonly name = InvalidModelRequestErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidModelRequestErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidModelRequestError(error: unknown): error is InvalidModelRequestError {\n return error instanceof InvalidModelRequestError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidConfigErrorLiteral = \"InvalidConfigError\" as const;\nexport class InvalidConfigError extends GatewayBaseError {\n readonly name = InvalidConfigErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidConfigErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidConfigError(error: unknown): error is InvalidConfigError {\n return error instanceof InvalidConfigError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidMessagesErrorLiteral = \"InvalidMessagesError\" as const;\nexport class InvalidMessagesError extends GatewayBaseError {\n readonly name = InvalidMessagesErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidMessagesErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidMessagesError(error: unknown): error is InvalidMessagesError {\n return error instanceof InvalidMessagesError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidToolsErrorLiteral = \"InvalidToolsError\" as const;\nexport class InvalidToolsError extends GatewayBaseError {\n readonly name = InvalidToolsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidToolsErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidToolsError(error: unknown): error is InvalidToolsError {\n return error instanceof InvalidToolsError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidEmbeddingRequestsErrorLiteral = \"InvalidEmbeddingRequestsError\" as const;\nexport class InvalidEmbeddingRequestsError extends GatewayBaseError {\n readonly name = InvalidEmbeddingRequestsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidEmbeddingRequestsErrorLiteral);\n this.info = info;\n this.cause = cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError {\n return error instanceof InvalidEmbeddingRequestsError;\n }\n}\n","import { z } from \"zod\";\n\nconst MultiStringConfigItemTypeLiteral = \"multi-string\" as const;\n\nconst MultiStringConfigItemDef = z.object({\n type: z.literal(MultiStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n max: z.number().int().positive(),\n});\ntype MultiStringConfigItemType = z.infer<typeof MultiStringConfigItemDef>;\n\nconst MultiStringConfigItemSchema = (max: number) => z.array(z.string()).max(max).default([]).optional();\ntype MultiStringConfigItemSchemaType = z.infer<ReturnType<typeof MultiStringConfigItemSchema>>;\n\nconst MultiStringConfigItem = (data: Omit<MultiStringConfigItemType, \"type\">) => {\n return {\n def: MultiStringConfigItemDef.parse({\n type: MultiStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: MultiStringConfigItemSchema(data.max),\n };\n};\n\nexport {\n MultiStringConfigItem,\n MultiStringConfigItemDef,\n MultiStringConfigItemSchema,\n MultiStringConfigItemTypeLiteral,\n type MultiStringConfigItemSchemaType,\n type MultiStringConfigItemType,\n};\n","import { z } from \"zod\";\n\nconst ObjectSchemaConfigItemTypeLiteral = \"object-schema\" as const;\n\nconst ObjectSchemaConfigItemDef = z.object({\n type: z.literal(ObjectSchemaConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n objectSchema: z.any(),\n});\ntype ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;\n\nconst ObjectSchemaConfigItemSchema = <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => schema.optional();\ntype ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<\n ReturnType<typeof ObjectSchemaConfigItemSchema<S>>\n>;\n\nconst ObjectSchemaConfigItem = (data: Omit<ObjectSchemaConfigItemType, \"type\">) => {\n return {\n def: ObjectSchemaConfigItemDef.parse({\n type: ObjectSchemaConfigItemTypeLiteral,\n ...data,\n }),\n schema: ObjectSchemaConfigItemSchema(data.objectSchema),\n };\n};\n\nexport {\n ObjectSchemaConfigItem,\n ObjectSchemaConfigItemDef,\n ObjectSchemaConfigItemSchema,\n ObjectSchemaConfigItemTypeLiteral,\n type ObjectSchemaConfigItemType,\n type ObjectSchemaConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst RangeConfigItemTypeLiteral = \"range\" as const;\n\nconst RangeConfigItemDef = z.object({\n type: z.literal(RangeConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n min: z.number().int(),\n max: z.number().int(),\n step: z.number().positive(),\n default: z.number(),\n});\ntype RangeConfigItemDefType = z.infer<typeof RangeConfigItemDef>;\n\nconst RangeConfigItemSchema = (min: number, max: number, step: number, defaultValue: number) =>\n z.number().min(min).max(max).step(step).default(defaultValue).optional();\ntype RangeConfigItemSchemaType = z.infer<ReturnType<typeof RangeConfigItemSchema>>;\n\nconst RangeConfigItem = (data: Omit<RangeConfigItemDefType, \"type\">) => {\n return {\n def: RangeConfigItemDef.parse({\n type: RangeConfigItemTypeLiteral,\n ...data,\n }),\n schema: RangeConfigItemSchema(data.min, data.max, data.step, data.default),\n };\n};\n\nexport {\n RangeConfigItem,\n RangeConfigItemDef,\n RangeConfigItemSchema,\n RangeConfigItemTypeLiteral,\n type RangeConfigItemDefType,\n type RangeConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectBooleanConfigItemTypeLiteral = \"select-boolean\" as const;\n\nconst SelectBooleanConfigItemDef = z.object({\n type: z.literal(SelectBooleanConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.boolean().nullable(),\n});\ntype SelectBooleanConfigItemDefType = z.infer<typeof SelectBooleanConfigItemDef>;\n\nconst SelectBooleanConfigItemSchema = (defaultValue: boolean | null) => z.boolean().nullable().default(defaultValue).optional();\ntype SelectBooleanConfigItemSchemaType = z.infer<ReturnType<typeof SelectBooleanConfigItemSchema>>;\n\nconst SelectBooleanConfigItem = (data: Omit<SelectBooleanConfigItemDefType, \"type\">) => {\n return {\n def: SelectBooleanConfigItemDef.parse({\n type: SelectBooleanConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectBooleanConfigItemSchema(data.default),\n };\n};\n\nexport {\n SelectBooleanConfigItem,\n SelectBooleanConfigItemDef,\n SelectBooleanConfigItemSchema,\n SelectBooleanConfigItemTypeLiteral,\n type SelectBooleanConfigItemDefType,\n type SelectBooleanConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectStringConfigItemTypeLiteral = \"select-string\" as const;\n\nconst SelectStringConfigItemDef = z.object({\n type: z.literal(SelectStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.string(),\n choices: z.array(z.string()),\n});\ntype SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;\n\nconst SelectStringConfigItemSchema = (defaultValue: string | null, choices: string[]) =>\n z\n .enum(choices as [string, ...string[]])\n .nullable()\n .default(defaultValue)\n .optional();\ntype SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;\n\nconst SelectStringConfigItem = (data: Omit<SelectStringConfigItemDefType, \"type\">) => {\n return {\n def: SelectStringConfigItemDef.parse({\n type: SelectStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectStringConfigItemSchema(data.default, data.choices),\n };\n};\n\nexport {\n SelectStringConfigItem,\n SelectStringConfigItemDef,\n SelectStringConfigItemSchema,\n SelectStringConfigItemTypeLiteral,\n type SelectStringConfigItemDefType,\n type SelectStringConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nimport { MultiStringConfigItemDef, MultiStringConfigItemTypeLiteral } from \"./multi-string-config-item\";\nimport { ObjectSchemaConfigItemDef, ObjectSchemaConfigItemTypeLiteral } from \"./object-schema-config-item\";\nimport { RangeConfigItemDef, RangeConfigItemTypeLiteral } from \"./range-config-item\";\nimport { SelectBooleanConfigItemDef, SelectBooleanConfigItemTypeLiteral } from \"./select-boolean-config-item\";\nimport { SelectStringConfigItemDef, SelectStringConfigItemTypeLiteral } from \"./select-string-config-item\";\n\nconst ConfigItemLiterals = [\n RangeConfigItemTypeLiteral,\n MultiStringConfigItemTypeLiteral,\n SelectStringConfigItemTypeLiteral,\n ObjectSchemaConfigItemTypeLiteral,\n SelectBooleanConfigItemTypeLiteral,\n] as const;\nconst ConfigItemEnum = z.enum(ConfigItemLiterals);\ntype ConfigItemEnumType = z.infer<typeof ConfigItemEnum>;\n\nconst ConfigItemDef = z.discriminatedUnion(\"type\", [\n RangeConfigItemDef,\n MultiStringConfigItemDef,\n SelectStringConfigItemDef,\n SelectBooleanConfigItemDef,\n ObjectSchemaConfigItemDef,\n]);\ntype ConfigItemDefType = z.infer<typeof ConfigItemDef>;\n\nexport { ConfigItemDef, ConfigItemEnum, ConfigItemLiterals, type ConfigItemDefType, type ConfigItemEnumType };\n","import { z } from \"zod\";\n\nimport { ModalityEnum, RoleEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\nconst ChatModelSchema = <\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n>(\n Roles: R = RoleEnum as unknown as R,\n Modalities: M = ModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n roles: z.record(Roles, z.string().min(1).optional()),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n maxReasoningTokens: z.number().int().positive().min(1).optional(),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype ChatModelSchemaType<\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n> = z.infer<ReturnType<typeof ChatModelSchema<R, M>>>;\n\nexport { ChatModelSchema, type ChatModelSchemaType };\n","import { z } from \"zod\";\n\nimport { EmbeddingModalityEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\n// TODO: add embedding model properties (dimensions, etc)\nconst EmbeddingModelSchema = <M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum>(\n Modalities: M = EmbeddingModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype EmbeddingModelSchemaType<M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum> = z.infer<\n ReturnType<typeof EmbeddingModelSchema<M>>\n>;\n\nexport { EmbeddingModelSchema, type EmbeddingModelSchemaType };\n","import { z } from \"zod\";\n\nconst Headers = z.record(z.string());\ntype HeadersType = z.infer<typeof Headers>;\n\nexport { Headers, type HeadersType };\n","import { z } from \"zod\";\n\nconst Params = z.record(\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.object({}),\n z.array(z.any()),\n z.null(),\n z.undefined(),\n ])\n);\ntype ParamsType = z.infer<typeof Params>;\n\nexport { Params, type ParamsType };\n","import { z } from \"zod\";\n\nconst Url = z.string().url();\ntype UrlType = z.infer<typeof Url>;\n\nexport { Url, type UrlType };\n","const TEMPERATURE = {\n type: \"range\",\n title: \"Temperature\",\n description:\n \"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. \\\n For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text \\\n that's unexpectedly fresh.\",\n} as const;\n\nconst MAX_TOKENS = {\n type: \"range\",\n title: \"Max tokens\",\n description:\n \"Specify the total tokens for generation, where one token approximates four English characters. \\\n Setting this to 0 defaults to the model's maximum capacity.\",\n} as const;\n\nconst MAX_REASONING_TOKENS = {\n type: \"range\",\n title: \"Max reasoning tokens\",\n description:\n \"Specify the total tokens for reasoning, where one token approximates four English characters.\",\n} as const;\n\nconst STOP = (max: number) =>\n ({\n type: \"multi\",\n title: \"Stop sequence\",\n description: `Enter up to ${max} sequences that will halt additional text output. \\\n The generated text will exclude these sequences.`,\n }) as const;\n\nconst TOP_A = {\n type: \"range\",\n title: \"Top A\",\n description:\n \"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, \\\n functioning like a dynamic Top-P. \\\n A lower Top-A value narrows down the token choices based on the highest probability token, \\\n while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output.\",\n} as const;\n\nconst TOP_P = {\n type: \"range\",\n title: \"Top P\",\n description:\n \"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, \\\n such as the top 10% when P=0.1. \\\n This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. \\\n It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously.\",\n} as const;\n\nconst TOP_K = {\n type: \"range\",\n title: \"Top K\",\n description:\n \"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options.\",\n} as const;\n\nconst MIN_P = {\n type: \"range\",\n title: \"Min P\",\n description:\n \"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. \\\n (This value varies based on the confidence level of the top token.) \\\n For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered.\",\n} as const;\n\nconst FREQUENCY_PENALTY = {\n type: \"range\",\n title: \"Frequency penalty\",\n description:\n \"Minimize redundancy.\\\n By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. \\\n The default setting for this penalty is zero.\",\n} as const;\n\nconst PRESENCE_PENALTY = {\n type: \"range\",\n title: \"Presence penalty\",\n description:\n \"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, \\\n thus boosting the chances of exploring fresh topics. \\\n The standard setting for this is zero.\",\n} as const;\n\nconst SEED = {\n type: \"range\",\n title: \"Seed\",\n description:\n \"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. \\\n Deterministic output isn't guaranteed. \\\n Also, changing the model or parameter settings, such as the temperature, \\\n can cause variations in the response even when you use the same seed value. \\\n By default, a random seed value is used.\",\n} as const;\n\nconst REPETITION_PENALTY = {\n type: \"range\",\n title: \"Repetition penalty\",\n description:\n \"Reduces the likelihood of repeating tokens from the input. \\\n Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, \\\n often resulting in run-on sentences missing smaller words. \\\n The token penalty is scaled according to the original token's probability.\",\n} as const;\n\nconst LOG_PROBS = {\n type: \"boolean\",\n title: \"Log probs\",\n description:\n \"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.\",\n} as const;\n\nconst TOP_LOG_PROBS = {\n type: \"range\",\n title: \"Top log probs\",\n description:\n \"The number of most likely tokens to return at each token position, each with an associated log probability. \\\n 'logprobs' must be set to true if this parameter is used.\",\n} as const;\n\nconst ECHO = {\n type: \"boolean\",\n title: \"Echo\",\n description: \"If true, the response will contain the prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT_WITH_SCHEMA = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid \\\n JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict \\\n response schema that the model will adhere to.\",\n} as const;\n\nconst RESPONSE_SCHEMA = {\n type: \"object\",\n title: \"Response schema\",\n description: \"When response format is set to 'json_schema', the model will return a JSON object of the specified schema.\",\n} as const;\n\nconst CHAT_CONFIG = {\n TEMPERATURE,\n MAX_TOKENS,\n STOP,\n TOP_A,\n TOP_P,\n TOP_K,\n MIN_P,\n FREQUENCY_PENALTY,\n PRESENCE_PENALTY,\n REPETITION_PENALTY,\n SEED,\n LOG_PROBS,\n TOP_LOG_PROBS,\n ECHO,\n RESPONSE_FORMAT,\n RESPONSE_FORMAT_WITH_SCHEMA,\n RESPONSE_SCHEMA,\n MAX_REASONING_TOKENS,\n};\n\nexport { CHAT_CONFIG };\n","const DIMENSIONS = {\n type: \"range\",\n title: \"Dimensions\",\n description: \"Select the number of dimensions for the word embedding.\",\n} as const;\n\nconst ENCODING_FORMAT = {\n type: \"select\",\n title: \"Encoding format\",\n description: \"Select the encoding format for the word embedding.\",\n} as const;\n\nconst EMBEDDING_CONFIG = {\n DIMENSIONS,\n ENCODING_FORMAT,\n};\n\nexport { EMBEDDING_CONFIG };\n","const getErrorMessage = (error: unknown | undefined): string => {\n if (error == null) return \"unknown error\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n return JSON.stringify(error);\n};\n\nexport { getErrorMessage };\n","const removeUndefinedEntries = <T = unknown>(record: Record<string, T | undefined>): Record<string, T> => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return Object.fromEntries(Object.entries(record).filter(([_, value]) => value != null)) as Record<string, T>;\n};\n\nexport { removeUndefinedEntries };\n","const isRunningInBrowser = () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof navigator !== \"undefined\";\n};\n\nexport { isRunningInBrowser };\n","import { isRunningInBrowser } from \"./is-running-in-browser\";\n\nconst convertBase64ToUint8Array = (base64String: string): Uint8Array => {\n const base64Url = base64String.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const latin1string = globalThis.atob(base64Url);\n return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0)!);\n};\n\nconst convertUint8ArrayToBase64 = (array: Uint8Array): string => {\n let latin1string = \"\";\n\n // Note: regular for loop to support older JavaScript versions that\n // do not support for..of on Uint8Array\n for (let i = 0; i < array.length; i++) {\n latin1string += String.fromCodePoint(array[i]);\n }\n\n return globalThis.btoa(latin1string);\n};\n\nconst encodedBase64ToString = (base64: string): string => {\n if (isRunningInBrowser()) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n const decoder = new TextDecoder(\"utf-8\");\n return decoder.decode(bytes);\n } else {\n return Buffer.from(base64, \"base64\").toString(\"utf-8\");\n }\n};\n\nconst getMimeTypeFromBase64 = (base64: string): string => {\n const mimeTypePrefix = base64.split(\";\")[0];\n const mimeType = mimeTypePrefix.split(\"/\")[1];\n return mimeType;\n};\n\nexport { convertBase64ToUint8Array, convertUint8ArrayToBase64, encodedBase64ToString, getMimeTypeFromBase64 };\n","const urlWithoutTrailingSlash = (url: string): string => {\n return url?.replace(/\\/$/, \"\");\n};\n\nexport { urlWithoutTrailingSlash };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors/provider.error.ts","../src/errors/model.error.ts","../src/errors/model-response.error.ts","../src/errors/invalid-model-request.error.ts","../src/errors/invalid-config.error.ts","../src/errors/invalid-messages.error.ts","../src/errors/invalid-tools.error.ts","../src/errors/invalid-embedding-requests.error.ts","../src/types/config/multi-string-config-item.ts","../src/types/config/object-schema-config-item.ts","../src/types/config/range-config-item.ts","../src/types/config/select-boolean-config-item.ts","../src/types/config/select-string-config-item.ts","../src/types/config/config-item.ts","../src/model/chat-model/chat-model.schema.v1.ts","../src/model/embedding-model/embedding-model.schema.v1.ts","../src/types/headers.ts","../src/types/params.ts","../src/types/url.ts","../src/utils/common-config.def.chat-model.ts","../src/utils/common-config.def.word-embedding.ts","../src/utils/get-error-message.ts","../src/utils/remove-undefined-entries.ts","../src/utils/is-running-in-browser.ts","../src/utils/base64.ts","../src/utils/url.ts"],"names":["ProviderErrorLiteral","ProviderError","_ProviderError","GatewayBaseError","info","cause","error","ModelErrorLiteral","ModelError","_ModelError","ModelResponseErrorLiteral","ModelResponseError","_ModelResponseError","InvalidModelRequestErrorLiteral","InvalidModelRequestError","_InvalidModelRequestError","InvalidConfigErrorLiteral","InvalidConfigError","_InvalidConfigError","InvalidMessagesErrorLiteral","InvalidMessagesError","_InvalidMessagesError","InvalidToolsErrorLiteral","InvalidToolsError","_InvalidToolsError","InvalidEmbeddingRequestsErrorLiteral","InvalidEmbeddingRequestsError","_InvalidEmbeddingRequestsError","MultiStringConfigItemTypeLiteral","MultiStringConfigItemDef","z","MultiStringConfigItemSchema","max","MultiStringConfigItem","data","__spreadValues","ObjectSchemaConfigItemTypeLiteral","ObjectSchemaConfigItemDef","ObjectSchemaConfigItemSchema","schema","ObjectSchemaConfigItem","RangeConfigItemTypeLiteral","RangeConfigItemDef","RangeConfigItemSchema","min","step","defaultValue","RangeConfigItem","SelectBooleanConfigItemTypeLiteral","SelectBooleanConfigItemDef","SelectBooleanConfigItemSchema","SelectBooleanConfigItem","SelectStringConfigItemTypeLiteral","SelectStringConfigItemDef","SelectStringConfigItemSchema","choices","SelectStringConfigItem","ConfigItemLiterals","ConfigItemEnum","ConfigItemDef","ChatModelSchema","Roles","RoleEnum","Modalities","ModalityEnum","config","_a","_b","defKeys","schemaKeys","key","EmbeddingModelSchema","EmbeddingModalityEnum","Headers","Params","Url","TEMPERATURE","MAX_TOKENS","MAX_REASONING_TOKENS","STOP","TOP_A","TOP_P","TOP_K","MIN_P","FREQUENCY_PENALTY","PRESENCE_PENALTY","SEED","REPETITION_PENALTY","LOG_PROBS","TOP_LOG_PROBS","ECHO","RESPONSE_FORMAT","RESPONSE_FORMAT_WITH_SCHEMA","RESPONSE_SCHEMA","CHAT_CONFIG","DIMENSIONS","ENCODING_FORMAT","EMBEDDING_CONFIG","getErrorMessage","removeUndefinedEntries","record","_","value","isRunningInBrowser","convertBase64ToUint8Array","base64String","base64Url","latin1string","byte","convertUint8ArrayToBase64","array","i","encodedBase64ToString","base64","binaryString","bytes","getMimeTypeFromBase64","urlWithoutTrailingSlash","url"],"mappings":";;;;;yVAEA,IAAMA,EAAuB,eAChBC,CAAAA,CAA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,CAAY,CACrC,CAEMK,CAAAA,EAAAA,CAAyBC,GAA2B,CACxD,GAAIV,CAAmB,EAAA,CAAG,CACxB,IAAMW,EAAe,IAAKD,CAAAA,CAAM,EAC1BE,CAAQ,CAAA,IAAI,WAAWD,CAAa,CAAA,MAAM,CAChD,CAAA,IAAA,IAASH,CAAI,CAAA,CAAA,CAAGA,EAAIG,CAAa,CAAA,MAAA,CAAQH,IACvCI,CAAMJ,CAAAA,CAAC,EAAIG,CAAa,CAAA,UAAA,CAAWH,CAAC,CAAA,CAGtC,OADgB,IAAI,YAAY,OAAO,CAAA,CACxB,OAAOI,CAAK,CAC7B,MACS,OAAA,MAAA,CAAO,IAAKF,CAAAA,CAAAA,CAAQ,QAAQ,CAAA,CAAE,SAAS,OAAO,CAEzD,EAEMG,EAAyBH,CAAAA,CAAAA,EACNA,EAAO,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACV,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,ECpCxCI,IAAAA,EAAAA,CAA2BC,GACxBA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAK,CAAA,OAAA,CAAQ,KAAO,CAAA,EAAA","file":"index.js","sourcesContent":["import { GatewayBaseError } from \"@adaline/types\";\n\nconst ProviderErrorLiteral = \"ProviderError\" as const;\nexport class ProviderError extends GatewayBaseError {\n readonly name = ProviderErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ProviderErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isProviderError(error: unknown): error is ProviderError {\n return error instanceof ProviderError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelErrorLiteral = \"ModelError\" as const;\nexport class ModelError extends GatewayBaseError {\n readonly name = ModelErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isModelError(error: unknown): error is ModelError {\n return error instanceof ModelError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelResponseErrorLiteral = \"ModelResponseError\" as const;\nexport class ModelResponseError extends GatewayBaseError {\n readonly name = ModelResponseErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelResponseErrorLiteral);\n this.cause = cause;\n this.info = info;\n }\n\n static isModelResponseError(error: unknown): error is ModelResponseError {\n return error instanceof ModelResponseError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidModelRequestErrorLiteral = \"InvalidModelRequestError\" as const;\nexport class InvalidModelRequestError extends GatewayBaseError {\n readonly name = InvalidModelRequestErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidModelRequestErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidModelRequestError(error: unknown): error is InvalidModelRequestError {\n return error instanceof InvalidModelRequestError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidConfigErrorLiteral = \"InvalidConfigError\" as const;\nexport class InvalidConfigError extends GatewayBaseError {\n readonly name = InvalidConfigErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidConfigErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidConfigError(error: unknown): error is InvalidConfigError {\n return error instanceof InvalidConfigError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidMessagesErrorLiteral = \"InvalidMessagesError\" as const;\nexport class InvalidMessagesError extends GatewayBaseError {\n readonly name = InvalidMessagesErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidMessagesErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidMessagesError(error: unknown): error is InvalidMessagesError {\n return error instanceof InvalidMessagesError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidToolsErrorLiteral = \"InvalidToolsError\" as const;\nexport class InvalidToolsError extends GatewayBaseError {\n readonly name = InvalidToolsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidToolsErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidToolsError(error: unknown): error is InvalidToolsError {\n return error instanceof InvalidToolsError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidEmbeddingRequestsErrorLiteral = \"InvalidEmbeddingRequestsError\" as const;\nexport class InvalidEmbeddingRequestsError extends GatewayBaseError {\n readonly name = InvalidEmbeddingRequestsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidEmbeddingRequestsErrorLiteral);\n this.info = info;\n this.cause = cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError {\n return error instanceof InvalidEmbeddingRequestsError;\n }\n}\n","import { z } from \"zod\";\n\nconst MultiStringConfigItemTypeLiteral = \"multi-string\" as const;\n\nconst MultiStringConfigItemDef = z.object({\n type: z.literal(MultiStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n max: z.number().int().positive(),\n});\ntype MultiStringConfigItemType = z.infer<typeof MultiStringConfigItemDef>;\n\nconst MultiStringConfigItemSchema = (max: number) => z.array(z.string()).max(max).default([]).optional();\ntype MultiStringConfigItemSchemaType = z.infer<ReturnType<typeof MultiStringConfigItemSchema>>;\n\nconst MultiStringConfigItem = (data: Omit<MultiStringConfigItemType, \"type\">) => {\n return {\n def: MultiStringConfigItemDef.parse({\n type: MultiStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: MultiStringConfigItemSchema(data.max),\n };\n};\n\nexport {\n MultiStringConfigItem,\n MultiStringConfigItemDef,\n MultiStringConfigItemSchema,\n MultiStringConfigItemTypeLiteral,\n type MultiStringConfigItemSchemaType,\n type MultiStringConfigItemType,\n};\n","import { z } from \"zod\";\n\nconst ObjectSchemaConfigItemTypeLiteral = \"object-schema\" as const;\n\nconst ObjectSchemaConfigItemDef = z.object({\n type: z.literal(ObjectSchemaConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n objectSchema: z.any(),\n});\ntype ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;\n\nconst ObjectSchemaConfigItemSchema = <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => schema.optional();\ntype ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<\n ReturnType<typeof ObjectSchemaConfigItemSchema<S>>\n>;\n\nconst ObjectSchemaConfigItem = (data: Omit<ObjectSchemaConfigItemType, \"type\">) => {\n return {\n def: ObjectSchemaConfigItemDef.parse({\n type: ObjectSchemaConfigItemTypeLiteral,\n ...data,\n }),\n schema: ObjectSchemaConfigItemSchema(data.objectSchema),\n };\n};\n\nexport {\n ObjectSchemaConfigItem,\n ObjectSchemaConfigItemDef,\n ObjectSchemaConfigItemSchema,\n ObjectSchemaConfigItemTypeLiteral,\n type ObjectSchemaConfigItemType,\n type ObjectSchemaConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst RangeConfigItemTypeLiteral = \"range\" as const;\n\nconst RangeConfigItemDef = z.object({\n type: z.literal(RangeConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n min: z.number().int(),\n max: z.number().int(),\n step: z.number().positive(),\n default: z.number(),\n});\ntype RangeConfigItemDefType = z.infer<typeof RangeConfigItemDef>;\n\nconst RangeConfigItemSchema = (min: number, max: number, step: number, defaultValue: number) =>\n z.number().min(min).max(max).step(step).default(defaultValue).optional();\ntype RangeConfigItemSchemaType = z.infer<ReturnType<typeof RangeConfigItemSchema>>;\n\nconst RangeConfigItem = (data: Omit<RangeConfigItemDefType, \"type\">) => {\n return {\n def: RangeConfigItemDef.parse({\n type: RangeConfigItemTypeLiteral,\n ...data,\n }),\n schema: RangeConfigItemSchema(data.min, data.max, data.step, data.default),\n };\n};\n\nexport {\n RangeConfigItem,\n RangeConfigItemDef,\n RangeConfigItemSchema,\n RangeConfigItemTypeLiteral,\n type RangeConfigItemDefType,\n type RangeConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectBooleanConfigItemTypeLiteral = \"select-boolean\" as const;\n\nconst SelectBooleanConfigItemDef = z.object({\n type: z.literal(SelectBooleanConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.boolean().nullable(),\n});\ntype SelectBooleanConfigItemDefType = z.infer<typeof SelectBooleanConfigItemDef>;\n\nconst SelectBooleanConfigItemSchema = (defaultValue: boolean | null) => z.boolean().nullable().default(defaultValue).optional();\ntype SelectBooleanConfigItemSchemaType = z.infer<ReturnType<typeof SelectBooleanConfigItemSchema>>;\n\nconst SelectBooleanConfigItem = (data: Omit<SelectBooleanConfigItemDefType, \"type\">) => {\n return {\n def: SelectBooleanConfigItemDef.parse({\n type: SelectBooleanConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectBooleanConfigItemSchema(data.default),\n };\n};\n\nexport {\n SelectBooleanConfigItem,\n SelectBooleanConfigItemDef,\n SelectBooleanConfigItemSchema,\n SelectBooleanConfigItemTypeLiteral,\n type SelectBooleanConfigItemDefType,\n type SelectBooleanConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectStringConfigItemTypeLiteral = \"select-string\" as const;\n\nconst SelectStringConfigItemDef = z.object({\n type: z.literal(SelectStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.string(),\n choices: z.array(z.string()),\n});\ntype SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;\n\nconst SelectStringConfigItemSchema = (defaultValue: string | null, choices: string[]) =>\n z\n .enum(choices as [string, ...string[]])\n .nullable()\n .default(defaultValue)\n .optional();\ntype SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;\n\nconst SelectStringConfigItem = (data: Omit<SelectStringConfigItemDefType, \"type\">) => {\n return {\n def: SelectStringConfigItemDef.parse({\n type: SelectStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectStringConfigItemSchema(data.default, data.choices),\n };\n};\n\nexport {\n SelectStringConfigItem,\n SelectStringConfigItemDef,\n SelectStringConfigItemSchema,\n SelectStringConfigItemTypeLiteral,\n type SelectStringConfigItemDefType,\n type SelectStringConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nimport { MultiStringConfigItemDef, MultiStringConfigItemTypeLiteral } from \"./multi-string-config-item\";\nimport { ObjectSchemaConfigItemDef, ObjectSchemaConfigItemTypeLiteral } from \"./object-schema-config-item\";\nimport { RangeConfigItemDef, RangeConfigItemTypeLiteral } from \"./range-config-item\";\nimport { SelectBooleanConfigItemDef, SelectBooleanConfigItemTypeLiteral } from \"./select-boolean-config-item\";\nimport { SelectStringConfigItemDef, SelectStringConfigItemTypeLiteral } from \"./select-string-config-item\";\n\nconst ConfigItemLiterals = [\n RangeConfigItemTypeLiteral,\n MultiStringConfigItemTypeLiteral,\n SelectStringConfigItemTypeLiteral,\n ObjectSchemaConfigItemTypeLiteral,\n SelectBooleanConfigItemTypeLiteral,\n] as const;\nconst ConfigItemEnum = z.enum(ConfigItemLiterals);\ntype ConfigItemEnumType = z.infer<typeof ConfigItemEnum>;\n\nconst ConfigItemDef = z.discriminatedUnion(\"type\", [\n RangeConfigItemDef,\n MultiStringConfigItemDef,\n SelectStringConfigItemDef,\n SelectBooleanConfigItemDef,\n ObjectSchemaConfigItemDef,\n]);\ntype ConfigItemDefType = z.infer<typeof ConfigItemDef>;\n\nexport { ConfigItemDef, ConfigItemEnum, ConfigItemLiterals, type ConfigItemDefType, type ConfigItemEnumType };\n","import { z } from \"zod\";\n\nimport { ChatModelPriceType, ModalityEnum, RoleEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\nconst ChatModelSchema = <\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n>(\n Roles: R = RoleEnum as unknown as R,\n Modalities: M = ModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n roles: z.record(Roles, z.string().min(1).optional()),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n maxReasoningTokens: z.number().int().positive().min(1).optional(),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n price: z.custom<ChatModelPriceType>(),\n });\ntype ChatModelSchemaType<\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n> = z.infer<ReturnType<typeof ChatModelSchema<R, M>>>;\n\nexport { ChatModelSchema, type ChatModelSchemaType };\n","import { z } from \"zod\";\n\nimport { EmbeddingModalityEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\n// TODO: add embedding model properties (dimensions, etc)\nconst EmbeddingModelSchema = <M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum>(\n Modalities: M = EmbeddingModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype EmbeddingModelSchemaType<M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum> = z.infer<\n ReturnType<typeof EmbeddingModelSchema<M>>\n>;\n\nexport { EmbeddingModelSchema, type EmbeddingModelSchemaType };\n","import { z } from \"zod\";\n\nconst Headers = z.record(z.string());\ntype HeadersType = z.infer<typeof Headers>;\n\nexport { Headers, type HeadersType };\n","import { z } from \"zod\";\n\nconst Params = z.record(\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.object({}),\n z.array(z.any()),\n z.null(),\n z.undefined(),\n ])\n);\ntype ParamsType = z.infer<typeof Params>;\n\nexport { Params, type ParamsType };\n","import { z } from \"zod\";\n\nconst Url = z.string().url();\ntype UrlType = z.infer<typeof Url>;\n\nexport { Url, type UrlType };\n","const TEMPERATURE = {\n type: \"range\",\n title: \"Temperature\",\n description:\n \"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. \\\n For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text \\\n that's unexpectedly fresh.\",\n} as const;\n\nconst MAX_TOKENS = {\n type: \"range\",\n title: \"Max tokens\",\n description:\n \"Specify the total tokens for generation, where one token approximates four English characters. \\\n Setting this to 0 defaults to the model's maximum capacity.\",\n} as const;\n\nconst MAX_REASONING_TOKENS = {\n type: \"range\",\n title: \"Max reasoning tokens\",\n description:\n \"Specify the total tokens for reasoning, where one token approximates four English characters.\",\n} as const;\n\nconst STOP = (max: number) =>\n ({\n type: \"multi\",\n title: \"Stop sequence\",\n description: `Enter up to ${max} sequences that will halt additional text output. \\\n The generated text will exclude these sequences.`,\n }) as const;\n\nconst TOP_A = {\n type: \"range\",\n title: \"Top A\",\n description:\n \"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, \\\n functioning like a dynamic Top-P. \\\n A lower Top-A value narrows down the token choices based on the highest probability token, \\\n while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output.\",\n} as const;\n\nconst TOP_P = {\n type: \"range\",\n title: \"Top P\",\n description:\n \"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, \\\n such as the top 10% when P=0.1. \\\n This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. \\\n It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously.\",\n} as const;\n\nconst TOP_K = {\n type: \"range\",\n title: \"Top K\",\n description:\n \"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options.\",\n} as const;\n\nconst MIN_P = {\n type: \"range\",\n title: \"Min P\",\n description:\n \"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. \\\n (This value varies based on the confidence level of the top token.) \\\n For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered.\",\n} as const;\n\nconst FREQUENCY_PENALTY = {\n type: \"range\",\n title: \"Frequency penalty\",\n description:\n \"Minimize redundancy.\\\n By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. \\\n The default setting for this penalty is zero.\",\n} as const;\n\nconst PRESENCE_PENALTY = {\n type: \"range\",\n title: \"Presence penalty\",\n description:\n \"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, \\\n thus boosting the chances of exploring fresh topics. \\\n The standard setting for this is zero.\",\n} as const;\n\nconst SEED = {\n type: \"range\",\n title: \"Seed\",\n description:\n \"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. \\\n Deterministic output isn't guaranteed. \\\n Also, changing the model or parameter settings, such as the temperature, \\\n can cause variations in the response even when you use the same seed value. \\\n By default, a random seed value is used.\",\n} as const;\n\nconst REPETITION_PENALTY = {\n type: \"range\",\n title: \"Repetition penalty\",\n description:\n \"Reduces the likelihood of repeating tokens from the input. \\\n Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, \\\n often resulting in run-on sentences missing smaller words. \\\n The token penalty is scaled according to the original token's probability.\",\n} as const;\n\nconst LOG_PROBS = {\n type: \"boolean\",\n title: \"Log probs\",\n description:\n \"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.\",\n} as const;\n\nconst TOP_LOG_PROBS = {\n type: \"range\",\n title: \"Top log probs\",\n description:\n \"The number of most likely tokens to return at each token position, each with an associated log probability. \\\n 'logprobs' must be set to true if this parameter is used.\",\n} as const;\n\nconst ECHO = {\n type: \"boolean\",\n title: \"Echo\",\n description: \"If true, the response will contain the prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT_WITH_SCHEMA = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid \\\n JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict \\\n response schema that the model will adhere to.\",\n} as const;\n\nconst RESPONSE_SCHEMA = {\n type: \"object\",\n title: \"Response schema\",\n description: \"When response format is set to 'json_schema', the model will return a JSON object of the specified schema.\",\n} as const;\n\nconst CHAT_CONFIG = {\n TEMPERATURE,\n MAX_TOKENS,\n STOP,\n TOP_A,\n TOP_P,\n TOP_K,\n MIN_P,\n FREQUENCY_PENALTY,\n PRESENCE_PENALTY,\n REPETITION_PENALTY,\n SEED,\n LOG_PROBS,\n TOP_LOG_PROBS,\n ECHO,\n RESPONSE_FORMAT,\n RESPONSE_FORMAT_WITH_SCHEMA,\n RESPONSE_SCHEMA,\n MAX_REASONING_TOKENS,\n};\n\nexport { CHAT_CONFIG };\n","const DIMENSIONS = {\n type: \"range\",\n title: \"Dimensions\",\n description: \"Select the number of dimensions for the word embedding.\",\n} as const;\n\nconst ENCODING_FORMAT = {\n type: \"select\",\n title: \"Encoding format\",\n description: \"Select the encoding format for the word embedding.\",\n} as const;\n\nconst EMBEDDING_CONFIG = {\n DIMENSIONS,\n ENCODING_FORMAT,\n};\n\nexport { EMBEDDING_CONFIG };\n","const getErrorMessage = (error: unknown | undefined): string => {\n if (error == null) return \"unknown error\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n return JSON.stringify(error);\n};\n\nexport { getErrorMessage };\n","const removeUndefinedEntries = <T = unknown>(record: Record<string, T | undefined>): Record<string, T> => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return Object.fromEntries(Object.entries(record).filter(([_, value]) => value != null)) as Record<string, T>;\n};\n\nexport { removeUndefinedEntries };\n","const isRunningInBrowser = () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof navigator !== \"undefined\";\n};\n\nexport { isRunningInBrowser };\n","import { isRunningInBrowser } from \"./is-running-in-browser\";\n\nconst convertBase64ToUint8Array = (base64String: string): Uint8Array => {\n const base64Url = base64String.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const latin1string = globalThis.atob(base64Url);\n return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0)!);\n};\n\nconst convertUint8ArrayToBase64 = (array: Uint8Array): string => {\n let latin1string = \"\";\n\n // Note: regular for loop to support older JavaScript versions that\n // do not support for..of on Uint8Array\n for (let i = 0; i < array.length; i++) {\n latin1string += String.fromCodePoint(array[i]);\n }\n\n return globalThis.btoa(latin1string);\n};\n\nconst encodedBase64ToString = (base64: string): string => {\n if (isRunningInBrowser()) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n const decoder = new TextDecoder(\"utf-8\");\n return decoder.decode(bytes);\n } else {\n return Buffer.from(base64, \"base64\").toString(\"utf-8\");\n }\n};\n\nconst getMimeTypeFromBase64 = (base64: string): string => {\n const mimeTypePrefix = base64.split(\";\")[0];\n const mimeType = mimeTypePrefix.split(\"/\")[1];\n return mimeType;\n};\n\nexport { convertBase64ToUint8Array, convertUint8ArrayToBase64, encodedBase64ToString, getMimeTypeFromBase64 };\n","const urlWithoutTrailingSlash = (url: string): string => {\n return url?.replace(/\\/$/, \"\");\n};\n\nexport { urlWithoutTrailingSlash };\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GatewayBaseError, RoleEnum, ModalityEnum, EmbeddingModalityEnum } from '@adaline/types';
|
|
2
2
|
import { z as z$1 } from 'zod';
|
|
3
3
|
|
|
4
|
-
var Y=Object.defineProperty;var M=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?Y(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))X.call(n,t)&&R(e,t,n[t]);if(M)for(var t of M(n))$.call(n,t)&&R(e,t,n[t]);return e};var v="ProviderError",j=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},v);this.name=v;this.info=t,this.cause=o;}static isProviderError(t){return t instanceof e}};var z="ModelError",P=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},z);this.name=z;this.info=t,this.cause=o;}static isModelError(t){return t instanceof e}};var D="ModelResponseError",B=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},D);this.name=D;this.cause=o,this.info=t;}static isModelResponseError(t){return t instanceof e}};var A="InvalidModelRequestError",N=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},A);this.name=A;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof e}};var L="InvalidConfigError",_=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},L);this.name=L;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof e}};var G="InvalidMessagesError",U=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},G);this.name=G;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof e}};var q="InvalidToolsError",Z=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},q);this.name=q;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof e}};var F="InvalidEmbeddingRequestsError",K=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},F);this.name=F;this.info=t,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof e}};var y="multi-string",C=z$1.object({type:z$1.literal(y),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),max:z$1.number().int().positive()}),se=e=>z$1.array(z$1.string()).max(e).default([]).optional(),et=e=>({def:C.parse(a({type:y},e)),schema:se(e.max)});var h="object-schema",x=z$1.object({type:z$1.literal(h),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),objectSchema:z$1.any()}),ae=e=>e.optional(),it=e=>({def:x.parse(a({type:h},e)),schema:ae(e.objectSchema)});var S="range",w=z$1.object({type:z$1.literal(S),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),min:z$1.number().int(),max:z$1.number().int(),step:z$1.number().positive(),default:z$1.number()}),ce=(e,n,t,o)=>z$1.number().min(e).max(n).step(t).default(o).optional(),ct=e=>({def:w.parse(a({type:S},e)),schema:ce(e.min,e.max,e.step,e.default)});var b="select-boolean",k=z$1.object({type:z$1.literal(b),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),default:z$1.boolean().nullable()}),me=e=>z$1.boolean().nullable().default(e).optional(),ft=e=>({def:k.parse(a({type:b},e)),schema:me(e.default)});var T="select-string",O=z$1.object({type:z$1.literal(T),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),default:z$1.string(),choices:z$1.array(z$1.string())}),pe=(e,n)=>z$1.enum(n).nullable().default(e).optional(),yt=e=>({def:O.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],wt=z$1.enum(le),I=z$1.discriminatedUnion("type",[w,C,O,k,x]);var vt=(e=RoleEnum,n=ModalityEnum)=>z$1.object({name:z$1.string().min(1),description:z$1.string().min(1),roles:z$1.record(e,z$1.string().min(1).optional()),modalities:z$1.array(n).nonempty(),maxInputTokens:z$1.number().int().positive().min(1),maxOutputTokens:z$1.number().int().positive().min(1),maxReasoningTokens:z$1.number().int().positive().min(1).optional(),config:z$1.object({def:z$1.record(z$1.string().min(1),I),schema:z$1.instanceof(z$1.ZodObject)}).refine(t=>{var d,g;let o=Object.keys(t.def),s=Object.keys((g=(d=t.schema)==null?void 0:d.shape)!=null?g:{});return o.every(E=>s.includes(E))&&s.every(E=>o.includes(E))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var Bt=(e=EmbeddingModalityEnum)=>z$1.object({name:z$1.string().min(1),description:z$1.string().min(1),modalities:z$1.array(e).nonempty(),maxInputTokens:z$1.number().int().positive().min(1),maxOutputTokens:z$1.number().int().positive().min(1),config:z$1.object({def:z$1.record(z$1.string().min(1),I),schema:z$1.instanceof(z$1.ZodObject)}).refine(n=>{var s,d;let t=Object.keys(n.def),o=Object.keys((d=(s=n.schema)==null?void 0:s.shape)!=null?d:{});return t.every(g=>o.includes(g))&&o.every(g=>t.includes(g))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var Lt=z$1.record(z$1.string());var Ut=z$1.record(z$1.union([z$1.boolean(),z$1.string(),z$1.number(),z$1.object({}),z$1.array(z$1.any()),z$1.null(),z$1.undefined()]));var Ft=z$1.string().url();var ye={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},he={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},Se={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},be=e=>({type:"multi",title:"Stop sequence",description:`Enter up to ${e} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Te={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},Ie={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},Ee={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},Ce={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},xe={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},we={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},ke={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},Oe={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},Me={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Re={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},ve={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},je={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},ze={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},Pe={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},Ht={TEMPERATURE:ye,MAX_TOKENS:he,STOP:be,TOP_A:Te,TOP_P:Ie,TOP_K:Ee,MIN_P:Ce,FREQUENCY_PENALTY:xe,PRESENCE_PENALTY:we,REPETITION_PENALTY:Oe,SEED:ke,LOG_PROBS:Me,TOP_LOG_PROBS:Re,ECHO:ve,RESPONSE_FORMAT:je,RESPONSE_FORMAT_WITH_SCHEMA:ze,RESPONSE_SCHEMA:Pe,MAX_REASONING_TOKENS:Se};var De={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Be={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Wt={DIMENSIONS:De,ENCODING_FORMAT:Be};var Xt=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var Qt=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var nn=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},on=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},rn=e=>{if(W()){let n=atob(e),t=new Uint8Array(n.length);for(let s=0;s<n.length;s++)t[s]=n.charCodeAt(s);return new TextDecoder("utf-8").decode(t)}else return Buffer.from(e,"base64").toString("utf-8")},sn=e=>e.split(";")[0].split("/")[1];var cn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
4
|
+
var Y=Object.defineProperty;var O=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var R=(e,n,t)=>n in e?Y(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,a=(e,n)=>{for(var t in n||(n={}))X.call(n,t)&&R(e,t,n[t]);if(O)for(var t of O(n))$.call(n,t)&&R(e,t,n[t]);return e};var v="ProviderError",j=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},v);this.name=v;this.info=t,this.cause=o;}static isProviderError(t){return t instanceof e}};var P="ModelError",z=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},P);this.name=P;this.info=t,this.cause=o;}static isModelError(t){return t instanceof e}};var D="ModelResponseError",B=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},D);this.name=D;this.cause=o,this.info=t;}static isModelResponseError(t){return t instanceof e}};var A="InvalidModelRequestError",N=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},A);this.name=A;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof e}};var L="InvalidConfigError",_=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},L);this.name=L;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof e}};var G="InvalidMessagesError",U=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},G);this.name=G;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof e}};var q="InvalidToolsError",Z=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},q);this.name=q;this.cause=o,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof e}};var F="InvalidEmbeddingRequestsError",K=class e extends GatewayBaseError{constructor({info:t,cause:o}){super({info:t,cause:o},F);this.name=F;this.info=t,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof e}};var y="multi-string",C=z$1.object({type:z$1.literal(y),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),max:z$1.number().int().positive()}),se=e=>z$1.array(z$1.string()).max(e).default([]).optional(),et=e=>({def:C.parse(a({type:y},e)),schema:se(e.max)});var h="object-schema",x=z$1.object({type:z$1.literal(h),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),objectSchema:z$1.any()}),ae=e=>e.optional(),it=e=>({def:x.parse(a({type:h},e)),schema:ae(e.objectSchema)});var S="range",w=z$1.object({type:z$1.literal(S),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),min:z$1.number().int(),max:z$1.number().int(),step:z$1.number().positive(),default:z$1.number()}),ce=(e,n,t,o)=>z$1.number().min(e).max(n).step(t).default(o).optional(),ct=e=>({def:w.parse(a({type:S},e)),schema:ce(e.min,e.max,e.step,e.default)});var b="select-boolean",k=z$1.object({type:z$1.literal(b),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),default:z$1.boolean().nullable()}),me=e=>z$1.boolean().nullable().default(e).optional(),ft=e=>({def:k.parse(a({type:b},e)),schema:me(e.default)});var T="select-string",M=z$1.object({type:z$1.literal(T),param:z$1.string().min(1),title:z$1.string().min(1),description:z$1.string().min(1).max(500),default:z$1.string(),choices:z$1.array(z$1.string())}),pe=(e,n)=>z$1.enum(n).nullable().default(e).optional(),yt=e=>({def:M.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],wt=z$1.enum(le),I=z$1.discriminatedUnion("type",[w,C,M,k,x]);var jt=(e=RoleEnum,n=ModalityEnum)=>z$1.object({name:z$1.string().min(1),description:z$1.string().min(1),roles:z$1.record(e,z$1.string().min(1).optional()),modalities:z$1.array(n).nonempty(),maxInputTokens:z$1.number().int().positive().min(1),maxOutputTokens:z$1.number().int().positive().min(1),maxReasoningTokens:z$1.number().int().positive().min(1).optional(),config:z$1.object({def:z$1.record(z$1.string().min(1),I),schema:z$1.instanceof(z$1.ZodObject)}).refine(t=>{var d,g;let o=Object.keys(t.def),s=Object.keys((g=(d=t.schema)==null?void 0:d.shape)!=null?g:{});return o.every(E=>s.includes(E))&&s.every(E=>o.includes(E))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"}),price:z$1.custom()});var At=(e=EmbeddingModalityEnum)=>z$1.object({name:z$1.string().min(1),description:z$1.string().min(1),modalities:z$1.array(e).nonempty(),maxInputTokens:z$1.number().int().positive().min(1),maxOutputTokens:z$1.number().int().positive().min(1),config:z$1.object({def:z$1.record(z$1.string().min(1),I),schema:z$1.instanceof(z$1.ZodObject)}).refine(n=>{var s,d;let t=Object.keys(n.def),o=Object.keys((d=(s=n.schema)==null?void 0:s.shape)!=null?d:{});return t.every(g=>o.includes(g))&&o.every(g=>t.includes(g))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});var _t=z$1.record(z$1.string());var qt=z$1.record(z$1.union([z$1.boolean(),z$1.string(),z$1.number(),z$1.object({}),z$1.array(z$1.any()),z$1.null(),z$1.undefined()]));var Kt=z$1.string().url();var ye={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},he={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},Se={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},be=e=>({type:"multi",title:"Stop sequence",description:`Enter up to ${e} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Te={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},Ie={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},Ee={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},Ce={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},xe={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},we={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},ke={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},Me={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},Oe={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Re={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},ve={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},je={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},Pe={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},ze={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},Jt={TEMPERATURE:ye,MAX_TOKENS:he,STOP:be,TOP_A:Te,TOP_P:Ie,TOP_K:Ee,MIN_P:Ce,FREQUENCY_PENALTY:xe,PRESENCE_PENALTY:we,REPETITION_PENALTY:Me,SEED:ke,LOG_PROBS:Oe,TOP_LOG_PROBS:Re,ECHO:ve,RESPONSE_FORMAT:je,RESPONSE_FORMAT_WITH_SCHEMA:Pe,RESPONSE_SCHEMA:ze,MAX_REASONING_TOKENS:Se};var De={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Be={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Yt={DIMENSIONS:De,ENCODING_FORMAT:Be};var $t=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var Vt=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var on=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},rn=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},sn=e=>{if(W()){let n=atob(e),t=new Uint8Array(n.length);for(let s=0;s<n.length;s++)t[s]=n.charCodeAt(s);return new TextDecoder("utf-8").decode(t)}else return Buffer.from(e,"base64").toString("utf-8")},an=e=>e.split(";")[0].split("/")[1];var mn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { Jt as CHAT_CONFIG, jt as ChatModelSchema, I as ConfigItemDef, wt as ConfigItemEnum, le as ConfigItemLiterals, Yt as EMBEDDING_CONFIG, At as EmbeddingModelSchema, _t as Headers, _ as InvalidConfigError, K as InvalidEmbeddingRequestsError, U as InvalidMessagesError, N as InvalidModelRequestError, Z as InvalidToolsError, z as ModelError, B as ModelResponseError, et as MultiStringConfigItem, C as MultiStringConfigItemDef, se as MultiStringConfigItemSchema, y as MultiStringConfigItemTypeLiteral, it as ObjectSchemaConfigItem, x as ObjectSchemaConfigItemDef, ae as ObjectSchemaConfigItemSchema, h as ObjectSchemaConfigItemTypeLiteral, qt as Params, j as ProviderError, ct as RangeConfigItem, w as RangeConfigItemDef, ce as RangeConfigItemSchema, S as RangeConfigItemTypeLiteral, ft as SelectBooleanConfigItem, k as SelectBooleanConfigItemDef, me as SelectBooleanConfigItemSchema, b as SelectBooleanConfigItemTypeLiteral, yt as SelectStringConfigItem, M as SelectStringConfigItemDef, pe as SelectStringConfigItemSchema, T as SelectStringConfigItemTypeLiteral, Kt as Url, on as convertBase64ToUint8Array, rn as convertUint8ArrayToBase64, sn as encodedBase64ToString, $t as getErrorMessage, an as getMimeTypeFromBase64, W as isRunningInBrowser, Vt as removeUndefinedEntries, mn as urlWithoutTrailingSlash };
|
|
7
7
|
//# sourceMappingURL=index.mjs.map
|
|
8
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors/provider.error.ts","../src/errors/model.error.ts","../src/errors/model-response.error.ts","../src/errors/invalid-model-request.error.ts","../src/errors/invalid-config.error.ts","../src/errors/invalid-messages.error.ts","../src/errors/invalid-tools.error.ts","../src/errors/invalid-embedding-requests.error.ts","../src/types/config/multi-string-config-item.ts","../src/types/config/object-schema-config-item.ts","../src/types/config/range-config-item.ts","../src/types/config/select-boolean-config-item.ts","../src/types/config/select-string-config-item.ts","../src/types/config/config-item.ts","../src/model/chat-model/chat-model.schema.v1.ts","../src/model/embedding-model/embedding-model.schema.v1.ts","../src/types/headers.ts","../src/types/params.ts","../src/types/url.ts","../src/utils/common-config.def.chat-model.ts","../src/utils/common-config.def.word-embedding.ts","../src/utils/get-error-message.ts","../src/utils/remove-undefined-entries.ts","../src/utils/is-running-in-browser.ts","../src/utils/base64.ts","../src/utils/url.ts"],"names":["ProviderErrorLiteral","ProviderError","_ProviderError","GatewayBaseError","info","cause","error","ModelErrorLiteral","ModelError","_ModelError","ModelResponseErrorLiteral","ModelResponseError","_ModelResponseError","InvalidModelRequestErrorLiteral","InvalidModelRequestError","_InvalidModelRequestError","InvalidConfigErrorLiteral","InvalidConfigError","_InvalidConfigError","InvalidMessagesErrorLiteral","InvalidMessagesError","_InvalidMessagesError","InvalidToolsErrorLiteral","InvalidToolsError","_InvalidToolsError","InvalidEmbeddingRequestsErrorLiteral","InvalidEmbeddingRequestsError","_InvalidEmbeddingRequestsError","MultiStringConfigItemTypeLiteral","MultiStringConfigItemDef","z","MultiStringConfigItemSchema","max","MultiStringConfigItem","data","__spreadValues","ObjectSchemaConfigItemTypeLiteral","ObjectSchemaConfigItemDef","ObjectSchemaConfigItemSchema","schema","ObjectSchemaConfigItem","RangeConfigItemTypeLiteral","RangeConfigItemDef","RangeConfigItemSchema","min","step","defaultValue","RangeConfigItem","SelectBooleanConfigItemTypeLiteral","SelectBooleanConfigItemDef","SelectBooleanConfigItemSchema","SelectBooleanConfigItem","SelectStringConfigItemTypeLiteral","SelectStringConfigItemDef","SelectStringConfigItemSchema","choices","SelectStringConfigItem","ConfigItemLiterals","ConfigItemEnum","ConfigItemDef","ChatModelSchema","Roles","RoleEnum","Modalities","ModalityEnum","config","_a","_b","defKeys","schemaKeys","key","EmbeddingModelSchema","EmbeddingModalityEnum","Headers","Params","Url","TEMPERATURE","MAX_TOKENS","MAX_REASONING_TOKENS","STOP","TOP_A","TOP_P","TOP_K","MIN_P","FREQUENCY_PENALTY","PRESENCE_PENALTY","SEED","REPETITION_PENALTY","LOG_PROBS","TOP_LOG_PROBS","ECHO","RESPONSE_FORMAT","RESPONSE_FORMAT_WITH_SCHEMA","RESPONSE_SCHEMA","CHAT_CONFIG","DIMENSIONS","ENCODING_FORMAT","EMBEDDING_CONFIG","getErrorMessage","removeUndefinedEntries","record","_","value","isRunningInBrowser","convertBase64ToUint8Array","base64String","base64Url","latin1string","byte","convertUint8ArrayToBase64","array","i","encodedBase64ToString","base64","binaryString","bytes","getMimeTypeFromBase64","urlWithoutTrailingSlash","url"],"mappings":";;;yVAEA,IAAMA,EAAuB,eAChBC,CAAAA,CAAAA,CAAN,MAAMC,CAAsBC,SAAAA,gBAAiB,CAKlD,WAAY,CAAA,CAAE,KAAAC,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAqC,CAAA,CAC7D,KAAM,CAAA,CAAE,IAAAD,CAAAA,CAAAA,CAAM,MAAAC,CAAM,CAAA,CAAGL,CAAoB,CAL7C,CAAA,IAAA,CAAS,KAAOA,CAMd,CAAA,IAAA,CAAK,IAAOI,CAAAA,CAAAA,CACZ,IAAK,CAAA,KAAA,CAAQC,EACf,CAEA,OAAO,gBAAgBC,CAAwC,CA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NA,EAAO,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACV,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,ECpCxCI,IAAAA,EAAAA,CAA2BC,GACxBA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAK,CAAA,OAAA,CAAQ,KAAO,CAAA,EAAA","file":"index.mjs","sourcesContent":["import { GatewayBaseError } from \"@adaline/types\";\n\nconst ProviderErrorLiteral = \"ProviderError\" as const;\nexport class ProviderError extends GatewayBaseError {\n readonly name = ProviderErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ProviderErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isProviderError(error: unknown): error is ProviderError {\n return error instanceof ProviderError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelErrorLiteral = \"ModelError\" as const;\nexport class ModelError extends GatewayBaseError {\n readonly name = ModelErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isModelError(error: unknown): error is ModelError {\n return error instanceof ModelError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelResponseErrorLiteral = \"ModelResponseError\" as const;\nexport class ModelResponseError extends GatewayBaseError {\n readonly name = ModelResponseErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelResponseErrorLiteral);\n this.cause = cause;\n this.info = info;\n }\n\n static isModelResponseError(error: unknown): error is ModelResponseError {\n return error instanceof ModelResponseError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidModelRequestErrorLiteral = \"InvalidModelRequestError\" as const;\nexport class InvalidModelRequestError extends GatewayBaseError {\n readonly name = InvalidModelRequestErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidModelRequestErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidModelRequestError(error: unknown): error is InvalidModelRequestError {\n return error instanceof InvalidModelRequestError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidConfigErrorLiteral = \"InvalidConfigError\" as const;\nexport class InvalidConfigError extends GatewayBaseError {\n readonly name = InvalidConfigErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidConfigErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidConfigError(error: unknown): error is InvalidConfigError {\n return error instanceof InvalidConfigError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidMessagesErrorLiteral = \"InvalidMessagesError\" as const;\nexport class InvalidMessagesError extends GatewayBaseError {\n readonly name = InvalidMessagesErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidMessagesErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidMessagesError(error: unknown): error is InvalidMessagesError {\n return error instanceof InvalidMessagesError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidToolsErrorLiteral = \"InvalidToolsError\" as const;\nexport class InvalidToolsError extends GatewayBaseError {\n readonly name = InvalidToolsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidToolsErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidToolsError(error: unknown): error is InvalidToolsError {\n return error instanceof InvalidToolsError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidEmbeddingRequestsErrorLiteral = \"InvalidEmbeddingRequestsError\" as const;\nexport class InvalidEmbeddingRequestsError extends GatewayBaseError {\n readonly name = InvalidEmbeddingRequestsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidEmbeddingRequestsErrorLiteral);\n this.info = info;\n this.cause = cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError {\n return error instanceof InvalidEmbeddingRequestsError;\n }\n}\n","import { z } from \"zod\";\n\nconst MultiStringConfigItemTypeLiteral = \"multi-string\" as const;\n\nconst MultiStringConfigItemDef = z.object({\n type: z.literal(MultiStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n max: z.number().int().positive(),\n});\ntype MultiStringConfigItemType = z.infer<typeof MultiStringConfigItemDef>;\n\nconst MultiStringConfigItemSchema = (max: number) => z.array(z.string()).max(max).default([]).optional();\ntype MultiStringConfigItemSchemaType = z.infer<ReturnType<typeof MultiStringConfigItemSchema>>;\n\nconst MultiStringConfigItem = (data: Omit<MultiStringConfigItemType, \"type\">) => {\n return {\n def: MultiStringConfigItemDef.parse({\n type: MultiStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: MultiStringConfigItemSchema(data.max),\n };\n};\n\nexport {\n MultiStringConfigItem,\n MultiStringConfigItemDef,\n MultiStringConfigItemSchema,\n MultiStringConfigItemTypeLiteral,\n type MultiStringConfigItemSchemaType,\n type MultiStringConfigItemType,\n};\n","import { z } from \"zod\";\n\nconst ObjectSchemaConfigItemTypeLiteral = \"object-schema\" as const;\n\nconst ObjectSchemaConfigItemDef = z.object({\n type: z.literal(ObjectSchemaConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n objectSchema: z.any(),\n});\ntype ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;\n\nconst ObjectSchemaConfigItemSchema = <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => schema.optional();\ntype ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<\n ReturnType<typeof ObjectSchemaConfigItemSchema<S>>\n>;\n\nconst ObjectSchemaConfigItem = (data: Omit<ObjectSchemaConfigItemType, \"type\">) => {\n return {\n def: ObjectSchemaConfigItemDef.parse({\n type: ObjectSchemaConfigItemTypeLiteral,\n ...data,\n }),\n schema: ObjectSchemaConfigItemSchema(data.objectSchema),\n };\n};\n\nexport {\n ObjectSchemaConfigItem,\n ObjectSchemaConfigItemDef,\n ObjectSchemaConfigItemSchema,\n ObjectSchemaConfigItemTypeLiteral,\n type ObjectSchemaConfigItemType,\n type ObjectSchemaConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst RangeConfigItemTypeLiteral = \"range\" as const;\n\nconst RangeConfigItemDef = z.object({\n type: z.literal(RangeConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n min: z.number().int(),\n max: z.number().int(),\n step: z.number().positive(),\n default: z.number(),\n});\ntype RangeConfigItemDefType = z.infer<typeof RangeConfigItemDef>;\n\nconst RangeConfigItemSchema = (min: number, max: number, step: number, defaultValue: number) =>\n z.number().min(min).max(max).step(step).default(defaultValue).optional();\ntype RangeConfigItemSchemaType = z.infer<ReturnType<typeof RangeConfigItemSchema>>;\n\nconst RangeConfigItem = (data: Omit<RangeConfigItemDefType, \"type\">) => {\n return {\n def: RangeConfigItemDef.parse({\n type: RangeConfigItemTypeLiteral,\n ...data,\n }),\n schema: RangeConfigItemSchema(data.min, data.max, data.step, data.default),\n };\n};\n\nexport {\n RangeConfigItem,\n RangeConfigItemDef,\n RangeConfigItemSchema,\n RangeConfigItemTypeLiteral,\n type RangeConfigItemDefType,\n type RangeConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectBooleanConfigItemTypeLiteral = \"select-boolean\" as const;\n\nconst SelectBooleanConfigItemDef = z.object({\n type: z.literal(SelectBooleanConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.boolean().nullable(),\n});\ntype SelectBooleanConfigItemDefType = z.infer<typeof SelectBooleanConfigItemDef>;\n\nconst SelectBooleanConfigItemSchema = (defaultValue: boolean | null) => z.boolean().nullable().default(defaultValue).optional();\ntype SelectBooleanConfigItemSchemaType = z.infer<ReturnType<typeof SelectBooleanConfigItemSchema>>;\n\nconst SelectBooleanConfigItem = (data: Omit<SelectBooleanConfigItemDefType, \"type\">) => {\n return {\n def: SelectBooleanConfigItemDef.parse({\n type: SelectBooleanConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectBooleanConfigItemSchema(data.default),\n };\n};\n\nexport {\n SelectBooleanConfigItem,\n SelectBooleanConfigItemDef,\n SelectBooleanConfigItemSchema,\n SelectBooleanConfigItemTypeLiteral,\n type SelectBooleanConfigItemDefType,\n type SelectBooleanConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectStringConfigItemTypeLiteral = \"select-string\" as const;\n\nconst SelectStringConfigItemDef = z.object({\n type: z.literal(SelectStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.string(),\n choices: z.array(z.string()),\n});\ntype SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;\n\nconst SelectStringConfigItemSchema = (defaultValue: string | null, choices: string[]) =>\n z\n .enum(choices as [string, ...string[]])\n .nullable()\n .default(defaultValue)\n .optional();\ntype SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;\n\nconst SelectStringConfigItem = (data: Omit<SelectStringConfigItemDefType, \"type\">) => {\n return {\n def: SelectStringConfigItemDef.parse({\n type: SelectStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectStringConfigItemSchema(data.default, data.choices),\n };\n};\n\nexport {\n SelectStringConfigItem,\n SelectStringConfigItemDef,\n SelectStringConfigItemSchema,\n SelectStringConfigItemTypeLiteral,\n type SelectStringConfigItemDefType,\n type SelectStringConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nimport { MultiStringConfigItemDef, MultiStringConfigItemTypeLiteral } from \"./multi-string-config-item\";\nimport { ObjectSchemaConfigItemDef, ObjectSchemaConfigItemTypeLiteral } from \"./object-schema-config-item\";\nimport { RangeConfigItemDef, RangeConfigItemTypeLiteral } from \"./range-config-item\";\nimport { SelectBooleanConfigItemDef, SelectBooleanConfigItemTypeLiteral } from \"./select-boolean-config-item\";\nimport { SelectStringConfigItemDef, SelectStringConfigItemTypeLiteral } from \"./select-string-config-item\";\n\nconst ConfigItemLiterals = [\n RangeConfigItemTypeLiteral,\n MultiStringConfigItemTypeLiteral,\n SelectStringConfigItemTypeLiteral,\n ObjectSchemaConfigItemTypeLiteral,\n SelectBooleanConfigItemTypeLiteral,\n] as const;\nconst ConfigItemEnum = z.enum(ConfigItemLiterals);\ntype ConfigItemEnumType = z.infer<typeof ConfigItemEnum>;\n\nconst ConfigItemDef = z.discriminatedUnion(\"type\", [\n RangeConfigItemDef,\n MultiStringConfigItemDef,\n SelectStringConfigItemDef,\n SelectBooleanConfigItemDef,\n ObjectSchemaConfigItemDef,\n]);\ntype ConfigItemDefType = z.infer<typeof ConfigItemDef>;\n\nexport { ConfigItemDef, ConfigItemEnum, ConfigItemLiterals, type ConfigItemDefType, type ConfigItemEnumType };\n","import { z } from \"zod\";\n\nimport { ModalityEnum, RoleEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\nconst ChatModelSchema = <\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n>(\n Roles: R = RoleEnum as unknown as R,\n Modalities: M = ModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n roles: z.record(Roles, z.string().min(1).optional()),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n maxReasoningTokens: z.number().int().positive().min(1).optional(),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype ChatModelSchemaType<\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n> = z.infer<ReturnType<typeof ChatModelSchema<R, M>>>;\n\nexport { ChatModelSchema, type ChatModelSchemaType };\n","import { z } from \"zod\";\n\nimport { EmbeddingModalityEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\n// TODO: add embedding model properties (dimensions, etc)\nconst EmbeddingModelSchema = <M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum>(\n Modalities: M = EmbeddingModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype EmbeddingModelSchemaType<M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum> = z.infer<\n ReturnType<typeof EmbeddingModelSchema<M>>\n>;\n\nexport { EmbeddingModelSchema, type EmbeddingModelSchemaType };\n","import { z } from \"zod\";\n\nconst Headers = z.record(z.string());\ntype HeadersType = z.infer<typeof Headers>;\n\nexport { Headers, type HeadersType };\n","import { z } from \"zod\";\n\nconst Params = z.record(\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.object({}),\n z.array(z.any()),\n z.null(),\n z.undefined(),\n ])\n);\ntype ParamsType = z.infer<typeof Params>;\n\nexport { Params, type ParamsType };\n","import { z } from \"zod\";\n\nconst Url = z.string().url();\ntype UrlType = z.infer<typeof Url>;\n\nexport { Url, type UrlType };\n","const TEMPERATURE = {\n type: \"range\",\n title: \"Temperature\",\n description:\n \"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. \\\n For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text \\\n that's unexpectedly fresh.\",\n} as const;\n\nconst MAX_TOKENS = {\n type: \"range\",\n title: \"Max tokens\",\n description:\n \"Specify the total tokens for generation, where one token approximates four English characters. \\\n Setting this to 0 defaults to the model's maximum capacity.\",\n} as const;\n\nconst MAX_REASONING_TOKENS = {\n type: \"range\",\n title: \"Max reasoning tokens\",\n description:\n \"Specify the total tokens for reasoning, where one token approximates four English characters.\",\n} as const;\n\nconst STOP = (max: number) =>\n ({\n type: \"multi\",\n title: \"Stop sequence\",\n description: `Enter up to ${max} sequences that will halt additional text output. \\\n The generated text will exclude these sequences.`,\n }) as const;\n\nconst TOP_A = {\n type: \"range\",\n title: \"Top A\",\n description:\n \"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, \\\n functioning like a dynamic Top-P. \\\n A lower Top-A value narrows down the token choices based on the highest probability token, \\\n while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output.\",\n} as const;\n\nconst TOP_P = {\n type: \"range\",\n title: \"Top P\",\n description:\n \"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, \\\n such as the top 10% when P=0.1. \\\n This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. \\\n It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously.\",\n} as const;\n\nconst TOP_K = {\n type: \"range\",\n title: \"Top K\",\n description:\n \"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options.\",\n} as const;\n\nconst MIN_P = {\n type: \"range\",\n title: \"Min P\",\n description:\n \"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. \\\n (This value varies based on the confidence level of the top token.) \\\n For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered.\",\n} as const;\n\nconst FREQUENCY_PENALTY = {\n type: \"range\",\n title: \"Frequency penalty\",\n description:\n \"Minimize redundancy.\\\n By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. \\\n The default setting for this penalty is zero.\",\n} as const;\n\nconst PRESENCE_PENALTY = {\n type: \"range\",\n title: \"Presence penalty\",\n description:\n \"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, \\\n thus boosting the chances of exploring fresh topics. \\\n The standard setting for this is zero.\",\n} as const;\n\nconst SEED = {\n type: \"range\",\n title: \"Seed\",\n description:\n \"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. \\\n Deterministic output isn't guaranteed. \\\n Also, changing the model or parameter settings, such as the temperature, \\\n can cause variations in the response even when you use the same seed value. \\\n By default, a random seed value is used.\",\n} as const;\n\nconst REPETITION_PENALTY = {\n type: \"range\",\n title: \"Repetition penalty\",\n description:\n \"Reduces the likelihood of repeating tokens from the input. \\\n Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, \\\n often resulting in run-on sentences missing smaller words. \\\n The token penalty is scaled according to the original token's probability.\",\n} as const;\n\nconst LOG_PROBS = {\n type: \"boolean\",\n title: \"Log probs\",\n description:\n \"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.\",\n} as const;\n\nconst TOP_LOG_PROBS = {\n type: \"range\",\n title: \"Top log probs\",\n description:\n \"The number of most likely tokens to return at each token position, each with an associated log probability. \\\n 'logprobs' must be set to true if this parameter is used.\",\n} as const;\n\nconst ECHO = {\n type: \"boolean\",\n title: \"Echo\",\n description: \"If true, the response will contain the prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT_WITH_SCHEMA = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid \\\n JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict \\\n response schema that the model will adhere to.\",\n} as const;\n\nconst RESPONSE_SCHEMA = {\n type: \"object\",\n title: \"Response schema\",\n description: \"When response format is set to 'json_schema', the model will return a JSON object of the specified schema.\",\n} as const;\n\nconst CHAT_CONFIG = {\n TEMPERATURE,\n MAX_TOKENS,\n STOP,\n TOP_A,\n TOP_P,\n TOP_K,\n MIN_P,\n FREQUENCY_PENALTY,\n PRESENCE_PENALTY,\n REPETITION_PENALTY,\n SEED,\n LOG_PROBS,\n TOP_LOG_PROBS,\n ECHO,\n RESPONSE_FORMAT,\n RESPONSE_FORMAT_WITH_SCHEMA,\n RESPONSE_SCHEMA,\n MAX_REASONING_TOKENS,\n};\n\nexport { CHAT_CONFIG };\n","const DIMENSIONS = {\n type: \"range\",\n title: \"Dimensions\",\n description: \"Select the number of dimensions for the word embedding.\",\n} as const;\n\nconst ENCODING_FORMAT = {\n type: \"select\",\n title: \"Encoding format\",\n description: \"Select the encoding format for the word embedding.\",\n} as const;\n\nconst EMBEDDING_CONFIG = {\n DIMENSIONS,\n ENCODING_FORMAT,\n};\n\nexport { EMBEDDING_CONFIG };\n","const getErrorMessage = (error: unknown | undefined): string => {\n if (error == null) return \"unknown error\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n return JSON.stringify(error);\n};\n\nexport { getErrorMessage };\n","const removeUndefinedEntries = <T = unknown>(record: Record<string, T | undefined>): Record<string, T> => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return Object.fromEntries(Object.entries(record).filter(([_, value]) => value != null)) as Record<string, T>;\n};\n\nexport { removeUndefinedEntries };\n","const isRunningInBrowser = () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof navigator !== \"undefined\";\n};\n\nexport { isRunningInBrowser };\n","import { isRunningInBrowser } from \"./is-running-in-browser\";\n\nconst convertBase64ToUint8Array = (base64String: string): Uint8Array => {\n const base64Url = base64String.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const latin1string = globalThis.atob(base64Url);\n return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0)!);\n};\n\nconst convertUint8ArrayToBase64 = (array: Uint8Array): string => {\n let latin1string = \"\";\n\n // Note: regular for loop to support older JavaScript versions that\n // do not support for..of on Uint8Array\n for (let i = 0; i < array.length; i++) {\n latin1string += String.fromCodePoint(array[i]);\n }\n\n return globalThis.btoa(latin1string);\n};\n\nconst encodedBase64ToString = (base64: string): string => {\n if (isRunningInBrowser()) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n const decoder = new TextDecoder(\"utf-8\");\n return decoder.decode(bytes);\n } else {\n return Buffer.from(base64, \"base64\").toString(\"utf-8\");\n }\n};\n\nconst getMimeTypeFromBase64 = (base64: string): string => {\n const mimeTypePrefix = base64.split(\";\")[0];\n const mimeType = mimeTypePrefix.split(\"/\")[1];\n return mimeType;\n};\n\nexport { convertBase64ToUint8Array, convertUint8ArrayToBase64, encodedBase64ToString, getMimeTypeFromBase64 };\n","const urlWithoutTrailingSlash = (url: string): string => {\n return url?.replace(/\\/$/, \"\");\n};\n\nexport { urlWithoutTrailingSlash };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors/provider.error.ts","../src/errors/model.error.ts","../src/errors/model-response.error.ts","../src/errors/invalid-model-request.error.ts","../src/errors/invalid-config.error.ts","../src/errors/invalid-messages.error.ts","../src/errors/invalid-tools.error.ts","../src/errors/invalid-embedding-requests.error.ts","../src/types/config/multi-string-config-item.ts","../src/types/config/object-schema-config-item.ts","../src/types/config/range-config-item.ts","../src/types/config/select-boolean-config-item.ts","../src/types/config/select-string-config-item.ts","../src/types/config/config-item.ts","../src/model/chat-model/chat-model.schema.v1.ts","../src/model/embedding-model/embedding-model.schema.v1.ts","../src/types/headers.ts","../src/types/params.ts","../src/types/url.ts","../src/utils/common-config.def.chat-model.ts","../src/utils/common-config.def.word-embedding.ts","../src/utils/get-error-message.ts","../src/utils/remove-undefined-entries.ts","../src/utils/is-running-in-browser.ts","../src/utils/base64.ts","../src/utils/url.ts"],"names":["ProviderErrorLiteral","ProviderError","_ProviderError","GatewayBaseError","info","cause","error","ModelErrorLiteral","ModelError","_ModelError","ModelResponseErrorLiteral","ModelResponseError","_ModelResponseError","InvalidModelRequestErrorLiteral","InvalidModelRequestError","_InvalidModelRequestError","InvalidConfigErrorLiteral","InvalidConfigError","_InvalidConfigError","InvalidMessagesErrorLiteral","InvalidMessagesError","_InvalidMessagesError","InvalidToolsErrorLiteral","InvalidToolsError","_InvalidToolsError","InvalidEmbeddingRequestsErrorLiteral","InvalidEmbeddingRequestsError","_InvalidEmbeddingRequestsError","MultiStringConfigItemTypeLiteral","MultiStringConfigItemDef","z","MultiStringConfigItemSchema","max","MultiStringConfigItem","data","__spreadValues","ObjectSchemaConfigItemTypeLiteral","ObjectSchemaConfigItemDef","ObjectSchemaConfigItemSchema","schema","ObjectSchemaConfigItem","RangeConfigItemTypeLiteral","RangeConfigItemDef","RangeConfigItemSchema","min","step","defaultValue","RangeConfigItem","SelectBooleanConfigItemTypeLiteral","SelectBooleanConfigItemDef","SelectBooleanConfigItemSchema","SelectBooleanConfigItem","SelectStringConfigItemTypeLiteral","SelectStringConfigItemDef","SelectStringConfigItemSchema","choices","SelectStringConfigItem","ConfigItemLiterals","ConfigItemEnum","ConfigItemDef","ChatModelSchema","Roles","RoleEnum","Modalities","ModalityEnum","config","_a","_b","defKeys","schemaKeys","key","EmbeddingModelSchema","EmbeddingModalityEnum","Headers","Params","Url","TEMPERATURE","MAX_TOKENS","MAX_REASONING_TOKENS","STOP","TOP_A","TOP_P","TOP_K","MIN_P","FREQUENCY_PENALTY","PRESENCE_PENALTY","SEED","REPETITION_PENALTY","LOG_PROBS","TOP_LOG_PROBS","ECHO","RESPONSE_FORMAT","RESPONSE_FORMAT_WITH_SCHEMA","RESPONSE_SCHEMA","CHAT_CONFIG","DIMENSIONS","ENCODING_FORMAT","EMBEDDING_CONFIG","getErrorMessage","removeUndefinedEntries","record","_","value","isRunningInBrowser","convertBase64ToUint8Array","base64String","base64Url","latin1string","byte","convertUint8ArrayToBase64","array","i","encodedBase64ToString","base64","binaryString","bytes","getMimeTypeFromBase64","urlWithoutTrailingSlash","url"],"mappings":";;;yVAEA,IAAMA,EAAuB,eAChBC,CAAAA,CAAAA,CAAN,MAAMC,CAAsBC,SAAAA,gBAAiB,CAKlD,WAAY,CAAA,CAAE,KAAAC,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAqC,CAAA,CAC7D,KAAM,CAAA,CAAE,IAAAD,CAAAA,CAAAA,CAAM,MAAAC,CAAM,CAAA,CAAGL,CAAoB,CAL7C,CAAA,IAAA,CAAS,KAAOA,CAMd,CAAA,IAAA,CAAK,IAAOI,CAAAA,CAAAA,CACZ,IAAK,CAAA,KAAA,CAAQC,EACf,CAEA,OAAO,gBAAgBC,CAAwC,CAAA,CAC7D,OAAOA,CAAiBJ,YAAAA,CAC1B,CACF,EC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AAA,MAAA,CAAO,IAAKF,CAAAA,CAAAA,CAAQ,QAAQ,CAAA,CAAE,SAAS,OAAO,CAEzD,EAEMG,EAAyBH,CAAAA,CAAAA,EACNA,EAAO,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CACV,CAAA,KAAA,CAAM,GAAG,CAAE,CAAA,CAAC,ECpCxCI,IAAAA,EAAAA,CAA2BC,GACxBA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAK,CAAA,OAAA,CAAQ,KAAO,CAAA,EAAA","file":"index.mjs","sourcesContent":["import { GatewayBaseError } from \"@adaline/types\";\n\nconst ProviderErrorLiteral = \"ProviderError\" as const;\nexport class ProviderError extends GatewayBaseError {\n readonly name = ProviderErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ProviderErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isProviderError(error: unknown): error is ProviderError {\n return error instanceof ProviderError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelErrorLiteral = \"ModelError\" as const;\nexport class ModelError extends GatewayBaseError {\n readonly name = ModelErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelErrorLiteral);\n this.info = info;\n this.cause = cause;\n }\n\n static isModelError(error: unknown): error is ModelError {\n return error instanceof ModelError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst ModelResponseErrorLiteral = \"ModelResponseError\" as const;\nexport class ModelResponseError extends GatewayBaseError {\n readonly name = ModelResponseErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, ModelResponseErrorLiteral);\n this.cause = cause;\n this.info = info;\n }\n\n static isModelResponseError(error: unknown): error is ModelResponseError {\n return error instanceof ModelResponseError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidModelRequestErrorLiteral = \"InvalidModelRequestError\" as const;\nexport class InvalidModelRequestError extends GatewayBaseError {\n readonly name = InvalidModelRequestErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidModelRequestErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidModelRequestError(error: unknown): error is InvalidModelRequestError {\n return error instanceof InvalidModelRequestError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidConfigErrorLiteral = \"InvalidConfigError\" as const;\nexport class InvalidConfigError extends GatewayBaseError {\n readonly name = InvalidConfigErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidConfigErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidConfigError(error: unknown): error is InvalidConfigError {\n return error instanceof InvalidConfigError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidMessagesErrorLiteral = \"InvalidMessagesError\" as const;\nexport class InvalidMessagesError extends GatewayBaseError {\n readonly name = InvalidMessagesErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidMessagesErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidMessagesError(error: unknown): error is InvalidMessagesError {\n return error instanceof InvalidMessagesError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidToolsErrorLiteral = \"InvalidToolsError\" as const;\nexport class InvalidToolsError extends GatewayBaseError {\n readonly name = InvalidToolsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidToolsErrorLiteral);\n this.cause = cause;\n this.info = info;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidToolsError(error: unknown): error is InvalidToolsError {\n return error instanceof InvalidToolsError;\n }\n}\n","import { GatewayBaseError } from \"@adaline/types\";\n\nconst InvalidEmbeddingRequestsErrorLiteral = \"InvalidEmbeddingRequestsError\" as const;\nexport class InvalidEmbeddingRequestsError extends GatewayBaseError {\n readonly name = InvalidEmbeddingRequestsErrorLiteral;\n readonly info: string;\n readonly cause: unknown;\n\n constructor({ info, cause }: { info: string; cause: unknown }) {\n super({ info, cause }, InvalidEmbeddingRequestsErrorLiteral);\n this.info = info;\n this.cause = cause;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static isInvalidEmbeddingRequestsError(error: unknown): error is InvalidEmbeddingRequestsError {\n return error instanceof InvalidEmbeddingRequestsError;\n }\n}\n","import { z } from \"zod\";\n\nconst MultiStringConfigItemTypeLiteral = \"multi-string\" as const;\n\nconst MultiStringConfigItemDef = z.object({\n type: z.literal(MultiStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n max: z.number().int().positive(),\n});\ntype MultiStringConfigItemType = z.infer<typeof MultiStringConfigItemDef>;\n\nconst MultiStringConfigItemSchema = (max: number) => z.array(z.string()).max(max).default([]).optional();\ntype MultiStringConfigItemSchemaType = z.infer<ReturnType<typeof MultiStringConfigItemSchema>>;\n\nconst MultiStringConfigItem = (data: Omit<MultiStringConfigItemType, \"type\">) => {\n return {\n def: MultiStringConfigItemDef.parse({\n type: MultiStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: MultiStringConfigItemSchema(data.max),\n };\n};\n\nexport {\n MultiStringConfigItem,\n MultiStringConfigItemDef,\n MultiStringConfigItemSchema,\n MultiStringConfigItemTypeLiteral,\n type MultiStringConfigItemSchemaType,\n type MultiStringConfigItemType,\n};\n","import { z } from \"zod\";\n\nconst ObjectSchemaConfigItemTypeLiteral = \"object-schema\" as const;\n\nconst ObjectSchemaConfigItemDef = z.object({\n type: z.literal(ObjectSchemaConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n objectSchema: z.any(),\n});\ntype ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;\n\nconst ObjectSchemaConfigItemSchema = <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => schema.optional();\ntype ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<\n ReturnType<typeof ObjectSchemaConfigItemSchema<S>>\n>;\n\nconst ObjectSchemaConfigItem = (data: Omit<ObjectSchemaConfigItemType, \"type\">) => {\n return {\n def: ObjectSchemaConfigItemDef.parse({\n type: ObjectSchemaConfigItemTypeLiteral,\n ...data,\n }),\n schema: ObjectSchemaConfigItemSchema(data.objectSchema),\n };\n};\n\nexport {\n ObjectSchemaConfigItem,\n ObjectSchemaConfigItemDef,\n ObjectSchemaConfigItemSchema,\n ObjectSchemaConfigItemTypeLiteral,\n type ObjectSchemaConfigItemType,\n type ObjectSchemaConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst RangeConfigItemTypeLiteral = \"range\" as const;\n\nconst RangeConfigItemDef = z.object({\n type: z.literal(RangeConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n min: z.number().int(),\n max: z.number().int(),\n step: z.number().positive(),\n default: z.number(),\n});\ntype RangeConfigItemDefType = z.infer<typeof RangeConfigItemDef>;\n\nconst RangeConfigItemSchema = (min: number, max: number, step: number, defaultValue: number) =>\n z.number().min(min).max(max).step(step).default(defaultValue).optional();\ntype RangeConfigItemSchemaType = z.infer<ReturnType<typeof RangeConfigItemSchema>>;\n\nconst RangeConfigItem = (data: Omit<RangeConfigItemDefType, \"type\">) => {\n return {\n def: RangeConfigItemDef.parse({\n type: RangeConfigItemTypeLiteral,\n ...data,\n }),\n schema: RangeConfigItemSchema(data.min, data.max, data.step, data.default),\n };\n};\n\nexport {\n RangeConfigItem,\n RangeConfigItemDef,\n RangeConfigItemSchema,\n RangeConfigItemTypeLiteral,\n type RangeConfigItemDefType,\n type RangeConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectBooleanConfigItemTypeLiteral = \"select-boolean\" as const;\n\nconst SelectBooleanConfigItemDef = z.object({\n type: z.literal(SelectBooleanConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.boolean().nullable(),\n});\ntype SelectBooleanConfigItemDefType = z.infer<typeof SelectBooleanConfigItemDef>;\n\nconst SelectBooleanConfigItemSchema = (defaultValue: boolean | null) => z.boolean().nullable().default(defaultValue).optional();\ntype SelectBooleanConfigItemSchemaType = z.infer<ReturnType<typeof SelectBooleanConfigItemSchema>>;\n\nconst SelectBooleanConfigItem = (data: Omit<SelectBooleanConfigItemDefType, \"type\">) => {\n return {\n def: SelectBooleanConfigItemDef.parse({\n type: SelectBooleanConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectBooleanConfigItemSchema(data.default),\n };\n};\n\nexport {\n SelectBooleanConfigItem,\n SelectBooleanConfigItemDef,\n SelectBooleanConfigItemSchema,\n SelectBooleanConfigItemTypeLiteral,\n type SelectBooleanConfigItemDefType,\n type SelectBooleanConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nconst SelectStringConfigItemTypeLiteral = \"select-string\" as const;\n\nconst SelectStringConfigItemDef = z.object({\n type: z.literal(SelectStringConfigItemTypeLiteral),\n param: z.string().min(1),\n title: z.string().min(1),\n description: z.string().min(1).max(500),\n default: z.string(),\n choices: z.array(z.string()),\n});\ntype SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;\n\nconst SelectStringConfigItemSchema = (defaultValue: string | null, choices: string[]) =>\n z\n .enum(choices as [string, ...string[]])\n .nullable()\n .default(defaultValue)\n .optional();\ntype SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;\n\nconst SelectStringConfigItem = (data: Omit<SelectStringConfigItemDefType, \"type\">) => {\n return {\n def: SelectStringConfigItemDef.parse({\n type: SelectStringConfigItemTypeLiteral,\n ...data,\n }),\n schema: SelectStringConfigItemSchema(data.default, data.choices),\n };\n};\n\nexport {\n SelectStringConfigItem,\n SelectStringConfigItemDef,\n SelectStringConfigItemSchema,\n SelectStringConfigItemTypeLiteral,\n type SelectStringConfigItemDefType,\n type SelectStringConfigItemSchemaType,\n};\n","import { z } from \"zod\";\n\nimport { MultiStringConfigItemDef, MultiStringConfigItemTypeLiteral } from \"./multi-string-config-item\";\nimport { ObjectSchemaConfigItemDef, ObjectSchemaConfigItemTypeLiteral } from \"./object-schema-config-item\";\nimport { RangeConfigItemDef, RangeConfigItemTypeLiteral } from \"./range-config-item\";\nimport { SelectBooleanConfigItemDef, SelectBooleanConfigItemTypeLiteral } from \"./select-boolean-config-item\";\nimport { SelectStringConfigItemDef, SelectStringConfigItemTypeLiteral } from \"./select-string-config-item\";\n\nconst ConfigItemLiterals = [\n RangeConfigItemTypeLiteral,\n MultiStringConfigItemTypeLiteral,\n SelectStringConfigItemTypeLiteral,\n ObjectSchemaConfigItemTypeLiteral,\n SelectBooleanConfigItemTypeLiteral,\n] as const;\nconst ConfigItemEnum = z.enum(ConfigItemLiterals);\ntype ConfigItemEnumType = z.infer<typeof ConfigItemEnum>;\n\nconst ConfigItemDef = z.discriminatedUnion(\"type\", [\n RangeConfigItemDef,\n MultiStringConfigItemDef,\n SelectStringConfigItemDef,\n SelectBooleanConfigItemDef,\n ObjectSchemaConfigItemDef,\n]);\ntype ConfigItemDefType = z.infer<typeof ConfigItemDef>;\n\nexport { ConfigItemDef, ConfigItemEnum, ConfigItemLiterals, type ConfigItemDefType, type ConfigItemEnumType };\n","import { z } from \"zod\";\n\nimport { ChatModelPriceType, ModalityEnum, RoleEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\nconst ChatModelSchema = <\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n>(\n Roles: R = RoleEnum as unknown as R,\n Modalities: M = ModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n roles: z.record(Roles, z.string().min(1).optional()),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n maxReasoningTokens: z.number().int().positive().min(1).optional(),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n price: z.custom<ChatModelPriceType>(),\n });\ntype ChatModelSchemaType<\n R extends z.ZodEnum<[string, ...string[]]> = typeof RoleEnum,\n M extends z.ZodEnum<[string, ...string[]]> = typeof ModalityEnum,\n> = z.infer<ReturnType<typeof ChatModelSchema<R, M>>>;\n\nexport { ChatModelSchema, type ChatModelSchemaType };\n","import { z } from \"zod\";\n\nimport { EmbeddingModalityEnum } from \"@adaline/types\";\n\nimport { ConfigItemDef } from \"../../types/config\";\n\n// TODO: add embedding model properties (dimensions, etc)\nconst EmbeddingModelSchema = <M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum>(\n Modalities: M = EmbeddingModalityEnum as unknown as M\n) =>\n z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n modalities: z.array(Modalities).nonempty(),\n maxInputTokens: z.number().int().positive().min(1),\n maxOutputTokens: z.number().int().positive().min(1),\n config: z\n .object({\n def: z.record(z.string().min(1), ConfigItemDef),\n schema: z.instanceof(z.ZodObject),\n })\n .refine(\n (config) => {\n const defKeys = Object.keys(config.def);\n const schemaKeys = Object.keys(config.schema?.shape ?? {});\n return defKeys.every((key) => schemaKeys.includes(key)) && schemaKeys.every((key) => defKeys.includes(key));\n },\n {\n message: \"Keys in 'config.def' must exactly match keys in 'config.schema'\",\n }\n ),\n });\ntype EmbeddingModelSchemaType<M extends z.ZodEnum<[string, ...string[]]> = typeof EmbeddingModalityEnum> = z.infer<\n ReturnType<typeof EmbeddingModelSchema<M>>\n>;\n\nexport { EmbeddingModelSchema, type EmbeddingModelSchemaType };\n","import { z } from \"zod\";\n\nconst Headers = z.record(z.string());\ntype HeadersType = z.infer<typeof Headers>;\n\nexport { Headers, type HeadersType };\n","import { z } from \"zod\";\n\nconst Params = z.record(\n z.union([\n z.boolean(),\n z.string(),\n z.number(),\n z.object({}),\n z.array(z.any()),\n z.null(),\n z.undefined(),\n ])\n);\ntype ParamsType = z.infer<typeof Params>;\n\nexport { Params, type ParamsType };\n","import { z } from \"zod\";\n\nconst Url = z.string().url();\ntype UrlType = z.infer<typeof Url>;\n\nexport { Url, type UrlType };\n","const TEMPERATURE = {\n type: \"range\",\n title: \"Temperature\",\n description:\n \"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. \\\n For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text \\\n that's unexpectedly fresh.\",\n} as const;\n\nconst MAX_TOKENS = {\n type: \"range\",\n title: \"Max tokens\",\n description:\n \"Specify the total tokens for generation, where one token approximates four English characters. \\\n Setting this to 0 defaults to the model's maximum capacity.\",\n} as const;\n\nconst MAX_REASONING_TOKENS = {\n type: \"range\",\n title: \"Max reasoning tokens\",\n description:\n \"Specify the total tokens for reasoning, where one token approximates four English characters.\",\n} as const;\n\nconst STOP = (max: number) =>\n ({\n type: \"multi\",\n title: \"Stop sequence\",\n description: `Enter up to ${max} sequences that will halt additional text output. \\\n The generated text will exclude these sequences.`,\n }) as const;\n\nconst TOP_A = {\n type: \"range\",\n title: \"Top A\",\n description:\n \"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, \\\n functioning like a dynamic Top-P. \\\n A lower Top-A value narrows down the token choices based on the highest probability token, \\\n while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output.\",\n} as const;\n\nconst TOP_P = {\n type: \"range\",\n title: \"Top P\",\n description:\n \"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, \\\n such as the top 10% when P=0.1. \\\n This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. \\\n It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously.\",\n} as const;\n\nconst TOP_K = {\n type: \"range\",\n title: \"Top K\",\n description:\n \"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options.\",\n} as const;\n\nconst MIN_P = {\n type: \"range\",\n title: \"Min P\",\n description:\n \"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. \\\n (This value varies based on the confidence level of the top token.) \\\n For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered.\",\n} as const;\n\nconst FREQUENCY_PENALTY = {\n type: \"range\",\n title: \"Frequency penalty\",\n description:\n \"Minimize redundancy.\\\n By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. \\\n The default setting for this penalty is zero.\",\n} as const;\n\nconst PRESENCE_PENALTY = {\n type: \"range\",\n title: \"Presence penalty\",\n description:\n \"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, \\\n thus boosting the chances of exploring fresh topics. \\\n The standard setting for this is zero.\",\n} as const;\n\nconst SEED = {\n type: \"range\",\n title: \"Seed\",\n description:\n \"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. \\\n Deterministic output isn't guaranteed. \\\n Also, changing the model or parameter settings, such as the temperature, \\\n can cause variations in the response even when you use the same seed value. \\\n By default, a random seed value is used.\",\n} as const;\n\nconst REPETITION_PENALTY = {\n type: \"range\",\n title: \"Repetition penalty\",\n description:\n \"Reduces the likelihood of repeating tokens from the input. \\\n Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, \\\n often resulting in run-on sentences missing smaller words. \\\n The token penalty is scaled according to the original token's probability.\",\n} as const;\n\nconst LOG_PROBS = {\n type: \"boolean\",\n title: \"Log probs\",\n description:\n \"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.\",\n} as const;\n\nconst TOP_LOG_PROBS = {\n type: \"range\",\n title: \"Top log probs\",\n description:\n \"The number of most likely tokens to return at each token position, each with an associated log probability. \\\n 'logprobs' must be set to true if this parameter is used.\",\n} as const;\n\nconst ECHO = {\n type: \"boolean\",\n title: \"Echo\",\n description: \"If true, the response will contain the prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt.\",\n} as const;\n\nconst RESPONSE_FORMAT_WITH_SCHEMA = {\n type: \"select\",\n title: \"Response format\",\n description:\n \"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid \\\n JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict \\\n response schema that the model will adhere to.\",\n} as const;\n\nconst RESPONSE_SCHEMA = {\n type: \"object\",\n title: \"Response schema\",\n description: \"When response format is set to 'json_schema', the model will return a JSON object of the specified schema.\",\n} as const;\n\nconst CHAT_CONFIG = {\n TEMPERATURE,\n MAX_TOKENS,\n STOP,\n TOP_A,\n TOP_P,\n TOP_K,\n MIN_P,\n FREQUENCY_PENALTY,\n PRESENCE_PENALTY,\n REPETITION_PENALTY,\n SEED,\n LOG_PROBS,\n TOP_LOG_PROBS,\n ECHO,\n RESPONSE_FORMAT,\n RESPONSE_FORMAT_WITH_SCHEMA,\n RESPONSE_SCHEMA,\n MAX_REASONING_TOKENS,\n};\n\nexport { CHAT_CONFIG };\n","const DIMENSIONS = {\n type: \"range\",\n title: \"Dimensions\",\n description: \"Select the number of dimensions for the word embedding.\",\n} as const;\n\nconst ENCODING_FORMAT = {\n type: \"select\",\n title: \"Encoding format\",\n description: \"Select the encoding format for the word embedding.\",\n} as const;\n\nconst EMBEDDING_CONFIG = {\n DIMENSIONS,\n ENCODING_FORMAT,\n};\n\nexport { EMBEDDING_CONFIG };\n","const getErrorMessage = (error: unknown | undefined): string => {\n if (error == null) return \"unknown error\";\n if (typeof error === \"string\") return error;\n if (error instanceof Error) return error.message;\n return JSON.stringify(error);\n};\n\nexport { getErrorMessage };\n","const removeUndefinedEntries = <T = unknown>(record: Record<string, T | undefined>): Record<string, T> => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return Object.fromEntries(Object.entries(record).filter(([_, value]) => value != null)) as Record<string, T>;\n};\n\nexport { removeUndefinedEntries };\n","const isRunningInBrowser = () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof navigator !== \"undefined\";\n};\n\nexport { isRunningInBrowser };\n","import { isRunningInBrowser } from \"./is-running-in-browser\";\n\nconst convertBase64ToUint8Array = (base64String: string): Uint8Array => {\n const base64Url = base64String.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const latin1string = globalThis.atob(base64Url);\n return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0)!);\n};\n\nconst convertUint8ArrayToBase64 = (array: Uint8Array): string => {\n let latin1string = \"\";\n\n // Note: regular for loop to support older JavaScript versions that\n // do not support for..of on Uint8Array\n for (let i = 0; i < array.length; i++) {\n latin1string += String.fromCodePoint(array[i]);\n }\n\n return globalThis.btoa(latin1string);\n};\n\nconst encodedBase64ToString = (base64: string): string => {\n if (isRunningInBrowser()) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n const decoder = new TextDecoder(\"utf-8\");\n return decoder.decode(bytes);\n } else {\n return Buffer.from(base64, \"base64\").toString(\"utf-8\");\n }\n};\n\nconst getMimeTypeFromBase64 = (base64: string): string => {\n const mimeTypePrefix = base64.split(\";\")[0];\n const mimeType = mimeTypePrefix.split(\"/\")[1];\n return mimeType;\n};\n\nexport { convertBase64ToUint8Array, convertUint8ArrayToBase64, encodedBase64ToString, getMimeTypeFromBase64 };\n","const urlWithoutTrailingSlash = (url: string): string => {\n return url?.replace(/\\/$/, \"\");\n};\n\nexport { urlWithoutTrailingSlash };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaline/provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zod": "^3.23.8",
|
|
49
|
-
"@adaline/types": "0.
|
|
49
|
+
"@adaline/types": "0.23.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@adaline/tsconfig": "0.11.0",
|