@adaline/provider 1.3.0 → 1.5.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 +62 -57
- package/dist/index.d.ts +62 -57
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1688,6 +1688,44 @@ declare const MultiStringConfigItem: (data: Omit<MultiStringConfigItemType, "typ
|
|
|
1688
1688
|
schema: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
1689
1689
|
};
|
|
1690
1690
|
|
|
1691
|
+
declare const ObjectSchemaConfigItemTypeLiteral: "object-schema";
|
|
1692
|
+
declare const ObjectSchemaConfigItemDef: z.ZodObject<{
|
|
1693
|
+
type: z.ZodLiteral<"object-schema">;
|
|
1694
|
+
param: z.ZodString;
|
|
1695
|
+
title: z.ZodString;
|
|
1696
|
+
description: z.ZodString;
|
|
1697
|
+
objectSchema: z.ZodAny;
|
|
1698
|
+
}, "strip", z.ZodTypeAny, {
|
|
1699
|
+
type: "object-schema";
|
|
1700
|
+
param: string;
|
|
1701
|
+
title: string;
|
|
1702
|
+
description: string;
|
|
1703
|
+
objectSchema?: any;
|
|
1704
|
+
}, {
|
|
1705
|
+
type: "object-schema";
|
|
1706
|
+
param: string;
|
|
1707
|
+
title: string;
|
|
1708
|
+
description: string;
|
|
1709
|
+
objectSchema?: any;
|
|
1710
|
+
}>;
|
|
1711
|
+
type ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;
|
|
1712
|
+
declare const ObjectSchemaConfigItemSchema: <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => z.ZodOptional<z.ZodObject<S, z.UnknownKeysParam, z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<S>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<S>, any>[k]; } : never, z.baseObjectInputType<S> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<S>[k_1]; } : never>>;
|
|
1713
|
+
type ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<ReturnType<typeof ObjectSchemaConfigItemSchema<S>>>;
|
|
1714
|
+
declare const ObjectSchemaConfigItem: (data: Omit<ObjectSchemaConfigItemType, "type">) => {
|
|
1715
|
+
def: {
|
|
1716
|
+
type: "object-schema";
|
|
1717
|
+
param: string;
|
|
1718
|
+
title: string;
|
|
1719
|
+
description: string;
|
|
1720
|
+
objectSchema?: any;
|
|
1721
|
+
};
|
|
1722
|
+
schema: z.ZodOptional<z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1723
|
+
[x: string]: any;
|
|
1724
|
+
}, {
|
|
1725
|
+
[x: string]: any;
|
|
1726
|
+
}>>;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1691
1729
|
declare const RangeConfigItemTypeLiteral: "range";
|
|
1692
1730
|
declare const RangeConfigItemDef: z.ZodObject<{
|
|
1693
1731
|
type: z.ZodLiteral<"range">;
|
|
@@ -1734,44 +1772,6 @@ declare const RangeConfigItem: (data: Omit<RangeConfigItemDefType, "type">) => {
|
|
|
1734
1772
|
schema: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1735
1773
|
};
|
|
1736
1774
|
|
|
1737
|
-
declare const SelectStringConfigItemTypeLiteral: "select-string";
|
|
1738
|
-
declare const SelectStringConfigItemDef: z.ZodObject<{
|
|
1739
|
-
type: z.ZodLiteral<"select-string">;
|
|
1740
|
-
param: z.ZodString;
|
|
1741
|
-
title: z.ZodString;
|
|
1742
|
-
description: z.ZodString;
|
|
1743
|
-
default: z.ZodString;
|
|
1744
|
-
choices: z.ZodArray<z.ZodString, "many">;
|
|
1745
|
-
}, "strip", z.ZodTypeAny, {
|
|
1746
|
-
type: "select-string";
|
|
1747
|
-
param: string;
|
|
1748
|
-
title: string;
|
|
1749
|
-
description: string;
|
|
1750
|
-
default: string;
|
|
1751
|
-
choices: string[];
|
|
1752
|
-
}, {
|
|
1753
|
-
type: "select-string";
|
|
1754
|
-
param: string;
|
|
1755
|
-
title: string;
|
|
1756
|
-
description: string;
|
|
1757
|
-
default: string;
|
|
1758
|
-
choices: string[];
|
|
1759
|
-
}>;
|
|
1760
|
-
type SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;
|
|
1761
|
-
declare const SelectStringConfigItemSchema: (defaultValue: string | null, choices: string[]) => z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1762
|
-
type SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;
|
|
1763
|
-
declare const SelectStringConfigItem: (data: Omit<SelectStringConfigItemDefType, "type">) => {
|
|
1764
|
-
def: {
|
|
1765
|
-
type: "select-string";
|
|
1766
|
-
param: string;
|
|
1767
|
-
title: string;
|
|
1768
|
-
description: string;
|
|
1769
|
-
default: string;
|
|
1770
|
-
choices: string[];
|
|
1771
|
-
};
|
|
1772
|
-
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1773
|
-
};
|
|
1774
|
-
|
|
1775
1775
|
declare const SelectBooleanConfigItemTypeLiteral: "select-boolean";
|
|
1776
1776
|
declare const SelectBooleanConfigItemDef: z.ZodObject<{
|
|
1777
1777
|
type: z.ZodLiteral<"select-boolean">;
|
|
@@ -1806,42 +1806,42 @@ declare const SelectBooleanConfigItem: (data: Omit<SelectBooleanConfigItemDefTyp
|
|
|
1806
1806
|
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodBoolean>>>;
|
|
1807
1807
|
};
|
|
1808
1808
|
|
|
1809
|
-
declare const
|
|
1810
|
-
declare const
|
|
1811
|
-
type: z.ZodLiteral<"
|
|
1809
|
+
declare const SelectStringConfigItemTypeLiteral: "select-string";
|
|
1810
|
+
declare const SelectStringConfigItemDef: z.ZodObject<{
|
|
1811
|
+
type: z.ZodLiteral<"select-string">;
|
|
1812
1812
|
param: z.ZodString;
|
|
1813
1813
|
title: z.ZodString;
|
|
1814
1814
|
description: z.ZodString;
|
|
1815
|
-
|
|
1815
|
+
default: z.ZodString;
|
|
1816
|
+
choices: z.ZodArray<z.ZodString, "many">;
|
|
1816
1817
|
}, "strip", z.ZodTypeAny, {
|
|
1817
|
-
type: "
|
|
1818
|
+
type: "select-string";
|
|
1818
1819
|
param: string;
|
|
1819
1820
|
title: string;
|
|
1820
1821
|
description: string;
|
|
1821
|
-
|
|
1822
|
+
default: string;
|
|
1823
|
+
choices: string[];
|
|
1822
1824
|
}, {
|
|
1823
|
-
type: "
|
|
1825
|
+
type: "select-string";
|
|
1824
1826
|
param: string;
|
|
1825
1827
|
title: string;
|
|
1826
1828
|
description: string;
|
|
1827
|
-
|
|
1829
|
+
default: string;
|
|
1830
|
+
choices: string[];
|
|
1828
1831
|
}>;
|
|
1829
|
-
type
|
|
1830
|
-
declare const
|
|
1831
|
-
type
|
|
1832
|
-
declare const
|
|
1832
|
+
type SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;
|
|
1833
|
+
declare const SelectStringConfigItemSchema: (defaultValue: string | null, choices: string[]) => z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1834
|
+
type SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;
|
|
1835
|
+
declare const SelectStringConfigItem: (data: Omit<SelectStringConfigItemDefType, "type">) => {
|
|
1833
1836
|
def: {
|
|
1834
|
-
type: "
|
|
1837
|
+
type: "select-string";
|
|
1835
1838
|
param: string;
|
|
1836
1839
|
title: string;
|
|
1837
1840
|
description: string;
|
|
1838
|
-
|
|
1841
|
+
default: string;
|
|
1842
|
+
choices: string[];
|
|
1839
1843
|
};
|
|
1840
|
-
schema: z.ZodOptional<z.
|
|
1841
|
-
[x: string]: any;
|
|
1842
|
-
}, {
|
|
1843
|
-
[x: string]: any;
|
|
1844
|
-
}>>;
|
|
1844
|
+
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1845
1845
|
};
|
|
1846
1846
|
|
|
1847
1847
|
interface ChatModelV1<MS extends ChatModelSchemaType = ChatModelSchemaType> {
|
|
@@ -2363,6 +2363,11 @@ declare const CHAT_CONFIG: {
|
|
|
2363
2363
|
readonly title: "Max reasoning tokens";
|
|
2364
2364
|
readonly description: "Specify the total tokens for reasoning, where one token approximates four English characters.";
|
|
2365
2365
|
};
|
|
2366
|
+
MCP_SERVERS: {
|
|
2367
|
+
readonly type: "object";
|
|
2368
|
+
readonly title: "MCP servers";
|
|
2369
|
+
readonly description: "MCP servers to use for the model.";
|
|
2370
|
+
};
|
|
2366
2371
|
};
|
|
2367
2372
|
|
|
2368
2373
|
declare const EMBEDDING_CONFIG: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1688,6 +1688,44 @@ declare const MultiStringConfigItem: (data: Omit<MultiStringConfigItemType, "typ
|
|
|
1688
1688
|
schema: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
1689
1689
|
};
|
|
1690
1690
|
|
|
1691
|
+
declare const ObjectSchemaConfigItemTypeLiteral: "object-schema";
|
|
1692
|
+
declare const ObjectSchemaConfigItemDef: z.ZodObject<{
|
|
1693
|
+
type: z.ZodLiteral<"object-schema">;
|
|
1694
|
+
param: z.ZodString;
|
|
1695
|
+
title: z.ZodString;
|
|
1696
|
+
description: z.ZodString;
|
|
1697
|
+
objectSchema: z.ZodAny;
|
|
1698
|
+
}, "strip", z.ZodTypeAny, {
|
|
1699
|
+
type: "object-schema";
|
|
1700
|
+
param: string;
|
|
1701
|
+
title: string;
|
|
1702
|
+
description: string;
|
|
1703
|
+
objectSchema?: any;
|
|
1704
|
+
}, {
|
|
1705
|
+
type: "object-schema";
|
|
1706
|
+
param: string;
|
|
1707
|
+
title: string;
|
|
1708
|
+
description: string;
|
|
1709
|
+
objectSchema?: any;
|
|
1710
|
+
}>;
|
|
1711
|
+
type ObjectSchemaConfigItemType = z.infer<typeof ObjectSchemaConfigItemDef>;
|
|
1712
|
+
declare const ObjectSchemaConfigItemSchema: <S extends z.ZodRawShape>(schema: z.ZodObject<S>) => z.ZodOptional<z.ZodObject<S, z.UnknownKeysParam, z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<S>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<S>, any>[k]; } : never, z.baseObjectInputType<S> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<S>[k_1]; } : never>>;
|
|
1713
|
+
type ObjectSchemaConfigItemSchemaType<S extends z.ZodRawShape = z.ZodRawShape> = z.infer<ReturnType<typeof ObjectSchemaConfigItemSchema<S>>>;
|
|
1714
|
+
declare const ObjectSchemaConfigItem: (data: Omit<ObjectSchemaConfigItemType, "type">) => {
|
|
1715
|
+
def: {
|
|
1716
|
+
type: "object-schema";
|
|
1717
|
+
param: string;
|
|
1718
|
+
title: string;
|
|
1719
|
+
description: string;
|
|
1720
|
+
objectSchema?: any;
|
|
1721
|
+
};
|
|
1722
|
+
schema: z.ZodOptional<z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1723
|
+
[x: string]: any;
|
|
1724
|
+
}, {
|
|
1725
|
+
[x: string]: any;
|
|
1726
|
+
}>>;
|
|
1727
|
+
};
|
|
1728
|
+
|
|
1691
1729
|
declare const RangeConfigItemTypeLiteral: "range";
|
|
1692
1730
|
declare const RangeConfigItemDef: z.ZodObject<{
|
|
1693
1731
|
type: z.ZodLiteral<"range">;
|
|
@@ -1734,44 +1772,6 @@ declare const RangeConfigItem: (data: Omit<RangeConfigItemDefType, "type">) => {
|
|
|
1734
1772
|
schema: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1735
1773
|
};
|
|
1736
1774
|
|
|
1737
|
-
declare const SelectStringConfigItemTypeLiteral: "select-string";
|
|
1738
|
-
declare const SelectStringConfigItemDef: z.ZodObject<{
|
|
1739
|
-
type: z.ZodLiteral<"select-string">;
|
|
1740
|
-
param: z.ZodString;
|
|
1741
|
-
title: z.ZodString;
|
|
1742
|
-
description: z.ZodString;
|
|
1743
|
-
default: z.ZodString;
|
|
1744
|
-
choices: z.ZodArray<z.ZodString, "many">;
|
|
1745
|
-
}, "strip", z.ZodTypeAny, {
|
|
1746
|
-
type: "select-string";
|
|
1747
|
-
param: string;
|
|
1748
|
-
title: string;
|
|
1749
|
-
description: string;
|
|
1750
|
-
default: string;
|
|
1751
|
-
choices: string[];
|
|
1752
|
-
}, {
|
|
1753
|
-
type: "select-string";
|
|
1754
|
-
param: string;
|
|
1755
|
-
title: string;
|
|
1756
|
-
description: string;
|
|
1757
|
-
default: string;
|
|
1758
|
-
choices: string[];
|
|
1759
|
-
}>;
|
|
1760
|
-
type SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;
|
|
1761
|
-
declare const SelectStringConfigItemSchema: (defaultValue: string | null, choices: string[]) => z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1762
|
-
type SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;
|
|
1763
|
-
declare const SelectStringConfigItem: (data: Omit<SelectStringConfigItemDefType, "type">) => {
|
|
1764
|
-
def: {
|
|
1765
|
-
type: "select-string";
|
|
1766
|
-
param: string;
|
|
1767
|
-
title: string;
|
|
1768
|
-
description: string;
|
|
1769
|
-
default: string;
|
|
1770
|
-
choices: string[];
|
|
1771
|
-
};
|
|
1772
|
-
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1773
|
-
};
|
|
1774
|
-
|
|
1775
1775
|
declare const SelectBooleanConfigItemTypeLiteral: "select-boolean";
|
|
1776
1776
|
declare const SelectBooleanConfigItemDef: z.ZodObject<{
|
|
1777
1777
|
type: z.ZodLiteral<"select-boolean">;
|
|
@@ -1806,42 +1806,42 @@ declare const SelectBooleanConfigItem: (data: Omit<SelectBooleanConfigItemDefTyp
|
|
|
1806
1806
|
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodBoolean>>>;
|
|
1807
1807
|
};
|
|
1808
1808
|
|
|
1809
|
-
declare const
|
|
1810
|
-
declare const
|
|
1811
|
-
type: z.ZodLiteral<"
|
|
1809
|
+
declare const SelectStringConfigItemTypeLiteral: "select-string";
|
|
1810
|
+
declare const SelectStringConfigItemDef: z.ZodObject<{
|
|
1811
|
+
type: z.ZodLiteral<"select-string">;
|
|
1812
1812
|
param: z.ZodString;
|
|
1813
1813
|
title: z.ZodString;
|
|
1814
1814
|
description: z.ZodString;
|
|
1815
|
-
|
|
1815
|
+
default: z.ZodString;
|
|
1816
|
+
choices: z.ZodArray<z.ZodString, "many">;
|
|
1816
1817
|
}, "strip", z.ZodTypeAny, {
|
|
1817
|
-
type: "
|
|
1818
|
+
type: "select-string";
|
|
1818
1819
|
param: string;
|
|
1819
1820
|
title: string;
|
|
1820
1821
|
description: string;
|
|
1821
|
-
|
|
1822
|
+
default: string;
|
|
1823
|
+
choices: string[];
|
|
1822
1824
|
}, {
|
|
1823
|
-
type: "
|
|
1825
|
+
type: "select-string";
|
|
1824
1826
|
param: string;
|
|
1825
1827
|
title: string;
|
|
1826
1828
|
description: string;
|
|
1827
|
-
|
|
1829
|
+
default: string;
|
|
1830
|
+
choices: string[];
|
|
1828
1831
|
}>;
|
|
1829
|
-
type
|
|
1830
|
-
declare const
|
|
1831
|
-
type
|
|
1832
|
-
declare const
|
|
1832
|
+
type SelectStringConfigItemDefType = z.infer<typeof SelectStringConfigItemDef>;
|
|
1833
|
+
declare const SelectStringConfigItemSchema: (defaultValue: string | null, choices: string[]) => z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1834
|
+
type SelectStringConfigItemSchemaType = z.infer<ReturnType<typeof SelectStringConfigItemSchema>>;
|
|
1835
|
+
declare const SelectStringConfigItem: (data: Omit<SelectStringConfigItemDefType, "type">) => {
|
|
1833
1836
|
def: {
|
|
1834
|
-
type: "
|
|
1837
|
+
type: "select-string";
|
|
1835
1838
|
param: string;
|
|
1836
1839
|
title: string;
|
|
1837
1840
|
description: string;
|
|
1838
|
-
|
|
1841
|
+
default: string;
|
|
1842
|
+
choices: string[];
|
|
1839
1843
|
};
|
|
1840
|
-
schema: z.ZodOptional<z.
|
|
1841
|
-
[x: string]: any;
|
|
1842
|
-
}, {
|
|
1843
|
-
[x: string]: any;
|
|
1844
|
-
}>>;
|
|
1844
|
+
schema: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodEnum<[string, ...string[]]>>>>;
|
|
1845
1845
|
};
|
|
1846
1846
|
|
|
1847
1847
|
interface ChatModelV1<MS extends ChatModelSchemaType = ChatModelSchemaType> {
|
|
@@ -2363,6 +2363,11 @@ declare const CHAT_CONFIG: {
|
|
|
2363
2363
|
readonly title: "Max reasoning tokens";
|
|
2364
2364
|
readonly description: "Specify the total tokens for reasoning, where one token approximates four English characters.";
|
|
2365
2365
|
};
|
|
2366
|
+
MCP_SERVERS: {
|
|
2367
|
+
readonly type: "object";
|
|
2368
|
+
readonly title: "MCP servers";
|
|
2369
|
+
readonly description: "MCP servers to use for the model.";
|
|
2370
|
+
};
|
|
2366
2371
|
};
|
|
2367
2372
|
|
|
2368
2373
|
declare const EMBEDDING_CONFIG: {
|
package/dist/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
var types = require('@adaline/types');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
|
|
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(/\/$/,"");
|
|
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(),tt=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(),rt=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(),mt=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(),gt=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(),ht=e=>({def:M.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],kt=zod.z.enum(le),I=zod.z.discriminatedUnion("type",[w,C,M,k,x]);var Pt=(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 Nt=(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 Gt=zod.z.record(zod.z.string());var Zt=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 Ht=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."},De={type:"object",title:"MCP servers",description:"MCP servers to use for the model."},Wt={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,MCP_SERVERS:De};var Be={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Ae={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Xt={DIMENSIONS:Be,ENCODING_FORMAT:Ae};var Qt=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var en=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var rn=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},sn=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},an=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")},cn=e=>e.split(";")[0].split("/")[1];var pn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
7
7
|
|
|
8
|
-
exports.CHAT_CONFIG =
|
|
9
|
-
exports.ChatModelSchema =
|
|
8
|
+
exports.CHAT_CONFIG = Wt;
|
|
9
|
+
exports.ChatModelSchema = Pt;
|
|
10
10
|
exports.ConfigItemDef = I;
|
|
11
|
-
exports.ConfigItemEnum =
|
|
11
|
+
exports.ConfigItemEnum = kt;
|
|
12
12
|
exports.ConfigItemLiterals = le;
|
|
13
|
-
exports.EMBEDDING_CONFIG =
|
|
14
|
-
exports.EmbeddingModelSchema =
|
|
15
|
-
exports.Headers =
|
|
13
|
+
exports.EMBEDDING_CONFIG = Xt;
|
|
14
|
+
exports.EmbeddingModelSchema = Nt;
|
|
15
|
+
exports.Headers = Gt;
|
|
16
16
|
exports.InvalidConfigError = _;
|
|
17
17
|
exports.InvalidEmbeddingRequestsError = K;
|
|
18
18
|
exports.InvalidMessagesError = U;
|
|
@@ -20,36 +20,36 @@ exports.InvalidModelRequestError = N;
|
|
|
20
20
|
exports.InvalidToolsError = Z;
|
|
21
21
|
exports.ModelError = z;
|
|
22
22
|
exports.ModelResponseError = B;
|
|
23
|
-
exports.MultiStringConfigItem =
|
|
23
|
+
exports.MultiStringConfigItem = tt;
|
|
24
24
|
exports.MultiStringConfigItemDef = C;
|
|
25
25
|
exports.MultiStringConfigItemSchema = se;
|
|
26
26
|
exports.MultiStringConfigItemTypeLiteral = y;
|
|
27
|
-
exports.ObjectSchemaConfigItem =
|
|
27
|
+
exports.ObjectSchemaConfigItem = rt;
|
|
28
28
|
exports.ObjectSchemaConfigItemDef = x;
|
|
29
29
|
exports.ObjectSchemaConfigItemSchema = ae;
|
|
30
30
|
exports.ObjectSchemaConfigItemTypeLiteral = h;
|
|
31
|
-
exports.Params =
|
|
31
|
+
exports.Params = Zt;
|
|
32
32
|
exports.ProviderError = j;
|
|
33
|
-
exports.RangeConfigItem =
|
|
33
|
+
exports.RangeConfigItem = mt;
|
|
34
34
|
exports.RangeConfigItemDef = w;
|
|
35
35
|
exports.RangeConfigItemSchema = ce;
|
|
36
36
|
exports.RangeConfigItemTypeLiteral = S;
|
|
37
|
-
exports.SelectBooleanConfigItem =
|
|
37
|
+
exports.SelectBooleanConfigItem = gt;
|
|
38
38
|
exports.SelectBooleanConfigItemDef = k;
|
|
39
39
|
exports.SelectBooleanConfigItemSchema = me;
|
|
40
40
|
exports.SelectBooleanConfigItemTypeLiteral = b;
|
|
41
|
-
exports.SelectStringConfigItem =
|
|
41
|
+
exports.SelectStringConfigItem = ht;
|
|
42
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 = Ht;
|
|
46
|
+
exports.convertBase64ToUint8Array = rn;
|
|
47
|
+
exports.convertUint8ArrayToBase64 = sn;
|
|
48
|
+
exports.encodedBase64ToString = an;
|
|
49
|
+
exports.getErrorMessage = Qt;
|
|
50
|
+
exports.getMimeTypeFromBase64 = cn;
|
|
51
51
|
exports.isRunningInBrowser = W;
|
|
52
|
-
exports.removeUndefinedEntries =
|
|
53
|
-
exports.urlWithoutTrailingSlash =
|
|
52
|
+
exports.removeUndefinedEntries = en;
|
|
53
|
+
exports.urlWithoutTrailingSlash = pn;
|
|
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"],"mappings":";;;;;yVAEA,IAAMA,EAAuB,eAChBC,CAAAA,CAAAA,CAAN,MAAMC,CAAsBC,SAAAA,sBAAiB,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,ECfA,IAAMK,EAAoB,YACbC,CAAAA,CAAAA,CAAN,MAAMC,CAAmBN,SAAAA,sBAAiB,CAK/C,WAAA,CAAY,CAAE,IAAA,CAAAC,EAAM,KAAAC,CAAAA,CAAM,EAAqC,CAC7D,KAAA,CAAM,CAAE,IAAAD,CAAAA,CAAAA,CAAM,KAAAC,CAAAA,CAAM,CAAGE,CAAAA,CAAiB,EAL1C,IAAS,CAAA,IAAA,CAAOA,EAMd,IAAK,CAAA,IAAA,CAAOH,EACZ,IAAK,CAAA,KAAA,CAAQC,EACf,CAEA,OAAO,YAAA,CAAaC,EAAqC,CACvD,OAAOA,aAAiBG,CAC1B,CACF,ECfMC,IAAAA,CAAAA,CAA4B,qBACrBC,CAAN,CAA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AAS,EAC9C,OAAO,UAAA,CAAW,IAAKC,CAAAA,CAAAA,CAAeC,CAASA,EAAAA,CAAAA,CAAK,YAAY,CAAC,CAAE,CACrE,CAEMC,CAAAA,EAAAA,CAA6BC,GAA8B,CAC/D,IAAIH,CAAe,CAAA,EAAA,CAInB,IAASI,IAAAA,CAAAA,CAAI,EAAGA,CAAID,CAAAA,CAAAA,CAAM,OAAQC,CAChCJ,EAAAA,CAAAA,CAAAA,EAAgB,OAAO,aAAcG,CAAAA,CAAAA,CAAMC,CAAC,CAAC,CAG/C,CAAA,OAAO,WAAW,IAAKJ,CAAAA,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"]}
|
|
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","MCP_SERVERS","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,CAAAA,SAAsBC,sBAAiB,CAKlD,YAAY,CAAE,IAAA,CAAAC,EAAM,KAAAC,CAAAA,CAAM,EAAqC,CAC7D,KAAA,CAAM,CAAE,IAAA,CAAAD,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAGL,CAAAA,CAAoB,EAL7C,IAAS,CAAA,IAAA,CAAOA,EAMd,IAAK,CAAA,IAAA,CAAOI,CACZ,CAAA,IAAA,CAAK,KAAQC,CAAAA,EACf,CAEA,OAAO,eAAA,CAAgBC,EAAwC,CAC7D,OAAOA,aAAiBJ,CAC1B,CACF,ECfMK,IAAAA,CAAAA,CAAoB,aACbC,CAAN,CAAA,MAAMC,UAAmBN,sBAAiB,CAK/C,WAAY,CAAA,CAAE,IAAAC,CAAAA,CAAAA,CAAM,MAAAC,CAAM,CAAA,CAAqC,CAC7D,KAAM,CAAA,CAAE,KAAAD,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAA,CAAGE,CAAiB,CAAA,CAL1C,KAAS,IAAOA,CAAAA,CAAAA,CAMd,KAAK,IAAOH,CAAAA,CAAAA,CACZ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AAC,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: \"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 MCP_SERVERS = {\n type: \"object\",\n title: \"MCP servers\",\n description: \"MCP servers to use for the model.\",\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 MCP_SERVERS,\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 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(/\/$/,"");
|
|
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(),tt=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(),rt=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(),mt=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(),gt=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(),ht=e=>({def:M.parse(a({type:T},e)),schema:pe(e.default,e.choices)});var le=[S,y,T,h,b],kt=z$1.enum(le),I=z$1.discriminatedUnion("type",[w,C,M,k,x]);var Pt=(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 Nt=(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 Gt=z$1.record(z$1.string());var Zt=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 Ht=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."},De={type:"object",title:"MCP servers",description:"MCP servers to use for the model."},Wt={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,MCP_SERVERS:De};var Be={type:"range",title:"Dimensions",description:"Select the number of dimensions for the word embedding."},Ae={type:"select",title:"Encoding format",description:"Select the encoding format for the word embedding."},Xt={DIMENSIONS:Be,ENCODING_FORMAT:Ae};var Qt=e=>e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e);var en=e=>Object.fromEntries(Object.entries(e).filter(([n,t])=>t!=null));var W=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var rn=e=>{let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=globalThis.atob(n);return Uint8Array.from(t,o=>o.codePointAt(0))},sn=e=>{let n="";for(let t=0;t<e.length;t++)n+=String.fromCodePoint(e[t]);return globalThis.btoa(n)},an=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")},cn=e=>e.split(";")[0].split("/")[1];var pn=e=>e==null?void 0:e.replace(/\/$/,"");
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { Wt as CHAT_CONFIG, Pt as ChatModelSchema, I as ConfigItemDef, kt as ConfigItemEnum, le as ConfigItemLiterals, Xt as EMBEDDING_CONFIG, Nt as EmbeddingModelSchema, Gt as Headers, _ as InvalidConfigError, K as InvalidEmbeddingRequestsError, U as InvalidMessagesError, N as InvalidModelRequestError, Z as InvalidToolsError, z as ModelError, B as ModelResponseError, tt as MultiStringConfigItem, C as MultiStringConfigItemDef, se as MultiStringConfigItemSchema, y as MultiStringConfigItemTypeLiteral, rt as ObjectSchemaConfigItem, x as ObjectSchemaConfigItemDef, ae as ObjectSchemaConfigItemSchema, h as ObjectSchemaConfigItemTypeLiteral, Zt as Params, j as ProviderError, mt as RangeConfigItem, w as RangeConfigItemDef, ce as RangeConfigItemSchema, S as RangeConfigItemTypeLiteral, gt as SelectBooleanConfigItem, k as SelectBooleanConfigItemDef, me as SelectBooleanConfigItemSchema, b as SelectBooleanConfigItemTypeLiteral, ht as SelectStringConfigItem, M as SelectStringConfigItemDef, pe as SelectStringConfigItemSchema, T as SelectStringConfigItemTypeLiteral, Ht as Url, rn as convertBase64ToUint8Array, sn as convertUint8ArrayToBase64, an as encodedBase64ToString, Qt as getErrorMessage, cn as getMimeTypeFromBase64, W as isRunningInBrowser, en as removeUndefinedEntries, pn 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,CAAA,CAC7D,OAAOA,CAAiBJ,YAAAA,CAC1B,CACF,ECfA,IAAMK,EAAoB,YACbC,CAAAA,CAAAA,CAAN,MAAMC,CAAmBN,SAAAA,gBAAiB,CAK/C,WAAA,CAAY,CAAE,IAAA,CAAAC,EAAM,KAAAC,CAAAA,CAAM,EAAqC,CAC7D,KAAA,CAAM,CAAE,IAAAD,CAAAA,CAAAA,CAAM,KAAAC,CAAAA,CAAM,CAAGE,CAAAA,CAAiB,EAL1C,IAAS,CAAA,IAAA,CAAOA,EAMd,IAAK,CAAA,IAAA,CAAOH,EACZ,IAAK,CAAA,KAAA,CAAQC,EACf,CAEA,OAAO,YAAA,CAAaC,EAAqC,CACvD,OAAOA,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st 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"]}
|
|
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","MCP_SERVERS","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,CAAAA,SAAsBC,gBAAiB,CAKlD,YAAY,CAAE,IAAA,CAAAC,EAAM,KAAAC,CAAAA,CAAM,EAAqC,CAC7D,KAAA,CAAM,CAAE,IAAA,CAAAD,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAGL,CAAAA,CAAoB,EAL7C,IAAS,CAAA,IAAA,CAAOA,EAMd,IAAK,CAAA,IAAA,CAAOI,CACZ,CAAA,IAAA,CAAK,KAAQC,CAAAA,EACf,CAEA,OAAO,eAAA,CAAgBC,EAAwC,CAC7D,OAAOA,aAAiBJ,CAC1B,CACF,ECfMK,IAAAA,CAAAA,CAAoB,aACbC,CAAN,CAAA,MAAMC,UAAmBN,gBAAiB,CAK/C,WAAY,CAAA,CAAE,IAAAC,CAAAA,CAAAA,CAAM,MAAAC,CAAM,CAAA,CAAqC,CAC7D,KAAM,CAAA,CAAE,KAAAD,CAAM,CAAA,KAAA,CAAAC,CAAM,CAAA,CAAGE,CAAiB,CAAA,CAL1C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AAM,GAAG,CAAA,CAAE,CAAC,CAAA,CACV,MAAM,GAAG,CAAA,CAAE,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: \"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 MCP_SERVERS = {\n type: \"object\",\n title: \"MCP servers\",\n description: \"MCP servers to use for the model.\",\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 MCP_SERVERS,\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": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zod": "^3.23.8",
|
|
49
|
-
"@adaline/types": "1.
|
|
49
|
+
"@adaline/types": "1.9.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"eslint-config-adaline": "0.
|
|
53
|
-
"@adaline/tsconfig": "0.
|
|
52
|
+
"eslint-config-adaline": "0.9.0",
|
|
53
|
+
"@adaline/tsconfig": "0.12.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"clean": "rimraf node_modules .turbo dist",
|