@adaline/anthropic 0.26.0 → 0.27.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 +528 -1
- package/dist/index.d.ts +528 -1
- package/dist/index.js +118 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2,120 +2,128 @@
|
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
Message: ${tn(o)}`),this.name=Oe,this.info=e,this.cause=o,this.name=n!=null?n:Oe,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(e){return e instanceof Lt}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},Z="system",z="user",P="assistant",Q="tool",on=[Z,z,P,Q],xe=zod.z.enum(on),nn=[P],an=zod.z.enum(nn),H="image",Ae="base64",sn=["png","jpeg","webp","gif"],rn=zod.z.object({type:zod.z.literal(Ae),base64:zod.z.string(),media_type:zod.z.enum(sn)}),ln="url",dn=zod.z.object({type:zod.z.literal(ln),url:zod.z.string()}),pn=zod.z.discriminatedUnion("type",[rn,dn]),mn=["low","medium","high","auto"],cn=zod.z.enum(mn),un=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(H),detail:cn,value:pn,metadata:a}),x="text",jt=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(x),value:zod.z.string(),metadata:a}),ke="partial-text",Bt=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ke),value:zod.z.string(),metadata:a}),V="tool-call",Ut=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(V),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:a}),_e="partial-tool-call",Vt=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(_e),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:a}),D="tool-response",hn=(a=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(D),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:a}),gn=[x,H,V,D],Nt=zod.z.enum(gn),yn=(a=zod.z.undefined(),e=zod.z.undefined(),o=zod.z.undefined(),n=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[jt(a),un(e),Ut(o),hn(n)]),fn=[ke,_e];zod.z.enum(fn);var bn=(a=zod.z.undefined(),e=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Bt(a),Vt(e)]);var we=(a=xe,e=zod.z.undefined(),o=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),r=zod.z.undefined())=>zod.z.object({role:a,content:zod.z.array(yn(e,o,n,i)),metadata:r}),qe=(a=an,e=zod.z.undefined(),o=zod.z.undefined(),n=zod.z.undefined())=>zod.z.object({role:a,partialContent:bn(e,o),metadata:n}),zt=a=>jt().parse({modality:x,value:a}),$t=(a,e,o,n)=>Ut().parse({modality:V,index:a,id:e,name:o,arguments:n});var Pe=(a,e)=>qe().parse({role:a,partialContent:Bt().parse({modality:ke,value:e})}),Ie=(a,e,o,n,i)=>qe().parse({role:a,partialContent:Vt().parse({modality:_e,index:e,id:o,name:n,arguments:i})});var se=(a=zod.z.record(zod.z.string(),zod.z.any()).optional())=>a,Cn=["object","array","number","string","boolean","enum"],qt=zod.z.enum(Cn),Tn=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([qt,zod.z.array(zod.z.union([qt,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()}),Mn=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(Tn),additionalProperties:zod.z.literal(!1)});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:Mn}).optional();var En="function";var Sn=zod.z.enum(["object","array","number","string","boolean","null"]),Rn=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Sn.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()});zod.z.object({type:zod.z.enum(["object"]),title:zod.z.string().optional(),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(Rn).optional(),required:zod.z.array(zod.z.string()).optional()});var vn=zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),parameters:zod.z.any(),strict:zod.z.boolean().optional()});var On=zod.z.enum(["function"]),xn=zod.z.object({type:On,definition:zod.z.object({schema:vn})}),An=[En];zod.z.enum(An);var Ft=(a=zod.z.undefined())=>zod.z.discriminatedUnion("type",[xn.extend({metadata:a})]),K="text",Ht="token",kn=[K,Ht],Dt=zod.z.enum(kn),_n=zod.z.array(zod.z.string().min(1)),wn=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),Kt=(a=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(K),metadata:a,requests:_n}),zod.z.object({modality:zod.z.literal(Ht),metadata:a,requests:wn})]),Le="float",qn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),je="base64",Pn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),Pt=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(Le),embeddings:zod.z.array(qn),usage:Pt.optional()}),zod.z.object({encodingFormat:zod.z.literal(je),embeddings:zod.z.array(Pn),usage:Pt.optional()})]);var Gt=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),It=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),In=It.extend({topLogProbs:zod.z.array(It)}),Jt=zod.z.array(In);zod.z.object({messages:zod.z.array(we()),usage:Gt.optional(),logProbs:Jt.optional()});zod.z.object({partialMessages:zod.z.array(qe()),usage:Gt.optional(),logProbs:Jt.optional()});var Ln=Object.defineProperty,Wt=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,Zt=(a,e,o)=>e in a?Ln(a,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[e]=o,ie=(a,e)=>{for(var o in e||(e={}))jn.call(e,o)&&Zt(a,o,e[o]);if(Wt)for(var o of Wt(e))Bn.call(e,o)&&Zt(a,o,e[o]);return a},Yt="ProviderError",Be=class ao extends F{constructor({info:e,cause:o}){super({info:e,cause:o},Yt),this.name=Yt,this.info=e,this.cause=o;}static isProviderError(e){return e instanceof ao}};var Qt="ModelResponseError",$=class so extends F{constructor({info:e,cause:o}){super({info:e,cause:o},Qt),this.name=Qt,this.cause=o,this.info=e;}static isModelResponseError(e){return e instanceof so}},Xt="InvalidModelRequestError",X=class io extends F{constructor({info:e,cause:o}){super({info:e,cause:o},Xt),this.name=Xt,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(e){return e instanceof io}},eo="InvalidConfigError",G=class ro extends F{constructor({info:e,cause:o}){super({info:e,cause:o},eo),this.name=eo,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(e){return e instanceof ro}},to="InvalidMessagesError",_=class lo extends F{constructor({info:e,cause:o}){super({info:e,cause:o},to),this.name=to,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(e){return e instanceof lo}},oo="InvalidToolsError",Ue=class po extends F{constructor({info:e,cause:o}){super({info:e,cause:o},oo),this.name=oo,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(e){return e instanceof po}},no="InvalidEmbeddingRequestsError",Ve=class mo extends F{constructor({info:e,cause:o}){super({info:e,cause:o},no),this.name=no,this.info=e,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(e){return e instanceof mo}},Ne="multi-string",co=zod.z.object({type:zod.z.literal(Ne),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()}),Un=a=>zod.z.array(zod.z.string()).max(a).default([]).optional(),uo=a=>({def:co.parse(ie({type:Ne},a)),schema:Un(a.max)}),ho="object-schema",Vn=zod.z.object({type:zod.z.literal(ho),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()});var ze="range",go=zod.z.object({type:zod.z.literal(ze),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()}),Nn=(a,e,o,n)=>zod.z.number().min(a).max(e).step(o).default(n).optional(),ee=a=>({def:go.parse(ie({type:ze},a)),schema:Nn(a.min,a.max,a.step,a.default)}),$e="select-boolean",yo=zod.z.object({type:zod.z.literal($e),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()}),zn=a=>zod.z.boolean().nullable().default(a).optional(),fo=a=>({def:yo.parse(ie({type:$e},a)),schema:zn(a.default)}),Fe="select-string",bo=zod.z.object({type:zod.z.literal(Fe),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())}),$n=(a,e)=>zod.z.enum(e).nullable().default(a).optional(),te=a=>({def:bo.parse(ie({type:Fe},a)),schema:$n(a.default,a.choices)}),Fn=[ze,Ne,Fe,ho,$e];zod.z.enum(Fn);var Co=zod.z.discriminatedUnion("type",[go,co,bo,yo,Vn]),M=(a=xe,e=Nt)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(a,zod.z.string().min(1).optional()),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),Co),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(o=>{var n,i;let r=Object.keys(o.def),p=Object.keys((i=(n=o.schema)==null?void 0:n.shape)!=null?i:{});return r.every(s=>p.includes(s))&&p.every(s=>r.includes(s))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})}),L=(a=Dt)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(a).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),Co),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(e=>{var o,n;let i=Object.keys(e.def),r=Object.keys((n=(o=e.schema)==null?void 0:o.shape)!=null?n:{});return i.every(p=>r.includes(p))&&r.every(p=>i.includes(p))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});zod.z.record(zod.z.string());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()]));zod.z.string().url();var Hn={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."},Dn={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."},Kn=a=>({type:"multi",title:"Stop sequence",description:`Enter up to ${a} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Gn={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."},Jn={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."},Wn={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."},Zn={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."},Yn={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."},Qn={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."},Xn={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."},ea={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."},ta={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."},oa={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."},na={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},aa={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."},sa={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."},ia={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."},N={TEMPERATURE:Hn,MAX_TOKENS:Dn,STOP:Kn,TOP_A:Gn,TOP_P:Jn,TOP_K:Wn,MIN_P:Zn,FREQUENCY_PENALTY:Yn,PRESENCE_PENALTY:Qn,REPETITION_PENALTY:ea,SEED:Xn,LOG_PROBS:ta,TOP_LOG_PROBS:oa,ECHO:na,RESPONSE_FORMAT:aa,RESPONSE_FORMAT_WITH_SCHEMA:sa,RESPONSE_SCHEMA:ia};var re=a=>Object.fromEntries(Object.entries(a).filter(([e,o])=>o!=null));var Y=a=>a==null?void 0:a.replace(/\/$/,"");var He=ee({param:"temperature",title:N.TEMPERATURE.title,description:N.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),De=a=>ee({param:"max_tokens",title:N.MAX_TOKENS.title,description:N.MAX_TOKENS.description,min:0,max:a,step:1,default:0}),Ke=a=>uo({param:"stop_sequences",title:N.STOP(a).title,description:N.STOP(a).description,max:a}),Ge=ee({param:"top_p",title:N.TOP_P.title,description:N.TOP_P.description,min:0,max:1,step:.01,default:1}),Je=ee({param:"top_k",title:N.TOP_K.title,description:N.TOP_K.description,min:0,max:1,step:.01,default:1}),We=te({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'any' means the model will call any of the provided tools. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any"]});var To=(a,e)=>zod.z.object({temperature:He.schema,maxTokens:De(a).schema,stop:Ke(e).schema,topP:Ge.schema,topK:Je.schema,toolChoice:We.schema}),Mo=(a,e)=>({temperature:He.def,maxTokens:De(a).def,stop:Ke(e).def,topP:Ge.def,topK:Je.def,toolChoice:We.def});var Ze=te({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),Ye=te({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),Qe=fo({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:!0});var Eo=()=>zod.z.object({encodingFormat:Ze.schema,inputType:Ye.schema,truncation:Qe.schema}),So=()=>({encodingFormat:Ze.def,inputType:Ye.def,truncation:Qe.def});var h={base:(a,e)=>({def:Mo(a,e),schema:To(a,e)})},f={base:()=>({def:So(),schema:Eo()})};var da="anthropic",J=class{constructor(){this.version="v1";this.name=da;this.chatModelFactories={[st]:{model:me,modelOptions:xo,modelSchema:it},[ut]:{model:ge,modelOptions:wo,modelSchema:ht},[mt]:{model:he,modelOptions:_o,modelSchema:ct},[Xe]:{model:le,modelOptions:Ro,modelSchema:et},[tt]:{model:de,modelOptions:vo,modelSchema:ot},[rt]:{model:ce,modelOptions:Ao,modelSchema:lt},[nt]:{model:pe,modelOptions:Oo,modelSchema:at},[dt]:{model:ue,modelOptions:ko,modelSchema:pt}};this.embeddingModelFactories={[vt]:{model:Me,modelOptions:Bo,modelSchema:Ot},[St]:{model:Te,modelOptions:jo,modelSchema:Rt},[gt]:{model:ye,modelOptions:qo,modelSchema:yt},[ft]:{model:fe,modelOptions:Po,modelSchema:bt},[Ct]:{model:be,modelOptions:Io,modelSchema:Tt},[Mt]:{model:Ce,modelOptions:Lo,modelSchema:Et}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!(o in this.chatModelFactories))throw new Be({info:`Anthropic chat model: ${o} not found`,cause:new Error(`Anthropic chat model: ${o} not found, available chat models:
|
|
7
|
-
|
|
8
|
-
${this.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
received : ${JSON.stringify(r)}`)})}})}transformProxyStreamChatResponseChunk(e,o,n,i,r){return ve(this,null,function*(){yield*wt(this.transformStreamChatResponseChunk(e,o));})}getProxyStreamChatUrl(e,o,n){return k(this,null,function*(){return new Promise(i=>{i(this.streamChatUrl);})})}getProxyCompleteChatUrl(e,o,n){return k(this,null,function*(){return new Promise(i=>{i(this.completeChatUrl);})})}getProxyCompleteChatHeaders(e,o,n){return k(this,null,function*(){if(!o)return {};let i=C({},o);return delete i.host,delete i["content-length"],i})}getProxyStreamChatHeaders(e,o,n){return k(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,n)})}};var Xe="claude-3-5-sonnet-20240620",Ra="Most intelligent model. Highest level of intelligence and capability.",et=M(E,v).parse({name:Xe,description:Ra,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:R,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Ro=T,le=class extends b{constructor(e){super(et,e);}};var tt="claude-3-5-sonnet-20241022",va="Most intelligent model. Highest level of intelligence and capability.",ot=M(E,v).parse({name:tt,description:va,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:R,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),vo=T,de=class extends b{constructor(e){super(ot,e);}};var nt="claude-3-5-sonnet-latest",Oa="Most intelligent model. Highest level of intelligence and capability.",at=M(E,v).parse({name:nt,description:Oa,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:R,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Oo=T,pe=class extends b{constructor(e){super(at,e);}};var st="claude-3-haiku-20240307",xa="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",it=M(E,v).parse({name:st,description:xa,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:R,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),xo=T,me=class extends b{constructor(e){super(it,e);}};var rt="claude-3-5-haiku-20241022",Aa="Our fastest model with intelligence at blazing speeds.",lt=M(E,v).parse({name:rt,description:Aa,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:R,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Ao=T,ce=class extends b{constructor(e){super(lt,e);}};var dt="claude-3-5-haiku-latest",ka="Our fastest model with intelligence at blazing speeds.",pt=M(E,v).parse({name:dt,description:ka,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:R,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),ko=T,ue=class extends b{constructor(e){super(pt,e);}};var mt="claude-3-opus-20240229",_a="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",ct=M(E,v).parse({name:mt,description:_a,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:R,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),_o=T,he=class extends b{constructor(e){super(ct,e);}};var ut="claude-3-sonnet-20240229",wa="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",ht=M(E,v).parse({name:ut,description:wa,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:R,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),wo=T,ge=class extends b{constructor(e){super(ht,e);}};var j=[K],B=zod.z.enum([K]);var Ko=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({total_tokens:zod.z.number()})});var Pa=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),Go=zod.z.object({model:zod.z.string().min(1).optional(),input:Pa,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional()});var I=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),w=class{constructor(e,o){this.version="v1";let n=I.parse(o);this.modelSchema=e,this.modelName=n.modelName,this.apiKey=n.apiKey,this.baseUrl=Y(J.embeddingBaseUrl),this.getEmbeddingsUrl=Y(n.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getTokenCount(e){return e.requests.reduce((o,n)=>o+n.length,0)}getRetryDelay(e){return {shouldRetry:!0,delayMs:0}}transformModelRequest(e){let o=Go.safeParse(e);if(!o.success)throw new X({info:"Invalid model request",cause:o.error});let n=o.data,i=n.model,r={encodingFormat:n.encoding_format,inputType:n.input_type,truncation:n.truncation},p=se().parse(re(r)),s;return typeof n.input=="string"?s={modality:K,requests:[n.input]}:s={modality:K,requests:n.input},{modelName:i,config:p,embeddingRequests:s}}transformConfig(e,o){"inputType"in e&&e.inputType===""&&delete e.inputType,"encodingFormat"in e&&e.encodingFormat===""&&delete e.encodingFormat;let n=this.modelSchema.config.schema.safeParse(e);if(!n.success)throw new G({info:`Invalid config for model : '${this.modelName}'`,cause:n.error});let i=n.data;return Object.keys(i).forEach(p=>{if(!this.modelSchema.config.def[p])throw new G({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${p}',
|
|
16
|
-
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(i).reduce((p,s)=>{let c=this.modelSchema.config.def[s].param,g=i[s];return p[c]=g,p},{})}transformEmbeddingRequests(e){let o=Kt().safeParse(e);if(!o.success)throw new Ve({info:"Invalid embedding requests",cause:o.error});if(o.data.requests.length>128)throw new Ve({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Max requests for model : '${this.modelName}' is 128`)});return {input:o.data.requests}}getGetEmbeddingsUrl(e,o){return k(this,null,function*(){return new Promise(n=>{n(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return k(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return k(this,null,function*(){return new Promise(n=>{n(C(C(C({},this.getDefaultParams()),this.transformConfig(e,o)),this.transformEmbeddingRequests(o)));})})}transformGetEmbeddingsResponse(e){let o,n=Ko.safeParse(e);if(n.success){let i=n.data;o=typeof i.data[0].embedding=="string"?je:Le;let r=i.data.map(p=>typeof p.embedding=="string"?{index:p.index,embedding:p.embedding}:{index:p.index,embedding:p.embedding});return {encodingFormat:o,embeddings:r,usage:{totalTokens:i.usage.total_tokens}}}throw new $({info:"Invalid response from model",cause:n.error})}};var gt="voyage-code-2",Ia="Optimized for code retrieval.",yt=L(B).parse({name:gt,description:Ia,modalities:j,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:f.base().def,schema:f.base().schema}}),qo=I,ye=class extends w{constructor(e){super(yt,e);}};var ft="voyage-law-2",La="Optimized for legal and long-context retrieval and RAG. Also improved performance across all domains.",bt=L(B).parse({name:ft,description:La,modalities:j,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:f.base().def,schema:f.base().schema}}),Po=I,fe=class extends w{constructor(e){super(bt,e);}};var Ct="voyage-multilingual-2",ja="Optimized for multilingual retrieval and RAG.",Tt=L(B).parse({name:Ct,description:ja,modalities:j,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:f.base().def,schema:f.base().schema}}),Io=I,be=class extends w{constructor(e){super(Tt,e);}};var Mt="voyage-finance-2",Ba="Optimized for finance retrieval and RAG.",Et=L(B).parse({name:Mt,description:Ba,modalities:j,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:f.base().def,schema:f.base().schema}}),Lo=I,Ce=class extends w{constructor(e){super(Et,e);}};var St="voyage-3-lite",Ua="Optimized for latency and cost.",Rt=L(B).parse({name:St,description:Ua,modalities:j,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:f.base().def,schema:f.base().schema}}),jo=I,Te=class extends w{constructor(e){super(Rt,e);}};var vt="voyage-3",Va="Optimized for quality.",Ot=L(B).parse({name:vt,description:Va,modalities:j,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:f.base().def,schema:f.base().schema}}),Bo=I,Me=class extends w{constructor(e){super(Ot,e);}};
|
|
5
|
+
var bn=Object.defineProperty,Tn=Object.defineProperties;var Mn=Object.getOwnPropertyDescriptors;var Dt=Object.getOwnPropertySymbols;var Rn=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable;var le=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),Sn=n=>{throw TypeError(n)};var Ft=(n,e,o)=>e in n?bn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,b=(n,e)=>{for(var o in e||(e={}))Rn.call(e,o)&&Ft(n,o,e[o]);if(Dt)for(var o of Dt(e))kn.call(e,o)&&Ft(n,o,e[o]);return n},oe=(n,e)=>Tn(n,Mn(e));var A=(n,e,o)=>new Promise((a,r)=>{var p=m=>{try{i(o.next(m));}catch(g){r(g);}},s=m=>{try{i(o.throw(m));}catch(g){r(g);}},i=m=>m.done?a(m.value):Promise.resolve(m.value).then(p,s);i((o=o.apply(n,e)).next());}),Ht=function(n,e){this[0]=n,this[1]=e;},je=(n,e,o)=>{var a=(s,i,m,g)=>{try{var f=o[s](i),V=(i=f.value)instanceof Ht,L=f.done;Promise.resolve(V?i[0]:i).then(u=>V?a(s==="return"?s:"next",i[1]?{done:u.done,value:u.value}:u,m,g):m({value:u,done:L})).catch(u=>a("throw",u,m,g));}catch(u){g(u);}},r=s=>p[s]=i=>new Promise((m,g)=>a(s,i,m,g)),p={};return o=o.apply(n,e),p[le("asyncIterator")]=()=>p,r("next"),r("throw"),r("return"),p},Kt=n=>{var e=n[le("asyncIterator")],o=!1,a,r={};return e==null?(e=n[le("iterator")](),a=p=>r[p]=s=>e[p](s)):(e=e.call(n),a=p=>r[p]=s=>{if(o){if(o=!1,p==="throw")throw s;return s}return o=!0,{done:!1,value:new Ht(new Promise(i=>{var m=e[p](s);m instanceof Object||Sn("Object expected"),i(m);}),1)}}),r[le("iterator")]=()=>r,a("next"),"throw"in e?a("throw"):r.throw=p=>{throw p},"return"in e&&a("return"),r};var En=n=>{let e=new WeakSet;return JSON.stringify(n,(o,a)=>{if(typeof a=="object"&&a!==null){if(e.has(a))return;e.add(a);}return a})},xn=n=>n==null?"unknown error":typeof n=="string"?n:n instanceof Error?n.message:En(n),Le="GatewayBaseError",J=class Zt extends Error{constructor({info:e,cause:o},a){super(`[${a!=null?a:Le}]: ${e}
|
|
6
|
+
Message: ${xn(o)}`),this.name=Le,this.info=e,this.cause=o,this.name=a!=null?a:Le,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(e){return e instanceof Zt}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},Q="system",W="user",x="assistant",ne="tool",vn=[Q,W,x,ne],Be=zod.z.enum(vn),On=[x],An=zod.z.enum(On),z="image",Ue="base64",_n=["png","jpeg","webp","gif"],wn=zod.z.object({type:zod.z.literal(Ue),base64:zod.z.string(),media_type:zod.z.enum(_n)}),qn="url",Pn=zod.z.object({type:zod.z.literal(qn),url:zod.z.string()}),jn=zod.z.discriminatedUnion("type",[wn,Pn]),Ln=["low","medium","high","auto"],In=zod.z.enum(Ln),Bn=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(z),detail:In,value:jn,metadata:n}),$="reasoning",de="partial-reasoning",pe="thinking",Ne="redacted",Ie=zod.z.object({type:zod.z.literal(pe),thinking:zod.z.string(),signature:zod.z.string()}),Xt=zod.z.object({type:zod.z.literal(Ne),data:zod.z.string()}),Un=zod.z.discriminatedUnion("type",[Ie,Xt]),Ve=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal($),value:Un,metadata:n}),Nn=zod.z.object({type:zod.z.literal(pe),thinking:Ie.shape.thinking.optional(),signature:Ie.shape.signature.optional()}),Vn=zod.z.discriminatedUnion("type",[Nn,Xt]),ze=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(de),value:Vn,metadata:n}),E="text",Yt=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(E),value:zod.z.string(),metadata:n}),$e="partial-text",Qt=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal($e),value:zod.z.string(),metadata:n}),q="tool-call",eo=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(q),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:n}),De="partial-tool-call",to=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(De),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:n}),D="tool-response",zn=(n=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(D),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:n}),$n=[E,z,q,D,$],oo=zod.z.enum($n),Dn=(n=zod.z.undefined(),e=zod.z.undefined(),o=zod.z.undefined(),a=zod.z.undefined(),r=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Yt(n),Bn(e),eo(o),zn(a),Ve(r)]),Fn=[$e,De,de];zod.z.enum(Fn);var Hn=(n=zod.z.undefined(),e=zod.z.undefined(),o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Qt(n),to(e),ze(o)]);var Fe=(n=Be,e=zod.z.undefined(),o=zod.z.undefined(),a=zod.z.undefined(),r=zod.z.undefined(),p=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:n,content:zod.z.array(Dn(e,o,a,r,s)),metadata:p}),ae=(n=An,e=zod.z.undefined(),o=zod.z.undefined(),a=zod.z.undefined(),r=zod.z.undefined())=>zod.z.object({role:n,partialContent:Hn(e,o,a),metadata:r}),no=n=>Yt().parse({modality:E,value:n}),ao=(n,e,o,a)=>eo().parse({modality:q,index:n,id:e,name:o,arguments:a});var He=(n,e)=>ae().parse({role:n,partialContent:Qt().parse({modality:$e,value:e})}),Ke=(n,e,o,a,r)=>ae().parse({role:n,partialContent:to().parse({modality:De,index:e,id:o,name:a,arguments:r})}),io=(n,e)=>Ve().parse({modality:$,value:{type:pe,thinking:n,signature:e}});var so=n=>Ve().parse({modality:$,value:{type:Ne,data:n}});var me=(n,e,o)=>ae().parse({role:n,partialContent:ze().parse({modality:de,value:{type:pe,thinking:e,signature:o}})}),ro=(n,e)=>ae().parse({role:n,partialContent:ze().parse({modality:de,value:{type:Ne,data:e}})});var ce=(n=zod.z.record(zod.z.string(),zod.z.any()).optional())=>n,Kn=["object","array","number","string","boolean","enum"],Gt=zod.z.enum(Kn),Gn=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Gt,zod.z.array(zod.z.union([Gt,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()}),Jn=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(Gn),additionalProperties:zod.z.literal(!1)});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:Jn}).optional();var Wn="function";var Zn=zod.z.enum(["object","array","number","string","boolean","null"]),Xn=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Zn.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()});zod.z.object({type:zod.z.enum(["object"]),title:zod.z.string().optional(),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(Xn).optional(),required:zod.z.array(zod.z.string()).optional()});var Yn=zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),parameters:zod.z.any(),strict:zod.z.boolean().optional()});var Qn=zod.z.enum(["function"]),ea=zod.z.object({type:Qn,definition:zod.z.object({schema:Yn})}),ta=[Wn];zod.z.enum(ta);var lo=(n=zod.z.undefined())=>zod.z.discriminatedUnion("type",[ea.extend({metadata:n})]),Z="text",po="token",oa=[Z,po],mo=zod.z.enum(oa),na=zod.z.array(zod.z.string().min(1)),aa=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),co=(n=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(Z),metadata:n,requests:na}),zod.z.object({modality:zod.z.literal(po),metadata:n,requests:aa})]),Ge="float",ia=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),Je="base64",sa=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),Jt=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(Ge),embeddings:zod.z.array(ia),usage:Jt.optional()}),zod.z.object({encodingFormat:zod.z.literal(Je),embeddings:zod.z.array(sa),usage:Jt.optional()})]);var uo=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Wt=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),ra=Wt.extend({topLogProbs:zod.z.array(Wt)}),ho=zod.z.array(ra);zod.z.object({messages:zod.z.array(Fe()),usage:uo.optional(),logProbs:ho.optional()});zod.z.object({partialMessages:zod.z.array(ae()),usage:uo.optional(),logProbs:ho.optional()});var la=Object.defineProperty,go=Object.getOwnPropertySymbols,da=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,yo=(n,e,o)=>e in n?la(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,ue=(n,e)=>{for(var o in e||(e={}))da.call(e,o)&&yo(n,o,e[o]);if(go)for(var o of go(e))pa.call(e,o)&&yo(n,o,e[o]);return n},fo="ProviderError",We=class So extends J{constructor({info:e,cause:o}){super({info:e,cause:o},fo),this.name=fo,this.info=e,this.cause=o;}static isProviderError(e){return e instanceof So}};var Co="ModelResponseError",F=class Eo extends J{constructor({info:e,cause:o}){super({info:e,cause:o},Co),this.name=Co,this.cause=o,this.info=e;}static isModelResponseError(e){return e instanceof Eo}},bo="InvalidModelRequestError",ie=class xo extends J{constructor({info:e,cause:o}){super({info:e,cause:o},bo),this.name=bo,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(e){return e instanceof xo}},To="InvalidConfigError",H=class vo extends J{constructor({info:e,cause:o}){super({info:e,cause:o},To),this.name=To,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(e){return e instanceof vo}},Mo="InvalidMessagesError",P=class Oo extends J{constructor({info:e,cause:o}){super({info:e,cause:o},Mo),this.name=Mo,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(e){return e instanceof Oo}},Ro="InvalidToolsError",Ze=class Ao extends J{constructor({info:e,cause:o}){super({info:e,cause:o},Ro),this.name=Ro,this.cause=o,this.info=e,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(e){return e instanceof Ao}},ko="InvalidEmbeddingRequestsError",Xe=class _o extends J{constructor({info:e,cause:o}){super({info:e,cause:o},ko),this.name=ko,this.info=e,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(e){return e instanceof _o}},Ye="multi-string",wo=zod.z.object({type:zod.z.literal(Ye),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()}),ma=n=>zod.z.array(zod.z.string()).max(n).default([]).optional(),qo=n=>({def:wo.parse(ue({type:Ye},n)),schema:ma(n.max)}),Po="object-schema",ca=zod.z.object({type:zod.z.literal(Po),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()});var Qe="range",jo=zod.z.object({type:zod.z.literal(Qe),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()}),ua=(n,e,o,a)=>zod.z.number().min(n).max(e).step(o).default(a).optional(),ee=n=>({def:jo.parse(ue({type:Qe},n)),schema:ua(n.min,n.max,n.step,n.default)}),et="select-boolean",Lo=zod.z.object({type:zod.z.literal(et),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()}),ha=n=>zod.z.boolean().nullable().default(n).optional(),he=n=>({def:Lo.parse(ue({type:et},n)),schema:ha(n.default)}),tt="select-string",Io=zod.z.object({type:zod.z.literal(tt),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())}),ga=(n,e)=>zod.z.enum(e).nullable().default(n).optional(),se=n=>({def:Io.parse(ue({type:tt},n)),schema:ga(n.default,n.choices)}),ya=[Qe,Ye,tt,Po,et];zod.z.enum(ya);var Bo=zod.z.discriminatedUnion("type",[jo,wo,Io,Lo,ca]),M=(n=Be,e=oo)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(n,zod.z.string().min(1).optional()),modalities:zod.z.array(e).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),Bo),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(o=>{var a,r;let p=Object.keys(o.def),s=Object.keys((r=(a=o.schema)==null?void 0:a.shape)!=null?r:{});return p.every(i=>s.includes(i))&&s.every(i=>p.includes(i))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})}),I=(n=mo)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(n).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),Bo),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(e=>{var o,a;let r=Object.keys(e.def),p=Object.keys((a=(o=e.schema)==null?void 0:o.shape)!=null?a:{});return r.every(s=>p.includes(s))&&p.every(s=>r.includes(s))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});zod.z.record(zod.z.string());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()]));zod.z.string().url();var fa={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."},Ca={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."},ba={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},Ta=n=>({type:"multi",title:"Stop sequence",description:`Enter up to ${n} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Ma={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."},Ra={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."},ka={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."},Sa={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."},Ea={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."},xa={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."},va={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."},Oa={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."},Aa={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."},_a={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."},wa={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},qa={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."},Pa={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."},ja={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."},_={TEMPERATURE:fa,MAX_TOKENS:Ca,STOP:Ta,TOP_A:Ma,TOP_P:Ra,TOP_K:ka,MIN_P:Sa,FREQUENCY_PENALTY:Ea,PRESENCE_PENALTY:xa,REPETITION_PENALTY:Oa,SEED:va,LOG_PROBS:Aa,TOP_LOG_PROBS:_a,ECHO:wa,RESPONSE_FORMAT:qa,RESPONSE_FORMAT_WITH_SCHEMA:Pa,RESPONSE_SCHEMA:ja,MAX_REASONING_TOKENS:ba};var ge=n=>Object.fromEntries(Object.entries(n).filter(([e,o])=>o!=null));var te=n=>n==null?void 0:n.replace(/\/$/,"");var ot=ee({param:"temperature",title:_.TEMPERATURE.title,description:_.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),nt=n=>ee({param:"max_tokens",title:_.MAX_TOKENS.title,description:_.MAX_TOKENS.description,min:0,max:n,step:1,default:0}),at=n=>qo({param:"stop_sequences",title:_.STOP(n).title,description:_.STOP(n).description,max:n}),it=ee({param:"top_p",title:_.TOP_P.title,description:_.TOP_P.description,min:0,max:1,step:.01,default:1}),st=ee({param:"top_k",title:_.TOP_K.title,description:_.TOP_K.description,min:0,max:1,step:.01,default:1}),rt=se({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'any' means the model will call any of the provided tools. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any"]});var ye=(n,e)=>zod.z.object({temperature:ot.schema,maxTokens:nt(n).schema,stop:at(e).schema,topP:it.schema,topK:st.schema,toolChoice:rt.schema}),fe=(n,e)=>({temperature:ot.def,maxTokens:nt(n).def,stop:at(e).def,topP:it.def,topK:st.def,toolChoice:rt.def});var Uo=(n,e)=>ee({param:"max_thinking_tokens",title:_.MAX_REASONING_TOKENS.title,description:_.MAX_REASONING_TOKENS.description,min:n,max:e,step:1,default:0}),No=he({param:"extended_thinking",title:"Extended thinking",description:`Controls whether the model is allowed to think for a longer period of time before generating a response.
|
|
7
|
+
This can be useful for complex tasks that require more time to think.`,default:!1}),Vo=(n,e,o,a)=>oe(b({},fe(n,e)),{extendedThinking:No.def,maxExtendedThinkingTokens:Uo(o,a).def}),zo=(n,e,o,a)=>ye(n,e).extend({extendedThinking:No.schema,maxExtendedThinkingTokens:Uo(o,a).schema});var lt=se({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),dt=se({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),pt=he({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:!0});var $o=()=>zod.z.object({encodingFormat:lt.schema,inputType:dt.schema,truncation:pt.schema}),Do=()=>({encodingFormat:lt.def,inputType:dt.def,truncation:pt.def});var h={base:(n,e)=>({def:fe(n,e),schema:ye(n,e)}),extendedThinking:(n,e,o,a)=>({def:Vo(n,e,o,a),schema:zo(n,e,o,a)})},R={base:()=>({def:Do(),schema:$o()})};var Ba="anthropic",X=class{constructor(){this.version="v1";this.name=Ba;this.chatModelFactories={[bt]:{model:Re,modelOptions:Jo,modelSchema:Tt},[vt]:{model:xe,modelOptions:Yo,modelSchema:Ot},[Et]:{model:Ee,modelOptions:Xo,modelSchema:xt},[mt]:{model:Ce,modelOptions:Fo,modelSchema:ct},[ut]:{model:be,modelOptions:Ho,modelSchema:ht},[Mt]:{model:ke,modelOptions:Wo,modelSchema:Rt},[gt]:{model:Te,modelOptions:Ko,modelSchema:yt},[kt]:{model:Se,modelOptions:Zo,modelSchema:St},[ft]:{model:Me,modelOptions:Go,modelSchema:Ct}};this.embeddingModelFactories={[Nt]:{model:qe,modelOptions:an,modelSchema:Vt},[Bt]:{model:we,modelOptions:nn,modelSchema:Ut},[At]:{model:ve,modelOptions:Qo,modelSchema:_t},[wt]:{model:Oe,modelOptions:en,modelSchema:qt},[Pt]:{model:Ae,modelOptions:tn,modelSchema:jt},[Lt]:{model:_e,modelOptions:on,modelSchema:It}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!(o in this.chatModelFactories))throw new We({info:`Anthropic chat model: ${o} not found`,cause:new Error(`Anthropic chat model: ${o} not found, available chat models:
|
|
8
|
+
${this.chatModelLiterals().join(", ")}`)});let a=this.chatModelFactories[o].model,r=this.chatModelFactories[o].modelOptions.parse(e);return new a(r)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,o)=>(e[o]=this.embeddingModelFactories[o].modelSchema,e),{})}embeddingModel(e){let o=e.modelName;if(!(o in this.embeddingModelFactories))throw new We({info:`Anthropic embedding model: ${o} not found`,cause:new Error(`Anthropic embedding model: ${o} not found, available embedding models:
|
|
9
|
+
${this.embeddingModelLiterals().join(", ")}`)});let a=this.embeddingModelFactories[o].model,r=this.embeddingModelFactories[o].modelOptions.parse(e);return new a(r)}};X.chatBaseUrl="https://api.anthropic.com/v1",X.embeddingBaseUrl="https://api.voyageai.com/v1";var k=zod.z.enum([Q,W,x,ne]),S={system:Q,user:W,assistant:x,tool:W};var v=[E,z,q,D],O=zod.z.enum([E,z,q,D]),rn=[E,z,q,D,$],ln=zod.z.enum([E,z,q,D,$]);var Na=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Va=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.record(zod.z.any())}),za=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string(),signature:zod.z.string()}),$a=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),dn=zod.z.object({content:zod.z.array(zod.z.discriminatedUnion("type",[Na,Va,za,$a])),id:zod.z.string(),model:zod.z.string(),role:zod.z.string(),stop_reason:zod.z.string(),stop_sequence:zod.z.null(),type:zod.z.literal("message"),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number(),cache_creation_input_tokens:zod.z.number().nullish(),cache_read_input_tokens:zod.z.number().nullish()})}),pn=zod.z.object({type:zod.z.literal("message_start"),message:zod.z.object({id:zod.z.string(),type:zod.z.literal("message"),role:zod.z.string(),model:zod.z.string(),stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable(),content:zod.z.array(zod.z.any()),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number()})})}),mn=zod.z.object({type:zod.z.literal("message_delta"),delta:zod.z.object({stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable()}),usage:zod.z.object({output_tokens:zod.z.number()})}),Da=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Fa=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.object({})}),Ha=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string()}),Ka=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),cn=zod.z.object({type:zod.z.literal("content_block_start"),index:zod.z.number(),content_block:zod.z.discriminatedUnion("type",[Da,Fa,Ha,Ka])}),Ga=zod.z.object({type:zod.z.literal("text_delta"),text:zod.z.string()}),Ja=zod.z.object({type:zod.z.literal("input_json_delta"),partial_json:zod.z.string()}),Wa=zod.z.object({type:zod.z.literal("thinking_delta"),thinking:zod.z.string()}),Za=zod.z.object({type:zod.z.literal("signature_delta"),signature:zod.z.string()}),un=zod.z.object({type:zod.z.literal("content_block_delta"),index:zod.z.number(),delta:zod.z.discriminatedUnion("type",[Ga,Ja,Wa,Za])});var Xa=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string().optional(),signature:zod.z.string().optional()}),Ya=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),Qa=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),input_schema:zod.z.any()}),ei=zod.z.object({type:zod.z.enum(["auto","any"])}),ti=zod.z.object({type:zod.z.literal("tool"),name:zod.z.string().min(1)}),zt=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),hn=zod.z.object({type:zod.z.literal("image"),source:zod.z.object({type:zod.z.literal("base64"),media_type:zod.z.enum(["image/jpeg","image/png","image/gif","image/webp"]),data:zod.z.string().base64()})}),Ts=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("tool_use"),name:zod.z.string().min(1),input:zod.z.record(zod.z.any())}),gn=zod.z.object({type:zod.z.literal("tool_result"),tool_use_id:zod.z.string().min(1),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zt,hn])).min(1))}),oi=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zt,hn,gn])).min(1))}),ni=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zt,gn,Xa,Ya])).min(1))}),ai=zod.z.union([oi,ni]),yn=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(ai).min(1),system:zod.z.string().min(1).optional(),max_tokens:zod.z.number().min(0).optional(),stop_sequences:zod.z.array(zod.z.string().min(1)).optional(),temperature:zod.z.number().min(0).max(1).optional(),tool_choice:zod.z.union([ei,ti]).optional(),tools:zod.z.array(Qa).min(1).optional(),top_p:zod.z.number().min(0).max(1).optional(),top_k:zod.z.number().min(0).optional()});var T=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),C=class{constructor(e,o){this.version="v1";let a=T.parse(o);this.modelSchema=e,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=te(X.chatBaseUrl),this.completeChatUrl=te(a.completeChatUrl||`${this.baseUrl}/messages`),this.streamChatUrl=te(a.streamChatUrl||`${this.baseUrl}/messages`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"x-api-key":`${this.apiKey}`,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){let o=0,a=!0;return e["x-should-retry"]&&(a=e["x-should-retry"].toLowerCase()!=="false"),e["retry-after"]&&(o=parseInt(e["retry-after"])*1e3),{shouldRetry:a,delayMs:o}}getTokenCount(e){return e.reduce((o,a)=>o+a.content.map(r=>r.modality==="text"?r.value:"").join(" ").length,0)}transformModelRequest(e){let o=yn.safeParse(e);if(!o.success)throw new ie({info:"Invalid model request",cause:o.error});let a=o.data,r=a.model;if(a.tool_choice&&(!a.tools||a.tools.length===0))throw new ie({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let p={};a.tool_choice&&(a.tool_choice.type==="tool"?p.toolChoice=a.tool_choice.name:p.toolChoice=a.tool_choice.type),p.maxTokens=a.max_tokens,p.temperature=a.temperature,p.topP=a.top_p,p.topK=a.top_k,p.stop=a.stop_sequences;let s=ce().parse(ge(p)),i=[],m={};a.system&&i.push({role:Q,content:[{modality:E,value:a.system}]}),a.messages.forEach(f=>{let V=f.role;switch(V){case"user":{let L=f.content;if(typeof L=="string")i.push({role:V,content:[{modality:E,value:L}]});else {let u=L.map(y=>{if(y.type==="text")return {modality:E,value:y.text};if(y.type==="image"){let K="auto",G=y.source.media_type.split("/")[1];return {modality:z,detail:K,value:{type:Ue,media_type:G,base64:y.source.data}}}else return {modality:D,id:y.tool_use_id,index:m[y.tool_use_id].index,name:m[y.tool_use_id].name,data:typeof y.content=="string"?y.content:JSON.stringify(y.content)}});i.push({role:V,content:u});}}break;case"assistant":{let L=f.content;if(typeof L=="string")i.push({role:V,content:[{modality:E,value:L}]});else {let u=L.map((y,K)=>{if(y.type==="text")return {modality:E,value:y.text};{let G={modality:q,id:y.id,index:K,name:y.name,arguments:JSON.stringify(y.input)};return m[y.id]=G,G}});i.push({role:V,content:u});}}break}});let g=[];return a.tools&&a.tools.forEach(f=>{g.push({type:"function",definition:{schema:{name:f.name,description:f.description||"",parameters:f.input_schema}}});}),{modelName:r,config:s,messages:i,tools:g.length>0?g:void 0}}transformConfig(e,o,a){let r=e.toolChoice,p=e.reasoningEnabled,s=e.maxReasoningTokens,i=b({},e);delete i.toolChoice,delete i.reasoningEnabled,delete i.maxReasoningTokens;let m=this.modelSchema.config.schema.safeParse(i);if(!m.success)throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:m.error});let g=m.data;r!==void 0&&(g.toolChoice=r),Object.keys(g).forEach(u=>{if(!(u in this.modelSchema.config.def))throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${u}',
|
|
10
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let f=Object.keys(g).reduce((u,y)=>{let K=this.modelSchema.config.def[y],G=K.param,$t=g[y];return G==="max_tokens"&&K.type==="range"&&$t===0?u[G]=K.max:u[G]=$t,u},{});if(!f.max_tokens){let u=this.modelSchema.config.def.maxTokens;f.max_tokens=u.max;}if("tool_choice"in f&&f.tool_choice!==void 0){let u=f.tool_choice;if(!a||a&&a.length===0)throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(a&&a.length>0){let y=this.modelSchema.config.def.toolChoice;if(y.choices.includes(u))f.tool_choice={type:u};else if(a.map(K=>K.definition.schema.name).includes(u))f.tool_choice={type:"tool",name:u};else throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${u}' is not part of provided 'tools' names or
|
|
11
|
+
one of [${y.choices.join(", ")}]`)})}}let V=p!==void 0,L=s!==void 0;if(V!==L)throw new H({info:`Invalid extended thinking config for model: '${this.modelName}'`,cause:new Error("Both 'extendedThinking' and 'maxExtendedThinkingTokens' must be defined together.")});if(V&&L){let u=f.max_tokens;if(p)if(s<u)f.thinking={type:"enabled",budget_tokens:s};else throw new H({info:`Invalid extended thinking token budget for model: '${this.modelName}'`,cause:new Error(`maxExtendedThinkingTokens (${s}) must be less than max_tokens (${u})`)})}return f}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let o=s=>{let i=s.match(/^data:image\/[a-zA-Z]+;base64,/);return i?s.substring(i[0].length):s},a=e.map(s=>{let i=Fe().safeParse(s);if(!i.success)throw new P({info:"Invalid messages",cause:i.error});return i.data});a.forEach(s=>{s.content.forEach(i=>{if(!this.modelSchema.modalities.includes(i.modality))throw new P({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${i.modality}', available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),a.forEach(s=>{if(!Object.keys(this.modelSchema.roles).includes(s.role))throw new P({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${s.role}', available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let r="",p=[];if(a.forEach(s=>{switch(s.role){case Q:{s.content.forEach(i=>{if(i.modality===E)r+=i.value;else throw new P({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${i.modality}'`)})});break}case x:{let i=[];s.content.forEach(m=>{if(m.modality===E)i.push({type:"text",text:m.value});else if(m.modality===q)i.push({type:"tool_use",id:m.id,name:m.name,input:JSON.parse(m.arguments)});else if(m.modality===$&&m.value.type==="thinking")i.push({type:"thinking",thinking:m.value.thinking,signature:m.value.signature});else if(m.modality===$&&m.value.type==="redacted")i.push({type:"redacted_thinking",data:m.value.data});else throw new P({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${m.modality}'`)})}),p.push({role:this.modelSchema.roles[s.role],content:i});break}case W:{let i=[];s.content.forEach(m=>{if(m.modality===E)i.push({type:"text",text:m.value});else if(m.modality===z){if(m.value.type==="base64"){let g=m.value.base64;g=o(g),i.push({type:"image",source:{type:"base64",media_type:`image/${m.value.media_type}`,data:g}});}else if(m.value.type==="url")throw new P({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${m.value.type}'`)})}else throw new P({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${m.modality}'`)})}),p.push({role:this.modelSchema.roles[s.role],content:i});break}case ne:{let i=[];s.content.forEach(m=>{if(m.modality===D)i.push({type:"tool_result",tool_use_id:m.id,content:m.data});else throw new P({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${m.modality}'`)})}),p.push({role:this.modelSchema.roles[s.role],content:i});break}default:throw new P({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' is not supported,
|
|
12
|
+
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),p[0].role!==this.modelSchema.roles[W])throw new P({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});return {system:r,messages:p}}transformTools(e){if(!this.modelSchema.modalities.includes(q))throw new Ze({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${q}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(r=>{let p=lo().safeParse(r);if(!p.success)throw new Ze({info:"Invalid tools",cause:p.error});return p.data}).map(r=>({name:r.definition.schema.name,description:r.definition.schema.description,input_schema:r.definition.schema.parameters}))}}getCompleteChatUrl(e,o,a){return A(this,null,function*(){return new Promise(r=>{r(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,a){return A(this,null,function*(){let r=this.getDefaultHeaders();return a&&a.length>0&&(r=oe(b({},r),{"anthropic-beta":"tools-2024-05-16"})),new Promise(p=>{p(r);})})}getCompleteChatData(e,o,a){return A(this,null,function*(){let r=this.transformConfig(e,o,a),p=this.transformMessages(o);if(p.messages&&p.messages.length===0)throw new P({info:"Messages are required",cause:new Error("Messages are required")});let s=a?this.transformTools(a):{};return new Promise(i=>{i(b(b(b(b({},this.getDefaultParams()),r),p),s));})})}transformCompleteChatResponse(e){let o=dn.safeParse(e);if(o.success){let a=o.data,p=a.content.map((m,g)=>{if(m.type==="text")return no(m.text);if(m.type==="tool_use")return ao(g,m.id,m.name,JSON.stringify(m.input));if(m.type==="thinking")return io(m.thinking,m.signature);if(m.type==="redacted_thinking")return so(m.data)}),s=[{role:x,content:p}],i={promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.input_tokens+a.usage.output_tokens};return {messages:s,usage:i,logProbs:[]}}throw new F({info:"Invalid response from model",cause:o.error})}getStreamChatUrl(e,o,a){return A(this,null,function*(){return new Promise(r=>{r(this.streamChatUrl);})})}getStreamChatHeaders(e,o,a){let r=this.getDefaultHeaders();return a&&a.length>0&&(r=oe(b({},r),{"anthropic-beta":"tools-2024-05-16"})),new Promise(p=>{p(r);})}getStreamChatData(e,o,a){return A(this,null,function*(){let r=this.transformConfig(e,o,a),p=this.transformMessages(o);if(p.messages&&p.messages.length===0)throw new P({info:"Messages are required",cause:new Error("Messages are required")});let s=a?this.transformTools(a):{};return new Promise(i=>{i(b(b(b(b({stream:!0},this.getDefaultParams()),r),p),s));})})}transformStreamChatResponseChunk(e,o){return je(this,null,function*(){let a=(o+e).split(`
|
|
13
|
+
`).filter(r=>r.trim()!=="");for(let r of a)if(r.startsWith("data: {")&&r.endsWith("}")){let p;try{p=JSON.parse(r.substring(6));}catch(s){throw new F({info:`Malformed JSON received in stream : ${p}`,cause:s})}if("type"in p){if(p.type==="message_stop")return;if(p.type==="message_start"){let s=pn.safeParse(p);if(s.success){let i=s.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:i.message.usage.input_tokens,completionTokens:i.message.usage.output_tokens,totalTokens:i.message.usage.input_tokens+i.message.usage.output_tokens}},buffer:o};}else throw new F({info:"Invalid response from model",cause:s.error})}else if(p.type==="message_delta"){let s=mn.safeParse(p);if(s.success){let i=s.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:0,completionTokens:i.usage.output_tokens,totalTokens:i.usage.output_tokens}},buffer:o};}else throw new F({info:"Invalid response from model",cause:s.error})}else if(p.type==="content_block_start"){let s=cn.safeParse(p);if(s.success){let i=s.data,m=[];i.content_block.type==="text"?m.push(He(x,i.content_block.text)):i.content_block.type==="tool_use"?m.push(Ke(x,i.index,i.content_block.id,i.content_block.name,"")):i.content_block.type==="thinking"?m.push(me(x,i.content_block.thinking)):i.content_block.type==="redacted_thinking"&&m.push(ro(x,i.content_block.data)),yield {partialResponse:{partialMessages:m},buffer:o};}else throw new F({info:"Invalid response from model",cause:s.error})}else if(p.type==="content_block_delta"){let s=un.safeParse(p);if(s.success){let i=s.data,m=[];i.delta.type==="text_delta"?m.push(He(x,i.delta.text)):i.delta.type==="input_json_delta"?m.push(Ke(x,i.index,"","",i.delta.partial_json)):i.delta.type==="thinking_delta"?m.push(me(x,i.delta.thinking)):i.delta.type==="signature_delta"&&m.push(me(x,void 0,i.delta.signature)),yield {partialResponse:{partialMessages:m},buffer:o};}else throw new F({info:"Invalid response from model",cause:s.error})}}else throw new F({info:"Invalid JSON received in stream",cause:new Error(`Invalid JSON received in stream, expected 'type' property, received: ${JSON.stringify(p)}`)})}})}transformProxyStreamChatResponseChunk(e,o,a,r,p){return je(this,null,function*(){yield*Kt(this.transformStreamChatResponseChunk(e,o));})}getProxyStreamChatUrl(e,o,a){return A(this,null,function*(){return new Promise(r=>{r(this.streamChatUrl);})})}getProxyCompleteChatUrl(e,o,a){return A(this,null,function*(){return new Promise(r=>{r(this.completeChatUrl);})})}getProxyCompleteChatHeaders(e,o,a){return A(this,null,function*(){if(!o)return {};let r=b({},o);return delete r.host,delete r["content-length"],r})}getProxyStreamChatHeaders(e,o,a){return A(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,a)})}};var mt="claude-3-5-sonnet-20240620",ii="Most intelligent model. Highest level of intelligence and capability.",ct=M(k,O).parse({name:mt,description:ii,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:v,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Fo=T,Ce=class extends C{constructor(e){super(ct,e);}};var ut="claude-3-5-sonnet-20241022",si="Most intelligent model. Highest level of intelligence and capability.",ht=M(k,O).parse({name:ut,description:si,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:v,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Ho=T,be=class extends C{constructor(e){super(ht,e);}};var gt="claude-3-5-sonnet-latest",ri="Most intelligent model. Highest level of intelligence and capability.",yt=M(k,O).parse({name:gt,description:ri,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:v,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Ko=T,Te=class extends C{constructor(e){super(yt,e);}};var ft="claude-3-7-sonnet-20250219",li="Most intelligent model. Highest level of intelligence and capability.",Ct=M(k,ln).parse({name:ft,description:li,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:64e3,roles:S,modalities:rn,config:{def:h.extendedThinking(128e3,4,1024,64e3).def,schema:h.extendedThinking(128e3,4,1024,64e3).schema}}),Go=T,Me=class extends C{constructor(e){super(Ct,e);}};var bt="claude-3-haiku-20240307",di="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",Tt=M(k,O).parse({name:bt,description:di,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:v,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Jo=T,Re=class extends C{constructor(e){super(Tt,e);}};var Mt="claude-3-5-haiku-20241022",pi="Our fastest model with intelligence at blazing speeds.",Rt=M(k,O).parse({name:Mt,description:pi,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:v,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Wo=T,ke=class extends C{constructor(e){super(Rt,e);}};var kt="claude-3-5-haiku-latest",mi="Our fastest model with intelligence at blazing speeds.",St=M(k,O).parse({name:kt,description:mi,maxInputTokens:2e5,maxOutputTokens:8192,roles:S,modalities:v,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema}}),Zo=T,Se=class extends C{constructor(e){super(St,e);}};var Et="claude-3-opus-20240229",ci="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",xt=M(k,O).parse({name:Et,description:ci,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:v,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Xo=T,Ee=class extends C{constructor(e){super(xt,e);}};var vt="claude-3-sonnet-20240229",ui="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",Ot=M(k,O).parse({name:vt,description:ui,maxInputTokens:2e5,maxOutputTokens:4096,roles:S,modalities:v,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Yo=T,xe=class extends C{constructor(e){super(Ot,e);}};var B=[Z],U=zod.z.enum([Z]);var fn=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({total_tokens:zod.z.number()})});var gi=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),Cn=zod.z.object({model:zod.z.string().min(1).optional(),input:gi,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional()});var j=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),w=class{constructor(e,o){this.version="v1";let a=j.parse(o);this.modelSchema=e,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=te(X.embeddingBaseUrl),this.getEmbeddingsUrl=te(a.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getTokenCount(e){return e.requests.reduce((o,a)=>o+a.length,0)}getRetryDelay(e){return {shouldRetry:!0,delayMs:0}}transformModelRequest(e){let o=Cn.safeParse(e);if(!o.success)throw new ie({info:"Invalid model request",cause:o.error});let a=o.data,r=a.model,p={encodingFormat:a.encoding_format,inputType:a.input_type,truncation:a.truncation},s=ce().parse(ge(p)),i;return typeof a.input=="string"?i={modality:Z,requests:[a.input]}:i={modality:Z,requests:a.input},{modelName:r,config:s,embeddingRequests:i}}transformConfig(e,o){"inputType"in e&&e.inputType===""&&delete e.inputType,"encodingFormat"in e&&e.encodingFormat===""&&delete e.encodingFormat;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let r=a.data;return Object.keys(r).forEach(s=>{if(!this.modelSchema.config.def[s])throw new H({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${s}',
|
|
14
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(r).reduce((s,i)=>{let g=this.modelSchema.config.def[i].param,f=r[i];return s[g]=f,s},{})}transformEmbeddingRequests(e){let o=co().safeParse(e);if(!o.success)throw new Xe({info:"Invalid embedding requests",cause:o.error});if(o.data.requests.length>128)throw new Xe({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Max requests for model : '${this.modelName}' is 128`)});return {input:o.data.requests}}getGetEmbeddingsUrl(e,o){return A(this,null,function*(){return new Promise(a=>{a(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return A(this,null,function*(){return new Promise(a=>{a(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return A(this,null,function*(){return new Promise(a=>{a(b(b(b({},this.getDefaultParams()),this.transformConfig(e,o)),this.transformEmbeddingRequests(o)));})})}transformGetEmbeddingsResponse(e){let o,a=fn.safeParse(e);if(a.success){let r=a.data;o=typeof r.data[0].embedding=="string"?Je:Ge;let p=r.data.map(s=>typeof s.embedding=="string"?{index:s.index,embedding:s.embedding}:{index:s.index,embedding:s.embedding});return {encodingFormat:o,embeddings:p,usage:{totalTokens:r.usage.total_tokens}}}throw new F({info:"Invalid response from model",cause:a.error})}};var At="voyage-code-2",yi="Optimized for code retrieval.",_t=I(U).parse({name:At,description:yi,modalities:B,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:R.base().def,schema:R.base().schema}}),Qo=j,ve=class extends w{constructor(e){super(_t,e);}};var wt="voyage-law-2",fi="Optimized for legal and long-context retrieval and RAG. Also improved performance across all domains.",qt=I(U).parse({name:wt,description:fi,modalities:B,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:R.base().def,schema:R.base().schema}}),en=j,Oe=class extends w{constructor(e){super(qt,e);}};var Pt="voyage-multilingual-2",Ci="Optimized for multilingual retrieval and RAG.",jt=I(U).parse({name:Pt,description:Ci,modalities:B,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:R.base().def,schema:R.base().schema}}),tn=j,Ae=class extends w{constructor(e){super(jt,e);}};var Lt="voyage-finance-2",bi="Optimized for finance retrieval and RAG.",It=I(U).parse({name:Lt,description:bi,modalities:B,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:R.base().def,schema:R.base().schema}}),on=j,_e=class extends w{constructor(e){super(It,e);}};var Bt="voyage-3-lite",Ti="Optimized for latency and cost.",Ut=I(U).parse({name:Bt,description:Ti,modalities:B,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:R.base().def,schema:R.base().schema}}),nn=j,we=class extends w{constructor(e){super(Ut,e);}};var Nt="voyage-3",Mi="Optimized for quality.",Vt=I(U).parse({name:Nt,description:Mi,modalities:B,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:R.base().def,schema:R.base().schema}}),an=j,qe=class extends w{constructor(e){super(Vt,e);}};
|
|
17
15
|
|
|
18
|
-
exports.Anthropic =
|
|
16
|
+
exports.Anthropic = X;
|
|
19
17
|
exports.AnthropicChatModelConfigs = h;
|
|
20
|
-
exports.AnthropicChatModelModalities =
|
|
21
|
-
exports.AnthropicChatModelModalitiesEnum =
|
|
22
|
-
exports.AnthropicChatModelRoles =
|
|
18
|
+
exports.AnthropicChatModelModalities = v;
|
|
19
|
+
exports.AnthropicChatModelModalitiesEnum = O;
|
|
20
|
+
exports.AnthropicChatModelRoles = k;
|
|
23
21
|
exports.AnthropicChatModelRolesMap = S;
|
|
24
|
-
exports.AnthropicCompleteChatResponse =
|
|
25
|
-
exports.AnthropicEmbeddingModelConfigs =
|
|
26
|
-
exports.AnthropicEmbeddingModelModalities =
|
|
27
|
-
exports.AnthropicEmbeddingModelModalitiesEnum =
|
|
28
|
-
exports.AnthropicEmbeddingRequest =
|
|
29
|
-
exports.AnthropicEmbeddingRequestInput =
|
|
30
|
-
exports.AnthropicGetEmbeddingsResponse =
|
|
31
|
-
exports.AnthropicRequest =
|
|
32
|
-
exports.AnthropicRequestAssistantMessage =
|
|
33
|
-
exports.AnthropicRequestImageContent =
|
|
34
|
-
exports.AnthropicRequestMessage =
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
22
|
+
exports.AnthropicCompleteChatResponse = dn;
|
|
23
|
+
exports.AnthropicEmbeddingModelConfigs = R;
|
|
24
|
+
exports.AnthropicEmbeddingModelModalities = B;
|
|
25
|
+
exports.AnthropicEmbeddingModelModalitiesEnum = U;
|
|
26
|
+
exports.AnthropicEmbeddingRequest = Cn;
|
|
27
|
+
exports.AnthropicEmbeddingRequestInput = gi;
|
|
28
|
+
exports.AnthropicGetEmbeddingsResponse = fn;
|
|
29
|
+
exports.AnthropicRequest = yn;
|
|
30
|
+
exports.AnthropicRequestAssistantMessage = ni;
|
|
31
|
+
exports.AnthropicRequestImageContent = hn;
|
|
32
|
+
exports.AnthropicRequestMessage = ai;
|
|
33
|
+
exports.AnthropicRequestRedactedThinkingContent = Ya;
|
|
34
|
+
exports.AnthropicRequestTextContent = zt;
|
|
35
|
+
exports.AnthropicRequestThinkingContent = Xa;
|
|
36
|
+
exports.AnthropicRequestTool = Qa;
|
|
37
|
+
exports.AnthropicRequestToolCallContent = Ts;
|
|
38
|
+
exports.AnthropicRequestToolChoiceEnum = ei;
|
|
39
|
+
exports.AnthropicRequestToolChoiceTool = ti;
|
|
40
|
+
exports.AnthropicRequestToolResponseContent = gn;
|
|
41
|
+
exports.AnthropicRequestUserMessage = oi;
|
|
42
|
+
exports.AnthropicStreamChatContentBlockDeltaResponse = un;
|
|
43
|
+
exports.AnthropicStreamChatContentBlockStartResponse = cn;
|
|
44
|
+
exports.AnthropicStreamChatMessageDeltaResponse = mn;
|
|
45
|
+
exports.AnthropicStreamChatMessageStartResponse = pn;
|
|
46
|
+
exports.AnthropicThinkingChatModelModalities = rn;
|
|
47
|
+
exports.AnthropicThinkingChatModelModalitiesEnum = ln;
|
|
48
|
+
exports.BaseChatModel = C;
|
|
47
49
|
exports.BaseChatModelOptions = T;
|
|
48
50
|
exports.BaseEmbeddingModel = w;
|
|
49
|
-
exports.BaseEmbeddingModelOptions =
|
|
50
|
-
exports.ChatModelBaseConfigDef =
|
|
51
|
-
exports.ChatModelBaseConfigSchema =
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
71
|
-
exports.
|
|
72
|
-
exports.
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
78
|
-
exports.
|
|
79
|
-
exports.
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.
|
|
86
|
-
exports.
|
|
87
|
-
exports.
|
|
88
|
-
exports.
|
|
89
|
-
exports.
|
|
90
|
-
exports.
|
|
91
|
-
exports.
|
|
92
|
-
exports.
|
|
93
|
-
exports.
|
|
94
|
-
exports.
|
|
95
|
-
exports.
|
|
96
|
-
exports.
|
|
97
|
-
exports.
|
|
98
|
-
exports.
|
|
99
|
-
exports.
|
|
100
|
-
exports.
|
|
101
|
-
exports.
|
|
102
|
-
exports.
|
|
103
|
-
exports.
|
|
104
|
-
exports.
|
|
105
|
-
exports.
|
|
106
|
-
exports.
|
|
107
|
-
exports.
|
|
108
|
-
exports.
|
|
109
|
-
exports.
|
|
110
|
-
exports.
|
|
111
|
-
exports.
|
|
112
|
-
exports.
|
|
113
|
-
exports.
|
|
114
|
-
exports.
|
|
115
|
-
exports.
|
|
116
|
-
exports.
|
|
117
|
-
exports.
|
|
118
|
-
exports.
|
|
119
|
-
exports.
|
|
51
|
+
exports.BaseEmbeddingModelOptions = j;
|
|
52
|
+
exports.ChatModelBaseConfigDef = fe;
|
|
53
|
+
exports.ChatModelBaseConfigSchema = ye;
|
|
54
|
+
exports.ChatModelExtendedThinkingConfigDef = Vo;
|
|
55
|
+
exports.ChatModelExtendedThinkingConfigSchema = zo;
|
|
56
|
+
exports.Claude3Haiku20240307 = Re;
|
|
57
|
+
exports.Claude3Haiku20240307Literal = bt;
|
|
58
|
+
exports.Claude3Haiku20240307Options = Jo;
|
|
59
|
+
exports.Claude3Haiku20240307Schema = Tt;
|
|
60
|
+
exports.Claude3Opus20240229 = Ee;
|
|
61
|
+
exports.Claude3Opus20240229Literal = Et;
|
|
62
|
+
exports.Claude3Opus20240229Options = Xo;
|
|
63
|
+
exports.Claude3Opus20240229Schema = xt;
|
|
64
|
+
exports.Claude3Sonnet20240229 = xe;
|
|
65
|
+
exports.Claude3Sonnet20240229Literal = vt;
|
|
66
|
+
exports.Claude3Sonnet20240229Options = Yo;
|
|
67
|
+
exports.Claude3Sonnet20240229Schema = Ot;
|
|
68
|
+
exports.Claude3_5Haiku20241022 = ke;
|
|
69
|
+
exports.Claude3_5Haiku20241022Literal = Mt;
|
|
70
|
+
exports.Claude3_5Haiku20241022Options = Wo;
|
|
71
|
+
exports.Claude3_5Haiku20241022Schema = Rt;
|
|
72
|
+
exports.Claude3_5HaikuLatest = Se;
|
|
73
|
+
exports.Claude3_5HaikuLatestLiteral = kt;
|
|
74
|
+
exports.Claude3_5HaikuLatestOptions = Zo;
|
|
75
|
+
exports.Claude3_5HaikuLatestSchema = St;
|
|
76
|
+
exports.Claude3_5Sonnet20240620 = Ce;
|
|
77
|
+
exports.Claude3_5Sonnet20240620Literal = mt;
|
|
78
|
+
exports.Claude3_5Sonnet20240620Options = Fo;
|
|
79
|
+
exports.Claude3_5Sonnet20240620Schema = ct;
|
|
80
|
+
exports.Claude3_5Sonnet20241022 = be;
|
|
81
|
+
exports.Claude3_5Sonnet20241022Literal = ut;
|
|
82
|
+
exports.Claude3_5Sonnet20241022Options = Ho;
|
|
83
|
+
exports.Claude3_5Sonnet20241022Schema = ht;
|
|
84
|
+
exports.Claude3_5SonnetLatest = Te;
|
|
85
|
+
exports.Claude3_5SonnetLatestLiteral = gt;
|
|
86
|
+
exports.Claude3_5SonnetLatestOptions = Ko;
|
|
87
|
+
exports.Claude3_5SonnetLatestSchema = yt;
|
|
88
|
+
exports.Claude3_7Sonnet20250219 = Me;
|
|
89
|
+
exports.Claude3_7Sonnet20250219Literal = ft;
|
|
90
|
+
exports.Claude3_7Sonnet20250219Options = Go;
|
|
91
|
+
exports.Claude3_7Sonnet20250219Schema = Ct;
|
|
92
|
+
exports.EmbeddingModelBaseConfigDef = Do;
|
|
93
|
+
exports.EmbeddingModelBaseConfigSchema = $o;
|
|
94
|
+
exports.ProviderLiteral = Ba;
|
|
95
|
+
exports.Voyage3 = qe;
|
|
96
|
+
exports.Voyage3Lite = we;
|
|
97
|
+
exports.Voyage3LiteLiteral = Bt;
|
|
98
|
+
exports.Voyage3LiteOptions = nn;
|
|
99
|
+
exports.Voyage3LiteSchema = Ut;
|
|
100
|
+
exports.Voyage3Literal = Nt;
|
|
101
|
+
exports.Voyage3Options = an;
|
|
102
|
+
exports.Voyage3Schema = Vt;
|
|
103
|
+
exports.VoyageCode2 = ve;
|
|
104
|
+
exports.VoyageCode2Literal = At;
|
|
105
|
+
exports.VoyageCode2Options = Qo;
|
|
106
|
+
exports.VoyageCode2Schema = _t;
|
|
107
|
+
exports.VoyageFinance2 = _e;
|
|
108
|
+
exports.VoyageFinance2Literal = Lt;
|
|
109
|
+
exports.VoyageFinance2Options = on;
|
|
110
|
+
exports.VoyageFinance2Schema = It;
|
|
111
|
+
exports.VoyageLaw2 = Oe;
|
|
112
|
+
exports.VoyageLaw2Literal = wt;
|
|
113
|
+
exports.VoyageLaw2Options = en;
|
|
114
|
+
exports.VoyageLaw2Schema = qt;
|
|
115
|
+
exports.VoyageMultilingual2 = Ae;
|
|
116
|
+
exports.VoyageMultilingual2Literal = Pt;
|
|
117
|
+
exports.VoyageMultilingual2Options = tn;
|
|
118
|
+
exports.VoyageMultilingual2Schema = jt;
|
|
119
|
+
exports.encodingFormat = lt;
|
|
120
|
+
exports.inputType = dt;
|
|
121
|
+
exports.maxTokens = nt;
|
|
122
|
+
exports.stop = at;
|
|
123
|
+
exports.temperature = ot;
|
|
124
|
+
exports.toolChoice = rt;
|
|
125
|
+
exports.topK = st;
|
|
126
|
+
exports.topP = it;
|
|
127
|
+
exports.truncation = pt;
|
|
120
128
|
//# sourceMappingURL=index.js.map
|
|
121
129
|
//# sourceMappingURL=index.js.map
|