@adaline/bedrock 0.20.0 → 0.21.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 +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +43 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -299,6 +299,7 @@ declare const BedrockClaude3_5Haiku20241022Schema: {
|
|
|
299
299
|
}>;
|
|
300
300
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
301
301
|
};
|
|
302
|
+
maxReasoningTokens?: number | undefined;
|
|
302
303
|
};
|
|
303
304
|
declare const BedrockClaude3_5Haiku20241022Options: z.ZodObject<{
|
|
304
305
|
modelName: z.ZodString;
|
|
@@ -364,6 +365,7 @@ declare const BedrockClaude3_5Sonnet20240620Schema: {
|
|
|
364
365
|
}>;
|
|
365
366
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
366
367
|
};
|
|
368
|
+
maxReasoningTokens?: number | undefined;
|
|
367
369
|
};
|
|
368
370
|
declare const BedrockClaude3_5Sonnet20240620Options: z.ZodObject<{
|
|
369
371
|
modelName: z.ZodString;
|
|
@@ -429,6 +431,7 @@ declare const BedrockClaude3_5Sonnet20241022Schema: {
|
|
|
429
431
|
}>;
|
|
430
432
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
431
433
|
};
|
|
434
|
+
maxReasoningTokens?: number | undefined;
|
|
432
435
|
};
|
|
433
436
|
declare const BedrockClaude3_5Sonnet20241022Options: z.ZodObject<{
|
|
434
437
|
modelName: z.ZodString;
|
|
@@ -494,6 +497,7 @@ declare const BedrockClaude3Haiku20240307Schema: {
|
|
|
494
497
|
}>;
|
|
495
498
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
496
499
|
};
|
|
500
|
+
maxReasoningTokens?: number | undefined;
|
|
497
501
|
};
|
|
498
502
|
declare const BedrockClaude3Haiku20240307Options: z.ZodObject<{
|
|
499
503
|
modelName: z.ZodString;
|
|
@@ -559,6 +563,7 @@ declare const BedrockClaude3Opus20240229Schema: {
|
|
|
559
563
|
}>;
|
|
560
564
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
561
565
|
};
|
|
566
|
+
maxReasoningTokens?: number | undefined;
|
|
562
567
|
};
|
|
563
568
|
declare const BedrockClaude3Opus20240229Options: z.ZodObject<{
|
|
564
569
|
modelName: z.ZodString;
|
|
@@ -624,6 +629,7 @@ declare const BedrockClaude3Sonnet20240229Schema: {
|
|
|
624
629
|
}>;
|
|
625
630
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
626
631
|
};
|
|
632
|
+
maxReasoningTokens?: number | undefined;
|
|
627
633
|
};
|
|
628
634
|
declare const BedrockClaude3Sonnet20240229Options: z.ZodObject<{
|
|
629
635
|
modelName: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -299,6 +299,7 @@ declare const BedrockClaude3_5Haiku20241022Schema: {
|
|
|
299
299
|
}>;
|
|
300
300
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
301
301
|
};
|
|
302
|
+
maxReasoningTokens?: number | undefined;
|
|
302
303
|
};
|
|
303
304
|
declare const BedrockClaude3_5Haiku20241022Options: z.ZodObject<{
|
|
304
305
|
modelName: z.ZodString;
|
|
@@ -364,6 +365,7 @@ declare const BedrockClaude3_5Sonnet20240620Schema: {
|
|
|
364
365
|
}>;
|
|
365
366
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
366
367
|
};
|
|
368
|
+
maxReasoningTokens?: number | undefined;
|
|
367
369
|
};
|
|
368
370
|
declare const BedrockClaude3_5Sonnet20240620Options: z.ZodObject<{
|
|
369
371
|
modelName: z.ZodString;
|
|
@@ -429,6 +431,7 @@ declare const BedrockClaude3_5Sonnet20241022Schema: {
|
|
|
429
431
|
}>;
|
|
430
432
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
431
433
|
};
|
|
434
|
+
maxReasoningTokens?: number | undefined;
|
|
432
435
|
};
|
|
433
436
|
declare const BedrockClaude3_5Sonnet20241022Options: z.ZodObject<{
|
|
434
437
|
modelName: z.ZodString;
|
|
@@ -494,6 +497,7 @@ declare const BedrockClaude3Haiku20240307Schema: {
|
|
|
494
497
|
}>;
|
|
495
498
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
496
499
|
};
|
|
500
|
+
maxReasoningTokens?: number | undefined;
|
|
497
501
|
};
|
|
498
502
|
declare const BedrockClaude3Haiku20240307Options: z.ZodObject<{
|
|
499
503
|
modelName: z.ZodString;
|
|
@@ -559,6 +563,7 @@ declare const BedrockClaude3Opus20240229Schema: {
|
|
|
559
563
|
}>;
|
|
560
564
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
561
565
|
};
|
|
566
|
+
maxReasoningTokens?: number | undefined;
|
|
562
567
|
};
|
|
563
568
|
declare const BedrockClaude3Opus20240229Options: z.ZodObject<{
|
|
564
569
|
modelName: z.ZodString;
|
|
@@ -624,6 +629,7 @@ declare const BedrockClaude3Sonnet20240229Schema: {
|
|
|
624
629
|
}>;
|
|
625
630
|
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
|
|
626
631
|
};
|
|
632
|
+
maxReasoningTokens?: number | undefined;
|
|
627
633
|
};
|
|
628
634
|
declare const BedrockClaude3Sonnet20240229Options: z.ZodObject<{
|
|
629
635
|
modelName: z.ZodString;
|
package/dist/index.js
CHANGED
|
@@ -5,51 +5,49 @@ var sha256Js = require('@aws-crypto/sha256-js');
|
|
|
5
5
|
var protocolHttp = require('@smithy/protocol-http');
|
|
6
6
|
var signatureV4 = require('@smithy/signature-v4');
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
Message: ${Ha(a)}`),this.name=we,this.info=o,this.cause=a,this.name=s!=null?s:we,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(o){return o instanceof Et}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},oe="system",H="user",I="assistant",xe="tool",Fa=[oe,H,I,xe],Pt=zod.z.enum(Fa),Da=[I],za=zod.z.enum(Da),J="image",_t="base64",Ka=["png","jpeg","webp","gif"],Va=zod.z.object({type:zod.z.literal(_t),base64:zod.z.string(),media_type:zod.z.enum(Ka)}),Ja="url",Ga=zod.z.object({type:zod.z.literal(Ja),url:zod.z.string()}),Wa=zod.z.discriminatedUnion("type",[Va,Ga]),Za=["low","medium","high","auto"],Ya=zod.z.enum(Za),Qa=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(J),detail:Ya,value:Wa,metadata:t}),O="text",Rt=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(O),value:zod.z.string(),metadata:t}),Te="partial-text",It=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Te),value:zod.z.string(),metadata:t}),N="tool-call",Bt=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(N),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:t}),Me="partial-tool-call",At=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Me),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:t}),G="tool-response",Xa=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(G),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:t}),en=[O,J,N,G],tn=zod.z.enum(en),on=(t=zod.z.undefined(),o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Rt(t),Qa(o),Bt(a),Xa(s)]),an=[Te,Me];zod.z.enum(an);var nn=(t=zod.z.undefined(),o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[It(t),At(o)]),Lt=(t=Pt,o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined(),i=zod.z.undefined(),l=zod.z.undefined())=>zod.z.object({role:t,content:zod.z.array(on(o,a,s,i)),metadata:l}),Oe=(t=za,o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:t,partialContent:nn(o,a),metadata:s}),sn=t=>Rt().parse({modality:O,value:t}),rn=(t,o,a,s)=>Bt().parse({modality:N,index:t,id:o,name:a,arguments:s}),ct=(t,o)=>Oe().parse({role:t,partialContent:It().parse({modality:Te,value:o})}),pt=(t,o,a,s,i)=>Oe().parse({role:t,partialContent:At().parse({modality:Me,index:o,id:a,name:s,arguments:i})}),Nt=(t=zod.z.record(zod.z.string(),zod.z.any()).optional())=>t,ln=["object","array","number","string","boolean","enum"],ut=zod.z.enum(ln),dn=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([ut,zod.z.array(zod.z.union([ut,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(dn),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 cn="function",pn=zod.z.enum(["object","array","number","string","boolean","null"]),un=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:pn.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(un).optional(),required:zod.z.array(zod.z.string()).optional()});var hn=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()}),gn=zod.z.enum(["function"]),fn=zod.z.object({type:gn,definition:zod.z.object({schema:hn})}),yn=[cn];zod.z.enum(yn);var bn=(t=zod.z.undefined())=>zod.z.discriminatedUnion("type",[fn.extend({metadata:t})]),W="text",Ut="token",Cn=[W,Ut],vn=zod.z.enum(Cn),kn=zod.z.array(zod.z.string().min(1)),wn=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),Sn=(t=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(W),metadata:t,requests:kn}),zod.z.object({modality:zod.z.literal(Ut),metadata:t,requests:wn})]),qt="float",xn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),$t="base64",Tn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),ht=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(qt),embeddings:zod.z.array(xn),usage:ht.optional()}),zod.z.object({encodingFormat:zod.z.literal($t),embeddings:zod.z.array(Tn),usage:ht.optional()})]);var Ht=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),gt=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),Mn=gt.extend({topLogProbs:zod.z.array(gt)}),Ft=zod.z.array(Mn);zod.z.object({messages:zod.z.array(Lt()),usage:Ht.optional(),logProbs:Ft.optional()});zod.z.object({partialMessages:zod.z.array(Oe()),usage:Ht.optional(),logProbs:Ft.optional()});var On=Object.defineProperty,ft=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,yt=(t,o,a)=>o in t?On(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,ce=(t,o)=>{for(var a in o||(o={}))jn.call(o,a)&&yt(t,a,o[a]);if(ft)for(var a of ft(o))En.call(o,a)&&yt(t,a,o[a]);return t},bt="ProviderError",Ct=class Dt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},bt),this.name=bt,this.info=o,this.cause=a;}static isProviderError(o){return o instanceof Dt}},vt="ModelResponseError",$=class zt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},vt),this.name=vt,this.cause=a,this.info=o;}static isModelResponseError(o){return o instanceof zt}},kt="InvalidModelRequestError",Se=class Kt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},kt),this.name=kt,this.cause=a,this.info=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(o){return o instanceof Kt}},wt="InvalidConfigError",V=class Vt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},wt),this.name=wt,this.cause=a,this.info=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(o){return o instanceof Vt}},St="InvalidMessagesError",M=class Jt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},St),this.name=St,this.cause=a,this.info=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(o){return o instanceof Jt}},xt="InvalidToolsError",Tt=class Gt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},xt),this.name=xt,this.cause=a,this.info=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(o){return o instanceof Gt}},Mt="InvalidEmbeddingRequestsError",Ot=class Wt extends D{constructor({info:o,cause:a}){super({info:o,cause:a},Mt),this.name=Mt,this.info=o,this.cause=a,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(o){return o instanceof Wt}},je="multi-string",Zt=zod.z.object({type:zod.z.literal(je),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()}),Pn=t=>zod.z.array(zod.z.string()).max(t).default([]).optional(),_n=t=>({def:Zt.parse(ce({type:je},t)),schema:Pn(t.max)}),Yt="object-schema",Rn=zod.z.object({type:zod.z.literal(Yt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),Ee="range",Qt=zod.z.object({type:zod.z.literal(Ee),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()}),In=(t,o,a,s)=>zod.z.number().min(t).max(o).step(a).default(s).optional(),pe=t=>({def:Qt.parse(ce({type:Ee},t)),schema:In(t.min,t.max,t.step,t.default)}),Pe="select-boolean",Xt=zod.z.object({type:zod.z.literal(Pe),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()}),Bn=t=>zod.z.boolean().nullable().default(t).optional(),An=t=>({def:Xt.parse(ce({type:Pe},t)),schema:Bn(t.default)}),_e="select-string",eo=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.string(),choices:zod.z.array(zod.z.string())}),Ln=(t,o)=>zod.z.enum(o).nullable().default(t).optional(),Re=t=>({def:eo.parse(ce({type:_e},t)),schema:Ln(t.default,t.choices)}),Nn=[Ee,je,_e,Yt,Pe];zod.z.enum(Nn);var to=zod.z.discriminatedUnion("type",[Qt,Zt,eo,Xt,Rn]),F=(t=Pt,o=tn)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(t,zod.z.string().min(1).optional()),modalities:zod.z.array(o).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),to),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(a=>{var s,i;let l=Object.keys(a.def),r=Object.keys((i=(s=a.schema)==null?void 0:s.shape)!=null?i:{});return l.every(d=>r.includes(d))&&r.every(d=>l.includes(d))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})}),Z=(t=vn)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(t).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),to),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(o=>{var a,s;let i=Object.keys(o.def),l=Object.keys((s=(a=o.schema)==null?void 0:a.shape)!=null?s:{});return i.every(r=>l.includes(r))&&l.every(r=>i.includes(r))},{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 Un={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."},qn={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."},$n=t=>({type:"multi",title:"Stop sequence",description:`Enter up to ${t} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Hn={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."},Fn={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."},Dn={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."},Kn={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."},Vn={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."},Jn={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."},Gn={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."},Wn={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."},Zn={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."},Yn={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},Qn={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."},Xn={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."},es={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."},A={TEMPERATURE:Un,MAX_TOKENS:qn,STOP:$n,TOP_A:Hn,TOP_P:Fn,TOP_K:Dn,MIN_P:zn,FREQUENCY_PENALTY:Kn,PRESENCE_PENALTY:Vn,REPETITION_PENALTY:Gn,SEED:Jn,LOG_PROBS:Wn,TOP_LOG_PROBS:Zn,ECHO:Yn,RESPONSE_FORMAT:Qn,RESPONSE_FORMAT_WITH_SCHEMA:Xn,RESPONSE_SCHEMA:es},oo=t=>Object.fromEntries(Object.entries(t).filter(([o,a])=>a!=null)),te=t=>t==null?void 0:t.replace(/\/$/,""),ao=pe({param:"temperature",title:A.TEMPERATURE.title,description:A.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),no=t=>pe({param:"max_tokens",title:A.MAX_TOKENS.title,description:A.MAX_TOKENS.description,min:0,max:t,step:1,default:0}),so=t=>_n({param:"stop_sequences",title:A.STOP(t).title,description:A.STOP(t).description,max:t}),io=pe({param:"top_p",title:A.TOP_P.title,description:A.TOP_P.description,min:0,max:1,step:.01,default:1}),ro=pe({param:"top_k",title:A.TOP_K.title,description:A.TOP_K.description,min:0,max:1,step:.01,default:1}),lo=Re({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"]}),Ie=(t,o)=>zod.z.object({temperature:ao.schema,maxTokens:no(t).schema,stop:so(o).schema,topP:io.schema,topK:ro.schema,toolChoice:lo.schema}),Be=(t,o)=>({temperature:ao.def,maxTokens:no(t).def,stop:so(o).def,topP:io.def,topK:ro.def,toolChoice:lo.def}),mo=Re({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),co=Re({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),po=An({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:!0}),ts=()=>zod.z.object({encodingFormat:mo.schema,inputType:co.schema,truncation:po.schema}),os=()=>({encodingFormat:mo.def,inputType:co.def,truncation:po.def}),w={base:(t,o)=>({def:Be(t,o),schema:Ie(t,o)})},E={base:()=>({def:os(),schema:ts()})},as="anthropic",me=class{constructor(){this.version="v1",this.name=as,this.chatModelFactories={[ko]:{model:Is,modelOptions:Rs,modelSchema:wo},[Eo]:{model:Ks,modelOptions:zs,modelSchema:Po},[Oo]:{model:Fs,modelOptions:Hs,modelSchema:jo},[go]:{model:xs,modelOptions:Ss,modelSchema:fo},[yo]:{model:Os,modelOptions:Ms,modelSchema:bo},[So]:{model:Ls,modelOptions:As,modelSchema:xo},[Co]:{model:Ps,modelOptions:Es,modelSchema:vo},[To]:{model:qs,modelOptions:Us,modelSchema:Mo}},this.embeddingModelFactories={[Ho]:{model:pi,modelOptions:ci,modelSchema:Fo},[qo]:{model:di,modelOptions:li,modelSchema:$o},[_o]:{model:Ys,modelOptions:Zs,modelSchema:Ro},[Io]:{model:ei,modelOptions:Xs,modelSchema:Bo},[Ao]:{model:ai,modelOptions:oi,modelSchema:Lo},[No]:{model:ii,modelOptions:si,modelSchema:Uo}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((t,o)=>(t[o]=this.chatModelFactories[o].modelSchema,t),{})}chatModel(t){let o=t.modelName;if(!(o in this.chatModelFactories))throw new Ct({info:`Anthropic chat model: ${o} not found`,cause:new Error(`Anthropic chat model: ${o} not found, available chat models:
|
|
10
|
-
|
|
11
|
-
${this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
received : ${JSON.stringify(i)}`)})}})}transformProxyStreamChatResponseChunk(t,o,a,s,i){return mt(this,null,function*(){yield*le(qa(this.transformStreamChatResponseChunk(t,o)));})}getProxyStreamChatUrl(t,o,a){return j(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getProxyCompleteChatUrl(t,o,a){return j(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyCompleteChatHeaders(t,o,a){return j(this,null,function*(){if(!o)return {};let s=S({},o);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(t,o,a){return j(this,null,function*(){return yield this.getProxyCompleteChatHeaders(t,o,a)})}},go="claude-3-5-sonnet-20240620",ws="Most intelligent model. Highest level of intelligence and capability.",fo=F(f,C).parse({name:go,description:ws,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:w.base(8192,4).def,schema:w.base(8192,4).schema}}),Ss=U,xs=class extends L{constructor(t){super(fo,t);}},yo="claude-3-5-sonnet-20241022",Ts="Most intelligent model. Highest level of intelligence and capability.",bo=F(f,C).parse({name:yo,description:Ts,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:w.base(8192,4).def,schema:w.base(8192,4).schema}}),Ms=U,Os=class extends L{constructor(t){super(bo,t);}},Co="claude-3-5-sonnet-latest",js="Most intelligent model. Highest level of intelligence and capability.",vo=F(f,C).parse({name:Co,description:js,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:w.base(8192,4).def,schema:w.base(8192,4).schema}}),Es=U,Ps=class extends L{constructor(t){super(vo,t);}},ko="claude-3-haiku-20240307",_s="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",wo=F(f,C).parse({name:ko,description:_s,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:w.base(4096,4).def,schema:w.base(4096,4).schema}}),Rs=U,Is=class extends L{constructor(t){super(wo,t);}},So="claude-3-5-haiku-20241022",Bs="Our fastest model with intelligence at blazing speeds.",xo=F(f,C).parse({name:So,description:Bs,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:w.base(8192,4).def,schema:w.base(8192,4).schema}}),As=U,Ls=class extends L{constructor(t){super(xo,t);}},To="claude-3-5-haiku-latest",Ns="Our fastest model with intelligence at blazing speeds.",Mo=F(f,C).parse({name:To,description:Ns,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:w.base(8192,4).def,schema:w.base(8192,4).schema}}),Us=U,qs=class extends L{constructor(t){super(Mo,t);}},Oo="claude-3-opus-20240229",$s="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",jo=F(f,C).parse({name:Oo,description:$s,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:w.base(4096,4).def,schema:w.base(4096,4).schema}}),Hs=U,Fs=class extends L{constructor(t){super(jo,t);}},Eo="claude-3-sonnet-20240229",Ds="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",Po=F(f,C).parse({name:Eo,description:Ds,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:w.base(4096,4).def,schema:w.base(4096,4).schema}}),zs=U,Ks=class extends L{constructor(t){super(Po,t);}},Y=[W],Q=zod.z.enum([W]),Vs=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()})}),Js=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),Gs=zod.z.object({model:zod.z.string().min(1).optional(),input:Js,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional()}),z=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),X=class{constructor(t,o){this.version="v1";let a=z.parse(o);this.modelSchema=t,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=te(me.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(t){return t.requests.reduce((o,a)=>o+a.length,0)}getRetryDelay(t){return {shouldRetry:!0,delayMs:0}}transformModelRequest(t){let o=Gs.safeParse(t);if(!o.success)throw new Se({info:"Invalid model request",cause:o.error});let a=o.data,s=a.model,i={encodingFormat:a.encoding_format,inputType:a.input_type,truncation:a.truncation},l=Nt().parse(oo(i)),r;return typeof a.input=="string"?r={modality:W,requests:[a.input]}:r={modality:W,requests:a.input},{modelName:s,config:l,embeddingRequests:r}}transformConfig(t,o){"inputType"in t&&t.inputType===""&&delete t.inputType,"encodingFormat"in t&&t.encodingFormat===""&&delete t.encodingFormat;let a=this.modelSchema.config.schema.safeParse(t);if(!a.success)throw new V({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let s=a.data;return Object.keys(s).forEach(i=>{if(!this.modelSchema.config.def[i])throw new V({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${i}',
|
|
19
|
-
|
|
20
|
-
Message: ${hi(a)}`),this.name=Le,this.info=o,this.cause=a,this.name=s!=null?s:Le,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(o){return o instanceof Vo}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},gi="system",fi="user",Jo="assistant",yi="tool",bi=[gi,fi,Jo,yi],Ue=zod.z.enum(bi),Ci=[Jo],vi=zod.z.enum(Ci),Go="image",ki="base64",wi=["png","jpeg","webp","gif"],Si=zod.z.object({type:zod.z.literal(ki),base64:zod.z.string(),media_type:zod.z.enum(wi)}),xi="url",Ti=zod.z.object({type:zod.z.literal(xi),url:zod.z.string()}),Mi=zod.z.discriminatedUnion("type",[Si,Ti]),Oi=["low","medium","high","auto"],ji=zod.z.enum(Oi),Ei=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Go),detail:ji,value:Mi,metadata:t}),Wo="text",Pi=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Wo),value:zod.z.string(),metadata:t}),Zo="partial-text",_i=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Zo),value:zod.z.string(),metadata:t}),Yo="tool-call",Ri=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Yo),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:t}),Qo="partial-tool-call",Ii=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Qo),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:t}),Xo="tool-response",Bi=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Xo),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:t}),Ai=[Wo,Go,Yo,Xo],ea=zod.z.enum(Ai),Li=(t=zod.z.undefined(),o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Pi(t),Ei(o),Ri(a),Bi(s)]),Ni=[Zo,Qo];zod.z.enum(Ni);var Ui=(t=zod.z.undefined(),o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[_i(t),Ii(o)]);var qi=(t=Ue,o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined(),i=zod.z.undefined(),l=zod.z.undefined())=>zod.z.object({role:t,content:zod.z.array(Li(o,a,s,i)),metadata:l}),$i=(t=vi,o=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:t,partialContent:Ui(o,a),metadata:s});var Hi=["object","array","number","string","boolean","enum"],Do=zod.z.enum(Hi),Fi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Do,zod.z.array(zod.z.union([Do,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()}),Di=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(Fi),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:Di}).optional();var zi="function";var Ki=zod.z.enum(["object","array","number","string","boolean","null"]),Vi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Ki.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(Vi).optional(),required:zod.z.array(zod.z.string()).optional()});var Ji=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 Gi=zod.z.enum(["function"]);zod.z.object({type:Gi,definition:zod.z.object({schema:Ji})});var Wi=[zi];zod.z.enum(Wi);var Zi="text",Yi="token",Qi=[Zi,Yi];zod.z.enum(Qi);zod.z.array(zod.z.string().min(1));zod.z.array(zod.z.array(zod.z.number().int().nonnegative()));var er="float",tr=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),or="base64",ar=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),zo=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(er),embeddings:zod.z.array(tr),usage:zo.optional()}),zod.z.object({encodingFormat:zod.z.literal(or),embeddings:zod.z.array(ar),usage:zo.optional()})]);var ta=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Ko=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),nr=Ko.extend({topLogProbs:zod.z.array(Ko)}),oa=zod.z.array(nr);zod.z.object({messages:zod.z.array(qi()),usage:ta.optional(),logProbs:oa.optional()});zod.z.object({partialMessages:zod.z.array($i()),usage:ta.optional(),logProbs:oa.optional()});var sr=Object.defineProperty,aa=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,na=(t,o,a)=>o in t?sr(t,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[o]=a,lr=(t,o)=>{for(var a in o||(o={}))ir.call(o,a)&&na(t,a,o[a]);if(aa)for(var a of aa(o))rr.call(o,a)&&na(t,a,o[a]);return t},sa="ProviderError",qe=class ra extends Ne{constructor({info:o,cause:a}){super({info:o,cause:a},sa),this.name=sa,this.info=o,this.cause=a;}static isProviderError(o){return o instanceof ra}};var ia="ModelResponseError",la=class da extends Ne{constructor({info:o,cause:a}){super({info:o,cause:a},ia),this.name=ia,this.cause=a,this.info=o;}static isModelResponseError(o){return o instanceof da}};var ma="multi-string",dr=zod.z.object({type:zod.z.literal(ma),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()});var ca="object-schema",mr=zod.z.object({type:zod.z.literal(ca),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 pa="range",cr=zod.z.object({type:zod.z.literal(pa),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()});var ua="select-boolean",pr=zod.z.object({type:zod.z.literal(ua),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()});var $e="select-string",ha=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.string(),choices:zod.z.array(zod.z.string())}),ur=(t,o)=>zod.z.enum(o).nullable().default(t).optional(),ga=t=>({def:ha.parse(lr({type:$e},t)),schema:ur(t.default,t.choices)}),hr=[pa,ma,$e,ca,ua];zod.z.enum(hr);var gr=zod.z.discriminatedUnion("type",[cr,dr,ha,pr,mr]),P=(t=Ue,o=ea)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(t,zod.z.string().min(1).optional()),modalities:zod.z.array(o).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),gr),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(a=>{var s,i;let l=Object.keys(a.def),r=Object.keys((i=(s=a.schema)==null?void 0:s.shape)!=null?i:{});return l.every(d=>r.includes(d))&&r.every(d=>l.includes(d))},{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 fr=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var fa=t=>{if(fr()){let o=atob(t),a=new Uint8Array(o.length);for(let s=0;s<o.length;s++)a[s]=o.charCodeAt(s);return new TextDecoder("utf-8").decode(a)}else return Buffer.from(t,"base64").toString("utf-8")};var He=ga({param:"awsRegion",title:"AWS Region",description:"Controls which region the model will use to call AWS services.",default:"us-east-1",choices:["us-east-1","us-west-2","eu-west-1","eu-west-3","eu-central-1","ap-south-3","ap-southeast-1","ap-southeast-2","ap-northeast-1"]});var ya=(t,o)=>Ie(t,o).extend({awsRegion:He.schema}),ba=(t,o)=>K(_({},Be(t,o)),{awsRegion:He.def});var v={base:(t,o)=>({def:ba(t,o),schema:ya(t,o)})};var yr="bedrock",ee=class ee{constructor(){this.version="v1";this.name=yr;this.chatModelFactories={[Ge]:{model:fe,modelOptions:wa,modelSchema:We},[Qe]:{model:be,modelOptions:xa,modelSchema:Xe},[Ze]:{model:ye,modelOptions:Sa,modelSchema:Ye},[ze]:{model:he,modelOptions:va,modelSchema:Ke},[Ve]:{model:ge,modelOptions:ka,modelSchema:Je},[Fe]:{model:ue,modelOptions:Ca,modelSchema:De}};this.embeddingModelFactories={};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((o,a)=>(o[a]=this.chatModelFactories[a].modelSchema,o),{})}chatModel(o){let a=o.modelName;if(!(a in this.chatModelFactories))throw new qe({info:`Bedrock chat model: ${a} not found`,cause:new Error(`Bedrock chat model: ${a} not found, available chat models:
|
|
21
|
-
${this.chatModelLiterals().join(", ")}`)});let s=this.chatModelFactories[a].model,i=this.chatModelFactories[a].modelOptions.parse(o);return new s(i)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((o,a)=>(o[a]=this.embeddingModelFactories[a].modelSchema,o),{})}embeddingModel(o){throw new qe({info:"Adaline Bedrock provider does not support embedding models yet",cause:new Error("Adaline Bedrock provider does not support embedding models yet")})}};ee.awsService="bedrock",ee.awsDefaultRegion="us-east-1",ee.awsUrl=o=>`https://bedrock-runtime.${o!=null?o:ee.awsDefaultRegion}.amazonaws.com`;var B=ee;var x=zod.z.object({modelName:zod.z.string(),awsAccessKeyId:zod.z.string(),awsSecretAccessKey:zod.z.string()});var T=class t extends L{constructor(a,s){let i=x.parse(s);super(a,{apiKey:"random-api-key",modelName:i.modelName});this.version="v1";this.modelSchema=a,this.modelName=i.modelName,this.awsService=B.awsService,this.awsAccessKeyId=i.awsAccessKeyId,this.awsSecretAccessKey=i.awsSecretAccessKey;}getDefaultBaseUrl(){return B.awsUrl()}getDefaultHeaders(){return {Accept:"application/json","Content-Type":"application/json"}}getDefaultParams(){return {anthropic_version:"bedrock-2023-05-31"}}getCompleteChatUrl(a,s,i){let l=B.awsUrl(a==null?void 0:a.awsRegion);return new Promise(r=>{r(`${l}/model/${this.modelName}/invoke`);})}transformConfig(a,s,i){let l=_({},a);return delete l.awsRegion,super.transformConfig(l,s,i)}getCompleteChatHeaders(a,s,i){return R(this,null,function*(){let l=new URL(yield this.getCompleteChatUrl(a,s,i)),r={accessKeyId:this.awsAccessKeyId,secretAccessKey:this.awsSecretAccessKey},d=a==null?void 0:a.awsRegion,m=this.getDefaultHeaders();m=K(_({},m),{host:B.awsUrl(d).split("://")[1]});let p=yield this.getCompleteChatData(a||{},s||[],i),h=new protocolHttp.HttpRequest({hostname:l.hostname,path:l.pathname,protocol:l.protocol,method:"POST",body:JSON.stringify(p),headers:m});return (yield new signatureV4.SignatureV4({credentials:r,service:this.awsService,region:d,sha256:sha256Js.Sha256}).sign(h)).headers})}getCompleteChatData(a,s,i){return R(this,null,function*(){let l=_(_({},this.getDefaultParams()),yield ie(t.prototype,this,"getCompleteChatData").call(this,a,s,i));return new Promise(r=>{r(l);})})}getStreamChatUrl(a,s,i){return R(this,null,function*(){let l=B.awsUrl(a==null?void 0:a.awsRegion);return new Promise(r=>{r(`${l}/model/${this.modelName}/invoke-with-response-stream`);})})}getStreamChatHeaders(a,s,i){return R(this,null,function*(){let l=new URL(yield this.getStreamChatUrl(a,s,i)),r={accessKeyId:this.awsAccessKeyId,secretAccessKey:this.awsSecretAccessKey},d=a==null?void 0:a.awsRegion,m=this.getDefaultHeaders();m=K(_({},m),{host:B.awsUrl(d).split("://")[1]});let p=yield this.getCompleteChatData(a||{},s||[],i),h=new protocolHttp.HttpRequest({hostname:l.hostname,path:l.pathname,protocol:l.protocol,method:"POST",body:JSON.stringify(p),headers:m});return (yield new signatureV4.SignatureV4({credentials:r,service:this.awsService,region:d,sha256:sha256Js.Sha256}).sign(h)).headers})}getStreamChatData(a,s,i){return R(this,null,function*(){let l=_(_({},this.getDefaultParams()),yield ie(t.prototype,this,"getStreamChatData").call(this,a,s,i));return "stream"in l&&delete l.stream,l})}transformStreamChatResponseChunk(a,s){return ke(this,null,function*(){let i=a.toString(),l=/{\s*"bytes"\s*:\s*"[\w=+/]+".*?}/g,r=i.match(l)||[];for(let d of r){let m=d.indexOf("{"),p=d.indexOf("}");if(m!==-1&&p!==-1&&m<p){let h;try{h=JSON.parse(d.slice(m,p+1));}catch(u){throw new la({info:`Malformed JSON received in stream : ${h}`,cause:u})}let g=fa(h.bytes),k=(yield new re(ie(t.prototype,this,"transformStreamChatResponseChunk").call(this,`data: ${g}`,s).next())).value;k&&(yield k);}}})}transformProxyStreamChatResponseChunk(a,s,i,l,r){return ke(this,null,function*(){yield*le(this.transformStreamChatResponseChunk(a,s));})}getRegionHelper(a){var i;let s=a["aws-region"];if(!s){let l=(i=a.authorization)==null?void 0:i.match(/Credential=[^/]+\/\d+\/([^/]+)\/bedrock/);l&&(s=l[1]);}return s}getProxyStreamChatUrl(a,s,i){return R(this,null,function*(){let l=this.getRegionHelper(s||{}),r=B.awsUrl(l);return new Promise(d=>{d(`${r}/model/${this.modelName}/invoke-with-response-stream`);})})}getProxyChatHeaders(a,s,i,l){return R(this,null,function*(){let r=new URL(yield a());if(!i)return {};let d=i["aws-access-key-id"],m=i["aws-secret-access-key"],p=this.getRegionHelper(i);if(!d||!m)return {};let h={accessKeyId:d,secretAccessKey:m};i=K(_({},i),{host:r.host,"content-type":"application/json",accept:"application/json"}),delete i["content-length"];let g=i.authorization||i.Authorization;if(g){let q=g.match(/SignedHeaders=([^,]+)/);if(q&&q[1]){let at=q[1].split(";").map(ne=>ne.trim().toLowerCase());at.push("authorization"),i=Object.keys(i).reduce((ne,ve)=>{var nt;return at.includes(ve.toLowerCase())&&(ne[ve]=(nt=i==null?void 0:i[ve])!=null?nt:""),ne},{});}}let k=new protocolHttp.HttpRequest({hostname:r.hostname,path:r.pathname,protocol:r.protocol,method:"POST",body:JSON.stringify(s),headers:i});return (yield new signatureV4.SignatureV4({credentials:h,service:this.awsService,region:p,sha256:sha256Js.Sha256}).sign(k)).headers})}getProxyCompleteChatUrl(a,s,i){return R(this,null,function*(){let l=this.getRegionHelper(s||{}),r=B.awsUrl(l);return new Promise(d=>{d(`${r}/model/${this.modelName}/invoke`);})})}getProxyCompleteChatHeaders(a,s,i){return R(this,null,function*(){return this.getProxyChatHeaders(()=>this.getProxyCompleteChatUrl(a,s,i),a,s,i)})}getProxyStreamChatHeaders(a,s,i){return R(this,null,function*(){return this.getProxyChatHeaders(()=>this.getProxyStreamChatUrl(a,s,i),a,s,i)})}};var Fe="anthropic.claude-3-5-haiku-20241022-v1:0",br="Our fastest model with intelligence at blazing speeds.",De=P(f,C).parse({name:Fe,description:br,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),Ca=x,ue=class extends T{constructor(o){super(De,o);}};var ze="anthropic.claude-3-5-sonnet-20240620-v1:0",Cr="Most intelligent model. Highest level of intelligence and capability.",Ke=P(f,C).parse({name:ze,description:Cr,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),va=x,he=class extends T{constructor(o){super(Ke,o);}};var Ve="anthropic.claude-3-5-sonnet-20241022-v2:0",vr="Most intelligent model. Highest level of intelligence and capability.",Je=P(f,C).parse({name:Ve,description:vr,maxInputTokens:2e5,maxOutputTokens:8192,roles:y,modalities:b,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),ka=x,ge=class extends T{constructor(o){super(Je,o);}};var Ge="anthropic.claude-3-haiku-20240307-v1:0",kr="Claude 3 Haiku is a large-scale multimodal model trained by Anthropic. It is the successor to Claude 3 and is designed to be more powerful and capable than its predecessor.",We=P(f,C).parse({name:Ge,description:kr,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),wa=x,fe=class extends T{constructor(o){super(We,o);}};var Ze="anthropic.claude-3-opus-20240229-v1:0",wr="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",Ye=P(f,C).parse({name:Ze,description:wr,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),Sa=x,ye=class extends T{constructor(o){super(Ye,o);}};var Qe="anthropic.claude-3-sonnet-20240229-v1:0",Sr="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",Xe=P(f,C).parse({name:Qe,description:Sr,maxInputTokens:2e5,maxOutputTokens:4096,roles:y,modalities:b,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),xa=x,be=class extends T{constructor(o){super(Xe,o);}};
|
|
8
|
+
var Ko=Object.defineProperty,zo=Object.defineProperties;var Vo=Object.getOwnPropertyDescriptors;var gt=Object.getOwnPropertySymbols,Go=Object.getPrototypeOf,Jo=Object.prototype.hasOwnProperty,Wo=Object.prototype.propertyIsEnumerable,Zo=Reflect.get;var de=(t,a)=>(a=Symbol[t])?a:Symbol.for("Symbol."+t),Xo=t=>{throw TypeError(t)};var ft=(t,a,o)=>a in t?Ko(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,A=(t,a)=>{for(var o in a||(a={}))Jo.call(a,o)&&ft(t,o,a[o]);if(gt)for(var o of gt(a))Wo.call(a,o)&&ft(t,o,a[o]);return t},W=(t,a)=>zo(t,Vo(a));var ce=(t,a,o)=>Zo(Go(t),o,a);var B=(t,a,o)=>new Promise((i,s)=>{var l=m=>{try{d(o.next(m));}catch(p){s(p);}},r=m=>{try{d(o.throw(m));}catch(p){s(p);}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(l,r);d((o=o.apply(t,a)).next());}),me=function(t,a){this[0]=t,this[1]=a;},je=(t,a,o)=>{var i=(r,d,m,p)=>{try{var g=o[r](d),f=(d=g.value)instanceof me,h=g.done;Promise.resolve(f?d[0]:d).then(u=>f?i(r==="return"?r:"next",d[1]?{done:u.done,value:u.value}:u,m,p):m({value:u,done:h})).catch(u=>i("throw",u,m,p));}catch(u){p(u);}},s=r=>l[r]=d=>new Promise((m,p)=>i(r,d,m,p)),l={};return o=o.apply(t,a),l[de("asyncIterator")]=()=>l,s("next"),s("throw"),s("return"),l},pe=t=>{var a=t[de("asyncIterator")],o=!1,i,s={};return a==null?(a=t[de("iterator")](),i=l=>s[l]=r=>a[l](r)):(a=a.call(t),i=l=>s[l]=r=>{if(o){if(o=!1,l==="throw")throw r;return r}return o=!0,{done:!1,value:new me(new Promise(d=>{var m=a[l](r);m instanceof Object||Xo("Object expected"),d(m);}),1)}}),s[de("iterator")]=()=>s,i("next"),"throw"in a?i("throw"):s.throw=l=>{throw l},"return"in a&&i("return"),s};var Yo=Object.defineProperty,Qo=Object.defineProperties,en=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,tn=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,ue=(t,a)=>(a=Symbol[t])?a:Symbol.for("Symbol."+t),on=t=>{throw TypeError(t)},bt=(t,a,o)=>a in t?Yo(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,T=(t,a)=>{for(var o in a||(a={}))tn.call(a,o)&&bt(t,o,a[o]);if(yt)for(var o of yt(a))an.call(a,o)&&bt(t,o,a[o]);return t},_e=(t,a)=>Qo(t,en(a)),R=(t,a,o)=>new Promise((i,s)=>{var l=m=>{try{d(o.next(m));}catch(p){s(p);}},r=m=>{try{d(o.throw(m));}catch(p){s(p);}},d=m=>m.done?i(m.value):Promise.resolve(m.value).then(l,r);d((o=o.apply(t,a)).next());}),Nt=function(t,a){this[0]=t,this[1]=a;},Ct=(t,a,o)=>{var i=(r,d,m,p)=>{try{var g=o[r](d),f=(d=g.value)instanceof Nt,h=g.done;Promise.resolve(f?d[0]:d).then(u=>f?i(r==="return"?r:"next",d[1]?{done:u.done,value:u.value}:u,m,p):m({value:u,done:h})).catch(u=>i("throw",u,m,p));}catch(u){p(u);}},s=r=>l[r]=d=>new Promise((m,p)=>i(r,d,m,p)),l={};return o=o.apply(t,a),l[ue("asyncIterator")]=()=>l,s("next"),s("throw"),s("return"),l},nn=t=>{var a=t[ue("asyncIterator")],o=!1,i,s={};return a==null?(a=t[ue("iterator")](),i=l=>s[l]=r=>a[l](r)):(a=a.call(t),i=l=>s[l]=r=>{if(o){if(o=!1,l==="throw")throw r;return r}return o=!0,{done:!1,value:new Nt(new Promise(d=>{var m=a[l](r);m instanceof Object||on("Object expected"),d(m);}),1)}}),s[ue("iterator")]=()=>s,i("next"),"throw"in a?i("throw"):s.throw=l=>{throw l},"return"in a&&i("return"),s},sn=t=>{let a=new WeakSet;return JSON.stringify(t,(o,i)=>{if(typeof i=="object"&&i!==null){if(a.has(i))return;a.add(i);}return i})},rn=t=>t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:sn(t),Ee="GatewayBaseError",G=class Ut extends Error{constructor({info:a,cause:o},i){super(`[${i!=null?i:Ee}]: ${a}
|
|
9
|
+
Message: ${rn(o)}`),this.name=Ee,this.info=a,this.cause=o,this.name=i!=null?i:Ee,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(a){return a instanceof Ut}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},ie="system",Z="user",S="assistant",Ae="tool",ln=[ie,Z,S,Ae],qt=zod.z.enum(ln),dn=[S],cn=zod.z.enum(dn),K="image",$t="base64",mn=["png","jpeg","webp","gif"],pn=zod.z.object({type:zod.z.literal($t),base64:zod.z.string(),media_type:zod.z.enum(mn)}),un="url",hn=zod.z.object({type:zod.z.literal(un),url:zod.z.string()}),gn=zod.z.discriminatedUnion("type",[pn,hn]),fn=["low","medium","high","auto"],yn=zod.z.enum(fn),bn=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(K),detail:yn,value:gn,metadata:t}),z="reasoning",ge="partial-reasoning",fe="thinking",Be="redacted",Pe=zod.z.object({type:zod.z.literal(fe),thinking:zod.z.string(),signature:zod.z.string()}),Ht=zod.z.object({type:zod.z.literal(Be),data:zod.z.string()}),Cn=zod.z.discriminatedUnion("type",[Pe,Ht]),Le=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(z),value:Cn,metadata:t}),kn=zod.z.object({type:zod.z.literal(fe),thinking:Pe.shape.thinking.optional(),signature:Pe.shape.signature.optional()}),vn=zod.z.discriminatedUnion("type",[kn,Ht]),Ne=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ge),value:vn,metadata:t}),w="text",Ft=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(w),value:zod.z.string(),metadata:t}),Ue="partial-text",Dt=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Ue),value:zod.z.string(),metadata:t}),L="tool-call",Kt=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(L),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:t}),qe="partial-tool-call",zt=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(qe),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:t}),V="tool-response",xn=(t=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),data:zod.z.string(),metadata:t}),Tn=[w,K,L,V,z],wn=zod.z.enum(Tn),Sn=(t=zod.z.undefined(),a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Ft(t),bn(a),Kt(o),xn(i),Le(s)]),Mn=[Ue,qe,ge];zod.z.enum(Mn);var On=(t=zod.z.undefined(),a=zod.z.undefined(),o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Dt(t),zt(a),Ne(o)]),Vt=(t=qt,a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined(),l=zod.z.undefined(),r=zod.z.undefined())=>zod.z.object({role:t,content:zod.z.array(Sn(a,o,i,s,r)),metadata:l}),se=(t=cn,a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:t,partialContent:On(a,o,i),metadata:s}),jn=t=>Ft().parse({modality:w,value:t}),En=(t,a,o,i)=>Kt().parse({modality:L,index:t,id:a,name:o,arguments:i}),kt=(t,a)=>se().parse({role:t,partialContent:Dt().parse({modality:Ue,value:a})}),vt=(t,a,o,i,s)=>se().parse({role:t,partialContent:zt().parse({modality:qe,index:a,id:o,name:i,arguments:s})}),Rn=(t,a)=>Le().parse({modality:z,value:{type:fe,thinking:t,signature:a}}),_n=t=>Le().parse({modality:z,value:{type:Be,data:t}}),Re=(t,a,o)=>se().parse({role:t,partialContent:Ne().parse({modality:ge,value:{type:fe,thinking:a,signature:o}})}),Pn=(t,a)=>se().parse({role:t,partialContent:Ne().parse({modality:ge,value:{type:Be,data:a}})}),Gt=(t=zod.z.record(zod.z.string(),zod.z.any()).optional())=>t,In=["object","array","number","string","boolean","enum"],xt=zod.z.enum(In),An=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([xt,zod.z.array(zod.z.union([xt,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()}),Bn=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(An),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:Bn}).optional();var Ln="function",Nn=zod.z.enum(["object","array","number","string","boolean","null"]),Un=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Nn.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(Un).optional(),required:zod.z.array(zod.z.string()).optional()});var qn=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()}),$n=zod.z.enum(["function"]),Hn=zod.z.object({type:$n,definition:zod.z.object({schema:qn})}),Fn=[Ln];zod.z.enum(Fn);var Dn=(t=zod.z.undefined())=>zod.z.discriminatedUnion("type",[Hn.extend({metadata:t})]),X="text",Jt="token",Kn=[X,Jt],zn=zod.z.enum(Kn),Vn=zod.z.array(zod.z.string().min(1)),Gn=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),Jn=(t=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(X),metadata:t,requests:Vn}),zod.z.object({modality:zod.z.literal(Jt),metadata:t,requests:Gn})]),Wt="float",Wn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),Zt="base64",Zn=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),Tt=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(Wt),embeddings:zod.z.array(Wn),usage:Tt.optional()}),zod.z.object({encodingFormat:zod.z.literal(Zt),embeddings:zod.z.array(Zn),usage:Tt.optional()})]);var Xt=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()}),Xn=wt.extend({topLogProbs:zod.z.array(wt)}),Yt=zod.z.array(Xn);zod.z.object({messages:zod.z.array(Vt()),usage:Xt.optional(),logProbs:Yt.optional()});zod.z.object({partialMessages:zod.z.array(se()),usage:Xt.optional(),logProbs:Yt.optional()});var Yn=Object.defineProperty,St=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable,Mt=(t,a,o)=>a in t?Yn(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,ye=(t,a)=>{for(var o in a||(a={}))Qn.call(a,o)&&Mt(t,o,a[o]);if(St)for(var o of St(a))ei.call(a,o)&&Mt(t,o,a[o]);return t},Ot="ProviderError",jt=class Qt extends G{constructor({info:a,cause:o}){super({info:a,cause:o},Ot),this.name=Ot,this.info=a,this.cause=o;}static isProviderError(a){return a instanceof Qt}},Et="ModelResponseError",F=class ea extends G{constructor({info:a,cause:o}){super({info:a,cause:o},Et),this.name=Et,this.cause=o,this.info=a;}static isModelResponseError(a){return a instanceof ea}},Rt="InvalidModelRequestError",Ie=class ta extends G{constructor({info:a,cause:o}){super({info:a,cause:o},Rt),this.name=Rt,this.cause=o,this.info=a,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(a){return a instanceof ta}},_t="InvalidConfigError",D=class aa extends G{constructor({info:a,cause:o}){super({info:a,cause:o},_t),this.name=_t,this.cause=o,this.info=a,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(a){return a instanceof aa}},Pt="InvalidMessagesError",E=class oa extends G{constructor({info:a,cause:o}){super({info:a,cause:o},Pt),this.name=Pt,this.cause=o,this.info=a,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(a){return a instanceof oa}},It="InvalidToolsError",At=class na extends G{constructor({info:a,cause:o}){super({info:a,cause:o},It),this.name=It,this.cause=o,this.info=a,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(a){return a instanceof na}},Bt="InvalidEmbeddingRequestsError",Lt=class ia extends G{constructor({info:a,cause:o}){super({info:a,cause:o},Bt),this.name=Bt,this.info=a,this.cause=o,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(a){return a instanceof ia}},$e="multi-string",sa=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),max:zod.z.number().int().positive()}),ti=t=>zod.z.array(zod.z.string()).max(t).default([]).optional(),ai=t=>({def:sa.parse(ye({type:$e},t)),schema:ti(t.max)}),ra="object-schema",oi=zod.z.object({type:zod.z.literal(ra),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),He="range",la=zod.z.object({type:zod.z.literal(He),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()}),ni=(t,a,o,i)=>zod.z.number().min(t).max(a).step(o).default(i).optional(),re=t=>({def:la.parse(ye({type:He},t)),schema:ni(t.min,t.max,t.step,t.default)}),Fe="select-boolean",da=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.boolean().nullable()}),ii=t=>zod.z.boolean().nullable().default(t).optional(),ca=t=>({def:da.parse(ye({type:Fe},t)),schema:ii(t.default)}),De="select-string",ma=zod.z.object({type:zod.z.literal(De),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())}),si=(t,a)=>zod.z.enum(a).nullable().default(t).optional(),Ke=t=>({def:ma.parse(ye({type:De},t)),schema:si(t.default,t.choices)}),ri=[He,$e,De,ra,Fe];zod.z.enum(ri);var pa=zod.z.discriminatedUnion("type",[la,sa,ma,da,oi]),H=(t=qt,a=wn)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(t,zod.z.string().min(1).optional()),modalities:zod.z.array(a).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),pa),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(o=>{var i,s;let l=Object.keys(o.def),r=Object.keys((s=(i=o.schema)==null?void 0:i.shape)!=null?s:{});return l.every(d=>r.includes(d))&&r.every(d=>l.includes(d))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})}),Y=(t=zn)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(t).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),pa),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(a=>{var o,i;let s=Object.keys(a.def),l=Object.keys((i=(o=a.schema)==null?void 0:o.shape)!=null?i:{});return s.every(r=>l.includes(r))&&l.every(r=>s.includes(r))},{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 li={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."},di={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."},ci={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},mi=t=>({type:"multi",title:"Stop sequence",description:`Enter up to ${t} sequences that will halt additional text output. The generated text will exclude these sequences.`}),pi={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."},ui={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."},hi={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."},gi={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."},fi={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."},yi={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."},bi={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."},Ci={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."},ki={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."},vi={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."},xi={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},Ti={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."},wi={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."},Si={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:li,MAX_TOKENS:di,STOP:mi,TOP_A:pi,TOP_P:ui,TOP_K:hi,MIN_P:gi,FREQUENCY_PENALTY:fi,PRESENCE_PENALTY:yi,REPETITION_PENALTY:Ci,SEED:bi,LOG_PROBS:ki,TOP_LOG_PROBS:vi,ECHO:xi,RESPONSE_FORMAT:Ti,RESPONSE_FORMAT_WITH_SCHEMA:wi,RESPONSE_SCHEMA:Si,MAX_REASONING_TOKENS:ci},ua=t=>Object.fromEntries(Object.entries(t).filter(([a,o])=>o!=null)),ne=t=>t==null?void 0:t.replace(/\/$/,""),ha=re({param:"temperature",title:_.TEMPERATURE.title,description:_.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),ga=t=>re({param:"max_tokens",title:_.MAX_TOKENS.title,description:_.MAX_TOKENS.description,min:0,max:t,step:1,default:0}),fa=t=>ai({param:"stop_sequences",title:_.STOP(t).title,description:_.STOP(t).description,max:t}),ya=re({param:"top_p",title:_.TOP_P.title,description:_.TOP_P.description,min:0,max:1,step:.01,default:1}),ba=re({param:"top_k",title:_.TOP_K.title,description:_.TOP_K.description,min:0,max:1,step:.01,default:1}),Ca=Ke({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"]}),be=(t,a)=>zod.z.object({temperature:ha.schema,maxTokens:ga(t).schema,stop:fa(a).schema,topP:ya.schema,topK:ba.schema,toolChoice:Ca.schema}),Ce=(t,a)=>({temperature:ha.def,maxTokens:ga(t).def,stop:fa(a).def,topP:ya.def,topK:ba.def,toolChoice:Ca.def}),ka=(t,a)=>re({param:"max_thinking_tokens",title:_.MAX_REASONING_TOKENS.title,description:_.MAX_REASONING_TOKENS.description,min:t,max:a,step:1,default:0}),va=ca({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.
|
|
10
|
+
This can be useful for complex tasks that require more time to think.`,default:!1}),Mi=(t,a,o,i)=>_e(T({},Ce(t,a)),{extendedThinking:va.def,maxExtendedThinkingTokens:ka(o,i).def}),Oi=(t,a,o,i)=>be(t,a).extend({extendedThinking:va.schema,maxExtendedThinkingTokens:ka(o,i).schema}),xa=Ke({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),Ta=Ke({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),wa=ca({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:!0}),ji=()=>zod.z.object({encodingFormat:xa.schema,inputType:Ta.schema,truncation:wa.schema}),Ei=()=>({encodingFormat:xa.def,inputType:Ta.def,truncation:wa.def}),v={base:(t,a)=>({def:Ce(t,a),schema:be(t,a)}),extendedThinking:(t,a,o,i)=>({def:Mi(t,a,o,i),schema:Oi(t,a,o,i)})},P={base:()=>({def:Ei(),schema:ji()})},Ri="anthropic",he=class{constructor(){this.version="v1",this.name=Ri,this.chatModelFactories={[Ba]:{model:Cs,modelOptions:bs,modelSchema:La},[Da]:{model:_s,modelOptions:Rs,modelSchema:Ka},[Ha]:{model:js,modelOptions:Os,modelSchema:Fa},[Oa]:{model:rs,modelOptions:ss,modelSchema:ja},[Ea]:{model:cs,modelOptions:ds,modelSchema:Ra},[Na]:{model:xs,modelOptions:vs,modelSchema:Ua},[_a]:{model:us,modelOptions:ps,modelSchema:Pa},[qa]:{model:Ss,modelOptions:ws,modelSchema:$a},[Ia]:{model:fs,modelOptions:gs,modelSchema:Aa}},this.embeddingModelFactories={[to]:{model:Ys,modelOptions:Xs,modelSchema:ao},[Qa]:{model:Ws,modelOptions:Js,modelSchema:eo},[za]:{model:Ns,modelOptions:Ls,modelSchema:Va},[Ga]:{model:$s,modelOptions:qs,modelSchema:Ja},[Wa]:{model:Ds,modelOptions:Fs,modelSchema:Za},[Xa]:{model:Vs,modelOptions:zs,modelSchema:Ya}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((t,a)=>(t[a]=this.chatModelFactories[a].modelSchema,t),{})}chatModel(t){let a=t.modelName;if(!(a in this.chatModelFactories))throw new jt({info:`Anthropic chat model: ${a} not found`,cause:new Error(`Anthropic chat model: ${a} not found, available chat models:
|
|
11
|
+
${this.chatModelLiterals().join(", ")}`)});let o=this.chatModelFactories[a].model,i=this.chatModelFactories[a].modelOptions.parse(t);return new o(i)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((t,a)=>(t[a]=this.embeddingModelFactories[a].modelSchema,t),{})}embeddingModel(t){let a=t.modelName;if(!(a in this.embeddingModelFactories))throw new jt({info:`Anthropic embedding model: ${a} not found`,cause:new Error(`Anthropic embedding model: ${a} not found, available embedding models:
|
|
12
|
+
${this.embeddingModelLiterals().join(", ")}`)});let o=this.embeddingModelFactories[a].model,i=this.embeddingModelFactories[a].modelOptions.parse(t);return new o(i)}};he.chatBaseUrl="https://api.anthropic.com/v1",he.embeddingBaseUrl="https://api.voyageai.com/v1";var y=zod.z.enum([ie,Z,S,Ae]),b={system:ie,user:Z,assistant:S,tool:Z},C=[w,K,L,V],k=zod.z.enum([w,K,L,V]),_i=[w,K,L,V,z],Pi=zod.z.enum([w,K,L,V,z]),Ii=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Ai=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.record(zod.z.any())}),Bi=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string(),signature:zod.z.string()}),Li=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),Ni=zod.z.object({content:zod.z.array(zod.z.discriminatedUnion("type",[Ii,Ai,Bi,Li])),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()})}),Ui=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()})})}),qi=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()})}),$i=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Hi=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.object({})}),Fi=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string()}),Di=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),Ki=zod.z.object({type:zod.z.literal("content_block_start"),index:zod.z.number(),content_block:zod.z.discriminatedUnion("type",[$i,Hi,Fi,Di])}),zi=zod.z.object({type:zod.z.literal("text_delta"),text:zod.z.string()}),Vi=zod.z.object({type:zod.z.literal("input_json_delta"),partial_json:zod.z.string()}),Gi=zod.z.object({type:zod.z.literal("thinking_delta"),thinking:zod.z.string()}),Ji=zod.z.object({type:zod.z.literal("signature_delta"),signature:zod.z.string()}),Wi=zod.z.object({type:zod.z.literal("content_block_delta"),index:zod.z.number(),delta:zod.z.discriminatedUnion("type",[zi,Vi,Gi,Ji])}),Zi=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string().optional(),signature:zod.z.string().optional()}),Xi=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),Yi=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),input_schema:zod.z.any()}),Qi=zod.z.object({type:zod.z.enum(["auto","any"])}),es=zod.z.object({type:zod.z.literal("tool"),name:zod.z.string().min(1)}),ze=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),Sa=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()})});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())});var Ma=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([ze,Sa])).min(1))}),ts=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ze,Sa,Ma])).min(1))}),as=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ze,Ma,Zi,Xi])).min(1))}),os=zod.z.union([ts,as]),ns=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(os).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([Qi,es]).optional(),tools:zod.z.array(Yi).min(1).optional(),top_p:zod.z.number().min(0).max(1).optional(),top_k:zod.z.number().min(0).optional()}),$=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),N=class{constructor(t,a){this.version="v1";let o=$.parse(a);this.modelSchema=t,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=ne(he.chatBaseUrl),this.completeChatUrl=ne(o.completeChatUrl||`${this.baseUrl}/messages`),this.streamChatUrl=ne(o.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(t){let a=0,o=!0;return t["x-should-retry"]&&(o=t["x-should-retry"].toLowerCase()!=="false"),t["retry-after"]&&(a=parseInt(t["retry-after"])*1e3),{shouldRetry:o,delayMs:a}}getTokenCount(t){return t.reduce((a,o)=>a+o.content.map(i=>i.modality==="text"?i.value:"").join(" ").length,0)}transformModelRequest(t){let a=ns.safeParse(t);if(!a.success)throw new Ie({info:"Invalid model request",cause:a.error});let o=a.data,i=o.model;if(o.tool_choice&&(!o.tools||o.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 s={};o.tool_choice&&(o.tool_choice.type==="tool"?s.toolChoice=o.tool_choice.name:s.toolChoice=o.tool_choice.type),s.maxTokens=o.max_tokens,s.temperature=o.temperature,s.topP=o.top_p,s.topK=o.top_k,s.stop=o.stop_sequences;let l=Gt().parse(ua(s)),r=[],d={};o.system&&r.push({role:ie,content:[{modality:w,value:o.system}]}),o.messages.forEach(p=>{let g=p.role;switch(g){case"user":{let f=p.content;if(typeof f=="string")r.push({role:g,content:[{modality:w,value:f}]});else {let h=f.map(u=>{if(u.type==="text")return {modality:w,value:u.text};if(u.type==="image"){let q="auto",j=u.source.media_type.split("/")[1];return {modality:K,detail:q,value:{type:$t,media_type:j,base64:u.source.data}}}else return {modality:V,id:u.tool_use_id,index:d[u.tool_use_id].index,name:d[u.tool_use_id].name,data:typeof u.content=="string"?u.content:JSON.stringify(u.content)}});r.push({role:g,content:h});}}break;case"assistant":{let f=p.content;if(typeof f=="string")r.push({role:g,content:[{modality:w,value:f}]});else {let h=f.map((u,q)=>{if(u.type==="text")return {modality:w,value:u.text};{let j={modality:L,id:u.id,index:q,name:u.name,arguments:JSON.stringify(u.input)};return d[u.id]=j,j}});r.push({role:g,content:h});}}break}});let m=[];return o.tools&&o.tools.forEach(p=>{m.push({type:"function",definition:{schema:{name:p.name,description:p.description||"",parameters:p.input_schema}}});}),{modelName:i,config:l,messages:r,tools:m.length>0?m:void 0}}transformConfig(t,a,o){let i=t.toolChoice,s=t.reasoningEnabled,l=t.maxReasoningTokens,r=T({},t);delete r.toolChoice,delete r.reasoningEnabled,delete r.maxReasoningTokens;let d=this.modelSchema.config.schema.safeParse(r);if(!d.success)throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:d.error});let m=d.data;i!==void 0&&(m.toolChoice=i),Object.keys(m).forEach(h=>{if(!(h in this.modelSchema.config.def))throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${h}',
|
|
13
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let p=Object.keys(m).reduce((h,u)=>{let q=this.modelSchema.config.def[u],j=q.param,oe=m[u];return j==="max_tokens"&&q.type==="range"&&oe===0?h[j]=q.max:h[j]=oe,h},{});if(!p.max_tokens){let h=this.modelSchema.config.def.maxTokens;p.max_tokens=h.max;}if("tool_choice"in p&&p.tool_choice!==void 0){let h=p.tool_choice;if(!o||o&&o.length===0)throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(o&&o.length>0){let u=this.modelSchema.config.def.toolChoice;if(u.choices.includes(h))p.tool_choice={type:h};else if(o.map(q=>q.definition.schema.name).includes(h))p.tool_choice={type:"tool",name:h};else throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${h}' is not part of provided 'tools' names or
|
|
14
|
+
one of [${u.choices.join(", ")}]`)})}}let g=s!==void 0,f=l!==void 0;if(g!==f)throw new D({info:`Invalid extended thinking config for model: '${this.modelName}'`,cause:new Error("Both 'extendedThinking' and 'maxExtendedThinkingTokens' must be defined together.")});if(g&&f){let h=p.max_tokens;if(s)if(l<h)p.thinking={type:"enabled",budget_tokens:l};else throw new D({info:`Invalid extended thinking token budget for model: '${this.modelName}'`,cause:new Error(`maxExtendedThinkingTokens (${l}) must be less than max_tokens (${h})`)})}return p}transformMessages(t){if(!t||t&&t.length===0)return {messages:[]};let a=l=>{let r=l.match(/^data:image\/[a-zA-Z]+;base64,/);return r?l.substring(r[0].length):l},o=t.map(l=>{let r=Vt().safeParse(l);if(!r.success)throw new E({info:"Invalid messages",cause:r.error});return r.data});o.forEach(l=>{l.content.forEach(r=>{if(!this.modelSchema.modalities.includes(r.modality))throw new E({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${r.modality}', available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),o.forEach(l=>{if(!Object.keys(this.modelSchema.roles).includes(l.role))throw new E({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${l.role}', available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let i="",s=[];if(o.forEach(l=>{switch(l.role){case ie:{l.content.forEach(r=>{if(r.modality===w)i+=r.value;else throw new E({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${l.role}' cannot have content with modality : '${r.modality}'`)})});break}case S:{let r=[];l.content.forEach(d=>{if(d.modality===w)r.push({type:"text",text:d.value});else if(d.modality===L)r.push({type:"tool_use",id:d.id,name:d.name,input:JSON.parse(d.arguments)});else if(d.modality===z&&d.value.type==="thinking")r.push({type:"thinking",thinking:d.value.thinking,signature:d.value.signature});else if(d.modality===z&&d.value.type==="redacted")r.push({type:"redacted_thinking",data:d.value.data});else throw new E({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${l.role}' cannot have content with modality : '${d.modality}'`)})}),s.push({role:this.modelSchema.roles[l.role],content:r});break}case Z:{let r=[];l.content.forEach(d=>{if(d.modality===w)r.push({type:"text",text:d.value});else if(d.modality===K){if(d.value.type==="base64"){let m=d.value.base64;m=a(m),r.push({type:"image",source:{type:"base64",media_type:`image/${d.value.media_type}`,data:m}});}else if(d.value.type==="url")throw new E({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${d.value.type}'`)})}else throw new E({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${l.role}' cannot have content with modality : '${d.modality}'`)})}),s.push({role:this.modelSchema.roles[l.role],content:r});break}case Ae:{let r=[];l.content.forEach(d=>{if(d.modality===V)r.push({type:"tool_result",tool_use_id:d.id,content:d.data});else throw new E({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${l.role}' cannot have content with modality : '${d.modality}'`)})}),s.push({role:this.modelSchema.roles[l.role],content:r});break}default:throw new E({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${l.role}' is not supported,
|
|
15
|
+
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),s[0].role!==this.modelSchema.roles[Z])throw new E({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});return {system:i,messages:s}}transformTools(t){if(!this.modelSchema.modalities.includes(L))throw new At({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${L}'`)});return !t||t&&t.length===0?{tools:[]}:{tools:t.map(a=>{let o=Dn().safeParse(a);if(!o.success)throw new At({info:"Invalid tools",cause:o.error});return o.data}).map(a=>({name:a.definition.schema.name,description:a.definition.schema.description,input_schema:a.definition.schema.parameters}))}}getCompleteChatUrl(t,a,o){return R(this,null,function*(){return new Promise(i=>{i(this.completeChatUrl);})})}getCompleteChatHeaders(t,a,o){return R(this,null,function*(){let i=this.getDefaultHeaders();return o&&o.length>0&&(i=_e(T({},i),{"anthropic-beta":"tools-2024-05-16"})),new Promise(s=>{s(i);})})}getCompleteChatData(t,a,o){return R(this,null,function*(){let i=this.transformConfig(t,a,o),s=this.transformMessages(a);if(s.messages&&s.messages.length===0)throw new E({info:"Messages are required",cause:new Error("Messages are required")});let l=o?this.transformTools(o):{};return new Promise(r=>{r(T(T(T(T({},this.getDefaultParams()),i),s),l));})})}transformCompleteChatResponse(t){let a=Ni.safeParse(t);if(a.success){let o=a.data,i=o.content.map((r,d)=>{if(r.type==="text")return jn(r.text);if(r.type==="tool_use")return En(d,r.id,r.name,JSON.stringify(r.input));if(r.type==="thinking")return Rn(r.thinking,r.signature);if(r.type==="redacted_thinking")return _n(r.data)}),s=[{role:S,content:i}],l={promptTokens:o.usage.input_tokens,completionTokens:o.usage.output_tokens,totalTokens:o.usage.input_tokens+o.usage.output_tokens};return {messages:s,usage:l,logProbs:[]}}throw new F({info:"Invalid response from model",cause:a.error})}getStreamChatUrl(t,a,o){return R(this,null,function*(){return new Promise(i=>{i(this.streamChatUrl);})})}getStreamChatHeaders(t,a,o){let i=this.getDefaultHeaders();return o&&o.length>0&&(i=_e(T({},i),{"anthropic-beta":"tools-2024-05-16"})),new Promise(s=>{s(i);})}getStreamChatData(t,a,o){return R(this,null,function*(){let i=this.transformConfig(t,a,o),s=this.transformMessages(a);if(s.messages&&s.messages.length===0)throw new E({info:"Messages are required",cause:new Error("Messages are required")});let l=o?this.transformTools(o):{};return new Promise(r=>{r(T(T(T(T({stream:!0},this.getDefaultParams()),i),s),l));})})}transformStreamChatResponseChunk(t,a){return Ct(this,null,function*(){let o=(a+t).split(`
|
|
16
|
+
`).filter(i=>i.trim()!=="");for(let i of o)if(i.startsWith("data: {")&&i.endsWith("}")){let s;try{s=JSON.parse(i.substring(6));}catch(l){throw new F({info:`Malformed JSON received in stream : ${s}`,cause:l})}if("type"in s){if(s.type==="message_stop")return;if(s.type==="message_start"){let l=Ui.safeParse(s);if(l.success){let r=l.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:r.message.usage.input_tokens,completionTokens:r.message.usage.output_tokens,totalTokens:r.message.usage.input_tokens+r.message.usage.output_tokens}},buffer:a};}else throw new F({info:"Invalid response from model",cause:l.error})}else if(s.type==="message_delta"){let l=qi.safeParse(s);if(l.success){let r=l.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:0,completionTokens:r.usage.output_tokens,totalTokens:r.usage.output_tokens}},buffer:a};}else throw new F({info:"Invalid response from model",cause:l.error})}else if(s.type==="content_block_start"){let l=Ki.safeParse(s);if(l.success){let r=l.data,d=[];r.content_block.type==="text"?d.push(kt(S,r.content_block.text)):r.content_block.type==="tool_use"?d.push(vt(S,r.index,r.content_block.id,r.content_block.name,"")):r.content_block.type==="thinking"?d.push(Re(S,r.content_block.thinking)):r.content_block.type==="redacted_thinking"&&d.push(Pn(S,r.content_block.data)),yield {partialResponse:{partialMessages:d},buffer:a};}else throw new F({info:"Invalid response from model",cause:l.error})}else if(s.type==="content_block_delta"){let l=Wi.safeParse(s);if(l.success){let r=l.data,d=[];r.delta.type==="text_delta"?d.push(kt(S,r.delta.text)):r.delta.type==="input_json_delta"?d.push(vt(S,r.index,"","",r.delta.partial_json)):r.delta.type==="thinking_delta"?d.push(Re(S,r.delta.thinking)):r.delta.type==="signature_delta"&&d.push(Re(S,void 0,r.delta.signature)),yield {partialResponse:{partialMessages:d},buffer:a};}else throw new F({info:"Invalid response from model",cause:l.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(s)}`)})}})}transformProxyStreamChatResponseChunk(t,a,o,i,s){return Ct(this,null,function*(){yield*pe(nn(this.transformStreamChatResponseChunk(t,a)));})}getProxyStreamChatUrl(t,a,o){return R(this,null,function*(){return new Promise(i=>{i(this.streamChatUrl);})})}getProxyCompleteChatUrl(t,a,o){return R(this,null,function*(){return new Promise(i=>{i(this.completeChatUrl);})})}getProxyCompleteChatHeaders(t,a,o){return R(this,null,function*(){if(!a)return {};let i=T({},a);return delete i.host,delete i["content-length"],i})}getProxyStreamChatHeaders(t,a,o){return R(this,null,function*(){return yield this.getProxyCompleteChatHeaders(t,a,o)})}},Oa="claude-3-5-sonnet-20240620",is="Most intelligent model. Highest level of intelligence and capability.",ja=H(y,k).parse({name:Oa,description:is,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),ss=$,rs=class extends N{constructor(t){super(ja,t);}},Ea="claude-3-5-sonnet-20241022",ls="Most intelligent model. Highest level of intelligence and capability.",Ra=H(y,k).parse({name:Ea,description:ls,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),ds=$,cs=class extends N{constructor(t){super(Ra,t);}},_a="claude-3-5-sonnet-latest",ms="Most intelligent model. Highest level of intelligence and capability.",Pa=H(y,k).parse({name:_a,description:ms,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),ps=$,us=class extends N{constructor(t){super(Pa,t);}},Ia="claude-3-7-sonnet-20250219",hs="Most intelligent model. Highest level of intelligence and capability.",Aa=H(y,Pi).parse({name:Ia,description:hs,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:64e3,roles:b,modalities:_i,config:{def:v.extendedThinking(128e3,4,1024,64e3).def,schema:v.extendedThinking(128e3,4,1024,64e3).schema}}),gs=$,fs=class extends N{constructor(t){super(Aa,t);}},Ba="claude-3-haiku-20240307",ys="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",La=H(y,k).parse({name:Ba,description:ys,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),bs=$,Cs=class extends N{constructor(t){super(La,t);}},Na="claude-3-5-haiku-20241022",ks="Our fastest model with intelligence at blazing speeds.",Ua=H(y,k).parse({name:Na,description:ks,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),vs=$,xs=class extends N{constructor(t){super(Ua,t);}},qa="claude-3-5-haiku-latest",Ts="Our fastest model with intelligence at blazing speeds.",$a=H(y,k).parse({name:qa,description:Ts,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:v.base(8192,4).def,schema:v.base(8192,4).schema}}),ws=$,Ss=class extends N{constructor(t){super($a,t);}},Ha="claude-3-opus-20240229",Ms="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",Fa=H(y,k).parse({name:Ha,description:Ms,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),Os=$,js=class extends N{constructor(t){super(Fa,t);}},Da="claude-3-sonnet-20240229",Es="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",Ka=H(y,k).parse({name:Da,description:Es,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:v.base(4096,4).def,schema:v.base(4096,4).schema}}),Rs=$,_s=class extends N{constructor(t){super(Ka,t);}},Q=[X],ee=zod.z.enum([X]),Ps=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()})}),Is=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),As=zod.z.object({model:zod.z.string().min(1).optional(),input:Is,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional()}),J=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),te=class{constructor(t,a){this.version="v1";let o=J.parse(a);this.modelSchema=t,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=ne(he.embeddingBaseUrl),this.getEmbeddingsUrl=ne(o.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getTokenCount(t){return t.requests.reduce((a,o)=>a+o.length,0)}getRetryDelay(t){return {shouldRetry:!0,delayMs:0}}transformModelRequest(t){let a=As.safeParse(t);if(!a.success)throw new Ie({info:"Invalid model request",cause:a.error});let o=a.data,i=o.model,s={encodingFormat:o.encoding_format,inputType:o.input_type,truncation:o.truncation},l=Gt().parse(ua(s)),r;return typeof o.input=="string"?r={modality:X,requests:[o.input]}:r={modality:X,requests:o.input},{modelName:i,config:l,embeddingRequests:r}}transformConfig(t,a){"inputType"in t&&t.inputType===""&&delete t.inputType,"encodingFormat"in t&&t.encodingFormat===""&&delete t.encodingFormat;let o=this.modelSchema.config.schema.safeParse(t);if(!o.success)throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:o.error});let i=o.data;return Object.keys(i).forEach(s=>{if(!this.modelSchema.config.def[s])throw new D({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${s}',
|
|
17
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(i).reduce((s,l)=>{let r=this.modelSchema.config.def[l].param,d=i[l];return s[r]=d,s},{})}transformEmbeddingRequests(t){let a=Jn().safeParse(t);if(!a.success)throw new Lt({info:"Invalid embedding requests",cause:a.error});if(a.data.requests.length>128)throw new Lt({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Max requests for model : '${this.modelName}' is 128`)});return {input:a.data.requests}}getGetEmbeddingsUrl(t,a){return R(this,null,function*(){return new Promise(o=>{o(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(t,a){return R(this,null,function*(){return new Promise(o=>{o(this.getDefaultHeaders());})})}getGetEmbeddingsData(t,a){return R(this,null,function*(){return new Promise(o=>{o(T(T(T({},this.getDefaultParams()),this.transformConfig(t,a)),this.transformEmbeddingRequests(a)));})})}transformGetEmbeddingsResponse(t){let a,o=Ps.safeParse(t);if(o.success){let i=o.data;a=typeof i.data[0].embedding=="string"?Zt:Wt;let s=i.data.map(l=>typeof l.embedding=="string"?{index:l.index,embedding:l.embedding}:{index:l.index,embedding:l.embedding});return {encodingFormat:a,embeddings:s,usage:{totalTokens:i.usage.total_tokens}}}throw new F({info:"Invalid response from model",cause:o.error})}},za="voyage-code-2",Bs="Optimized for code retrieval.",Va=Y(ee).parse({name:za,description:Bs,modalities:Q,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:P.base().def,schema:P.base().schema}}),Ls=J,Ns=class extends te{constructor(t){super(Va,t);}},Ga="voyage-law-2",Us="Optimized for legal and long-context retrieval and RAG. Also improved performance across all domains.",Ja=Y(ee).parse({name:Ga,description:Us,modalities:Q,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:P.base().def,schema:P.base().schema}}),qs=J,$s=class extends te{constructor(t){super(Ja,t);}},Wa="voyage-multilingual-2",Hs="Optimized for multilingual retrieval and RAG.",Za=Y(ee).parse({name:Wa,description:Hs,modalities:Q,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:P.base().def,schema:P.base().schema}}),Fs=J,Ds=class extends te{constructor(t){super(Za,t);}},Xa="voyage-finance-2",Ks="Optimized for finance retrieval and RAG.",Ya=Y(ee).parse({name:Xa,description:Ks,modalities:Q,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:P.base().def,schema:P.base().schema}}),zs=J,Vs=class extends te{constructor(t){super(Ya,t);}},Qa="voyage-3-lite",Gs="Optimized for latency and cost.",eo=Y(ee).parse({name:Qa,description:Gs,modalities:Q,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:P.base().def,schema:P.base().schema}}),Js=J,Ws=class extends te{constructor(t){super(eo,t);}},to="voyage-3",Zs="Optimized for quality.",ao=Y(ee).parse({name:to,description:Zs,modalities:Q,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:P.base().def,schema:P.base().schema}}),Xs=J,Ys=class extends te{constructor(t){super(ao,t);}};var Qs=t=>{let a=new WeakSet;return JSON.stringify(t,(o,i)=>{if(typeof i=="object"&&i!==null){if(a.has(i))return;a.add(i);}return i})},er=t=>t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:Qs(t),Ve="GatewayBaseError",Je=class so extends Error{constructor({info:a,cause:o},i){super(`[${i!=null?i:Ve}]: ${a}
|
|
18
|
+
Message: ${er(o)}`),this.name=Ve,this.info=a,this.cause=o,this.name=i!=null?i:Ve,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(a){return a instanceof so}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},tr="system",ar="user",ro="assistant",or="tool",nr=[tr,ar,ro,or],We=zod.z.enum(nr),ir=[ro],sr=zod.z.enum(ir),lo="image",rr="base64",lr=["png","jpeg","webp","gif"],dr=zod.z.object({type:zod.z.literal(rr),base64:zod.z.string(),media_type:zod.z.enum(lr)}),cr="url",mr=zod.z.object({type:zod.z.literal(cr),url:zod.z.string()}),pr=zod.z.discriminatedUnion("type",[dr,mr]),ur=["low","medium","high","auto"],hr=zod.z.enum(ur),gr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(lo),detail:hr,value:pr,metadata:t}),co="reasoning",mo="partial-reasoning",po="thinking",fr="redacted",Ge=zod.z.object({type:zod.z.literal(po),thinking:zod.z.string(),signature:zod.z.string()}),uo=zod.z.object({type:zod.z.literal(fr),data:zod.z.string()}),yr=zod.z.discriminatedUnion("type",[Ge,uo]),br=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(co),value:yr,metadata:t}),Cr=zod.z.object({type:zod.z.literal(po),thinking:Ge.shape.thinking.optional(),signature:Ge.shape.signature.optional()}),kr=zod.z.discriminatedUnion("type",[Cr,uo]),vr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(mo),value:kr,metadata:t}),ho="text",xr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ho),value:zod.z.string(),metadata:t}),go="partial-text",Tr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(go),value:zod.z.string(),metadata:t}),fo="tool-call",wr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(fo),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:t}),yo="partial-tool-call",Sr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(yo),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:t}),bo="tool-response",Mr=(t=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(bo),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:t}),Or=[ho,lo,fo,bo,co],Co=zod.z.enum(Or),jr=(t=zod.z.undefined(),a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[xr(t),gr(a),wr(o),Mr(i),br(s)]),Er=[go,yo,mo];zod.z.enum(Er);var Rr=(t=zod.z.undefined(),a=zod.z.undefined(),o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Tr(t),Sr(a),vr(o)]);var _r=(t=We,a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined(),l=zod.z.undefined(),r=zod.z.undefined())=>zod.z.object({role:t,content:zod.z.array(jr(a,o,i,s,r)),metadata:l}),Pr=(t=sr,a=zod.z.undefined(),o=zod.z.undefined(),i=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:t,partialContent:Rr(a,o,i),metadata:s});var Ir=["object","array","number","string","boolean","enum"],oo=zod.z.enum(Ir),Ar=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([oo,zod.z.array(zod.z.union([oo,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()}),Br=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(Ar),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:Br}).optional();var Lr="function";var Nr=zod.z.enum(["object","array","number","string","boolean","null"]),Ur=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Nr.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(Ur).optional(),required:zod.z.array(zod.z.string()).optional()});var qr=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 $r=zod.z.enum(["function"]);zod.z.object({type:$r,definition:zod.z.object({schema:qr})});var Hr=[Lr];zod.z.enum(Hr);var Fr="text",Dr="token",Kr=[Fr,Dr];zod.z.enum(Kr);zod.z.array(zod.z.string().min(1));zod.z.array(zod.z.array(zod.z.number().int().nonnegative()));var Vr="float",Gr=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),Jr="base64",Wr=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),no=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(Vr),embeddings:zod.z.array(Gr),usage:no.optional()}),zod.z.object({encodingFormat:zod.z.literal(Jr),embeddings:zod.z.array(Wr),usage:no.optional()})]);var ko=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),io=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),Zr=io.extend({topLogProbs:zod.z.array(io)}),vo=zod.z.array(Zr);zod.z.object({messages:zod.z.array(_r()),usage:ko.optional(),logProbs:vo.optional()});zod.z.object({partialMessages:zod.z.array(Pr()),usage:ko.optional(),logProbs:vo.optional()});var Xr=Object.defineProperty,xo=Object.getOwnPropertySymbols,Yr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,To=(t,a,o)=>a in t?Xr(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,el=(t,a)=>{for(var o in a||(a={}))Yr.call(a,o)&&To(t,o,a[o]);if(xo)for(var o of xo(a))Qr.call(a,o)&&To(t,o,a[o]);return t},wo="ProviderError",Ze=class Mo extends Je{constructor({info:a,cause:o}){super({info:a,cause:o},wo),this.name=wo,this.info=a,this.cause=o;}static isProviderError(a){return a instanceof Mo}};var So="ModelResponseError",Oo=class jo extends Je{constructor({info:a,cause:o}){super({info:a,cause:o},So),this.name=So,this.cause=o,this.info=a;}static isModelResponseError(a){return a instanceof jo}};var Eo="multi-string",tl=zod.z.object({type:zod.z.literal(Eo),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()});var Ro="object-schema",al=zod.z.object({type:zod.z.literal(Ro),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 _o="range",ol=zod.z.object({type:zod.z.literal(_o),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()});var Po="select-boolean",nl=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),default:zod.z.boolean().nullable()});var Xe="select-string",Io=zod.z.object({type:zod.z.literal(Xe),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())}),il=(t,a)=>zod.z.enum(a).nullable().default(t).optional(),Ao=t=>({def:Io.parse(el({type:Xe},t)),schema:il(t.default,t.choices)}),sl=[_o,Eo,Xe,Ro,Po];zod.z.enum(sl);var rl=zod.z.discriminatedUnion("type",[ol,tl,Io,nl,al]),I=(t=We,a=Co)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(t,zod.z.string().min(1).optional()),modalities:zod.z.array(a).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),rl),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(o=>{var i,s;let l=Object.keys(o.def),r=Object.keys((s=(i=o.schema)==null?void 0:i.shape)!=null?s:{});return l.every(d=>r.includes(d))&&r.every(d=>l.includes(d))},{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 ll=()=>typeof window!="undefined"&&typeof window.document!="undefined"&&typeof navigator!="undefined";var Bo=t=>{if(ll()){let a=atob(t),o=new Uint8Array(a.length);for(let i=0;i<a.length;i++)o[i]=a.charCodeAt(i);return new TextDecoder("utf-8").decode(o)}else return Buffer.from(t,"base64").toString("utf-8")};var Ye=Ao({param:"awsRegion",title:"AWS Region",description:"Controls which region the model will use to call AWS services.",default:"us-east-1",choices:["us-east-1","us-west-2","eu-west-1","eu-west-3","eu-central-1","ap-south-3","ap-southeast-1","ap-southeast-2","ap-northeast-1"]});var Lo=(t,a)=>be(t,a).extend({awsRegion:Ye.schema}),No=(t,a)=>W(A({},Ce(t,a)),{awsRegion:Ye.def});var x={base:(t,a)=>({def:No(t,a),schema:Lo(t,a)})};var dl="bedrock",ae=class ae{constructor(){this.version="v1";this.name=dl;this.chatModelFactories={[it]:{model:Te,modelOptions:Ho,modelSchema:st},[dt]:{model:Se,modelOptions:Do,modelSchema:ct},[rt]:{model:we,modelOptions:Fo,modelSchema:lt},[tt]:{model:ve,modelOptions:qo,modelSchema:at},[ot]:{model:xe,modelOptions:$o,modelSchema:nt},[Qe]:{model:ke,modelOptions:Uo,modelSchema:et}};this.embeddingModelFactories={};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((a,o)=>(a[o]=this.chatModelFactories[o].modelSchema,a),{})}chatModel(a){let o=a.modelName;if(!(o in this.chatModelFactories))throw new Ze({info:`Bedrock chat model: ${o} not found`,cause:new Error(`Bedrock chat model: ${o} not found, available chat models:
|
|
19
|
+
${this.chatModelLiterals().join(", ")}`)});let i=this.chatModelFactories[o].model,s=this.chatModelFactories[o].modelOptions.parse(a);return new i(s)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((a,o)=>(a[o]=this.embeddingModelFactories[o].modelSchema,a),{})}embeddingModel(a){throw new Ze({info:"Adaline Bedrock provider does not support embedding models yet",cause:new Error("Adaline Bedrock provider does not support embedding models yet")})}};ae.awsService="bedrock",ae.awsDefaultRegion="us-east-1",ae.awsUrl=a=>`https://bedrock-runtime.${a!=null?a:ae.awsDefaultRegion}.amazonaws.com`;var U=ae;var M=zod.z.object({modelName:zod.z.string(),awsAccessKeyId:zod.z.string(),awsSecretAccessKey:zod.z.string()});var O=class t extends N{constructor(o,i){let s=M.parse(i);super(o,{apiKey:"random-api-key",modelName:s.modelName});this.version="v1";this.modelSchema=o,this.modelName=s.modelName,this.awsService=U.awsService,this.awsAccessKeyId=s.awsAccessKeyId,this.awsSecretAccessKey=s.awsSecretAccessKey;}getDefaultBaseUrl(){return U.awsUrl()}getDefaultHeaders(){return {Accept:"application/json","Content-Type":"application/json"}}getDefaultParams(){return {anthropic_version:"bedrock-2023-05-31"}}getCompleteChatUrl(o,i,s){let l=U.awsUrl(o==null?void 0:o.awsRegion);return new Promise(r=>{r(`${l}/model/${this.modelName}/invoke`);})}transformConfig(o,i,s){let l=A({},o);return delete l.awsRegion,super.transformConfig(l,i,s)}getCompleteChatHeaders(o,i,s){return B(this,null,function*(){let l=new URL(yield this.getCompleteChatUrl(o,i,s)),r={accessKeyId:this.awsAccessKeyId,secretAccessKey:this.awsSecretAccessKey},d=o==null?void 0:o.awsRegion,m=this.getDefaultHeaders();m=W(A({},m),{host:U.awsUrl(d).split("://")[1]});let p=yield this.getCompleteChatData(o||{},i||[],s),g=new protocolHttp.HttpRequest({hostname:l.hostname,path:l.pathname,protocol:l.protocol,method:"POST",body:JSON.stringify(p),headers:m});return (yield new signatureV4.SignatureV4({credentials:r,service:this.awsService,region:d,sha256:sha256Js.Sha256}).sign(g)).headers})}getCompleteChatData(o,i,s){return B(this,null,function*(){let l=A(A({},this.getDefaultParams()),yield ce(t.prototype,this,"getCompleteChatData").call(this,o,i,s));return new Promise(r=>{r(l);})})}getStreamChatUrl(o,i,s){return B(this,null,function*(){let l=U.awsUrl(o==null?void 0:o.awsRegion);return new Promise(r=>{r(`${l}/model/${this.modelName}/invoke-with-response-stream`);})})}getStreamChatHeaders(o,i,s){return B(this,null,function*(){let l=new URL(yield this.getStreamChatUrl(o,i,s)),r={accessKeyId:this.awsAccessKeyId,secretAccessKey:this.awsSecretAccessKey},d=o==null?void 0:o.awsRegion,m=this.getDefaultHeaders();m=W(A({},m),{host:U.awsUrl(d).split("://")[1]});let p=yield this.getCompleteChatData(o||{},i||[],s),g=new protocolHttp.HttpRequest({hostname:l.hostname,path:l.pathname,protocol:l.protocol,method:"POST",body:JSON.stringify(p),headers:m});return (yield new signatureV4.SignatureV4({credentials:r,service:this.awsService,region:d,sha256:sha256Js.Sha256}).sign(g)).headers})}getStreamChatData(o,i,s){return B(this,null,function*(){let l=A(A({},this.getDefaultParams()),yield ce(t.prototype,this,"getStreamChatData").call(this,o,i,s));return "stream"in l&&delete l.stream,l})}transformStreamChatResponseChunk(o,i){return je(this,null,function*(){let s=o.toString(),l=/{\s*"bytes"\s*:\s*"[\w=+/]+".*?}/g,r=s.match(l)||[];for(let d of r){let m=d.indexOf("{"),p=d.indexOf("}");if(m!==-1&&p!==-1&&m<p){let g;try{g=JSON.parse(d.slice(m,p+1));}catch(u){throw new Oo({info:`Malformed JSON received in stream : ${g}`,cause:u})}let f=Bo(g.bytes),h=(yield new me(ce(t.prototype,this,"transformStreamChatResponseChunk").call(this,`data: ${f}`,i).next())).value;h&&(yield h);}}})}transformProxyStreamChatResponseChunk(o,i,s,l,r){return je(this,null,function*(){yield*pe(this.transformStreamChatResponseChunk(o,i));})}getRegionHelper(o){var s;let i=o["aws-region"];if(!i){let l=(s=o.authorization)==null?void 0:s.match(/Credential=[^/]+\/\d+\/([^/]+)\/bedrock/);l&&(i=l[1]);}return i}getProxyStreamChatUrl(o,i,s){return B(this,null,function*(){let l=this.getRegionHelper(i||{}),r=U.awsUrl(l);return new Promise(d=>{d(`${r}/model/${this.modelName}/invoke-with-response-stream`);})})}getProxyChatHeaders(o,i,s,l){return B(this,null,function*(){let r=new URL(yield o());if(!s)return {};let d=s["aws-access-key-id"],m=s["aws-secret-access-key"],p=this.getRegionHelper(s);if(!d||!m)return {};let g={accessKeyId:d,secretAccessKey:m};s=W(A({},s),{host:r.host,"content-type":"application/json",accept:"application/json"}),delete s["content-length"];let f=s.authorization||s.Authorization;if(f){let j=f.match(/SignedHeaders=([^,]+)/);if(j&&j[1]){let oe=j[1].split(";").map(le=>le.trim().toLowerCase());oe.push("authorization"),s=Object.keys(s).reduce((le,Oe)=>{var ht;return oe.includes(Oe.toLowerCase())&&(le[Oe]=(ht=s==null?void 0:s[Oe])!=null?ht:""),le},{});}}let h=new protocolHttp.HttpRequest({hostname:r.hostname,path:r.pathname,protocol:r.protocol,method:"POST",body:JSON.stringify(i),headers:s});return (yield new signatureV4.SignatureV4({credentials:g,service:this.awsService,region:p,sha256:sha256Js.Sha256}).sign(h)).headers})}getProxyCompleteChatUrl(o,i,s){return B(this,null,function*(){let l=this.getRegionHelper(i||{}),r=U.awsUrl(l);return new Promise(d=>{d(`${r}/model/${this.modelName}/invoke`);})})}getProxyCompleteChatHeaders(o,i,s){return B(this,null,function*(){return this.getProxyChatHeaders(()=>this.getProxyCompleteChatUrl(o,i,s),o,i,s)})}getProxyStreamChatHeaders(o,i,s){return B(this,null,function*(){return this.getProxyChatHeaders(()=>this.getProxyStreamChatUrl(o,i,s),o,i,s)})}};var Qe="anthropic.claude-3-5-haiku-20241022-v1:0",cl="Our fastest model with intelligence at blazing speeds.",et=I(y,k).parse({name:Qe,description:cl,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:x.base(8192,4).def,schema:x.base(8192,4).schema}}),Uo=M,ke=class extends O{constructor(a){super(et,a);}};var tt="anthropic.claude-3-5-sonnet-20240620-v1:0",ml="Most intelligent model. Highest level of intelligence and capability.",at=I(y,k).parse({name:tt,description:ml,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:x.base(8192,4).def,schema:x.base(8192,4).schema}}),qo=M,ve=class extends O{constructor(a){super(at,a);}};var ot="anthropic.claude-3-5-sonnet-20241022-v2:0",pl="Most intelligent model. Highest level of intelligence and capability.",nt=I(y,k).parse({name:ot,description:pl,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:C,config:{def:x.base(8192,4).def,schema:x.base(8192,4).schema}}),$o=M,xe=class extends O{constructor(a){super(nt,a);}};var it="anthropic.claude-3-haiku-20240307-v1:0",ul="Claude 3 Haiku is a large-scale multimodal model trained by Anthropic. It is the successor to Claude 3 and is designed to be more powerful and capable than its predecessor.",st=I(y,k).parse({name:it,description:ul,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:x.base(4096,4).def,schema:x.base(4096,4).schema}}),Ho=M,Te=class extends O{constructor(a){super(st,a);}};var rt="anthropic.claude-3-opus-20240229-v1:0",hl="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",lt=I(y,k).parse({name:rt,description:hl,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:x.base(4096,4).def,schema:x.base(4096,4).schema}}),Fo=M,we=class extends O{constructor(a){super(lt,a);}};var dt="anthropic.claude-3-sonnet-20240229-v1:0",gl="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",ct=I(y,k).parse({name:dt,description:gl,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:C,config:{def:x.base(4096,4).def,schema:x.base(4096,4).schema}}),Do=M,Se=class extends O{constructor(a){super(ct,a);}};
|
|
22
20
|
|
|
23
|
-
exports.BaseChatModelAnthropic =
|
|
24
|
-
exports.BaseChatModelOptions =
|
|
25
|
-
exports.Bedrock =
|
|
26
|
-
exports.BedrockAnthropicChatModelBaseConfigDef =
|
|
27
|
-
exports.BedrockAnthropicChatModelBaseConfigSchema =
|
|
28
|
-
exports.BedrockAnthropicChatModelConfigs =
|
|
29
|
-
exports.BedrockClaude3Haiku20240307 =
|
|
30
|
-
exports.BedrockClaude3Haiku20240307Literal =
|
|
31
|
-
exports.BedrockClaude3Haiku20240307Options =
|
|
32
|
-
exports.BedrockClaude3Haiku20240307Schema =
|
|
33
|
-
exports.BedrockClaude3Opus20240229 =
|
|
34
|
-
exports.BedrockClaude3Opus20240229Literal =
|
|
35
|
-
exports.BedrockClaude3Opus20240229Options =
|
|
36
|
-
exports.BedrockClaude3Opus20240229Schema =
|
|
37
|
-
exports.BedrockClaude3Sonnet20240229 =
|
|
38
|
-
exports.BedrockClaude3Sonnet20240229Literal =
|
|
39
|
-
exports.BedrockClaude3Sonnet20240229Options =
|
|
40
|
-
exports.BedrockClaude3Sonnet20240229Schema =
|
|
41
|
-
exports.BedrockClaude3_5Haiku20241022 =
|
|
42
|
-
exports.BedrockClaude3_5Haiku20241022Literal =
|
|
43
|
-
exports.BedrockClaude3_5Haiku20241022Options =
|
|
44
|
-
exports.BedrockClaude3_5Haiku20241022Schema =
|
|
45
|
-
exports.BedrockClaude3_5Sonnet20240620 =
|
|
46
|
-
exports.BedrockClaude3_5Sonnet20240620Literal =
|
|
47
|
-
exports.BedrockClaude3_5Sonnet20240620Options =
|
|
48
|
-
exports.BedrockClaude3_5Sonnet20240620Schema =
|
|
49
|
-
exports.BedrockClaude3_5Sonnet20241022 =
|
|
50
|
-
exports.BedrockClaude3_5Sonnet20241022Literal =
|
|
51
|
-
exports.BedrockClaude3_5Sonnet20241022Options =
|
|
52
|
-
exports.BedrockClaude3_5Sonnet20241022Schema =
|
|
53
|
-
exports.awsRegionChoice =
|
|
21
|
+
exports.BaseChatModelAnthropic = O;
|
|
22
|
+
exports.BaseChatModelOptions = M;
|
|
23
|
+
exports.Bedrock = U;
|
|
24
|
+
exports.BedrockAnthropicChatModelBaseConfigDef = No;
|
|
25
|
+
exports.BedrockAnthropicChatModelBaseConfigSchema = Lo;
|
|
26
|
+
exports.BedrockAnthropicChatModelConfigs = x;
|
|
27
|
+
exports.BedrockClaude3Haiku20240307 = Te;
|
|
28
|
+
exports.BedrockClaude3Haiku20240307Literal = it;
|
|
29
|
+
exports.BedrockClaude3Haiku20240307Options = Ho;
|
|
30
|
+
exports.BedrockClaude3Haiku20240307Schema = st;
|
|
31
|
+
exports.BedrockClaude3Opus20240229 = we;
|
|
32
|
+
exports.BedrockClaude3Opus20240229Literal = rt;
|
|
33
|
+
exports.BedrockClaude3Opus20240229Options = Fo;
|
|
34
|
+
exports.BedrockClaude3Opus20240229Schema = lt;
|
|
35
|
+
exports.BedrockClaude3Sonnet20240229 = Se;
|
|
36
|
+
exports.BedrockClaude3Sonnet20240229Literal = dt;
|
|
37
|
+
exports.BedrockClaude3Sonnet20240229Options = Do;
|
|
38
|
+
exports.BedrockClaude3Sonnet20240229Schema = ct;
|
|
39
|
+
exports.BedrockClaude3_5Haiku20241022 = ke;
|
|
40
|
+
exports.BedrockClaude3_5Haiku20241022Literal = Qe;
|
|
41
|
+
exports.BedrockClaude3_5Haiku20241022Options = Uo;
|
|
42
|
+
exports.BedrockClaude3_5Haiku20241022Schema = et;
|
|
43
|
+
exports.BedrockClaude3_5Sonnet20240620 = ve;
|
|
44
|
+
exports.BedrockClaude3_5Sonnet20240620Literal = tt;
|
|
45
|
+
exports.BedrockClaude3_5Sonnet20240620Options = qo;
|
|
46
|
+
exports.BedrockClaude3_5Sonnet20240620Schema = at;
|
|
47
|
+
exports.BedrockClaude3_5Sonnet20241022 = xe;
|
|
48
|
+
exports.BedrockClaude3_5Sonnet20241022Literal = ot;
|
|
49
|
+
exports.BedrockClaude3_5Sonnet20241022Options = $o;
|
|
50
|
+
exports.BedrockClaude3_5Sonnet20241022Schema = nt;
|
|
51
|
+
exports.awsRegionChoice = Ye;
|
|
54
52
|
//# sourceMappingURL=index.js.map
|
|
55
53
|
//# sourceMappingURL=index.js.map
|