@adaline/google 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,20 +4,20 @@ var zod = require('zod');
4
4
  var provider = require('@adaline/provider');
5
5
  var types = require('@adaline/types');
6
6
 
7
- var Ct=Object.defineProperty;var Oo=Object.getOwnPropertySymbols;var Tt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable;var se=(i,e)=>(e=Symbol[i])?e:Symbol.for("Symbol."+i),Gt=i=>{throw TypeError(i)};var Po=(i,e,o)=>e in i?Ct(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o,E=(i,e)=>{for(var o in e||(e={}))Tt.call(e,o)&&Po(i,o,e[o]);if(Oo)for(var o of Oo(e))Mt.call(e,o)&&Po(i,o,e[o]);return i};var P=(i,e,o)=>new Promise((t,s)=>{var a=l=>{try{m(o.next(l));}catch(d){s(d);}},n=l=>{try{m(o.throw(l));}catch(d){s(d);}},m=l=>l.done?t(l.value):Promise.resolve(l.value).then(a,n);m((o=o.apply(i,e)).next());}),So=function(i,e){this[0]=i,this[1]=e;},Le=(i,e,o)=>{var t=(n,m,l,d)=>{try{var h=o[n](m),u=(m=h.value)instanceof So,M=h.done;Promise.resolve(u?m[0]:m).then(f=>u?t(n==="return"?n:"next",m[1]?{done:f.done,value:f.value}:f,l,d):l({value:f,done:M})).catch(f=>t("throw",f,l,d));}catch(f){d(f);}},s=n=>a[n]=m=>new Promise((l,d)=>t(n,m,l,d)),a={};return o=o.apply(i,e),a[se("asyncIterator")]=()=>a,s("next"),s("throw"),s("return"),a},Ro=i=>{var e=i[se("asyncIterator")],o=!1,t,s={};return e==null?(e=i[se("iterator")](),t=a=>s[a]=n=>e[a](n)):(e=e.call(i),t=a=>s[a]=n=>{if(o){if(o=!1,a==="throw")throw n;return n}return o=!0,{done:!1,value:new So(new Promise(m=>{var l=e[a](n);l instanceof Object||Gt("Object expected"),m(l);}),1)}}),s[se("iterator")]=()=>s,t("next"),"throw"in e?t("throw"):s.throw=a=>{throw a},"return"in e&&t("return"),s};var B=(i,e)=>provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:i,step:.01,default:e}),D=i=>provider.RangeConfigItem({param:"maxOutputTokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:i,step:1,default:0}),U=i=>provider.MultiStringConfigItem({param:"stopSequences",title:provider.CHAT_CONFIG.STOP(i).title,description:provider.CHAT_CONFIG.STOP(i).description,max:i}),A=i=>provider.RangeConfigItem({param:"topP",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:i}),Ne=i=>provider.RangeConfigItem({param:"topK",title:provider.CHAT_CONFIG.TOP_K.title,description:provider.CHAT_CONFIG.TOP_K.description,min:1,max:40,step:1,default:i}),ve=provider.RangeConfigItem({param:"frequencyPenalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Fe=provider.RangeConfigItem({param:"presencePenalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),$e=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),H=provider.SelectStringConfigItem({param:"toolChoice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any","none"]}),V=provider.ObjectSchemaConfigItem({param:"safetySettings",title:"Safety settings",description:"The safety rating contains the category of harm and the harm probability level in that category for a piece of content.",objectSchema:zod.z.array(zod.z.object({threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]),category:zod.z.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"])}))});var xo=(i,e,o,t,s)=>zod.z.object({temperature:B(i,e).schema,maxTokens:D(o).schema,stop:U(t).schema,topP:A(s).schema,toolChoice:H.schema,safetySettings:V.schema}),wo=(i,e,o,t,s)=>({temperature:B(i,e).def,maxTokens:D(o).def,stop:U(t).def,topP:A(s).def,toolChoice:H.def,safetySettings:V.def});var ko=(i,e,o,t,s,a)=>zod.z.object({temperature:B(i,e).schema,maxTokens:D(o).schema,stop:U(t).schema,topP:A(s).schema,topK:Ne(a).schema,frequencyPenalty:ve.schema,presencePenalty:Fe.schema,seed:$e.schema.transform(n=>n===0?void 0:n),toolChoice:H.schema,safetySettings:V.schema}),Io=(i,e,o,t,s,a)=>({temperature:B(i,e).def,maxTokens:D(o).def,stop:U(t).def,topP:A(s).def,topK:Ne(a).def,frequencyPenalty:ve.def,presencePenalty:Fe.def,seed:$e.def,toolChoice:H.def,safetySettings:V.def});var qe=i=>provider.RangeConfigItem({param:"outputDimensionality",title:provider.EMBEDDING_CONFIG.DIMENSIONS.title,description:provider.EMBEDDING_CONFIG.DIMENSIONS.description,min:1,max:i,step:1,default:i});var No=i=>zod.z.object({dimensions:qe(i).schema}),vo=i=>({dimensions:qe(i).def});var c={base:(i,e,o,t,s)=>({def:wo(i,e,o,t,s),schema:xo(i,e,o,t,s)}),c1:(i,e,o,t,s,a)=>({def:Io(i,e,o,t,s,a),schema:ko(i,e,o,t,s,a)})},K={base:i=>({def:vo(i),schema:No(i)})};var xt="google",z=class{constructor(){this.version="v1";this.name=xt;this.chatModelFactories={[fo]:{model:Te,modelOptions:Xo,modelSchema:go},[co]:{model:Ce,modelOptions:Wo,modelSchema:ho},[Ke]:{model:me,modelOptions:Bo,modelSchema:Ye},[Je]:{model:de,modelOptions:Do,modelSchema:We},[Xe]:{model:pe,modelOptions:Uo,modelSchema:Qe},[Ze]:{model:ce,modelOptions:Ao,modelSchema:eo},[oo]:{model:he,modelOptions:Ho,modelSchema:to},[so]:{model:fe,modelOptions:Vo,modelSchema:no},[io]:{model:ge,modelOptions:Ko,modelSchema:ao},[ro]:{model:ue,modelOptions:Yo,modelSchema:lo},[He]:{model:le,modelOptions:jo,modelSchema:Ve},[Ue]:{model:re,modelOptions:zo,modelSchema:Ae},[Be]:{model:ae,modelOptions:qo,modelSchema:De},[ze]:{model:ie,modelOptions:$o,modelSchema:je},[mo]:{model:ye,modelOptions:Jo,modelSchema:po}};this.embeddingModelFactories={[uo]:{model:Me,modelOptions:Qo,modelSchema:yo},[Co]:{model:Ge,modelOptions:Zo,modelSchema:To}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!(o in this.chatModelFactories))throw new provider.ProviderError({info:`Google chat model: ${o} not found`,cause:new Error(`Google chat model: ${o} not found, available chat models:
7
+ var Ct=Object.defineProperty;var Oo=Object.getOwnPropertySymbols;var Tt=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable;var se=(i,e)=>(e=Symbol[i])?e:Symbol.for("Symbol."+i),Gt=i=>{throw TypeError(i)};var Po=(i,e,o)=>e in i?Ct(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o,E=(i,e)=>{for(var o in e||(e={}))Tt.call(e,o)&&Po(i,o,e[o]);if(Oo)for(var o of Oo(e))Mt.call(e,o)&&Po(i,o,e[o]);return i};var P=(i,e,o)=>new Promise((t,s)=>{var n=m=>{try{r(o.next(m));}catch(a){s(a);}},l=m=>{try{r(o.throw(m));}catch(a){s(a);}},r=m=>m.done?t(m.value):Promise.resolve(m.value).then(n,l);r((o=o.apply(i,e)).next());}),So=function(i,e){this[0]=i,this[1]=e;},Le=(i,e,o)=>{var t=(l,r,m,a)=>{try{var c=o[l](r),u=(r=c.value)instanceof So,M=c.done;Promise.resolve(u?r[0]:r).then(g=>u?t(l==="return"?l:"next",r[1]?{done:g.done,value:g.value}:g,m,a):m({value:g,done:M})).catch(g=>t("throw",g,m,a));}catch(g){a(g);}},s=l=>n[l]=r=>new Promise((m,a)=>t(l,r,m,a)),n={};return o=o.apply(i,e),n[se("asyncIterator")]=()=>n,s("next"),s("throw"),s("return"),n},Ro=i=>{var e=i[se("asyncIterator")],o=!1,t,s={};return e==null?(e=i[se("iterator")](),t=n=>s[n]=l=>e[n](l)):(e=e.call(i),t=n=>s[n]=l=>{if(o){if(o=!1,n==="throw")throw l;return l}return o=!0,{done:!1,value:new So(new Promise(r=>{var m=e[n](l);m instanceof Object||Gt("Object expected"),r(m);}),1)}}),s[se("iterator")]=()=>s,t("next"),"throw"in e?t("throw"):s.throw=n=>{throw n},"return"in e&&t("return"),s};var j=(i,e)=>provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:i,step:.01,default:e}),D=i=>provider.RangeConfigItem({param:"maxOutputTokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:i,step:1,default:0}),U=i=>provider.MultiStringConfigItem({param:"stopSequences",title:provider.CHAT_CONFIG.STOP(i).title,description:provider.CHAT_CONFIG.STOP(i).description,max:i}),A=i=>provider.RangeConfigItem({param:"topP",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:i}),Ne=i=>provider.RangeConfigItem({param:"topK",title:provider.CHAT_CONFIG.TOP_K.title,description:provider.CHAT_CONFIG.TOP_K.description,min:1,max:40,step:1,default:i}),ve=provider.RangeConfigItem({param:"frequencyPenalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Fe=provider.RangeConfigItem({param:"presencePenalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),$e=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),H=provider.SelectStringConfigItem({param:"toolChoice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any","none"]}),V=provider.ObjectSchemaConfigItem({param:"safetySettings",title:"Safety settings",description:"The safety rating contains the category of harm and the harm probability level in that category for a piece of content.",objectSchema:zod.z.array(zod.z.object({threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]),category:zod.z.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"])}))});var xo=(i,e,o,t,s)=>zod.z.object({temperature:j(i,e).schema,maxTokens:D(o).schema,stop:U(t).schema,topP:A(s).schema,toolChoice:H.schema,safetySettings:V.schema}),wo=(i,e,o,t,s)=>({temperature:j(i,e).def,maxTokens:D(o).def,stop:U(t).def,topP:A(s).def,toolChoice:H.def,safetySettings:V.def});var ko=(i,e,o,t,s,n)=>zod.z.object({temperature:j(i,e).schema,maxTokens:D(o).schema,stop:U(t).schema,topP:A(s).schema,topK:Ne(n).schema,frequencyPenalty:ve.schema,presencePenalty:Fe.schema,seed:$e.schema.transform(l=>l===0?void 0:l),toolChoice:H.schema,safetySettings:V.schema}),Io=(i,e,o,t,s,n)=>({temperature:j(i,e).def,maxTokens:D(o).def,stop:U(t).def,topP:A(s).def,topK:Ne(n).def,frequencyPenalty:ve.def,presencePenalty:Fe.def,seed:$e.def,toolChoice:H.def,safetySettings:V.def});var qe=i=>provider.RangeConfigItem({param:"outputDimensionality",title:provider.EMBEDDING_CONFIG.DIMENSIONS.title,description:provider.EMBEDDING_CONFIG.DIMENSIONS.description,min:1,max:i,step:1,default:i});var No=i=>zod.z.object({dimensions:qe(i).schema}),vo=i=>({dimensions:qe(i).def});var h={base:(i,e,o,t,s)=>({def:wo(i,e,o,t,s),schema:xo(i,e,o,t,s)}),c1:(i,e,o,t,s,n)=>({def:Io(i,e,o,t,s,n),schema:ko(i,e,o,t,s,n)})},K={base:i=>({def:vo(i),schema:No(i)})};var xt="google",z=class{constructor(){this.version="v1";this.name=xt;this.chatModelFactories={[go]:{model:Te,modelOptions:Xo,modelSchema:fo},[co]:{model:Ce,modelOptions:Wo,modelSchema:ho},[Ke]:{model:me,modelOptions:jo,modelSchema:Ye},[Je]:{model:de,modelOptions:Do,modelSchema:We},[Xe]:{model:pe,modelOptions:Uo,modelSchema:Ze},[Qe]:{model:ce,modelOptions:Ao,modelSchema:eo},[oo]:{model:he,modelOptions:Ho,modelSchema:to},[so]:{model:ge,modelOptions:Vo,modelSchema:no},[io]:{model:fe,modelOptions:Ko,modelSchema:ao},[ro]:{model:ue,modelOptions:Yo,modelSchema:lo},[He]:{model:le,modelOptions:Bo,modelSchema:Ve},[Ue]:{model:re,modelOptions:zo,modelSchema:Ae},[je]:{model:ae,modelOptions:qo,modelSchema:De},[ze]:{model:ie,modelOptions:$o,modelSchema:Be},[mo]:{model:ye,modelOptions:Jo,modelSchema:po}};this.embeddingModelFactories={[uo]:{model:Me,modelOptions:Zo,modelSchema:yo},[Co]:{model:Ge,modelOptions:Qo,modelSchema:To}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!(o in this.chatModelFactories))throw new provider.ProviderError({info:`Google chat model: ${o} not found`,cause:new Error(`Google chat model: ${o} not found, available chat models:
8
8
  [${this.chatModelLiterals().join(", ")}]`)});let t=this.chatModelFactories[o].model,s=this.chatModelFactories[o].modelOptions.parse(e);return new t(s)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,o)=>(e[o]=this.embeddingModelFactories[o].modelSchema,e),{})}embeddingModel(e){let o=e.modelName;if(!(o in this.embeddingModelFactories))throw new provider.ProviderError({info:`Google embedding model: ${o} not found`,cause:new Error(`Google embedding model: ${o} not found, available embedding models:
9
- [${this.embeddingModelLiterals().join(", ")}]`)});let t=this.embeddingModelFactories[o].model,s=this.embeddingModelFactories[o].modelOptions.parse(e);return new t(s)}};z.baseUrl="https://generativelanguage.googleapis.com/v1beta";var y=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),Nt="model",vt="function",C={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:Nt,tool:vt};var b=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],_=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),Tn=[types.TextModalityLiteral],Mn=zod.z.enum([types.TextModalityLiteral]),Pe=[types.TextModalityLiteral,types.ImageModalityLiteral],Se=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),v=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],F=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var Ft=zod.z.object({text:zod.z.string()}),$t=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),et=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([Ft,$t]))}).optional(),finishReason:zod.z.string(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number()}).optional()}),qt=zod.z.object({text:zod.z.string()}),zt=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Go=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([qt,zt]))}).optional(),finishReason:zod.z.string().optional(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number().optional(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number().optional()}).optional()});var it=zod.z.object({text:zod.z.string().min(1)}),jt=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),Bt=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),Dt=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),Ut=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([it,jt,Bt,Dt]))}),ot=zod.z.object({parts:zod.z.array(it)}),At=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),tt=zod.z.object({function_calling_config:zod.z.object({mode:zod.z.enum(["ANY","AUTO","NONE"]),allowed_function_names:zod.z.array(zod.z.string()).optional()})}),st=zod.z.object({stopSequences:zod.z.array(zod.z.string()).optional(),maxOutputTokens:zod.z.number().optional(),temperature:zod.z.number().optional(),topP:zod.z.number().optional(),topK:zod.z.number().optional(),presencePenalty:zod.z.number().optional(),frequencyPenalty:zod.z.number().optional(),seed:zod.z.number().optional()}),nt=zod.z.object({category:zod.z.enum(["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])}),at=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(Ut),systemInstruction:ot.optional(),system_instruction:ot.optional(),generationConfig:st.optional(),generation_config:st.optional(),safetySettings:zod.z.array(nt).optional(),safety_settings:zod.z.array(nt).optional(),tools:zod.z.object({function_declarations:zod.z.array(At)}).optional(),toolConfig:tt.optional(),tool_config:tt.optional()});var g=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),T=class{constructor(e,o){this.version="v1";var s;let t=g.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((s=t.baseUrl)!=null?s:z.baseUrl),this.completeChatUrl=provider.urlWithoutTrailingSlash(t.completeChatUrl||`${this.baseUrl}/models/${this.modelName}:generateContent?key=${this.apiKey}`),this.streamChatUrl=provider.urlWithoutTrailingSlash(t.streamChatUrl||`${this.baseUrl}/models/${this.modelName}:streamGenerateContent?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.reduce((o,t)=>o+t.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let o=at.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model;if(t.system_instruction&&t.systemInstruction)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'system_instruction' and 'systemInstruction' are not allowed at the same time")});if(t.generation_config&&t.generationConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'generation_config' and 'generationConfig' are not allowed at the same time")});if(t.tool_config&&t.toolConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tool_config' and 'toolConfig' are not allowed at the same time")});let a=t.system_instruction||t.systemInstruction,n=t.generation_config||t.generationConfig,m=t.safety_settings||t.safetySettings,l=t.tool_config||t.toolConfig;if(l&&(!t.tools||t.tools.function_declarations.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let d={};l&&(l.function_calling_config.mode==="ANY"&&l.function_calling_config.allowed_function_names&&l.function_calling_config.allowed_function_names.length===1?d.toolChoice=l.function_calling_config.allowed_function_names[0]:d.toolChoice=l.function_calling_config.mode.toLowerCase()),d.seed=n==null?void 0:n.seed,d.maxTokens=n==null?void 0:n.maxOutputTokens,d.temperature=n==null?void 0:n.temperature,d.topP=n==null?void 0:n.topP,d.presencePenalty=n==null?void 0:n.presencePenalty,d.frequencyPenalty=n==null?void 0:n.frequencyPenalty,d.stop=n==null?void 0:n.stopSequences,d.safetySettings=m;let h=types.Config().parse(provider.removeUndefinedEntries(d)),u=[];a&&a.parts.forEach(f=>{u.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:f.text}]});}),t.contents.forEach(f=>{let w=f.role;switch(w){case"user":{let k=f.parts.map(G=>"text"in G?{modality:types.TextModalityLiteral,value:G.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:G.inline_data.data,media_type:G.inline_data.mime_type.split("/")[1]}});u.push({role:w,content:k});}break;case"model":{let k=f.parts.map((G,L)=>"text"in G?{modality:types.TextModalityLiteral,value:G.text}:{modality:types.ToolCallModalityLiteral,id:L.toString(),index:L,name:G.function_call.name,arguments:JSON.stringify(G.function_call.args)});u.push({role:types.AssistantRoleLiteral,content:k});}break;case"function":{let k=f.parts.map((G,L)=>({modality:types.ToolResponseModalityLiteral,id:L.toString(),index:L,name:G.function_response.name,data:JSON.stringify(G.function_response.response)}));u.push({role:types.ToolRoleLiteral,content:k});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${f.role}' is not supported for model : ${this.modelName}`)})}});let M=[];return t.tools&&t.tools.function_declarations.forEach(f=>{M.push({type:"function",definition:{schema:{name:f.name,description:f.description,parameters:f.parameters}}});}),{modelName:s,config:h,messages:u,tools:M.length>0?M:void 0}}transformConfig(e,o,t){let s=e.toolChoice;delete e.toolChoice;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let n=a.data;Object.keys(n).forEach(h=>{if(!(h in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${h}',
10
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let m=Object.keys(n).reduce((h,u)=>{let M=this.modelSchema.config.def[u],f=M.param,w=n[u];return f==="maxOutputTokens"&&M.type==="range"&&w===0?h[f]=M.max:h[f]=w,h},{}),l=m.safetySettings;delete m.safetySettings;let d;if(s!==void 0){let h=s;if(!t||t&&t.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(t&&t.length>0){let u=this.modelSchema.config.def.toolChoice;if(u.choices.includes(h))h==="any"?d={function_calling_config:{mode:"ANY",allowed_function_names:t.map(M=>M.definition.schema.name)}}:d={function_calling_config:{mode:h.toUpperCase()}};else if(t.map(M=>M.definition.schema.name).includes(h))d={function_calling_config:{mode:"ANY",allowed_function_names:[h]}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${h}' is not part of provided 'tools' names or
11
- one of [${u.choices.join(", ")}]`)})}}return E(E({generation_config:m},d?{tool_config:d}:{}),l?{safety_settings:l}:{})}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let o=e.map(n=>{let m=types.Message().safeParse(n);if(!m.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:m.error});return m.data});o.forEach(n=>{n.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}',
12
- available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),o.forEach(n=>{if(!Object.keys(this.modelSchema.roles).includes(n.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${n.role}',
13
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let t={parts:[]},s=[];if(o.forEach(n=>{switch(n.role){case types.SystemRoleLiteral:n.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)t.parts.push({text:m.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${m.modality}'`)})});break;case types.AssistantRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ToolCallModalityLiteral)m.push({function_call:{name:l.name,args:JSON.parse(l.arguments)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ImageModalityLiteral){if(l.value.type==="base64")m.push({inline_data:{mime_type:l.value.media_type,data:l.value.base64}});else if(l.value.type==="url")throw new provider.InvalidMessagesError({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${l.value.type}'`)})}else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;case types.ToolRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.ToolResponseModalityLiteral)m.push({function_response:{name:l.name,response:JSON.parse(l.data)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' is not supported,
14
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),s[0].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});let a=n=>n===this.modelSchema.roles[types.UserRoleLiteral]||n===this.modelSchema.roles[types.ToolRoleLiteral]?[this.modelSchema.roles[types.AssistantRoleLiteral]]:[this.modelSchema.roles[types.UserRoleLiteral],this.modelSchema.roles[types.ToolRoleLiteral]];for(let n=1;n<s.length;n++)if(!a(s[n-1].role).includes(s[n].role))throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' cannot have message with role : '${s[n].role}' after message with role : '${s[n-1].role}'`)});if(s[s.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral]&&s[s.length-1].role!==this.modelSchema.roles[types.ToolRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires last message to be from user`)});return E({contents:s},t.parts.length>0?{system_instruction:t}:{})}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:[{function_declarations:e.map(s=>{let a=types.Tool().safeParse(s);if(!a.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:a.error});return a.data}).map(s=>({name:s.definition.schema.name,description:s.definition.schema.description,parameters:s.definition.schema.parameters}))}]}}getCompleteChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return P(this,null,function*(){let s=this.transformConfig(e,o,t),a=this.transformMessages(o);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=t?this.transformTools(t):{};return new Promise(m=>{m(E(E(E(E({},this.getDefaultParams()),s),a),n));})})}transformCompleteChatResponse(e){let o=et.safeParse(e);if(o.success){if(o.data.candidates.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(o.data)}`)});let t=o.data,s=[],a,n=t.candidates[0].content;if(n){let d=n.parts.map((h,u)=>{if("text"in h&&h.text!==void 0)return types.createTextContent(h.text);if("functionCall"in h&&h.functionCall!==void 0)return types.createToolCallContent(u,`${h.functionCall.name}_${u}`,h.functionCall.name,JSON.stringify(h.functionCall.args))});return s.push({role:types.AssistantRoleLiteral,content:d}),t.usageMetadata&&(a={promptTokens:t.usageMetadata.promptTokenCount,totalTokens:t.usageMetadata.totalTokenCount,completionTokens:t.usageMetadata.candidatesTokenCount||0}),{messages:s,usage:a,logProbs:void 0}}let m=t.candidates[0].safetyRatings;if(m&&m.length>0&&m.forEach(d=>{if(d.blocked)throw new provider.ModelResponseError({info:`Blocked content for category: ${d.category} with probability: ${d.probability}`,cause:new Error(`Blocked content for category: ${d.category} with probability: ${d.probability}`)})}),t.candidates[0].finishReason==="SAFETY")throw new provider.ModelResponseError({info:"Blocked content, model response finished with safety reason",cause:new Error("Blocked content, model response finished with safety reason")})}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}getStreamChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return P(this,null,function*(){let s=this.transformConfig(e,o,t),a=this.transformMessages(o);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=t?this.transformTools(t):{};return new Promise(m=>{m(E(E(E(E({},this.getDefaultParams()),s),a),n));})})}transformStreamChatResponseChunk(e,o){return Le(this,null,function*(){let t=(o+e).split(",\r").filter(s=>s.trim()!=="");for(let s of t){let a=s;if(a=a.replace(/\n/g,""),a.startsWith("[")||a.startsWith(",{"))a=a.slice(1);else if(a.endsWith("]")){if(a==="]")return;a=a.slice(0,-1);}let n;try{n=JSON.parse(a);}catch(l){if(l instanceof SyntaxError){o=a;continue}else throw l}o="";let m=Go.safeParse(n);if(m.success){let l={partialMessages:[]},d=m.data;if(d.candidates.length>0){let h=d.candidates[0].content;h&&"parts"in h&&h.parts.length>0&&h.parts.forEach((u,M)=>{if("text"in u&&u.text!==void 0&&l.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,u.text)),"functionCall"in u&&u.functionCall!==void 0){let f=u.functionCall;l.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,M,`${f.name}_${M}`,f.name,JSON.stringify(f.args)));}});}d.usageMetadata&&d.usageMetadata.totalTokenCount&&d.usageMetadata.promptTokenCount&&d.usageMetadata.candidatesTokenCount&&(l.usage={promptTokens:d.usageMetadata.promptTokenCount,completionTokens:d.usageMetadata.candidatesTokenCount,totalTokens:d.usageMetadata.totalTokenCount}),yield {partialResponse:l,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:m.error})}yield {partialResponse:{partialMessages:[]},buffer:o};})}transformProxyStreamChatResponseChunk(e,o,t,s,a){return Le(this,null,function*(){if((a==null?void 0:a.alt)!=="sse"){yield*Ro(this.transformStreamChatResponseChunk(e,o));return}let n=o+e,m=[],l="",d=0;for(;d<n.length;){let h=n.indexOf(`
15
- `,d);if(h===-1){l=n.substring(d);break}else {let u=n.substring(d,h).trim();u&&m.push(u),d=h+1;}}for(let h of m){if(h==="data: [DONE]")return;if(h.startsWith("data: ")){let u=h.substring(6);try{let M=JSON.parse(u),f=Go.safeParse(M);if(f.success){let w={partialMessages:[]},x=f.data;if(x.candidates.length>0){let k=x.candidates[0].content;k&&"parts"in k&&k.parts.length>0&&k.parts.forEach((G,L)=>{if("text"in G&&G.text!==void 0&&w.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,G.text)),"functionCall"in G&&G.functionCall!==void 0){let Ie=G.functionCall;w.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,L,`${Ie.name}_${L}`,Ie.name,JSON.stringify(Ie.args)));}});}x.usageMetadata&&x.usageMetadata.totalTokenCount&&x.usageMetadata.promptTokenCount&&x.usageMetadata.candidatesTokenCount&&(w.usage={promptTokens:x.usageMetadata.promptTokenCount,completionTokens:x.usageMetadata.candidatesTokenCount,totalTokens:x.usageMetadata.totalTokenCount}),yield {partialResponse:w,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:f.error})}catch(M){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${u}`,cause:M})}}}yield {partialResponse:{partialMessages:[]},buffer:l};})}getProxyCompleteChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{if(!t||Object.keys(t).length===0){s(this.streamChatUrl);return}let a=new URL(this.streamChatUrl);Object.entries(t).forEach(([n,m])=>{m!=null&&a.searchParams.set(n,m);}),s(a.toString());})})}getProxyCompleteChatHeaders(e,o,t){return P(this,null,function*(){if(!o)return {};let s=E({},o);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,o,t){return P(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}};var R=class extends T{transformMessages(e){let o=super.transformMessages(e);if(o.systemInstruction){let t={role:this.modelSchema.roles[types.UserRoleLiteral],parts:o.systemInstruction.parts};o.contents.unshift(t),delete o.systemInstruction;}return o}};var ze="gemini-1.0-pro-001",es="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",je=provider.ChatModelSchema(y,F).parse({name:ze,description:es,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),$o=g,ie=class extends R{constructor(e){super(je,e);}};var Be="gemini-1.0-pro-latest",ts="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for natural language tasks, multi-turn text and code chat, and code generation",De=provider.ChatModelSchema(y,F).parse({name:Be,description:ts,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),qo=g,ae=class extends R{constructor(e){super(De,e);}};var Ue="gemini-1.0-pro-vision",ns="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",Ae=provider.ChatModelSchema(y,Se).parse({name:Ue,description:ns,maxInputTokens:12288,maxOutputTokens:4096,roles:C,modalities:Pe,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),zo=g,re=class extends R{constructor(e){super(Ae,e);}};var He="gemini-1.0-pro",as="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Ve=provider.ChatModelSchema(y,F).parse({name:He,description:as,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),jo=g,le=class extends R{constructor(e){super(Ve,e);}};var Ke="gemini-1.5-flash-001",ls="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Ye=provider.ChatModelSchema(y,_).parse({name:Ke,description:ls,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Bo=g,me=class extends T{constructor(e){super(Ye,e);}};var Je="gemini-1.5-flash-002",ds="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",We=provider.ChatModelSchema(y,_).parse({name:Je,description:ds,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Do=g,de=class extends T{constructor(e){super(We,e);}};var Xe="gemini-1.5-flash-latest",cs="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Qe=provider.ChatModelSchema(y,_).parse({name:Xe,description:cs,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Uo=g,pe=class extends T{constructor(e){super(Qe,e);}};var Ze="gemini-1.5-flash",fs="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",eo=provider.ChatModelSchema(y,_).parse({name:Ze,description:fs,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ao=g,ce=class extends T{constructor(e){super(eo,e);}};var oo="gemini-1.5-pro-001",us="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",to=provider.ChatModelSchema(y,_).parse({name:oo,description:us,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ho=g,he=class extends T{constructor(e){super(to,e);}};var so="gemini-1.5-pro-002",Cs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",no=provider.ChatModelSchema(y,_).parse({name:so,description:Cs,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Vo=g,fe=class extends T{constructor(e){super(no,e);}};var io="gemini-1.5-pro-latest",Ms="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ao=provider.ChatModelSchema(y,_).parse({name:io,description:Ms,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ko=g,ge=class extends T{constructor(e){super(ao,e);}};var ro="gemini-1.5-pro",bs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",lo=provider.ChatModelSchema(y,_).parse({name:ro,description:bs,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Yo=g,ue=class extends T{constructor(e){super(lo,e);}};var mo="gemini-2.0-flash-exp",Es="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",po=provider.ChatModelSchema(y,_).parse({name:mo,description:Es,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Jo=g,ye=class extends T{constructor(e){super(po,e);}};var co="gemini-pro-vision",Ps="An image understanding model to handle a broad range of applications",ho=provider.ChatModelSchema(y,Se).parse({name:co,description:Ps,maxInputTokens:12288,maxOutputTokens:4096,roles:C,modalities:Pe,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),Wo=g,Ce=class extends R{constructor(e){super(ho,e);}};var fo="gemini-pro",Rs="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",go=provider.ChatModelSchema(y,F).parse({name:fo,description:Rs,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),Xo=g,Te=class extends R{constructor(e){super(go,e);}};var we=[types.EmbeddingTextModalityLiteral],ke=zod.z.enum([types.EmbeddingTextModalityLiteral]);var ft=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var ws=zod.z.object({model:zod.z.string().min(1),content:zod.z.object({parts:zod.z.array(zod.z.object({text:zod.z.string().min(1)})).min(1)})}),gt=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(ws).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var te=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),W=class{constructor(e,o){this.version="v1";let t=te.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||z.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(t.getEmbeddingsUrl||`${this.baseUrl}/models/${this.modelName}:batchEmbedContents?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.requests.reduce((o,t)=>o+t.length,0)}transformModelRequest(e){let o=gt.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model,a={outputDimensionality:t.outputDimensionality},n=types.Config().parse(provider.removeUndefinedEntries(a)),m={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((l,d)=>(l.push(...d.content.parts.map(h=>h.text)),l),[])};return {modelName:s,config:n,embeddingRequests:m}}transformConfig(e,o){let t=this.modelSchema.config.schema.safeParse(e);if(!t.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:t.error});let s=t.data;return Object.keys(s).forEach(n=>{if(!this.modelSchema.config.def[n])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${n}',
16
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((n,m)=>{let d=this.modelSchema.config.def[m].param,h=s[m];return n[d]=h,n},{})}transformEmbeddingRequests(e){let o=types.EmbeddingRequests().safeParse(e);if(!o.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:o.error});if(e.modality!==types.EmbeddingTextModalityLiteral)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Only '${types.EmbeddingTextModalityLiteral}' modality is supported for model : '${this.modelName}'`)});return {requests:o.data.requests.map(s=>({model:`models/${this.modelName}`,content:{parts:[{text:s}]}}))}}getGetEmbeddingsUrl(e,o){return P(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return P(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return P(this,null,function*(){return new Promise(t=>{let s=this.transformConfig(e),a=this.transformEmbeddingRequests(o);if(o.requests.length===0)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error("requests cannot be empty")});s.outputDimensionality&&(a.requests.forEach(n=>{n.outputDimensionality=s.outputDimensionality;}),delete s.outputDimensionality),t(E(E(E({},this.getDefaultParams()),s),a));})})}transformGetEmbeddingsResponse(e){let o=ft.safeParse(e);if(o.success){let s=o.data.embeddings.map((a,n)=>({index:n,embedding:a.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:s}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var uo="text-embedding-001",qs="text-embedding-001",yo=provider.EmbeddingModelSchema(ke).parse({name:uo,description:qs,modalities:we,maxInputTokens:2048,maxOutputTokens:768,config:{def:K.base(768).def,schema:K.base(768).schema}}),Qo=te,Me=class extends W{constructor(e){super(yo,e);}};var Co="text-embedding-004",js="text-embedding-004",To=provider.EmbeddingModelSchema(ke).parse({name:Co,description:js,modalities:we,maxInputTokens:2048,maxOutputTokens:768,config:{def:K.base(768).def,schema:K.base(768).schema}}),Zo=te,Ge=class extends W{constructor(e){super(To,e);}};
9
+ [${this.embeddingModelLiterals().join(", ")}]`)});let t=this.embeddingModelFactories[o].model,s=this.embeddingModelFactories[o].modelOptions.parse(e);return new t(s)}};z.baseUrl="https://generativelanguage.googleapis.com/v1beta";var y=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),Nt="model",vt="function",C={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:Nt,tool:vt};var b=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],_=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),Tn=[types.TextModalityLiteral],Mn=zod.z.enum([types.TextModalityLiteral]),Pe=[types.TextModalityLiteral,types.ImageModalityLiteral],Se=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),v=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],F=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var Ft=zod.z.object({text:zod.z.string()}),$t=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),et=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([Ft,$t]))}).optional(),finishReason:zod.z.string(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number()}).optional()}),qt=zod.z.object({text:zod.z.string()}),zt=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Go=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([qt,zt]))}).optional(),finishReason:zod.z.string().optional(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number().optional(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number().optional()}).optional()});var it=zod.z.object({text:zod.z.string().min(1)}),Bt=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),jt=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),Dt=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),Ut=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([it,Bt,jt,Dt]))}),ot=zod.z.object({parts:zod.z.array(it)}),At=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),tt=zod.z.object({function_calling_config:zod.z.object({mode:zod.z.enum(["ANY","AUTO","NONE"]),allowed_function_names:zod.z.array(zod.z.string()).optional()})}),st=zod.z.object({stopSequences:zod.z.array(zod.z.string()).optional(),maxOutputTokens:zod.z.number().optional(),temperature:zod.z.number().optional(),topP:zod.z.number().optional(),topK:zod.z.number().optional(),presencePenalty:zod.z.number().optional(),frequencyPenalty:zod.z.number().optional(),seed:zod.z.number().optional()}),nt=zod.z.object({category:zod.z.enum(["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])}),at=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(Ut),systemInstruction:ot.optional(),system_instruction:ot.optional(),generationConfig:st.optional(),generation_config:st.optional(),safetySettings:zod.z.array(nt).optional(),safety_settings:zod.z.array(nt).optional(),tools:zod.z.object({function_declarations:zod.z.array(At)}).optional(),toolConfig:tt.optional(),tool_config:tt.optional()});var f=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),T=class{constructor(e,o){this.version="v1";var s;let t=f.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((s=t.baseUrl)!=null?s:z.baseUrl),this.completeChatUrl=provider.urlWithoutTrailingSlash(t.completeChatUrl||`${this.baseUrl}/models/${this.modelName}:generateContent?key=${this.apiKey}`),this.streamChatUrl=provider.urlWithoutTrailingSlash(t.streamChatUrl||`${this.baseUrl}/models/${this.modelName}:streamGenerateContent?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.reduce((o,t)=>o+t.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let o=at.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model;if(t.system_instruction&&t.systemInstruction)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'system_instruction' and 'systemInstruction' are not allowed at the same time")});if(t.generation_config&&t.generationConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'generation_config' and 'generationConfig' are not allowed at the same time")});if(t.tool_config&&t.toolConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tool_config' and 'toolConfig' are not allowed at the same time")});let n=t.system_instruction||t.systemInstruction,l=t.generation_config||t.generationConfig,r=t.safety_settings||t.safetySettings,m=t.tool_config||t.toolConfig;if(m&&(!t.tools||t.tools.function_declarations.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};m&&(m.function_calling_config.mode==="ANY"&&m.function_calling_config.allowed_function_names&&m.function_calling_config.allowed_function_names.length===1?a.toolChoice=m.function_calling_config.allowed_function_names[0]:a.toolChoice=m.function_calling_config.mode.toLowerCase()),a.seed=l==null?void 0:l.seed,a.maxTokens=l==null?void 0:l.maxOutputTokens,a.temperature=l==null?void 0:l.temperature,a.topP=l==null?void 0:l.topP,a.presencePenalty=l==null?void 0:l.presencePenalty,a.frequencyPenalty=l==null?void 0:l.frequencyPenalty,a.stop=l==null?void 0:l.stopSequences,a.safetySettings=r;let c=types.Config().parse(provider.removeUndefinedEntries(a)),u=[];n&&n.parts.forEach(g=>{u.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:g.text}]});}),t.contents.forEach(g=>{let w=g.role;switch(w){case"user":{let k=g.parts.map(G=>"text"in G?{modality:types.TextModalityLiteral,value:G.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:G.inline_data.data,media_type:G.inline_data.mime_type.split("/")[1]}});u.push({role:w,content:k});}break;case"model":{let k=g.parts.map((G,L)=>"text"in G?{modality:types.TextModalityLiteral,value:G.text}:{modality:types.ToolCallModalityLiteral,id:L.toString(),index:L,name:G.function_call.name,arguments:JSON.stringify(G.function_call.args)});u.push({role:types.AssistantRoleLiteral,content:k});}break;case"function":{let k=g.parts.map((G,L)=>({modality:types.ToolResponseModalityLiteral,id:L.toString(),index:L,name:G.function_response.name,data:JSON.stringify(G.function_response.response)}));u.push({role:types.ToolRoleLiteral,content:k});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${g.role}' is not supported for model : ${this.modelName}`)})}});let M=[];return t.tools&&t.tools.function_declarations.forEach(g=>{M.push({type:"function",definition:{schema:{name:g.name,description:g.description,parameters:g.parameters}}});}),{modelName:s,config:c,messages:u,tools:M.length>0?M:void 0}}transformConfig(e,o,t){let s=e.toolChoice;delete e.toolChoice;let n=this.modelSchema.config.schema.safeParse(e);if(!n.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:n.error});let l=n.data;Object.keys(l).forEach(c=>{if(!(c in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${c}',
10
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let r=Object.keys(l).reduce((c,u)=>{let M=this.modelSchema.config.def[u],g=M.param,w=l[u];return g==="maxOutputTokens"&&M.type==="range"&&w===0?c[g]=M.max:c[g]=w,c},{}),m=r.safetySettings;delete r.safetySettings;let a;if(s!==void 0){let c=s;if(!t||t&&t.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(t&&t.length>0){let u=this.modelSchema.config.def.toolChoice;if(u.choices.includes(c))c==="any"?a={function_calling_config:{mode:"ANY",allowed_function_names:t.map(M=>M.definition.schema.name)}}:a={function_calling_config:{mode:c.toUpperCase()}};else if(t.map(M=>M.definition.schema.name).includes(c))a={function_calling_config:{mode:"ANY",allowed_function_names:[c]}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${c}' is not part of provided 'tools' names or
11
+ one of [${u.choices.join(", ")}]`)})}}return E(E({generation_config:r},a?{tool_config:a}:{}),m?{safety_settings:m}:{})}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let o=r=>{let m=r.match(/^data:image\/[a-zA-Z]+;base64,/);return m?r.substring(m[0].length):r},t=e.map(r=>{let m=types.Message().safeParse(r);if(!m.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:m.error});return m.data});t.forEach(r=>{r.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}',
12
+ available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),t.forEach(r=>{if(!Object.keys(this.modelSchema.roles).includes(r.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${r.role}',
13
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let s={parts:[]},n=[];if(t.forEach(r=>{switch(r.role){case types.SystemRoleLiteral:r.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)s.parts.push({text:m.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${m.modality}'`)})});break;case types.AssistantRoleLiteral:{let m=[];r.content.forEach(a=>{if(a.modality===types.TextModalityLiteral)m.push({text:a.value});else if(a.modality===types.ToolCallModalityLiteral)m.push({function_call:{name:a.name,args:JSON.parse(a.arguments)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${a.modality}'`)})}),n.push({role:this.modelSchema.roles[r.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];r.content.forEach(a=>{if(a.modality===types.TextModalityLiteral)m.push({text:a.value});else if(a.modality===types.ImageModalityLiteral){if(a.value.type==="base64"){let c=a.value.base64;c=o(c),m.push({inline_data:{mime_type:`image/${a.value.media_type}`,data:c}});}else if(a.value.type==="url")throw new provider.InvalidMessagesError({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${a.value.type}'`)})}else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${a.modality}'`)})}),n.push({role:this.modelSchema.roles[r.role],parts:m});}break;case types.ToolRoleLiteral:{let m=[];r.content.forEach(a=>{if(a.modality===types.ToolResponseModalityLiteral)m.push({function_response:{name:a.name,response:JSON.parse(a.data)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${a.modality}'`)})}),n.push({role:this.modelSchema.roles[r.role],parts:m});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' is not supported,
14
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),n[0].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});let l=r=>r===this.modelSchema.roles[types.UserRoleLiteral]||r===this.modelSchema.roles[types.ToolRoleLiteral]?[this.modelSchema.roles[types.AssistantRoleLiteral]]:[this.modelSchema.roles[types.UserRoleLiteral],this.modelSchema.roles[types.ToolRoleLiteral]];for(let r=1;r<n.length;r++)if(!l(n[r-1].role).includes(n[r].role))throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' cannot have message with role : '${n[r].role}' after message with role : '${n[r-1].role}'`)});if(n[n.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral]&&n[n.length-1].role!==this.modelSchema.roles[types.ToolRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires last message to be from user`)});return E({contents:n},s.parts.length>0?{system_instruction:s}:{})}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:[{function_declarations:e.map(s=>{let n=types.Tool().safeParse(s);if(!n.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:n.error});return n.data}).map(s=>({name:s.definition.schema.name,description:s.definition.schema.description,parameters:s.definition.schema.parameters}))}]}}getCompleteChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return P(this,null,function*(){let s=this.transformConfig(e,o,t),n=this.transformMessages(o);if(n.messages&&n.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let l=t?this.transformTools(t):{};return new Promise(r=>{r(E(E(E(E({},this.getDefaultParams()),s),n),l));})})}transformCompleteChatResponse(e){let o=et.safeParse(e);if(o.success){if(o.data.candidates.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(o.data)}`)});let t=o.data,s=[],n,l=t.candidates[0].content;if(l){let a=l.parts.map((c,u)=>{if("text"in c&&c.text!==void 0)return types.createTextContent(c.text);if("functionCall"in c&&c.functionCall!==void 0)return types.createToolCallContent(u,`${c.functionCall.name}_${u}`,c.functionCall.name,JSON.stringify(c.functionCall.args))});return s.push({role:types.AssistantRoleLiteral,content:a}),t.usageMetadata&&(n={promptTokens:t.usageMetadata.promptTokenCount,totalTokens:t.usageMetadata.totalTokenCount,completionTokens:t.usageMetadata.candidatesTokenCount||0}),{messages:s,usage:n,logProbs:void 0}}let r=t.candidates[0].safetyRatings;if(r&&r.length>0&&r.forEach(a=>{if(a.blocked)throw new provider.ModelResponseError({info:`Blocked content for category: ${a.category} with probability: ${a.probability}`,cause:new Error(`Blocked content for category: ${a.category} with probability: ${a.probability}`)})}),t.candidates[0].finishReason==="SAFETY")throw new provider.ModelResponseError({info:"Blocked content, model response finished with safety reason",cause:new Error("Blocked content, model response finished with safety reason")})}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}getStreamChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return P(this,null,function*(){let s=this.transformConfig(e,o,t),n=this.transformMessages(o);if(n.messages&&n.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let l=t?this.transformTools(t):{};return new Promise(r=>{r(E(E(E(E({},this.getDefaultParams()),s),n),l));})})}transformStreamChatResponseChunk(e,o){return Le(this,null,function*(){let t=(o+e).split(",\r").filter(s=>s.trim()!=="");for(let s of t){let n=s;if(n=n.replace(/\n/g,""),n.startsWith("[")||n.startsWith(",{"))n=n.slice(1);else if(n.endsWith("]")){if(n==="]")return;n=n.slice(0,-1);}let l;try{l=JSON.parse(n);}catch(m){if(m instanceof SyntaxError){o=n;continue}else throw m}o="";let r=Go.safeParse(l);if(r.success){let m={partialMessages:[]},a=r.data;if(a.candidates.length>0){let c=a.candidates[0].content;c&&"parts"in c&&c.parts.length>0&&c.parts.forEach((u,M)=>{if("text"in u&&u.text!==void 0&&m.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,u.text)),"functionCall"in u&&u.functionCall!==void 0){let g=u.functionCall;m.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,M,`${g.name}_${M}`,g.name,JSON.stringify(g.args)));}});}a.usageMetadata&&a.usageMetadata.totalTokenCount&&a.usageMetadata.promptTokenCount&&a.usageMetadata.candidatesTokenCount&&(m.usage={promptTokens:a.usageMetadata.promptTokenCount,completionTokens:a.usageMetadata.candidatesTokenCount,totalTokens:a.usageMetadata.totalTokenCount}),yield {partialResponse:m,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:r.error})}yield {partialResponse:{partialMessages:[]},buffer:o};})}transformProxyStreamChatResponseChunk(e,o,t,s,n){return Le(this,null,function*(){if((n==null?void 0:n.alt)!=="sse"){yield*Ro(this.transformStreamChatResponseChunk(e,o));return}let l=o+e,r=[],m="",a=0;for(;a<l.length;){let c=l.indexOf(`
15
+ `,a);if(c===-1){m=l.substring(a);break}else {let u=l.substring(a,c).trim();u&&r.push(u),a=c+1;}}for(let c of r){if(c==="data: [DONE]")return;if(c.startsWith("data: ")){let u=c.substring(6);try{let M=JSON.parse(u),g=Go.safeParse(M);if(g.success){let w={partialMessages:[]},x=g.data;if(x.candidates.length>0){let k=x.candidates[0].content;k&&"parts"in k&&k.parts.length>0&&k.parts.forEach((G,L)=>{if("text"in G&&G.text!==void 0&&w.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,G.text)),"functionCall"in G&&G.functionCall!==void 0){let Ie=G.functionCall;w.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,L,`${Ie.name}_${L}`,Ie.name,JSON.stringify(Ie.args)));}});}x.usageMetadata&&x.usageMetadata.totalTokenCount&&x.usageMetadata.promptTokenCount&&x.usageMetadata.candidatesTokenCount&&(w.usage={promptTokens:x.usageMetadata.promptTokenCount,completionTokens:x.usageMetadata.candidatesTokenCount,totalTokens:x.usageMetadata.totalTokenCount}),yield {partialResponse:w,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:g.error})}catch(M){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${u}`,cause:M})}}}yield {partialResponse:{partialMessages:[]},buffer:m};})}getProxyCompleteChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return P(this,null,function*(){return new Promise(s=>{if(!t||Object.keys(t).length===0){s(this.streamChatUrl);return}let n=new URL(this.streamChatUrl);Object.entries(t).forEach(([l,r])=>{r!=null&&n.searchParams.set(l,r);}),s(n.toString());})})}getProxyCompleteChatHeaders(e,o,t){return P(this,null,function*(){if(!o)return {};let s=E({},o);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,o,t){return P(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}};var R=class extends T{transformMessages(e){let o=super.transformMessages(e);if(o.systemInstruction){let t={role:this.modelSchema.roles[types.UserRoleLiteral],parts:o.systemInstruction.parts};o.contents.unshift(t),delete o.systemInstruction;}return o}};var ze="gemini-1.0-pro-001",es="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Be=provider.ChatModelSchema(y,F).parse({name:ze,description:es,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:h.base(1,.9,2048,4,1).def,schema:h.base(1,.9,2048,4,1).schema}}),$o=f,ie=class extends R{constructor(e){super(Be,e);}};var je="gemini-1.0-pro-latest",ts="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for natural language tasks, multi-turn text and code chat, and code generation",De=provider.ChatModelSchema(y,F).parse({name:je,description:ts,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:h.base(1,.9,2048,4,1).def,schema:h.base(1,.9,2048,4,1).schema}}),qo=f,ae=class extends R{constructor(e){super(De,e);}};var Ue="gemini-1.0-pro-vision",ns="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",Ae=provider.ChatModelSchema(y,Se).parse({name:Ue,description:ns,maxInputTokens:12288,maxOutputTokens:4096,roles:C,modalities:Pe,config:{def:h.c1(1,.4,4096,4,1,32).def,schema:h.c1(1,.4,4096,4,1,32).schema}}),zo=f,re=class extends R{constructor(e){super(Ae,e);}};var He="gemini-1.0-pro",as="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Ve=provider.ChatModelSchema(y,F).parse({name:He,description:as,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:h.base(1,.9,2048,4,1).def,schema:h.base(1,.9,2048,4,1).schema}}),Bo=f,le=class extends R{constructor(e){super(Ve,e);}};var Ke="gemini-1.5-flash-001",ls="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Ye=provider.ChatModelSchema(y,_).parse({name:Ke,description:ls,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),jo=f,me=class extends T{constructor(e){super(Ye,e);}};var Je="gemini-1.5-flash-002",ds="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",We=provider.ChatModelSchema(y,_).parse({name:Je,description:ds,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,40).def,schema:h.c1(2,1,8192,4,.95,40).schema}}),Do=f,de=class extends T{constructor(e){super(We,e);}};var Xe="gemini-1.5-flash-latest",cs="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Ze=provider.ChatModelSchema(y,_).parse({name:Xe,description:cs,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Uo=f,pe=class extends T{constructor(e){super(Ze,e);}};var Qe="gemini-1.5-flash",gs="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",eo=provider.ChatModelSchema(y,_).parse({name:Qe,description:gs,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Ao=f,ce=class extends T{constructor(e){super(eo,e);}};var oo="gemini-1.5-pro-001",us="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",to=provider.ChatModelSchema(y,_).parse({name:oo,description:us,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Ho=f,he=class extends T{constructor(e){super(to,e);}};var so="gemini-1.5-pro-002",Cs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",no=provider.ChatModelSchema(y,_).parse({name:so,description:Cs,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,40).def,schema:h.c1(2,1,8192,4,.95,40).schema}}),Vo=f,ge=class extends T{constructor(e){super(no,e);}};var io="gemini-1.5-pro-latest",Ms="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ao=provider.ChatModelSchema(y,_).parse({name:io,description:Ms,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Ko=f,fe=class extends T{constructor(e){super(ao,e);}};var ro="gemini-1.5-pro",bs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",lo=provider.ChatModelSchema(y,_).parse({name:ro,description:bs,maxInputTokens:2e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Yo=f,ue=class extends T{constructor(e){super(lo,e);}};var mo="gemini-2.0-flash-exp",Es="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",po=provider.ChatModelSchema(y,_).parse({name:mo,description:Es,maxInputTokens:1e6,maxOutputTokens:8192,roles:C,modalities:b,config:{def:h.c1(2,1,8192,4,.95,64).def,schema:h.c1(2,1,8192,4,.95,64).schema}}),Jo=f,ye=class extends T{constructor(e){super(po,e);}};var co="gemini-pro-vision",Ps="An image understanding model to handle a broad range of applications",ho=provider.ChatModelSchema(y,Se).parse({name:co,description:Ps,maxInputTokens:12288,maxOutputTokens:4096,roles:C,modalities:Pe,config:{def:h.c1(1,.4,4096,4,1,32).def,schema:h.c1(1,.4,4096,4,1,32).schema}}),Wo=f,Ce=class extends R{constructor(e){super(ho,e);}};var go="gemini-pro",Rs="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",fo=provider.ChatModelSchema(y,F).parse({name:go,description:Rs,maxInputTokens:30720,maxOutputTokens:2048,roles:C,modalities:v,config:{def:h.base(1,.9,2048,4,1).def,schema:h.base(1,.9,2048,4,1).schema}}),Xo=f,Te=class extends R{constructor(e){super(fo,e);}};var we=[types.EmbeddingTextModalityLiteral],ke=zod.z.enum([types.EmbeddingTextModalityLiteral]);var gt=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var ws=zod.z.object({model:zod.z.string().min(1),content:zod.z.object({parts:zod.z.array(zod.z.object({text:zod.z.string().min(1)})).min(1)})}),ft=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(ws).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var te=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),W=class{constructor(e,o){this.version="v1";let t=te.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||z.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(t.getEmbeddingsUrl||`${this.baseUrl}/models/${this.modelName}:batchEmbedContents?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.requests.reduce((o,t)=>o+t.length,0)}transformModelRequest(e){let o=ft.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model,n={outputDimensionality:t.outputDimensionality},l=types.Config().parse(provider.removeUndefinedEntries(n)),r={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((m,a)=>(m.push(...a.content.parts.map(c=>c.text)),m),[])};return {modelName:s,config:l,embeddingRequests:r}}transformConfig(e,o){let t=this.modelSchema.config.schema.safeParse(e);if(!t.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:t.error});let s=t.data;return Object.keys(s).forEach(l=>{if(!this.modelSchema.config.def[l])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${l}',
16
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((l,r)=>{let a=this.modelSchema.config.def[r].param,c=s[r];return l[a]=c,l},{})}transformEmbeddingRequests(e){let o=types.EmbeddingRequests().safeParse(e);if(!o.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:o.error});if(e.modality!==types.EmbeddingTextModalityLiteral)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Only '${types.EmbeddingTextModalityLiteral}' modality is supported for model : '${this.modelName}'`)});return {requests:o.data.requests.map(s=>({model:`models/${this.modelName}`,content:{parts:[{text:s}]}}))}}getGetEmbeddingsUrl(e,o){return P(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return P(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return P(this,null,function*(){return new Promise(t=>{let s=this.transformConfig(e),n=this.transformEmbeddingRequests(o);if(o.requests.length===0)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error("requests cannot be empty")});s.outputDimensionality&&(n.requests.forEach(l=>{l.outputDimensionality=s.outputDimensionality;}),delete s.outputDimensionality),t(E(E(E({},this.getDefaultParams()),s),n));})})}transformGetEmbeddingsResponse(e){let o=gt.safeParse(e);if(o.success){let s=o.data.embeddings.map((n,l)=>({index:l,embedding:n.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:s}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var uo="text-embedding-001",qs="text-embedding-001",yo=provider.EmbeddingModelSchema(ke).parse({name:uo,description:qs,modalities:we,maxInputTokens:2048,maxOutputTokens:768,config:{def:K.base(768).def,schema:K.base(768).schema}}),Zo=te,Me=class extends W{constructor(e){super(yo,e);}};var Co="text-embedding-004",Bs="text-embedding-004",To=provider.EmbeddingModelSchema(ke).parse({name:Co,description:Bs,modalities:we,maxInputTokens:2048,maxOutputTokens:768,config:{def:K.base(768).def,schema:K.base(768).schema}}),Qo=te,Ge=class extends W{constructor(e){super(To,e);}};
17
17
 
18
18
  exports.BaseChatModel = T;
19
19
  exports.BaseChatModelGemini1 = R;
20
- exports.BaseChatModelOptions = g;
20
+ exports.BaseChatModelOptions = f;
21
21
  exports.BaseEmbeddingModel = W;
22
22
  exports.BaseEmbeddingModelOptions = te;
23
23
  exports.ChatModelBaseConfigDef = wo;
@@ -28,11 +28,11 @@ exports.EmbeddingModelBaseConfigDef = vo;
28
28
  exports.EmbeddingModelBaseConfigSchema = No;
29
29
  exports.Gemini1_0Pro = le;
30
30
  exports.Gemini1_0ProLatest = ae;
31
- exports.Gemini1_0ProLatestLiteral = Be;
31
+ exports.Gemini1_0ProLatestLiteral = je;
32
32
  exports.Gemini1_0ProLatestOptions = qo;
33
33
  exports.Gemini1_0ProLatestSchema = De;
34
34
  exports.Gemini1_0ProLiteral = He;
35
- exports.Gemini1_0ProOptions = jo;
35
+ exports.Gemini1_0ProOptions = Bo;
36
36
  exports.Gemini1_0ProSchema = Ve;
37
37
  exports.Gemini1_0ProVision = re;
38
38
  exports.Gemini1_0ProVisionLiteral = Ue;
@@ -41,11 +41,11 @@ exports.Gemini1_0ProVisionSchema = Ae;
41
41
  exports.Gemini1_0Pro_001 = ie;
42
42
  exports.Gemini1_0Pro_001Literal = ze;
43
43
  exports.Gemini1_0Pro_001Options = $o;
44
- exports.Gemini1_0Pro_001Schema = je;
44
+ exports.Gemini1_0Pro_001Schema = Be;
45
45
  exports.Gemini1_5Flash = ce;
46
46
  exports.Gemini1_5Flash001 = me;
47
47
  exports.Gemini1_5Flash001Literal = Ke;
48
- exports.Gemini1_5Flash001Options = Bo;
48
+ exports.Gemini1_5Flash001Options = jo;
49
49
  exports.Gemini1_5Flash001Schema = Ye;
50
50
  exports.Gemini1_5Flash002 = de;
51
51
  exports.Gemini1_5Flash002Literal = Je;
@@ -54,8 +54,8 @@ exports.Gemini1_5Flash002Schema = We;
54
54
  exports.Gemini1_5FlashLatest = pe;
55
55
  exports.Gemini1_5FlashLatestLiteral = Xe;
56
56
  exports.Gemini1_5FlashLatestOptions = Uo;
57
- exports.Gemini1_5FlashLatestSchema = Qe;
58
- exports.Gemini1_5FlashLiteral = Ze;
57
+ exports.Gemini1_5FlashLatestSchema = Ze;
58
+ exports.Gemini1_5FlashLiteral = Qe;
59
59
  exports.Gemini1_5FlashOptions = Ao;
60
60
  exports.Gemini1_5FlashSchema = eo;
61
61
  exports.Gemini1_5Pro = ue;
@@ -63,11 +63,11 @@ exports.Gemini1_5Pro001 = he;
63
63
  exports.Gemini1_5Pro001Literal = oo;
64
64
  exports.Gemini1_5Pro001Options = Ho;
65
65
  exports.Gemini1_5Pro001Schema = to;
66
- exports.Gemini1_5Pro002 = fe;
66
+ exports.Gemini1_5Pro002 = ge;
67
67
  exports.Gemini1_5Pro002Literal = so;
68
68
  exports.Gemini1_5Pro002Options = Vo;
69
69
  exports.Gemini1_5Pro002Schema = no;
70
- exports.Gemini1_5ProLatest = ge;
70
+ exports.Gemini1_5ProLatest = fe;
71
71
  exports.Gemini1_5ProLatestLiteral = io;
72
72
  exports.Gemini1_5ProLatestOptions = Ko;
73
73
  exports.Gemini1_5ProLatestSchema = ao;
@@ -79,9 +79,9 @@ exports.Gemini2_0FlashExpLiteral = mo;
79
79
  exports.Gemini2_0FlashExpOptions = Jo;
80
80
  exports.Gemini2_0FlashExpSchema = po;
81
81
  exports.GeminiPro = Te;
82
- exports.GeminiProLiteral = fo;
82
+ exports.GeminiProLiteral = go;
83
83
  exports.GeminiProOptions = Xo;
84
- exports.GeminiProSchema = go;
84
+ exports.GeminiProSchema = fo;
85
85
  exports.GeminiProVision = Ce;
86
86
  exports.GeminiProVisionLiteral = co;
87
87
  exports.GeminiProVisionOptions = Wo;
@@ -89,12 +89,12 @@ exports.GeminiProVisionSchema = ho;
89
89
  exports.Google = z;
90
90
  exports.GoogleChatAssistantRoleLiteral = Nt;
91
91
  exports.GoogleChatContent = Ut;
92
- exports.GoogleChatContentPartFunctionCall = Bt;
92
+ exports.GoogleChatContentPartFunctionCall = jt;
93
93
  exports.GoogleChatContentPartFunctionResponse = Dt;
94
- exports.GoogleChatContentPartInlineData = jt;
94
+ exports.GoogleChatContentPartInlineData = Bt;
95
95
  exports.GoogleChatContentPartText = it;
96
96
  exports.GoogleChatGenerationConfig = st;
97
- exports.GoogleChatModelConfigs = c;
97
+ exports.GoogleChatModelConfigs = h;
98
98
  exports.GoogleChatModelModalities = b;
99
99
  exports.GoogleChatModelModalitiesEnum = _;
100
100
  exports.GoogleChatModelRoles = y;
@@ -117,20 +117,20 @@ exports.GoogleCompleteChatToolResponse = $t;
117
117
  exports.GoogleEmbeddingModelConfigs = K;
118
118
  exports.GoogleEmbeddingModelModalities = we;
119
119
  exports.GoogleEmbeddingModelModalitiesEnum = ke;
120
- exports.GoogleEmbeddingRequest = gt;
120
+ exports.GoogleEmbeddingRequest = ft;
121
121
  exports.GoogleEmbeddingRequestInput = ws;
122
- exports.GoogleGetEmbeddingsResponse = ft;
122
+ exports.GoogleGetEmbeddingsResponse = gt;
123
123
  exports.GoogleStreamChatResponse = Go;
124
124
  exports.GoogleStreamChatTextResponse = qt;
125
125
  exports.GoogleStreamChatToolResponse = zt;
126
126
  exports.ProviderLiteral = xt;
127
127
  exports.Text_Embedding_001 = Me;
128
128
  exports.Text_Embedding_001Literal = uo;
129
- exports.Text_Embedding_001Options = Qo;
129
+ exports.Text_Embedding_001Options = Zo;
130
130
  exports.Text_Embedding_001Schema = yo;
131
131
  exports.Text_Embedding_004 = Ge;
132
132
  exports.Text_Embedding_004Literal = Co;
133
- exports.Text_Embedding_004Options = Zo;
133
+ exports.Text_Embedding_004Options = Qo;
134
134
  exports.Text_Embedding_004Schema = To;
135
135
  exports.dimensions = qe;
136
136
  exports.frequencyPenalty = ve;
@@ -139,7 +139,7 @@ exports.presencePenalty = Fe;
139
139
  exports.safetySettings = V;
140
140
  exports.seed = $e;
141
141
  exports.stop = U;
142
- exports.temperature = B;
142
+ exports.temperature = j;
143
143
  exports.toolChoice = H;
144
144
  exports.topK = Ne;
145
145
  exports.topP = A;