@adaline/openai 0.12.0 → 0.14.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/README.md +9 -0
- package/dist/index.d.mts +126 -126
- package/dist/index.d.ts +126 -126
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,47 +4,47 @@ var zod = require('zod');
|
|
|
4
4
|
var provider = require('@adaline/provider');
|
|
5
5
|
var types = require('@adaline/types');
|
|
6
6
|
|
|
7
|
-
var qt=Object.defineProperty,kt=Object.defineProperties;var jt=Object.getOwnPropertyDescriptors;var jo=Object.getOwnPropertySymbols;var Lt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable;var $t=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n);var Lo=(n,e,t)=>e in n?qt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))Lt.call(e,t)&&Lo(n,t,e[t]);if(jo)for(var t of jo(e))zt.call(e,t)&&Lo(n,t,e[t]);return n},x=(n,e)=>kt(n,jt(e));var I=(n,e,t)=>new Promise((o,s)=>{var a=l=>{try{i(t.next(l));}catch(c){s(c);}},m=l=>{try{i(t.throw(l));}catch(c){s(c);}},i=l=>l.done?o(l.value):Promise.resolve(l.value).then(a,m);i((t=t.apply(n,e)).next());}),Bt=function(n,e){this[0]=n,this[1]=e;},W=(n,e,t)=>{var o=(m,i,l,c)=>{try{var d=t[m](i),f=(i=d.value)instanceof Bt,g=d.done;Promise.resolve(f?i[0]:i).then(O=>f?o(m==="return"?m:"next",i[1]?{done:O.done,value:O.value}:O,l,c):l({value:O,done:g})).catch(O=>o("throw",O,l,c));}catch(O){c(O);}},s=m=>a[m]=i=>new Promise((l,c)=>o(m,i,l,c)),a={};return t=t.apply(n,e),a[$t("asyncIterator")]=()=>a,s("next"),s("throw"),s("return"),a};var qe=provider.RangeConfigItem({param:"temperature",title:provider.CONFIG.TEMPERATURE.title,description:provider.CONFIG.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),ke=n=>provider.RangeConfigItem({param:"max_tokens",title:provider.CONFIG.MAX_TOKENS.title,description:provider.CONFIG.MAX_TOKENS.description,min:0,max:n,step:1,default:0}),je=n=>provider.MultiStringConfigItem({param:"stop",title:provider.CONFIG.STOP(n).title,description:provider.CONFIG.STOP(n).description,max:n}),Le=provider.RangeConfigItem({param:"top_p",title:provider.CONFIG.TOP_P.title,description:provider.CONFIG.TOP_P.description,min:0,max:1,step:.01,default:1}),ze=provider.RangeConfigItem({param:"frequency_penalty",title:provider.CONFIG.FREQUENCY_PENALTY.title,description:provider.CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),$e=provider.RangeConfigItem({param:"presence_penalty",title:provider.CONFIG.PRESENCE_PENALTY.title,description:provider.CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Be=provider.RangeConfigItem({param:"seed",title:"Seed",description:"This is in BETA. Set a seed to get reproducible results. Determinism is not guaranteed. Set to 0 to disable.",min:0,max:1e6,step:1,default:0}),Fe=provider.SelectBooleanConfigItem({param:"logprobs",title:"LogProbs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.",default:!1}),Ue=provider.RangeConfigItem({param:"top_logprobs",title:"Top logprobs",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.",min:0,max:20,step:1,default:0}),De=provider.SelectStringConfigItem({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]});var B=(n,e)=>zod.z.object({temperature:qe.schema,maxTokens:ke(n).schema,stop:je(e).schema,topP:Le.schema,frequencyPenalty:ze.schema,presencePenalty:$e.schema,seed:Be.schema.transform(t=>t===0?void 0:t),logProbs:Fe.schema,topLogProbs:Ue.schema,toolChoice:De.schema}),F=(n,e)=>({temperature:qe.def,maxTokens:ke(n).def,stop:je(e).def,topP:Le.def,frequencyPenalty:ze.def,presencePenalty:$e.def,seed:Be.def,logProbs:Fe.def,topLogProbs:Ue.def,toolChoice:De.def});var zo=provider.SelectStringConfigItem({param:"response_format",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.",default:"text",choices:["text","json_object"]}),$o=(n,e)=>x(y({},F(n,e)),{responseFormat:zo.def}),Bo=(n,e)=>B(n,e).extend({responseFormat:zo.schema});var Jt=["object","array","number","string","boolean","enum"],Fo=zod.z.enum(Jt),Wt=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Fo,zod.z.array(zod.z.union([Fo,zod.z.literal("null")]))]).optional(),default:zod.z.any().optional(),title:zod.z.string().optional(),description:zod.z.string().max(4096).optional(),properties:zod.z.record(zod.z.any()).optional(),required:zod.z.array(zod.z.string()).optional(),minItems:zod.z.number().int().min(0).optional(),maxItems:zod.z.number().int().optional(),items:zod.z.record(zod.z.any()).optional(),enum:zod.z.array(zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.null()])).optional(),minimum:zod.z.number().optional(),maximum:zod.z.number().optional(),minLength:zod.z.number().int().min(0).optional(),maxLength:zod.z.number().int().optional(),$ref:zod.z.string().optional()}),Yt=zod.z.object({type:zod.z.enum(["object"]),required:zod.z.array(zod.z.string()),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(Wt),additionalProperties:zod.z.literal(!1)}),Xt=zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),strict:zod.z.boolean().optional(),schema:Yt}).optional(),Uo=provider.ObjectSchemaConfigItem({param:"response_schema",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema.",objectSchema:Xt}),Do=provider.SelectStringConfigItem({param:"response_format",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.",default:"text",choices:["text","json_object","json_schema"]}),Y=(n,e)=>x(y({},F(n,e)),{responseFormat:Do.def,responseSchema:Uo.def}),X=(n,e)=>B(n,e).extend({responseFormat:Do.schema,responseSchema:Uo.schema});var Vo=provider.RangeConfigItem({param:"temperature",title:provider.CONFIG.TEMPERATURE.title,description:provider.CONFIG.TEMPERATURE.description,min:1,max:1,step:.01,default:1}),Ko=n=>provider.RangeConfigItem({param:"max_completion_tokens",title:provider.CONFIG.MAX_TOKENS.title,description:provider.CONFIG.MAX_TOKENS.description,min:0,max:n,step:1,default:0}),Ho=(n,e)=>x(y({},Y(n,e)),{temperature:Vo.def,maxTokens:Ko(n).def}),Jo=(n,e)=>X(n,e).extend({temperature:Vo.schema,maxTokens:Ko(n).schema});var Ne=provider.SelectStringConfigItem({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"float",choices:["float","base64"]}),Ve=n=>provider.RangeConfigItem({param:"dimensions",title:"Dimensions",description:"Select the number of dimensions for the word embedding.",min:1,max:n,step:1,default:n});var Q=()=>zod.z.object({encodingFormat:Ne.schema}),ee=()=>({encodingFormat:Ne.def});var Wo=n=>Q().extend({dimensions:Ve(n).schema}),Yo=n=>x(y({},ee()),{dimensions:Ve(n).def});var h={base:(n,e)=>({def:F(n,e),schema:B(n,e)}),responseFormat:(n,e)=>({def:$o(n,e),schema:Bo(n,e)}),responseSchema:(n,e)=>({def:Y(n,e),schema:X(n,e)}),oSeries:(n,e)=>({def:Ho(n,e),schema:Jo(n,e)})},q={base:()=>({def:ee(),schema:Q()}),dimensions:n=>({def:Yo(n),schema:Wo(n)})};var b=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),C={system:types.SystemRoleLiteral,user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral,tool:types.ToolRoleLiteral},ne=zod.z.enum([types.UserRoleLiteral,types.AssistantRoleLiteral]),se={user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral};var v=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],G=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),re=[types.TextModalityLiteral],le=zod.z.enum([types.TextModalityLiteral]),S=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],P=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var me=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),ot=zod.z.object({content:zod.z.array(me.extend({top_logprobs:zod.z.array(me)})).nullable(),refusal:zod.z.array(me.extend({top_logprobs:zod.z.array(me)})).nullable()}).nullable(),on=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),tt=zod.z.object({id:zod.z.string(),object:zod.z.literal("chat.completion"),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:on.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:ot.optional(),finish_reason:zod.z.string()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()})}),tn=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),nt=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:tn.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:ot,finish_reason:zod.z.string().nullable()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var nn=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),sn=zod.z.enum(["none","auto","required"]),an=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),rn=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),He=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),ln=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),mn=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),pn=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(He).min(1))}),dn=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([He,ln])).min(1))}),cn=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(He).min(1)).optional(),tool_calls:zod.z.array(mn).min(1).optional()}),hn=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),un=zod.z.union([pn,dn,cn,hn]),pe=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(un).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),response_format:rn.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(nn).optional(),tool_choice:sn.or(an).optional()});var st=pe.omit({max_tokens:!0}).extend({max_completion_tokens:zod.z.number().min(0).nullable().optional()});var T=zod.z.object({apiKey:zod.z.string(),baseUrl:zod.z.string().url(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional(),organization:zod.z.string().optional()}),_=class{constructor(e,t){this.version="v1";let o=T.parse(t);this.modelSchema=e,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl),this.streamChatUrl=provider.urlWithoutTrailingSlash(o.streamChatUrl||`${this.baseUrl}/chat/completions`),this.completeChatUrl=provider.urlWithoutTrailingSlash(o.completeChatUrl||`${this.baseUrl}/chat/completions`),this.organization=o.organization;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return y({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",source:"adaline.ai"},this.organization?{"OpenAI-Organization":this.organization}:{})}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let t=i=>{let l=/(\d+)(h|m|s|ms)/g,c={h:36e5,m:6e4,s:1e3,ms:1},d,f=0;for(;(d=l.exec(i))!==null;){let g=parseInt(d[1]),O=d[2];f+=g*c[O];}return f},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=t(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=t(e["x-ratelimit-reset-tokens"]));let m=Math.max(o,s);return {shouldRetry:a,delayMs:m}}getTokenCount(e){return e.reduce((t,o)=>t+o.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let t=pe.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=o.model;if(o.tool_choice&&(!o.tools||o.tools.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelSchema.name}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};o.response_format&&(a.responseFormat=o.response_format.type,o.response_format.type==="json_schema"&&(a.responseSchema={name:o.response_format.json_schema.name,description:o.response_format.json_schema.description||"",strict:o.response_format.json_schema.strict,schema:o.response_format.json_schema.schema})),o.tool_choice&&(typeof o.tool_choice=="string"?a.toolChoice=o.tool_choice:a.toolChoice=o.tool_choice.function.name),a.seed=o.seed,a.maxTokens=o.max_tokens,a.temperature=o.temperature,a.topP=o.top_p,a.presencePenalty=o.presence_penalty,a.frequencyPenalty=o.frequency_penalty,a.stop=o.stop,a.logProbs=o.logprobs,a.topLogProbs=o.top_logprobs;let m=types.Config().parse(provider.removeUndefinedEntries(a)),i=[],l={};o.messages.forEach(d=>{let f=d.role;switch(f){case"system":{let g=d.content;if(typeof g=="string")i.push({role:f,content:[{modality:types.TextModalityLiteral,value:g}]});else {let O=g.map(M=>({modality:types.TextModalityLiteral,value:M.text}));i.push({role:f,content:O});}}break;case"user":{let g=d.content;if(typeof g=="string")i.push({role:f,content:[{modality:types.TextModalityLiteral,value:g}]});else {let O=g.map(M=>M.type==="text"?{modality:types.TextModalityLiteral,value:M.text}:M.image_url.url.startsWith("data:")?{modality:types.ImageModalityLiteral,detail:M.image_url.detail||"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:M.image_url.url,media_type:provider.getMimeTypeFromBase64(M.image_url.url)}}:{modality:types.ImageModalityLiteral,detail:M.image_url.detail||"auto",value:{type:types.UrlImageContentTypeLiteral,url:M.image_url.url}});i.push({role:f,content:O});}}break;case"assistant":{let g=[];if(!d.content&&!d.tool_calls)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelSchema.name}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(d.content){let O=d.content;typeof O=="string"?g.push({modality:types.TextModalityLiteral,value:O}):O.forEach(M=>{g.push({modality:types.TextModalityLiteral,value:M.text});});}d.tool_calls&&d.tool_calls.forEach((M,Gt)=>{let Ge={modality:types.ToolCallModalityLiteral,id:M.id,index:Gt,name:M.function.name,arguments:M.function.arguments};g.push(Ge),l[Ge.id]=Ge;}),i.push({role:f,content:g});}break;case"tool":{let g=d;i.push({role:f,content:[{modality:types.ToolResponseModalityLiteral,id:g.tool_call_id,index:l[g.tool_call_id].index,name:l[g.tool_call_id].name,data:g.content}]});}break}});let c=[];return o.tools&&o.tools.forEach(d=>{c.push({type:"function",definition:{schema:{name:d.function.name,description:d.function.description||"",strict:d.function.strict,parameters:d.function.parameters}}});}),{modelName:s,config:m,messages:i,tools:c.length>0?c:void 0}}transformConfig(e,t,o){let s=e.toolChoice;delete e.toolChoice;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:a.error});let m=a.data;s!==void 0&&(m.toolChoice=s),Object.keys(m).forEach(l=>{if(!(l in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${l}',
|
|
8
|
-
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let i=Object.keys(
|
|
7
|
+
var qt=Object.defineProperty,kt=Object.defineProperties;var Lt=Object.getOwnPropertyDescriptors;var Lo=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable;var Bt=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n);var jo=(n,e,t)=>e in n?qt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,_=(n,e)=>{for(var t in e||(e={}))jt.call(e,t)&&jo(n,t,e[t]);if(Lo)for(var t of Lo(e))zt.call(e,t)&&jo(n,t,e[t]);return n},E=(n,e)=>kt(n,Lt(e));var I=(n,e,t)=>new Promise((o,s)=>{var a=l=>{try{i(t.next(l));}catch(c){s(c);}},p=l=>{try{i(t.throw(l));}catch(c){s(c);}},i=l=>l.done?o(l.value):Promise.resolve(l.value).then(a,p);i((t=t.apply(n,e)).next());}),Ft=function(n,e){this[0]=n,this[1]=e;},J=(n,e,t)=>{var o=(p,i,l,c)=>{try{var d=t[p](i),u=(i=d.value)instanceof Ft,f=d.done;Promise.resolve(u?i[0]:i).then(C=>u?o(p==="return"?p:"next",i[1]?{done:C.done,value:C.value}:C,l,c):l({value:C,done:f})).catch(C=>o("throw",C,l,c));}catch(C){c(C);}},s=p=>a[p]=i=>new Promise((l,c)=>o(p,i,l,c)),a={};return t=t.apply(n,e),a[Bt("asyncIterator")]=()=>a,s("next"),s("throw"),s("return"),a};var qe=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),ke=n=>provider.RangeConfigItem({param:"max_tokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:n,step:1,default:0}),Le=n=>provider.MultiStringConfigItem({param:"stop",title:provider.CHAT_CONFIG.STOP(n).title,description:provider.CHAT_CONFIG.STOP(n).description,max:n}),je=provider.RangeConfigItem({param:"top_p",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:1}),ze=provider.RangeConfigItem({param:"frequency_penalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Be=provider.RangeConfigItem({param:"presence_penalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Fe=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),$e=provider.SelectBooleanConfigItem({param:"logprobs",title:provider.CHAT_CONFIG.LOG_PROBS.title,description:provider.CHAT_CONFIG.LOG_PROBS.description,default:!1}),Ue=provider.RangeConfigItem({param:"top_logprobs",title:provider.CHAT_CONFIG.TOP_LOG_PROBS.title,description:provider.CHAT_CONFIG.TOP_LOG_PROBS.description,min:0,max:20,step:1,default:0}),De=provider.SelectStringConfigItem({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]});var B=(n,e)=>zod.z.object({temperature:qe.schema,maxTokens:ke(n).schema,stop:Le(e).schema,topP:je.schema,frequencyPenalty:ze.schema,presencePenalty:Be.schema,seed:Fe.schema.transform(t=>t===0?void 0:t),logProbs:$e.schema,topLogProbs:Ue.schema,toolChoice:De.schema}),F=(n,e)=>({temperature:qe.def,maxTokens:ke(n).def,stop:Le(e).def,topP:je.def,frequencyPenalty:ze.def,presencePenalty:Be.def,seed:Fe.def,logProbs:$e.def,topLogProbs:Ue.def,toolChoice:De.def});var Bo=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT.description,default:"text",choices:["text","json_object"]}),Fo=(n,e)=>E(_({},F(n,e)),{responseFormat:Bo.def}),$o=(n,e)=>B(n,e).extend({responseFormat:Bo.schema});var Uo=provider.ObjectSchemaConfigItem({param:"response_schema",title:provider.CHAT_CONFIG.RESPONSE_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_SCHEMA.description,objectSchema:types.ResponseSchema}),Do=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.description,default:"text",choices:["text","json_object","json_schema"]}),Y=(n,e)=>E(_({},F(n,e)),{responseFormat:Do.def,responseSchema:Uo.def}),X=(n,e)=>B(n,e).extend({responseFormat:Do.schema,responseSchema:Uo.schema});var Ho=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:1,max:1,step:.01,default:1}),Vo=n=>provider.RangeConfigItem({param:"max_completion_tokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:n,step:1,default:0}),Ko=(n,e)=>E(_({},Y(n,e)),{temperature:Ho.def,maxTokens:Vo(n).def}),Jo=(n,e)=>X(n,e).extend({temperature:Ho.schema,maxTokens:Vo(n).schema});var Ne=provider.SelectStringConfigItem({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"float",choices:["float","base64"]}),He=n=>provider.RangeConfigItem({param:"dimensions",title:"Dimensions",description:"Select the number of dimensions for the word embedding.",min:1,max:n,step:1,default:n});var Z=()=>zod.z.object({encodingFormat:Ne.schema}),ee=()=>({encodingFormat:Ne.def});var Wo=n=>Z().extend({dimensions:He(n).schema}),Yo=n=>E(_({},ee()),{dimensions:He(n).def});var h={base:(n,e)=>({def:F(n,e),schema:B(n,e)}),responseFormat:(n,e)=>({def:Fo(n,e),schema:$o(n,e)}),responseSchema:(n,e)=>({def:Y(n,e),schema:X(n,e)}),oSeries:(n,e)=>({def:Ko(n,e),schema:Jo(n,e)})},v={base:()=>({def:ee(),schema:Z()}),dimensions:n=>({def:Yo(n),schema:Wo(n)})};var y=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),b={system:types.SystemRoleLiteral,user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral,tool:types.ToolRoleLiteral},ne=zod.z.enum([types.UserRoleLiteral,types.AssistantRoleLiteral]),se={user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral};var w=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],G=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),re=[types.TextModalityLiteral],le=zod.z.enum([types.TextModalityLiteral]),S=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],P=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var pe=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),ot=zod.z.object({content:zod.z.array(pe.extend({top_logprobs:zod.z.array(pe)})).nullable(),refusal:zod.z.array(pe.extend({top_logprobs:zod.z.array(pe)})).nullable()}).nullable(),Qt=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),tt=zod.z.object({id:zod.z.string(),object:zod.z.literal("chat.completion"),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:Qt.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:ot.optional(),finish_reason:zod.z.string()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()})}),Zt=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),nt=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:Zt.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:ot,finish_reason:zod.z.string().nullable()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var en=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),on=zod.z.enum(["none","auto","required"]),tn=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),nn=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),Ke=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),sn=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),an=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),rn=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(Ke).min(1))}),ln=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([Ke,sn])).min(1))}),pn=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(Ke).min(1)).optional(),tool_calls:zod.z.array(an).min(1).optional()}),mn=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),dn=zod.z.union([rn,ln,pn,mn]),me=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(dn).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),response_format:nn.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(en).optional(),tool_choice:on.or(tn).optional()});var st=me.omit({max_tokens:!0}).extend({max_completion_tokens:zod.z.number().min(0).nullable().optional()});var g=zod.z.object({apiKey:zod.z.string(),baseUrl:zod.z.string().url(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional(),organization:zod.z.string().optional()}),T=class{constructor(e,t){this.version="v1";let o=g.parse(t);this.modelSchema=e,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl),this.streamChatUrl=provider.urlWithoutTrailingSlash(o.streamChatUrl||`${this.baseUrl}/chat/completions`),this.completeChatUrl=provider.urlWithoutTrailingSlash(o.completeChatUrl||`${this.baseUrl}/chat/completions`),this.organization=o.organization;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return _({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",source:"adaline.ai"},this.organization?{"OpenAI-Organization":this.organization}:{})}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let t=i=>{let l=/(\d+)(h|m|s|ms)/g,c={h:36e5,m:6e4,s:1e3,ms:1},d,u=0;for(;(d=l.exec(i))!==null;){let f=parseInt(d[1]),C=d[2];u+=f*c[C];}return u},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=t(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=t(e["x-ratelimit-reset-tokens"]));let p=Math.max(o,s);return {shouldRetry:a,delayMs:p}}getTokenCount(e){return e.reduce((t,o)=>t+o.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let t=me.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=o.model;if(o.tool_choice&&(!o.tools||o.tools.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelSchema.name}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};o.response_format&&(a.responseFormat=o.response_format.type,o.response_format.type==="json_schema"&&(a.responseSchema={name:o.response_format.json_schema.name,description:o.response_format.json_schema.description||"",strict:o.response_format.json_schema.strict,schema:o.response_format.json_schema.schema})),o.tool_choice&&(typeof o.tool_choice=="string"?a.toolChoice=o.tool_choice:a.toolChoice=o.tool_choice.function.name),a.seed=o.seed,a.maxTokens=o.max_tokens,a.temperature=o.temperature,a.topP=o.top_p,a.presencePenalty=o.presence_penalty,a.frequencyPenalty=o.frequency_penalty,a.stop=o.stop,a.logProbs=o.logprobs,a.topLogProbs=o.top_logprobs;let p=types.Config().parse(provider.removeUndefinedEntries(a)),i=[],l={};o.messages.forEach(d=>{let u=d.role;switch(u){case"system":{let f=d.content;if(typeof f=="string")i.push({role:u,content:[{modality:types.TextModalityLiteral,value:f}]});else {let C=f.map(M=>({modality:types.TextModalityLiteral,value:M.text}));i.push({role:u,content:C});}}break;case"user":{let f=d.content;if(typeof f=="string")i.push({role:u,content:[{modality:types.TextModalityLiteral,value:f}]});else {let C=f.map(M=>M.type==="text"?{modality:types.TextModalityLiteral,value:M.text}:M.image_url.url.startsWith("data:")?{modality:types.ImageModalityLiteral,detail:M.image_url.detail||"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:M.image_url.url,media_type:provider.getMimeTypeFromBase64(M.image_url.url)}}:{modality:types.ImageModalityLiteral,detail:M.image_url.detail||"auto",value:{type:types.UrlImageContentTypeLiteral,url:M.image_url.url}});i.push({role:u,content:C});}}break;case"assistant":{let f=[];if(!d.content&&!d.tool_calls)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelSchema.name}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(d.content){let C=d.content;typeof C=="string"?f.push({modality:types.TextModalityLiteral,value:C}):C.forEach(M=>{f.push({modality:types.TextModalityLiteral,value:M.text});});}d.tool_calls&&d.tool_calls.forEach((M,vt)=>{let ve={modality:types.ToolCallModalityLiteral,id:M.id,index:vt,name:M.function.name,arguments:M.function.arguments};f.push(ve),l[ve.id]=ve;}),i.push({role:u,content:f});}break;case"tool":{let f=d;i.push({role:u,content:[{modality:types.ToolResponseModalityLiteral,id:f.tool_call_id,index:l[f.tool_call_id].index,name:l[f.tool_call_id].name,data:f.content}]});}break}});let c=[];return o.tools&&o.tools.forEach(d=>{c.push({type:"function",definition:{schema:{name:d.function.name,description:d.function.description||"",strict:d.function.strict,parameters:d.function.parameters}}});}),{modelName:s,config:p,messages:i,tools:c.length>0?c:void 0}}transformConfig(e,t,o){let s=e.toolChoice;delete e.toolChoice;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:a.error});let p=a.data;s!==void 0&&(p.toolChoice=s),Object.keys(p).forEach(l=>{if(!(l in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${l}',
|
|
8
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let i=Object.keys(p).reduce((l,c)=>{let d=this.modelSchema.config.def[c],u=d.param,f=p[c];return u==="max_tokens"&&d.type==="range"&&f===0?l[u]=d.max:l[u]=f,l},{});if(i.top_logprobs&&!i.logprobs)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error("'logprobs' must be 'true' when 'top_logprobs' is specified")});if("tool_choice"in i&&i.tool_choice!==void 0){let l=i.tool_choice;if(!o||o&&o.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(o&&o.length>0){let c=this.modelSchema.config.def.toolChoice;if(!c.choices.includes(l))if(o.map(d=>d.definition.schema.name).includes(l))i.tool_choice={type:"function",function:{name:l}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`toolChoice : '${l}' is not part of provided 'tools' names or
|
|
9
9
|
one of [${c.choices.join(", ")}]`)})}}if("response_format"in i&&i.response_format!==void 0){let l=i.response_format;if(l==="json_schema")if("response_schema"in i)i.response_format={type:"json_schema",json_schema:i.response_schema},delete i.response_schema;else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error("'responseSchema' is required in config when 'responseFormat' is 'json_schema'")});else i.response_format={type:l};}return i}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let t=e.map(s=>{let a=types.Message().safeParse(s);if(!a.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:a.error});return a.data});return t.forEach(s=>{s.content.forEach(a=>{if(!this.modelSchema.modalities.includes(a.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelSchema.name}'`,cause:new Error(`model : '${this.modelSchema.name}' does not support modality : '${a.modality}',
|
|
10
10
|
available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),t.forEach(s=>{if(!Object.keys(this.modelSchema.roles).includes(s.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelSchema.name}'`,cause:new Error(`model : '${this.modelSchema.name}' does not support role : '${s.role}',
|
|
11
|
-
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:t.map(s=>{switch(s.role){case types.SystemRoleLiteral:{let a=[];return s.content.forEach(
|
|
12
|
-
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelSchema.name}`,cause:new Error(`model : '${this.modelSchema.name}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(s=>{let a=types.Tool().safeParse(s);if(!a.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:a.error});return a.data}).map(s=>({type:"function",function:s.definition.schema}))}}getCompleteChatUrl(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,t,o){return I(this,null,function*(){let s=this.transformConfig(e,t,o),a=this.transformMessages(t);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let
|
|
13
|
-
`).filter(m=>m.trim()!=="");for(let m of o){if(m==="data: [DONE]")return;if(m.startsWith("data: {")&&m.endsWith("}")){let i;try{i=JSON.parse(m.substring(6));}catch(c){throw new provider.ModelResponseError({info:"Malformed JSON received in stream",cause:new Error(`Malformed JSON received in stream : ${i}`)})}let l=nt.safeParse(i);if(l.success){let c={partialMessages:[]},d=l.data;if(d.choices.length>0){let f=d.choices[0].delta;if(f!==void 0&&Object.keys(f).length!==0){if("content"in f&&f.content!==null)c.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,f.content));else if("refusal"in f&&f.refusal!==null)c.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,f.refusal));else if("tool_calls"in f&&f.tool_calls!==void 0){let g=f.tool_calls.at(0);c.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,g.index,g.id,(s=g.function)==null?void 0:s.name,(a=g.function)==null?void 0:a.arguments));}}}d.usage&&(c.usage={promptTokens:d.usage.prompt_tokens,completionTokens:d.usage.completion_tokens,totalTokens:d.usage.total_tokens}),yield {partialResponse:c,buffer:t};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:l.error})}}})}};var V=class extends _{constructor(e,t){super(e,t);}transformModelRequest(e){let t=st.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=x(y({},o),{max_tokens:o.max_completion_tokens});return delete s.max_completion_tokens,super.transformModelRequest(s)}transformTools(e){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support 'tools'.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support 'tools'.`)})}getStreamChatUrl(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}getStreamChatHeaders(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}getStreamChatData(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}transformStreamChatResponseChunk(e,t){return W(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}};var Ze="gpt-3.5-turbo-0125",An="The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls. Training data up to Sept 2021.",Qe=provider.ChatModelSchema(b,P).parse({name:Ze,description:An,maxInputTokens:4092,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),lt=T,he=class extends _{constructor(e){super(Qe,e);}};var eo="gpt-3.5-turbo-1106",vn="The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. Training data up to Sept 2021.",oo=provider.ChatModelSchema(b,P).parse({name:eo,description:vn,maxInputTokens:4092,maxOutputTokens:16385,roles:C,modalities:S,config:{def:h.responseFormat(16385,4).def,schema:h.responseFormat(16385,4).schema}}),mt=T,ue=class extends _{constructor(e){super(oo,e);}};var to="gpt-3.5-turbo",qn="Currently points to gpt-3.5-turbo-0125. Training data up to Sept 2021.",no=provider.ChatModelSchema(b,P).parse({name:to,description:qn,maxInputTokens:4092,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),pt=T,fe=class extends _{constructor(e){super(no,e);}};var so="gpt-4-0125-preview",jn="The latest GPT-4 model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task. Training data up to Apr 2023.",ao=provider.ChatModelSchema(b,P).parse({name:so,description:jn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),dt=T,ge=class extends _{constructor(e){super(ao,e);}};var io="gpt-4-0613",zn="Snapshot of gpt-4 from June 13th 2023 with improved function calling support. Training data up to Sept 2021.",ro=provider.ChatModelSchema(b,P).parse({name:io,description:zn,maxInputTokens:8192,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),ct=T,Te=class extends _{constructor(e){super(ro,e);}};var lo="gpt-4-1106-preview",Bn="GPT-4 Turbo model featuring improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. This preview model is not yet suited for production traffic. Training data up to Apr 2023.",mo=provider.ChatModelSchema(b,P).parse({name:lo,description:Bn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),ht=T,_e=class extends _{constructor(e){super(mo,e);}};var po="gpt-4-turbo-2024-04-09",Un="GPT-4 Turbo with Vision model. Vision requests can now use JSON mode and function calling. gpt-4-turbo currently points to this version. Training data up to Dec 2023.",co=provider.ChatModelSchema(b,G).parse({name:po,description:Un,maxInputTokens:128e3,maxOutputTokens:4096,roles:C,modalities:v,config:{def:h.responseFormat(4096,4).def,schema:h.responseFormat(4096,4).schema}}),ut=T,ye=class extends _{constructor(e){super(co,e);}};var ho="gpt-4-turbo-preview",Nn="Currently points to gpt-4-0125-preview. Training data up to Apr 2023.",uo=provider.ChatModelSchema(b,P).parse({name:ho,description:Nn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),ft=T,be=class extends _{constructor(e){super(uo,e);}};var fo="gpt-4-turbo",Kn="The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09. Training data up to Dec 2023.",go=provider.ChatModelSchema(b,G).parse({name:fo,description:Kn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:v,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),gt=T,Ce=class extends _{constructor(e){super(go,e);}};var To="gpt-4",Jn="Currently points to gpt-4-0613. Training data up to Sept 2021.",_o=provider.ChatModelSchema(b,P).parse({name:To,description:Jn,maxInputTokens:8192,maxOutputTokens:4092,roles:C,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),Tt=T,Oe=class extends _{constructor(e){super(_o,e);}};var yo="gpt-4o-2024-08-06",Yn="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",bo=provider.ChatModelSchema(b,G).parse({name:yo,description:Yn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:v,config:{def:h.responseSchema(4092,4).def,schema:h.responseSchema(4092,4).schema}}),_t=T,Me=class extends _{constructor(e){super(bo,e);}};var Co="gpt-4o-mini",Zn="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Oo=provider.ChatModelSchema(b,G).parse({name:Co,description:Zn,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:v,config:{def:h.responseSchema(4092,4).def,schema:h.responseSchema(4092,4).schema}}),yt=T,Se=class extends _{constructor(e){super(Oo,e);}};var Mo="gpt-4o",es="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",So=provider.ChatModelSchema(b,G).parse({name:Mo,description:es,maxInputTokens:128e3,maxOutputTokens:4092,roles:C,modalities:v,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),bt=T,Pe=class extends _{constructor(e){super(So,e);}};var Po="o1-mini",ts="Faster and cheaper reasoning model particularly good at coding, math, and science. Training data up to Oct 2023.",Io=provider.ChatModelSchema(ne,le).parse({name:Po,description:ts,maxInputTokens:128e3,maxOutputTokens:4092,roles:se,modalities:re,config:{def:h.oSeries(4092,4).def,schema:h.oSeries(4092,4).schema}}),Ct=T,Ie=class extends V{constructor(e){super(Io,e);}};var xo="o1-preview",ss="Reasoning model designed to solve hard problems across domains. Training data up to Oct 2023.",Ro=provider.ChatModelSchema(ne,le).parse({name:xo,description:ss,maxInputTokens:128e3,maxOutputTokens:4092,roles:se,modalities:re,config:{def:h.oSeries(4092,4).def,schema:h.oSeries(4092,4).schema}}),Ot=T,xe=class extends V{constructor(e){super(Ro,e);}};var K=[types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral],H=zod.z.enum([types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral]);var Pt=zod.z.object({object:zod.z.literal("list"),model:zod.z.string(),data:zod.z.array(zod.z.object({index:zod.z.number(),object:zod.z.literal("embedding"),embedding:zod.z.array(zod.z.number()).or(zod.z.string().base64())})),usage:zod.z.object({prompt_tokens:zod.z.number().nonnegative(),total_tokens:zod.z.number().nonnegative()})});var is=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)).or(zod.z.array(zod.z.number().int().nonnegative()).min(1)).or(zod.z.array(zod.z.array(zod.z.number().int().nonnegative()).min(1)).min(1)),It=zod.z.object({model:zod.z.string().min(1).optional(),input:is,encoding_format:zod.z.enum(["float","base64"]).optional(),dimensions:zod.z.number().int().min(1).optional()});var $=zod.z.object({apiKey:zod.z.string(),baseUrl:zod.z.string().url(),getEmbeddingsUrl:zod.z.string().url().optional()}),j=class{constructor(e,t){this.version="v1";let o=$.parse(t);this.modelSchema=e,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(o.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",source:"adaline.ai"}}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let t=i=>{let l=/(\d+)(h|m|s|ms)/g,c={h:36e5,m:6e4,s:1e3,ms:1},d,f=0;for(;(d=l.exec(i))!==null;){let g=parseInt(d[1]),O=d[2];f+=g*c[O];}return f},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=t(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=t(e["x-ratelimit-reset-tokens"]));let m=Math.max(o,s);return {shouldRetry:a,delayMs:m}}getTokenCount(e){return e.requests.reduce((t,o)=>t+o.length,0)}transformModelRequest(e){let t=It.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=o.model,a={encodingFormat:o.encoding_format,dimensions:o.dimensions},m=types.Config().parse(provider.removeUndefinedEntries(a)),i,l;return typeof o.input=="string"?l=types.EmbeddingTextModalityLiteral:typeof o.input[0]=="string"?l=types.EmbeddingTextModalityLiteral:l=types.EmbeddingTokenModalityLiteral,l===types.EmbeddingTextModalityLiteral?typeof o.input=="string"?i={modality:l,requests:[o.input]}:i={modality:l,requests:o.input}:typeof o.input[0]=="number"?i={modality:l,requests:[o.input]}:i={modality:l,requests:o.input},{modelName:s,config:m,embeddingRequests:i}}transformConfig(e,t){let o=this.modelSchema.config.schema.safeParse(e);if(!o.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:o.error});let s=o.data;return Object.keys(s).forEach(m=>{if(!this.modelSchema.config.def[m])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${m}',
|
|
14
|
-
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((
|
|
15
|
-
[${this.chatModelLiterals().join(", ")}]`)});let o=this.chatModelFactories[e].model,s=
|
|
16
|
-
[${this.chatModelLiterals().join(", ")}]`)});return this.chatModelFactories[e].modelSchema}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,t)=>(e[t]=this.chatModelFactories[t].modelSchema,e),{})}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModel(e,t){var
|
|
17
|
-
[${this.embeddingModelLiterals().join(", ")}]`)});let o=this.embeddingModelFactories[e].model,s=
|
|
11
|
+
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:t.map(s=>{switch(s.role){case types.SystemRoleLiteral:{let a=[];return s.content.forEach(p=>{if(p.modality===types.TextModalityLiteral)a.push({type:"text",text:p.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelSchema.name}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${p.modality}'`)})}),{role:this.modelSchema.roles[s.role],content:a}}case types.AssistantRoleLiteral:{let a=[],p=[];return s.content.forEach(i=>{if(i.modality===types.TextModalityLiteral)a.push({type:"text",text:i.value});else if(i.modality===types.ToolCallModalityLiteral)p.push({id:i.id,type:"function",function:{name:i.name,arguments:i.arguments}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelSchema.name}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${i.modality}'`)})}),_({role:this.modelSchema.roles[s.role],content:a},p.length>0?{tool_calls:p}:{})}case types.UserRoleLiteral:{let a=[],p=[];s.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)a.push({type:"text",text:l.value});else if(l.modality===types.ImageModalityLiteral)p.push({type:"image_url",image_url:{url:l.value.type==="url"?l.value.url:l.value.base64,detail:l.detail}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelSchema.name}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${l.modality}'`)})});let i=[...a,...p];return {role:this.modelSchema.roles[s.role],content:i}}case types.ToolRoleLiteral:{if(s.content.length!==1)throw new provider.InvalidMessagesError({info:`Invalid message for role : '${s.role}'`,cause:new Error(`role : '${s.role}' must have exactly one content item`)});if(s.content[0].modality!==types.ToolResponseModalityLiteral)throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelSchema.name}`,cause:new Error(`role : '${s.role}' must have content with modality : '${types.ToolResponseModalityLiteral}'`)});let a=s.content[0];return {role:this.modelSchema.roles[s.role],tool_call_id:a.id,content:a.data}}default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelSchema.name}`,cause:new Error(`role : '${s.role}' is not supported,
|
|
12
|
+
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelSchema.name}`,cause:new Error(`model : '${this.modelSchema.name}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(s=>{let a=types.Tool().safeParse(s);if(!a.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:a.error});return a.data}).map(s=>({type:"function",function:s.definition.schema}))}}getCompleteChatUrl(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,t,o){return I(this,null,function*(){let s=this.transformConfig(e,t,o),a=this.transformMessages(t);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let p=o?this.transformTools(o):{};return new Promise(i=>{i(_(_(_(_({},this.getDefaultParams()),s),a),p));})})}transformCompleteChatResponse(e){let t=tt.safeParse(e);if(t.success){if(t.data.choices.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(t.data)}`)});let o=t.data,s=[],a=o.choices[0].message;a.content&&s.push(types.createTextMessage(types.AssistantRoleLiteral,a.content)),a.refusal&&s.push(types.createTextMessage(types.AssistantRoleLiteral,a.refusal)),a.tool_calls&&a.tool_calls.forEach((c,d)=>{s.push(types.createToolCallMessage(types.AssistantRoleLiteral,d,c.id,c.function.name,c.function.arguments));});let p={promptTokens:o.usage.prompt_tokens,completionTokens:o.usage.completion_tokens,totalTokens:o.usage.total_tokens},i=[],l=o.choices[0].logprobs;return l&&(l.content&&i.push(...l.content.map(c=>({token:c.token,logProb:c.logprob,bytes:c.bytes,topLogProbs:c.top_logprobs.map(d=>({token:d.token,logProb:d.logprob,bytes:d.bytes}))}))),l.refusal&&i.push(...l.refusal.map(c=>({token:c.token,logProb:c.logprob,bytes:c.bytes,topLogProbs:c.top_logprobs.map(d=>({token:d.token,logProb:d.logprob,bytes:d.bytes}))})))),{messages:s,usage:p,logProbs:i}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:t.error})}getStreamChatUrl(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,t,o){return I(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,t,o){return I(this,null,function*(){let s=this.transformConfig(e,t,o),a=this.transformMessages(t);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let p=o?this.transformTools(o):{};return new Promise(i=>{i(_(_(_(_({stream:!0,stream_options:{include_usage:!0}},this.getDefaultParams()),s),a),p));})})}transformStreamChatResponseChunk(e,t){return J(this,null,function*(){var s,a;let o=(t+e).split(`
|
|
13
|
+
`).filter(p=>p.trim()!=="");for(let p of o){if(p==="data: [DONE]")return;if(p.startsWith("data: {")&&p.endsWith("}")){let i;try{i=JSON.parse(p.substring(6));}catch(c){throw new provider.ModelResponseError({info:"Malformed JSON received in stream",cause:new Error(`Malformed JSON received in stream : ${i}`)})}let l=nt.safeParse(i);if(l.success){let c={partialMessages:[]},d=l.data;if(d.choices.length>0){let u=d.choices[0].delta;if(u!==void 0&&Object.keys(u).length!==0){if("content"in u&&u.content!==null)c.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,u.content));else if("refusal"in u&&u.refusal!==null)c.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,u.refusal));else if("tool_calls"in u&&u.tool_calls!==void 0){let f=u.tool_calls.at(0);c.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,f.index,f.id,(s=f.function)==null?void 0:s.name,(a=f.function)==null?void 0:a.arguments));}}}d.usage&&(c.usage={promptTokens:d.usage.prompt_tokens,completionTokens:d.usage.completion_tokens,totalTokens:d.usage.total_tokens}),yield {partialResponse:c,buffer:t};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:l.error})}}})}};var N=class extends T{constructor(e,t){super(e,t);}transformModelRequest(e){let t=st.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=E(_({},o),{max_tokens:o.max_completion_tokens});return delete s.max_completion_tokens,super.transformModelRequest(s)}transformTools(e){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support 'tools'.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support 'tools'.`)})}getStreamChatUrl(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}getStreamChatHeaders(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}getStreamChatData(e,t,o){return I(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}transformStreamChatResponseChunk(e,t){return J(this,null,function*(){throw new provider.ModelError({info:`Model: '${this.modelSchema.name}' does not support streaming.`,cause:new Error(`Model: '${this.modelSchema.name}' does not support streaming.`)})})}};var Qe="gpt-3.5-turbo-0125",En="The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls. Training data up to Sept 2021.",Ze=provider.ChatModelSchema(y,P).parse({name:Qe,description:En,maxInputTokens:4092,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),lt=g,he=class extends T{constructor(e){super(Ze,e);}};var eo="gpt-3.5-turbo-1106",xn="The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. Training data up to Sept 2021.",oo=provider.ChatModelSchema(y,P).parse({name:eo,description:xn,maxInputTokens:4092,maxOutputTokens:16385,roles:b,modalities:S,config:{def:h.responseFormat(16385,4).def,schema:h.responseFormat(16385,4).schema}}),pt=g,ue=class extends T{constructor(e){super(oo,e);}};var to="gpt-3.5-turbo",wn="Currently points to gpt-3.5-turbo-0125. Training data up to Sept 2021.",no=provider.ChatModelSchema(y,P).parse({name:to,description:wn,maxInputTokens:4092,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),mt=g,fe=class extends T{constructor(e){super(no,e);}};var so="gpt-4-0125-preview",vn="The latest GPT-4 model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task. Training data up to Apr 2023.",ao=provider.ChatModelSchema(y,P).parse({name:so,description:vn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),dt=g,ge=class extends T{constructor(e){super(ao,e);}};var io="gpt-4-0613",kn="Snapshot of gpt-4 from June 13th 2023 with improved function calling support. Training data up to Sept 2021.",ro=provider.ChatModelSchema(y,P).parse({name:io,description:kn,maxInputTokens:8192,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),ct=g,Te=class extends T{constructor(e){super(ro,e);}};var lo="gpt-4-1106-preview",jn="GPT-4 Turbo model featuring improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. This preview model is not yet suited for production traffic. Training data up to Apr 2023.",po=provider.ChatModelSchema(y,P).parse({name:lo,description:jn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),ht=g,_e=class extends T{constructor(e){super(po,e);}};var mo="gpt-4-turbo-2024-04-09",Bn="GPT-4 Turbo with Vision model. Vision requests can now use JSON mode and function calling. gpt-4-turbo currently points to this version. Training data up to Dec 2023.",co=provider.ChatModelSchema(y,G).parse({name:mo,description:Bn,maxInputTokens:128e3,maxOutputTokens:4096,roles:b,modalities:w,config:{def:h.responseFormat(4096,4).def,schema:h.responseFormat(4096,4).schema}}),ut=g,ye=class extends T{constructor(e){super(co,e);}};var ho="gpt-4-turbo-preview",$n="Currently points to gpt-4-0125-preview. Training data up to Apr 2023.",uo=provider.ChatModelSchema(y,P).parse({name:ho,description:$n,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),ft=g,be=class extends T{constructor(e){super(uo,e);}};var fo="gpt-4-turbo",Dn="The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09. Training data up to Dec 2023.",go=provider.ChatModelSchema(y,G).parse({name:fo,description:Dn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:w,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),gt=g,Ce=class extends T{constructor(e){super(go,e);}};var To="gpt-4",Hn="Currently points to gpt-4-0613. Training data up to Sept 2021.",_o=provider.ChatModelSchema(y,P).parse({name:To,description:Hn,maxInputTokens:8192,maxOutputTokens:4092,roles:b,modalities:S,config:{def:h.base(4092,4).def,schema:h.base(4092,4).schema}}),Tt=g,Oe=class extends T{constructor(e){super(_o,e);}};var yo="gpt-4o-2024-08-06",Kn="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",bo=provider.ChatModelSchema(y,G).parse({name:yo,description:Kn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:w,config:{def:h.responseSchema(4092,4).def,schema:h.responseSchema(4092,4).schema}}),_t=g,Me=class extends T{constructor(e){super(bo,e);}};var Co="gpt-4o-mini",Wn="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Oo=provider.ChatModelSchema(y,G).parse({name:Co,description:Wn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:w,config:{def:h.responseSchema(4092,4).def,schema:h.responseSchema(4092,4).schema}}),yt=g,Se=class extends T{constructor(e){super(Oo,e);}};var Mo="gpt-4o",Xn="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",So=provider.ChatModelSchema(y,G).parse({name:Mo,description:Xn,maxInputTokens:128e3,maxOutputTokens:4092,roles:b,modalities:w,config:{def:h.responseFormat(4092,4).def,schema:h.responseFormat(4092,4).schema}}),bt=g,Pe=class extends T{constructor(e){super(So,e);}};var Po="o1-mini",Zn="Faster and cheaper reasoning model particularly good at coding, math, and science. Training data up to Oct 2023.",Io=provider.ChatModelSchema(ne,le).parse({name:Po,description:Zn,maxInputTokens:128e3,maxOutputTokens:4092,roles:se,modalities:re,config:{def:h.oSeries(4092,4).def,schema:h.oSeries(4092,4).schema}}),Ct=g,Ie=class extends N{constructor(e){super(Io,e);}};var Eo="o1-preview",os="Reasoning model designed to solve hard problems across domains. Training data up to Oct 2023.",Ro=provider.ChatModelSchema(ne,le).parse({name:Eo,description:os,maxInputTokens:128e3,maxOutputTokens:4092,roles:se,modalities:re,config:{def:h.oSeries(4092,4).def,schema:h.oSeries(4092,4).schema}}),Ot=g,Ee=class extends N{constructor(e){super(Ro,e);}};var H=[types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral],V=zod.z.enum([types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral]);var Pt=zod.z.object({object:zod.z.literal("list"),model:zod.z.string(),data:zod.z.array(zod.z.object({index:zod.z.number(),object:zod.z.literal("embedding"),embedding:zod.z.array(zod.z.number()).or(zod.z.string().base64())})),usage:zod.z.object({prompt_tokens:zod.z.number().nonnegative(),total_tokens:zod.z.number().nonnegative()})});var ns=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)).or(zod.z.array(zod.z.number().int().nonnegative()).min(1)).or(zod.z.array(zod.z.array(zod.z.number().int().nonnegative()).min(1)).min(1)),It=zod.z.object({model:zod.z.string().min(1).optional(),input:ns,encoding_format:zod.z.enum(["float","base64"]).optional(),dimensions:zod.z.number().int().min(1).optional()});var z=zod.z.object({apiKey:zod.z.string(),baseUrl:zod.z.string().url(),getEmbeddingsUrl:zod.z.string().url().optional()}),k=class{constructor(e,t){this.version="v1";let o=z.parse(t);this.modelSchema=e,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(o.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",source:"adaline.ai"}}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let t=i=>{let l=/(\d+)(h|m|s|ms)/g,c={h:36e5,m:6e4,s:1e3,ms:1},d,u=0;for(;(d=l.exec(i))!==null;){let f=parseInt(d[1]),C=d[2];u+=f*c[C];}return u},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=t(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=t(e["x-ratelimit-reset-tokens"]));let p=Math.max(o,s);return {shouldRetry:a,delayMs:p}}getTokenCount(e){return e.requests.reduce((t,o)=>t+o.length,0)}transformModelRequest(e){let t=It.safeParse(e);if(!t.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:t.error});let o=t.data,s=o.model,a={encodingFormat:o.encoding_format,dimensions:o.dimensions},p=types.Config().parse(provider.removeUndefinedEntries(a)),i,l;return typeof o.input=="string"?l=types.EmbeddingTextModalityLiteral:typeof o.input[0]=="string"?l=types.EmbeddingTextModalityLiteral:l=types.EmbeddingTokenModalityLiteral,l===types.EmbeddingTextModalityLiteral?typeof o.input=="string"?i={modality:l,requests:[o.input]}:i={modality:l,requests:o.input}:typeof o.input[0]=="number"?i={modality:l,requests:[o.input]}:i={modality:l,requests:o.input},{modelName:s,config:p,embeddingRequests:i}}transformConfig(e,t){let o=this.modelSchema.config.schema.safeParse(e);if(!o.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:o.error});let s=o.data;return Object.keys(s).forEach(p=>{if(!this.modelSchema.config.def[p])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${p}',
|
|
14
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((p,i)=>{let c=this.modelSchema.config.def[i].param,d=s[i];return p[c]=d,p},{})}transformEmbeddingRequests(e){let t=types.EmbeddingRequests().safeParse(e);if(!t.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:t.error});return {input:t.data.requests}}getGetEmbeddingsUrl(e,t){return I(this,null,function*(){return new Promise(o=>{o(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,t){return I(this,null,function*(){return new Promise(o=>{o(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,t){return I(this,null,function*(){return new Promise(o=>{o(_(_(_({},this.getDefaultParams()),this.transformConfig(e,t)),this.transformEmbeddingRequests(t)));})})}transformGetEmbeddingsResponse(e){let t,o=Pt.safeParse(e);if(o.success){let s=o.data;t=typeof s.data[0].embedding=="string"?types.Base64EmbeddingLiteral:types.FloatEmbeddingLiteral;let a=s.data.map(p=>typeof p.embedding=="string"?{index:p.index,embedding:p.embedding}:{index:p.index,embedding:p.embedding});return {encodingFormat:t,embeddings:a,usage:{totalTokens:s.usage.total_tokens}}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var Ao="text-embedding-ada-002",us="Most capable 2nd generation embedding model, replacing 16 first generation models",wo=provider.EmbeddingModelSchema(V).parse({name:Ao,description:us,modalities:H,maxInputTokens:8192,maxOutputTokens:1536,config:{def:v.base().def,schema:v.base().schema}}),xt=z,xe=class extends k{constructor(e){super(wo,e);}};var Go="text-embedding-3-small",gs="Increased performance over 2nd generation ada embedding model",vo=provider.EmbeddingModelSchema(V).parse({name:Go,description:gs,modalities:H,maxInputTokens:8192,maxOutputTokens:1536,config:{def:v.dimensions(1536).def,schema:v.dimensions(1536).schema}}),At=z,Ae=class extends k{constructor(e){super(vo,e);}};var qo="text-embedding-3-large",_s="Most capable embedding model for both english and non-english tasks",ko=provider.EmbeddingModelSchema(V).parse({name:qo,description:_s,modalities:H,maxInputTokens:8192,maxOutputTokens:3072,config:{def:v.dimensions(3072).def,schema:v.dimensions(3072).schema}}),wt=z,we=class extends k{constructor(e){super(ko,e);}};var ys="openai",Gt=class{constructor(){this.version="v1";this.name=ys;this.baseUrl="https://api.openai.com/v1";this.chatModelFactories={[to]:{model:fe,modelOptions:mt,modelSchema:no},[Qe]:{model:he,modelOptions:lt,modelSchema:Ze},[eo]:{model:ue,modelOptions:pt,modelSchema:oo},[so]:{model:ge,modelOptions:dt,modelSchema:ao},[io]:{model:Te,modelOptions:ct,modelSchema:ro},[lo]:{model:_e,modelOptions:ht,modelSchema:po},[mo]:{model:ye,modelOptions:ut,modelSchema:co},[ho]:{model:be,modelOptions:ft,modelSchema:uo},[fo]:{model:Ce,modelOptions:gt,modelSchema:go},[To]:{model:Oe,modelOptions:Tt,modelSchema:_o},[yo]:{model:Me,modelOptions:_t,modelSchema:bo},[Co]:{model:Se,modelOptions:yt,modelSchema:Oo},[Mo]:{model:Pe,modelOptions:bt,modelSchema:So},[Po]:{model:Ie,modelOptions:Ct,modelSchema:Io},[Eo]:{model:Ee,modelOptions:Ot,modelSchema:Ro}};this.embeddingModelFactories={[Ao]:{model:xe,modelOptions:xt,modelSchema:wo},[Go]:{model:Ae,modelOptions:At,modelSchema:vo},[qo]:{model:we,modelOptions:wt,modelSchema:ko}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModel(e,t){var p;if(!(e in this.chatModelFactories))throw new provider.ProviderError({info:`OpenAI chat model: ${e} not found`,cause:new Error(`OpenAI chat model: ${e} not found, available chat models:
|
|
15
|
+
[${this.chatModelLiterals().join(", ")}]`)});let o=this.chatModelFactories[e].model,s=E(_({},t),{baseUrl:(p=t.baseUrl)!=null?p:this.baseUrl}),a=this.chatModelFactories[e].modelOptions.parse(s);return new o(a)}chatModelSchema(e){if(!(e in this.chatModelFactories))throw new provider.ProviderError({info:`OpenAI chat model: ${e} not found `,cause:new Error(`OpenAI chat model: ${e} not found, available chat models:
|
|
16
|
+
[${this.chatModelLiterals().join(", ")}]`)});return this.chatModelFactories[e].modelSchema}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,t)=>(e[t]=this.chatModelFactories[t].modelSchema,e),{})}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModel(e,t){var p;if(!(e in this.embeddingModelFactories))throw new provider.ProviderError({info:`OpenAI embedding model: ${e} not found`,cause:new Error(`OpenAI embedding model: ${e} not found, available embedding models:
|
|
17
|
+
[${this.embeddingModelLiterals().join(", ")}]`)});let o=this.embeddingModelFactories[e].model,s=E(_({},t),{baseUrl:(p=t.baseUrl)!=null?p:this.baseUrl}),a=this.embeddingModelFactories[e].modelOptions.parse(s);return new o(a)}embeddingModelSchema(e){if(!(e in this.embeddingModelFactories))throw new provider.ProviderError({info:`OpenAI embedding model: ${e} not found`,cause:new Error(`OpenAI embedding model: ${e} not found, available embedding models:
|
|
18
18
|
[${this.embeddingModelLiterals().join(", ")}]`)});return this.embeddingModelFactories[e].modelSchema}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,t)=>(e[t]=this.embeddingModelFactories[t].modelSchema,e),{})}};
|
|
19
19
|
|
|
20
|
-
exports.BaseChatModel =
|
|
21
|
-
exports.BaseChatModelOptions =
|
|
22
|
-
exports.BaseEmbeddingModel =
|
|
23
|
-
exports.BaseEmbeddingModelOptions =
|
|
24
|
-
exports.BaseOSeriesChatModel =
|
|
20
|
+
exports.BaseChatModel = T;
|
|
21
|
+
exports.BaseChatModelOptions = g;
|
|
22
|
+
exports.BaseEmbeddingModel = k;
|
|
23
|
+
exports.BaseEmbeddingModelOptions = z;
|
|
24
|
+
exports.BaseOSeriesChatModel = N;
|
|
25
25
|
exports.ChatModelBaseConfigDef = F;
|
|
26
26
|
exports.ChatModelBaseConfigSchema = B;
|
|
27
|
-
exports.ChatModelOSeriesConfigDef =
|
|
27
|
+
exports.ChatModelOSeriesConfigDef = Ko;
|
|
28
28
|
exports.ChatModelOSeriesConfigSchema = Jo;
|
|
29
|
-
exports.ChatModelResponseFormatConfigDef =
|
|
30
|
-
exports.ChatModelResponseFormatConfigSchema =
|
|
29
|
+
exports.ChatModelResponseFormatConfigDef = Fo;
|
|
30
|
+
exports.ChatModelResponseFormatConfigSchema = $o;
|
|
31
31
|
exports.ChatModelResponseSchemaConfigDef = Y;
|
|
32
32
|
exports.ChatModelResponseSchemaConfigSchema = X;
|
|
33
33
|
exports.EmbeddingModelBaseConfigDef = ee;
|
|
34
|
-
exports.EmbeddingModelBaseConfigSchema =
|
|
34
|
+
exports.EmbeddingModelBaseConfigSchema = Z;
|
|
35
35
|
exports.EmbeddingModelDimensionsConfigDef = Yo;
|
|
36
36
|
exports.EmbeddingModelDimensionsConfigSchema = Wo;
|
|
37
37
|
exports.GPT_3_5_Turbo = fe;
|
|
38
38
|
exports.GPT_3_5_TurboLiteral = to;
|
|
39
|
-
exports.GPT_3_5_TurboOptions =
|
|
39
|
+
exports.GPT_3_5_TurboOptions = mt;
|
|
40
40
|
exports.GPT_3_5_TurboSchema = no;
|
|
41
41
|
exports.GPT_3_5_Turbo_0125 = he;
|
|
42
|
-
exports.GPT_3_5_Turbo_0125Literal =
|
|
42
|
+
exports.GPT_3_5_Turbo_0125Literal = Qe;
|
|
43
43
|
exports.GPT_3_5_Turbo_0125Options = lt;
|
|
44
|
-
exports.GPT_3_5_Turbo_0125Schema =
|
|
44
|
+
exports.GPT_3_5_Turbo_0125Schema = Ze;
|
|
45
45
|
exports.GPT_3_5_Turbo_1106 = ue;
|
|
46
46
|
exports.GPT_3_5_Turbo_1106Literal = eo;
|
|
47
|
-
exports.GPT_3_5_Turbo_1106Options =
|
|
47
|
+
exports.GPT_3_5_Turbo_1106Options = pt;
|
|
48
48
|
exports.GPT_3_5_Turbo_1106Schema = oo;
|
|
49
49
|
exports.GPT_4 = Oe;
|
|
50
50
|
exports.GPT_4Literal = To;
|
|
@@ -61,13 +61,13 @@ exports.GPT_4_0613Schema = ro;
|
|
|
61
61
|
exports.GPT_4_1106_Preview = _e;
|
|
62
62
|
exports.GPT_4_1106_PreviewLiteral = lo;
|
|
63
63
|
exports.GPT_4_1106_PreviewOptions = ht;
|
|
64
|
-
exports.GPT_4_1106_PreviewSchema =
|
|
64
|
+
exports.GPT_4_1106_PreviewSchema = po;
|
|
65
65
|
exports.GPT_4_Turbo = Ce;
|
|
66
66
|
exports.GPT_4_TurboLiteral = fo;
|
|
67
67
|
exports.GPT_4_TurboOptions = gt;
|
|
68
68
|
exports.GPT_4_TurboSchema = go;
|
|
69
69
|
exports.GPT_4_Turbo_2024_04_09 = ye;
|
|
70
|
-
exports.GPT_4_Turbo_2024_04_09Literal =
|
|
70
|
+
exports.GPT_4_Turbo_2024_04_09Literal = mo;
|
|
71
71
|
exports.GPT_4_Turbo_2024_04_09Options = ut;
|
|
72
72
|
exports.GPT_4_Turbo_2024_04_09Schema = co;
|
|
73
73
|
exports.GPT_4_Turbo_Preview = be;
|
|
@@ -90,70 +90,70 @@ exports.O1_Mini = Ie;
|
|
|
90
90
|
exports.O1_MiniLiteral = Po;
|
|
91
91
|
exports.O1_MiniOptions = Ct;
|
|
92
92
|
exports.O1_MiniSchema = Io;
|
|
93
|
-
exports.O1_Preview =
|
|
94
|
-
exports.O1_PreviewLiteral =
|
|
93
|
+
exports.O1_Preview = Ee;
|
|
94
|
+
exports.O1_PreviewLiteral = Eo;
|
|
95
95
|
exports.O1_PreviewOptions = Ot;
|
|
96
96
|
exports.O1_PreviewSchema = Ro;
|
|
97
|
-
exports.OpenAI =
|
|
97
|
+
exports.OpenAI = Gt;
|
|
98
98
|
exports.OpenAIChatModelConfigs = h;
|
|
99
|
-
exports.OpenAIChatModelModalities =
|
|
99
|
+
exports.OpenAIChatModelModalities = w;
|
|
100
100
|
exports.OpenAIChatModelModalitiesEnum = G;
|
|
101
101
|
exports.OpenAIChatModelOSSeriesRoles = ne;
|
|
102
102
|
exports.OpenAIChatModelOSSeriesRolesMap = se;
|
|
103
|
-
exports.OpenAIChatModelRoles =
|
|
104
|
-
exports.OpenAIChatModelRolesMap =
|
|
103
|
+
exports.OpenAIChatModelRoles = y;
|
|
104
|
+
exports.OpenAIChatModelRolesMap = b;
|
|
105
105
|
exports.OpenAIChatModelTextModalities = re;
|
|
106
106
|
exports.OpenAIChatModelTextModalitiesEnum = le;
|
|
107
107
|
exports.OpenAIChatModelTextToolModalities = S;
|
|
108
108
|
exports.OpenAIChatModelTextToolModalitiesEnum = P;
|
|
109
109
|
exports.OpenAIChatOSeriesRequest = st;
|
|
110
|
-
exports.OpenAIChatRequest =
|
|
111
|
-
exports.OpenAIChatRequestAssistantMessage =
|
|
112
|
-
exports.OpenAIChatRequestImageContent =
|
|
113
|
-
exports.OpenAIChatRequestMessage =
|
|
114
|
-
exports.OpenAIChatRequestResponseFormat =
|
|
115
|
-
exports.OpenAIChatRequestSystemMessage =
|
|
116
|
-
exports.OpenAIChatRequestTextContent =
|
|
117
|
-
exports.OpenAIChatRequestTool =
|
|
118
|
-
exports.OpenAIChatRequestToolCallContent =
|
|
119
|
-
exports.OpenAIChatRequestToolChoiceEnum =
|
|
120
|
-
exports.OpenAIChatRequestToolChoiceFunction =
|
|
121
|
-
exports.OpenAIChatRequestToolMessage =
|
|
122
|
-
exports.OpenAIChatRequestUserMessage =
|
|
110
|
+
exports.OpenAIChatRequest = me;
|
|
111
|
+
exports.OpenAIChatRequestAssistantMessage = pn;
|
|
112
|
+
exports.OpenAIChatRequestImageContent = sn;
|
|
113
|
+
exports.OpenAIChatRequestMessage = dn;
|
|
114
|
+
exports.OpenAIChatRequestResponseFormat = nn;
|
|
115
|
+
exports.OpenAIChatRequestSystemMessage = rn;
|
|
116
|
+
exports.OpenAIChatRequestTextContent = Ke;
|
|
117
|
+
exports.OpenAIChatRequestTool = en;
|
|
118
|
+
exports.OpenAIChatRequestToolCallContent = an;
|
|
119
|
+
exports.OpenAIChatRequestToolChoiceEnum = on;
|
|
120
|
+
exports.OpenAIChatRequestToolChoiceFunction = tn;
|
|
121
|
+
exports.OpenAIChatRequestToolMessage = mn;
|
|
122
|
+
exports.OpenAIChatRequestUserMessage = ln;
|
|
123
123
|
exports.OpenAICompleteChatResponse = tt;
|
|
124
|
-
exports.OpenAIEmbeddingModelConfigs =
|
|
125
|
-
exports.OpenAIEmbeddingModelModalities =
|
|
126
|
-
exports.OpenAIEmbeddingModelModalitiesEnum =
|
|
124
|
+
exports.OpenAIEmbeddingModelConfigs = v;
|
|
125
|
+
exports.OpenAIEmbeddingModelModalities = H;
|
|
126
|
+
exports.OpenAIEmbeddingModelModalitiesEnum = V;
|
|
127
127
|
exports.OpenAIEmbeddingRequest = It;
|
|
128
|
-
exports.OpenAIEmbeddingRequestInput =
|
|
128
|
+
exports.OpenAIEmbeddingRequestInput = ns;
|
|
129
129
|
exports.OpenAIGetEmbeddingsResponse = Pt;
|
|
130
130
|
exports.OpenAIStreamChatResponse = nt;
|
|
131
|
-
exports.OpenAIToolCallsCompleteChatResponse =
|
|
132
|
-
exports.OpenAIToolCallsStreamChatResponse =
|
|
133
|
-
exports.ProviderLiteral =
|
|
131
|
+
exports.OpenAIToolCallsCompleteChatResponse = Qt;
|
|
132
|
+
exports.OpenAIToolCallsStreamChatResponse = Zt;
|
|
133
|
+
exports.ProviderLiteral = ys;
|
|
134
134
|
exports.Text_Embedding_3_Large = we;
|
|
135
135
|
exports.Text_Embedding_3_LargeLiteral = qo;
|
|
136
136
|
exports.Text_Embedding_3_LargeSchema = ko;
|
|
137
137
|
exports.Text_Embedding_3_Large_Options = wt;
|
|
138
138
|
exports.Text_Embedding_3_Small = Ae;
|
|
139
|
-
exports.Text_Embedding_3_SmallLiteral =
|
|
140
|
-
exports.Text_Embedding_3_SmallSchema =
|
|
139
|
+
exports.Text_Embedding_3_SmallLiteral = Go;
|
|
140
|
+
exports.Text_Embedding_3_SmallSchema = vo;
|
|
141
141
|
exports.Text_Embedding_3_Small_Options = At;
|
|
142
|
-
exports.Text_Embedding_Ada002 =
|
|
142
|
+
exports.Text_Embedding_Ada002 = xe;
|
|
143
143
|
exports.Text_Embedding_Ada002Literal = Ao;
|
|
144
144
|
exports.Text_Embedding_Ada002Schema = wo;
|
|
145
|
-
exports.Text_Embedding_Ada002_Options =
|
|
146
|
-
exports.dimensions =
|
|
145
|
+
exports.Text_Embedding_Ada002_Options = xt;
|
|
146
|
+
exports.dimensions = He;
|
|
147
147
|
exports.encodingFormat = Ne;
|
|
148
148
|
exports.frequencyPenalty = ze;
|
|
149
|
-
exports.logProbs =
|
|
149
|
+
exports.logProbs = $e;
|
|
150
150
|
exports.maxTokens = ke;
|
|
151
|
-
exports.presencePenalty =
|
|
152
|
-
exports.seed =
|
|
153
|
-
exports.stop =
|
|
151
|
+
exports.presencePenalty = Be;
|
|
152
|
+
exports.seed = Fe;
|
|
153
|
+
exports.stop = Le;
|
|
154
154
|
exports.temperature = qe;
|
|
155
155
|
exports.toolChoice = De;
|
|
156
156
|
exports.topLogProbs = Ue;
|
|
157
|
-
exports.topP =
|
|
157
|
+
exports.topP = je;
|
|
158
158
|
//# sourceMappingURL=index.js.map
|
|
159
159
|
//# sourceMappingURL=index.js.map
|