@adaline/google 1.1.0 → 1.2.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 +60 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,143 +4,143 @@ var zod = require('zod');
|
|
|
4
4
|
var provider = require('@adaline/provider');
|
|
5
5
|
var types = require('@adaline/types');
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var wt=Object.defineProperty,vt=Object.defineProperties;var Nt=Object.getOwnPropertyDescriptors;var No=Object.getOwnPropertySymbols;var It=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var le=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s),Dt=s=>{throw TypeError(s)};var Io=(s,e,o)=>e in s?wt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[e]=o,E=(s,e)=>{for(var o in e||(e={}))It.call(e,o)&&Io(s,o,e[o]);if(No)for(var o of No(e))Lt.call(e,o)&&Io(s,o,e[o]);return s},Lo=(s,e)=>vt(s,Nt(e));var S=(s,e,o)=>new Promise((t,n)=>{var i=m=>{try{r(o.next(m));}catch(l){n(l);}},a=m=>{try{r(o.throw(m));}catch(l){n(l);}},r=m=>m.done?t(m.value):Promise.resolve(m.value).then(i,a);r((o=o.apply(s,e)).next());}),Do=function(s,e){this[0]=s,this[1]=e;},no=(s,e,o)=>{var t=(a,r,m,l)=>{try{var p=o[a](r),C=(r=p.value)instanceof Do,P=p.done;Promise.resolve(C?r[0]:r).then(T=>C?t(a==="return"?a:"next",r[1]?{done:T.done,value:T.value}:T,m,l):m({value:T,done:P})).catch(T=>t("throw",T,m,l));}catch(T){l(T);}},n=a=>i[a]=r=>new Promise((m,l)=>t(a,r,m,l)),i={};return o=o.apply(s,e),i[le("asyncIterator")]=()=>i,n("next"),n("throw"),n("return"),i},Fo=s=>{var e=s[le("asyncIterator")],o=!1,t,n={};return e==null?(e=s[le("iterator")](),t=i=>n[i]=a=>e[i](a)):(e=e.call(s),t=i=>n[i]=a=>{if(o){if(o=!1,i==="throw")throw a;return a}return o=!0,{done:!1,value:new Do(new Promise(r=>{var m=e[i](a);m instanceof Object||Dt("Object expected"),r(m);}),1)}}),n[le("iterator")]=()=>n,t("next"),"throw"in e?t("throw"):n.throw=i=>{throw i},"return"in e&&t("return"),n};var I=(s,e)=>provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:s,step:.01,default:e}),L=s=>provider.RangeConfigItem({param:"maxOutputTokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:s,step:1,default:0}),D=s=>provider.MultiStringConfigItem({param:"stopSequences",title:provider.CHAT_CONFIG.STOP(s).title,description:provider.CHAT_CONFIG.STOP(s).description,max:s}),F=s=>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:s}),Y=s=>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:s}),J=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}),W=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}),X=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),U=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"]}),$=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"])}))}),io=provider.SelectBooleanConfigItem({param:"reasoningEnabled",title:"Reasoning Enabled",description:"Controls whether the model is allowed to think for a longer period of time before generating a response. This can be useful for complex tasks that require more time to think.",default:!1});var Uo=(s,e,o,t,n)=>zod.z.object({temperature:I(s,e).schema,maxTokens:L(o).schema,stop:D(t).schema,topP:F(n).schema,toolChoice:U.schema,safetySettings:$.schema}),$o=(s,e,o,t,n)=>({temperature:I(s,e).def,maxTokens:L(o).def,stop:D(t).def,topP:F(n).def,toolChoice:U.def,safetySettings:$.def});var qo=(s,e,o,t,n,i)=>zod.z.object({temperature:I(s,e).schema,maxTokens:L(o).schema,stop:D(t).schema,topP:F(n).schema,topK:Y(i).schema,frequencyPenalty:J.schema,presencePenalty:W.schema,seed:X.schema.transform(a=>a===0?void 0:a),toolChoice:U.schema,safetySettings:$.schema}),zo=(s,e,o,t,n,i)=>({temperature:I(s,e).def,maxTokens:L(o).def,stop:D(t).def,topP:F(n).def,topK:Y(i).def,frequencyPenalty:J.def,presencePenalty:W.def,seed:X.def,toolChoice:U.def,safetySettings:$.def});var Bo=(s,e,o,t,n,i)=>zod.z.object({temperature:I(s,e).schema,maxTokens:L(o).schema,stop:D(t).schema,topP:F(n).schema,topK:Y(i).schema,frequencyPenalty:J.schema,presencePenalty:W.schema,seed:X.schema.transform(a=>a===0?void 0:a),toolChoice:U.schema,safetySettings:$.schema,reasoningEnabled:io.schema}),jo=(s,e,o,t,n,i)=>({temperature:I(s,e).def,maxTokens:L(o).def,stop:D(t).def,topP:F(n).def,topK:Y(i).def,frequencyPenalty:J.def,presencePenalty:W.def,seed:X.def,toolChoice:U.def,safetySettings:$.def,reasoningEnabled:io.def});var so=s=>provider.RangeConfigItem({param:"outputDimensionality",title:provider.EMBEDDING_CONFIG.DIMENSIONS.title,description:provider.EMBEDDING_CONFIG.DIMENSIONS.description,min:1,max:s,step:1,default:s});var Ho=s=>zod.z.object({dimensions:so(s).schema}),Vo=s=>({dimensions:so(s).def});var c={base:(s,e,o,t,n)=>({def:$o(s,e,o,t,n),schema:Uo(s,e,o,t,n)}),c1:(s,e,o,t,n,i)=>({def:zo(s,e,o,t,n,i),schema:qo(s,e,o,t,n,i)}),reasoning:(s,e,o,t,n,i)=>({def:jo(s,e,o,t,n,i),schema:Bo(s,e,o,t,n,i)})},Z={base:s=>({def:Vo(s),schema:Ho(s)})};var Vt="google",K=class{constructor(){this.version="v1";this.name=Vt;this.chatModelFactories={[Be]:{model:je,modelOptions:dt,modelSchema:Po},[qe]:{model:ze,modelOptions:mt,modelSchema:bo},[Ce]:{model:Te,modelOptions:Zo,modelSchema:po},[Me]:{model:Ge,modelOptions:Qo,modelSchema:co},[be]:{model:Pe,modelOptions:et,modelSchema:go},[_e]:{model:Ee,modelOptions:ot,modelSchema:ho},[Oe]:{model:Se,modelOptions:tt,modelSchema:fo},[xe]:{model:Re,modelOptions:nt,modelSchema:uo},[ke]:{model:we,modelOptions:it,modelSchema:yo},[ve]:{model:Ne,modelOptions:st,modelSchema:Co},[ue]:{model:ye,modelOptions:Xo,modelSchema:mo},[he]:{model:fe,modelOptions:Wo,modelSchema:lo},[ce]:{model:ge,modelOptions:Jo,modelSchema:ro},[de]:{model:pe,modelOptions:Yo,modelSchema:ao},[Ie]:{model:Le,modelOptions:at,modelSchema:To},[De]:{model:Fe,modelOptions:rt,modelSchema:Mo},[Ue]:{model:$e,modelOptions:lt,modelSchema:Go}};this.embeddingModelFactories={[_o]:{model:Ae,modelOptions:pt,modelSchema:Eo},[Oo]:{model:He,modelOptions:ct,modelSchema:So}};}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,n=this.chatModelFactories[o].modelOptions.parse(e);return new t(n)}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,n=this.embeddingModelFactories[o].modelOptions.parse(e);return new t(n)}};K.baseUrl="https://generativelanguage.googleapis.com/v1beta";var h={"base-gemini-1-chat-model":{modelName:"base-gemini-1-chat-model",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"gemini-1.0-pro-001":{modelName:"gemini-1.0-pro-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro-latest":{modelName:"gemini-1.0-pro-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro-vision":{modelName:"gemini-1.0-pro-vision",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro":{modelName:"gemini-1.0-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.5-flash-001":{modelName:"gemini-1.5-flash-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-flash-002":{modelName:"gemini-1.5-flash-002",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.0375,outputPricePerMillion:.15}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}}]},"gemini-1.5-flash-latest":{modelName:"gemini-1.5-flash-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-flash":{modelName:"gemini-1.5-flash",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-pro-001":{modelName:"gemini-1.5-pro-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro-002":{modelName:"gemini-1.5-pro-002",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro-latest":{modelName:"gemini-1.5-pro-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro":{modelName:"gemini-1.5-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-2.0-flash-exp":{modelName:"gemini-2.0-flash-exp",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.1,outputPricePerMillion:.4}}}]},"gemini-2.5-flash-preview-04-17":{modelName:"gemini-2.5-flash-preview-04-17",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-2.5-pro-preview-03-25":{modelName:"gemini-2.5-pro-preview-03-25",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:2e5,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}},{minTokens:200001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:15}}}]},"gemini-pro-vision":{modelName:"gemini-pro-vision",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-pro":{modelName:"gemini-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]}};var u=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),Jt="model",Wt="function",y={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:Jt,tool:Wt};var G=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],b=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),Bi=[types.TextModalityLiteral],ji=zod.z.enum([types.TextModalityLiteral]),We=[types.TextModalityLiteral,types.ImageModalityLiteral],Xe=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),B=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],j=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var Xt=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())})}),ct=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([Xt,Zt]))}).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()}),en=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Ro=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,en]))}).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 yt=zod.z.object({text:zod.z.string().min(1)}),on=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),tn=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),nn=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),sn=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([yt,on,tn,nn]))}),gt=zod.z.object({parts:zod.z.array(yt)}),an=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),ht=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()})}),ft=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()}),ut=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"])}),Ct=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(sn),systemInstruction:gt.optional(),system_instruction:gt.optional(),generationConfig:ft.optional(),generation_config:ft.optional(),safetySettings:zod.z.array(ut).optional(),safety_settings:zod.z.array(ut).optional(),tools:zod.z.object({function_declarations:zod.z.array(an)}).optional(),toolConfig:ht.optional(),tool_config:ht.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()}),M=class{constructor(e,o){this.version="v1";var n;let t=f.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((n=t.baseUrl)!=null?n:K.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(n=>n.modality==="text"?n.value:"").join(" ").length,0)}transformModelRequest(e){let o=Ct.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=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 i=t.system_instruction||t.systemInstruction,a=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 l={};m&&(m.function_calling_config.mode==="ANY"&&m.function_calling_config.allowed_function_names&&m.function_calling_config.allowed_function_names.length===1?l.toolChoice=m.function_calling_config.allowed_function_names[0]:l.toolChoice=m.function_calling_config.mode.toLowerCase()),l.seed=a==null?void 0:a.seed,l.maxTokens=a==null?void 0:a.maxOutputTokens,l.temperature=a==null?void 0:a.temperature,l.topP=a==null?void 0:a.topP,l.presencePenalty=a==null?void 0:a.presencePenalty,l.frequencyPenalty=a==null?void 0:a.frequencyPenalty,l.stop=a==null?void 0:a.stopSequences,l.safetySettings=r;let g=types.Config().parse(provider.removeUndefinedEntries(l)),T=[];i&&i.parts.forEach(C=>{T.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:C.text}]});}),t.contents.forEach(C=>{let w=C.role;switch(w){case"user":{let v=C.parts.map(_=>"text"in _?{modality:types.TextModalityLiteral,value:_.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:_.inline_data.data,mediaType:_.inline_data.mime_type.split("/")[1]}});T.push({role:w,content:v});}break;case"model":{let v=C.parts.map((_,q)=>"text"in _?{modality:types.TextModalityLiteral,value:_.text}:{modality:types.ToolCallModalityLiteral,id:q.toString(),index:q,name:_.function_call.name,arguments:JSON.stringify(_.function_call.args)});T.push({role:types.AssistantRoleLiteral,content:v});}break;case"function":{let v=C.parts.map((_,q)=>({modality:types.ToolResponseModalityLiteral,id:q.toString(),index:q,name:_.function_response.name,data:JSON.stringify(_.function_response.response)}));T.push({role:types.ToolRoleLiteral,content:v});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${C.role}' is not supported for model : ${this.modelName}`)})}});let P=[];return t.tools&&t.tools.function_declarations.forEach(C=>{P.push({type:"function",definition:{schema:{name:C.name,description:C.description,parameters:C.parameters}}});}),{modelName:n,config:g,messages:T,tools:P.length>0?P:void 0}}transformConfig(e,o,t){let n=e.toolChoice;delete e.toolChoice;let i=this.modelSchema.config.schema.safeParse(e);if(!i.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:i.error});let a=i.data;Object.keys(a).forEach(g=>{if(!(g in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${g}',
|
|
10
|
-
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let r=Object.keys(a).reduce((
|
|
11
|
-
one of [${
|
|
9
|
+
[${this.embeddingModelLiterals().join(", ")}]`)});let t=this.embeddingModelFactories[o].model,n=this.embeddingModelFactories[o].modelOptions.parse(e);return new t(n)}};K.baseUrl="https://generativelanguage.googleapis.com/v1beta";var h={"base-gemini-1-chat-model":{modelName:"base-gemini-1-chat-model",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"gemini-1.0-pro-001":{modelName:"gemini-1.0-pro-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro-latest":{modelName:"gemini-1.0-pro-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro-vision":{modelName:"gemini-1.0-pro-vision",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.0-pro":{modelName:"gemini-1.0-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-1.5-flash-001":{modelName:"gemini-1.5-flash-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-flash-002":{modelName:"gemini-1.5-flash-002",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.0375,outputPricePerMillion:.15}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}}]},"gemini-1.5-flash-latest":{modelName:"gemini-1.5-flash-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-flash":{modelName:"gemini-1.5-flash",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-1.5-pro-001":{modelName:"gemini-1.5-pro-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro-002":{modelName:"gemini-1.5-pro-002",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro-latest":{modelName:"gemini-1.5-pro-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-1.5-pro":{modelName:"gemini-1.5-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:128e3,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}},{minTokens:128001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gemini-2.0-flash-exp":{modelName:"gemini-2.0-flash-exp",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.1,outputPricePerMillion:.4}}}]},"gemini-2.5-flash-preview-04-17":{modelName:"gemini-2.5-flash-preview-04-17",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"gemini-2.5-pro-preview-03-25":{modelName:"gemini-2.5-pro-preview-03-25",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:2e5,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}},{minTokens:200001,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:15}}}]},"gemini-pro-vision":{modelName:"gemini-pro-vision",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gemini-pro":{modelName:"gemini-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]}};var u=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),Zt="model",Qt="function",y={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:Zt,tool:Qt};var G=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],b=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),Hi=[types.TextModalityLiteral],Vi=zod.z.enum([types.TextModalityLiteral]),We=[types.TextModalityLiteral,types.ImageModalityLiteral],Xe=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),B=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],j=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var en=zod.z.object({text:zod.z.string()}),on=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),gt=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([en,on]))}).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()}),tn=zod.z.object({text:zod.z.string()}),nn=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Ro=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([tn,nn]))}).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 Ct=zod.z.object({text:zod.z.string().min(1)}),sn=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),an=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),rn=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),ln=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([Ct,sn,an,rn]))}),ht=zod.z.object({parts:zod.z.array(Ct)}),mn=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),ft=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()})}),ut=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()}),yt=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"])}),Tt=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(ln),systemInstruction:ht.optional(),system_instruction:ht.optional(),generationConfig:ut.optional(),generation_config:ut.optional(),safetySettings:zod.z.array(yt).optional(),safety_settings:zod.z.array(yt).optional(),tools:zod.z.object({function_declarations:zod.z.array(mn)}).optional(),toolConfig:ft.optional(),tool_config:ft.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()}),M=class{constructor(e,o){this.version="v1";var n;let t=f.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((n=t.baseUrl)!=null?n:K.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(n=>n.modality==="text"?n.value:"").join(" ").length,0)}transformModelRequest(e){let o=Tt.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=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 i=t.system_instruction||t.systemInstruction,a=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 l={};m&&(m.function_calling_config.mode==="ANY"&&m.function_calling_config.allowed_function_names&&m.function_calling_config.allowed_function_names.length===1?l.toolChoice=m.function_calling_config.allowed_function_names[0]:l.toolChoice=m.function_calling_config.mode.toLowerCase()),l.seed=a==null?void 0:a.seed,l.maxTokens=a==null?void 0:a.maxOutputTokens,l.temperature=a==null?void 0:a.temperature,l.topP=a==null?void 0:a.topP,l.presencePenalty=a==null?void 0:a.presencePenalty,l.frequencyPenalty=a==null?void 0:a.frequencyPenalty,l.stop=a==null?void 0:a.stopSequences,l.safetySettings=r;let p=types.Config().parse(provider.removeUndefinedEntries(l)),C=[];i&&i.parts.forEach(T=>{C.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:T.text}]});}),t.contents.forEach(T=>{let k=T.role;switch(k){case"user":{let v=T.parts.map(_=>"text"in _?{modality:types.TextModalityLiteral,value:_.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:_.inline_data.data,mediaType:_.inline_data.mime_type.split("/")[1]}});C.push({role:k,content:v});}break;case"model":{let v=T.parts.map((_,q)=>"text"in _?{modality:types.TextModalityLiteral,value:_.text}:{modality:types.ToolCallModalityLiteral,id:q.toString(),index:q,name:_.function_call.name,arguments:JSON.stringify(_.function_call.args)});C.push({role:types.AssistantRoleLiteral,content:v});}break;case"function":{let v=T.parts.map((_,q)=>({modality:types.ToolResponseModalityLiteral,id:q.toString(),index:q,name:_.function_response.name,data:JSON.stringify(_.function_response.response)}));C.push({role:types.ToolRoleLiteral,content:v});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${T.role}' is not supported for model : ${this.modelName}`)})}});let P=[];return t.tools&&t.tools.function_declarations.forEach(T=>{P.push({type:"function",definition:{schema:{name:T.name,description:T.description,parameters:T.parameters}}});}),{modelName:n,config:p,messages:C,tools:P.length>0?P:void 0}}transformConfig(e,o,t){let n=e.toolChoice;delete e.toolChoice;let i=this.modelSchema.config.schema.safeParse(e);if(!i.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:i.error});let a=i.data;Object.keys(a).forEach(p=>{if(!(p in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${p}',
|
|
10
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let r=Object.keys(a).reduce((p,C)=>{let P=this.modelSchema.config.def[C],T=P.param,k=a[C];return C==="reasoningEnabled"?p.thinkingConfig={includeThoughts:k}:C==="maxReasoningTokens"?p.thinkingConfig=p.thinkingConfig&&typeof p.thinkingConfig=="object"?Lo(E({},p.thinkingConfig),{thinkingBudget:k}):{thinkingBudget:k}:T==="maxOutputTokens"&&P.type==="range"&&k===0?p[T]=P.max:p[T]=k,p},{}),m=r.safetySettings;delete r.safetySettings;let l;if(n!==void 0){let p=n;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 C=this.modelSchema.config.def.toolChoice;if(C.choices.includes(p))p==="any"?l={function_calling_config:{mode:"ANY",allowed_function_names:t.map(P=>P.definition.schema.name)}}:l={function_calling_config:{mode:p.toUpperCase()}};else if(t.map(P=>P.definition.schema.name).includes(p))l={function_calling_config:{mode:"ANY",allowed_function_names:[p]}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${p}' is not part of provided 'tools' names or
|
|
11
|
+
one of [${C.choices.join(", ")}]`)})}}return E(E({generation_config:r},l?{tool_config:l}:{}),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
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 n={parts:[]},i=[];if(t.forEach(r=>{switch(r.role){case types.SystemRoleLiteral:r.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)n.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(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 : '${r.role}' cannot have content with modality : '${l.modality}'`)})}),i.push({role:this.modelSchema.roles[r.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];r.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ImageModalityLiteral){if(l.value.type==="base64"){let
|
|
14
|
-
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),i[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=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<i.length;r++)if(!a(i[r-1].role).includes(i[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 : '${i[r].role}' after message with role : '${i[r-1].role}'`)});if(i[i.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral]&&i[i.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:i},n.parts.length>0?{system_instruction:n}:{})}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(n=>{let i=types.Tool().safeParse(n);if(!i.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:i.error});return i.data}).map(n=>({name:n.definition.schema.name,description:n.definition.schema.description,parameters:n.definition.schema.parameters}))}]}}getCompleteChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return S(this,null,function*(){let n=this.transformConfig(e,o,t),i=this.transformMessages(o);if(i.messages&&i.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let a=t?this.transformTools(t):{};return new Promise(r=>{r(E(E(E(E({},this.getDefaultParams()),n),i),a));})})}transformCompleteChatResponse(e){let o=
|
|
15
|
-
`,l);if(g===-1){m=a.substring(l);break}else {let T=a.substring(l,g).trim();T&&r.push(T),l=g+1;}}for(let g of r){if(g==="data: [DONE]")return;if(g.startsWith("data: ")){let T=g.substring(6);try{let P=JSON.parse(T),C=Ro.safeParse(P);if(C.success){let w={partialMessages:[]},k=C.data;if(k.candidates.length>0){let v=k.candidates[0].content;v&&"parts"in v&&v.parts.length>0&&v.parts.forEach((_,q)=>{if("text"in _&&_.text!==void 0&&w.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,_.text)),"functionCall"in _&&_.functionCall!==void 0){let to=_.functionCall;w.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,q,`${to.name}_${q}`,to.name,JSON.stringify(to.args)));}});}k.usageMetadata&&k.usageMetadata.totalTokenCount&&k.usageMetadata.promptTokenCount&&k.usageMetadata.candidatesTokenCount&&(w.usage={promptTokens:k.usageMetadata.promptTokenCount,completionTokens:k.usageMetadata.candidatesTokenCount,totalTokens:k.usageMetadata.totalTokenCount}),yield {partialResponse:w,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:C.error})}catch(P){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${T}`,cause:P})}}}yield {partialResponse:{partialMessages:[]},buffer:m};})}getProxyCompleteChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{if(!t||Object.keys(t).length===0){n(this.streamChatUrl);return}let i=new URL(this.streamChatUrl);Object.entries(t).forEach(([a,r])=>{r!=null&&i.searchParams.set(a,r);}),n(i.toString());})})}getProxyCompleteChatHeaders(e,o,t){return S(this,null,function*(){if(!o)return {};let n=E({},o);return delete n.host,delete n["content-length"],n})}getProxyStreamChatHeaders(e,o,t){return S(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}getModelPricing(){if(!(this.modelName in h))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return h[this.modelName]}};var R=class extends M{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 de="gemini-1.0-pro-001",un="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",ao=provider.ChatModelSchema(u,j).parse({name:de,description:un,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:p.base(1,.9,2048,4,1).def,schema:p.base(1,.9,2048,4,1).schema},price:h[de]}),Ko=f,pe=class extends R{constructor(e){super(ao,e);}};var ce="gemini-1.0-pro-latest",Cn="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",ro=provider.ChatModelSchema(u,j).parse({name:ce,description:Cn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:p.base(1,.9,2048,4,1).def,schema:p.base(1,.9,2048,4,1).schema},price:h[ce]}),Yo=f,ge=class extends R{constructor(e){super(ro,e);}};var he="gemini-1.0-pro-vision",Mn="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",lo=provider.ChatModelSchema(u,Xe).parse({name:he,description:Mn,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:We,config:{def:p.c1(1,.4,4096,4,1,32).def,schema:p.c1(1,.4,4096,4,1,32).schema},price:h[he]}),Jo=f,fe=class extends R{constructor(e){super(lo,e);}};var ue="gemini-1.0-pro",bn="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",mo=provider.ChatModelSchema(u,j).parse({name:ue,description:bn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:p.base(1,.9,2048,4,1).def,schema:p.base(1,.9,2048,4,1).schema},price:h[ue]}),Wo=f,ye=class extends R{constructor(e){super(mo,e);}};var Ce="gemini-1.5-flash-001",_n="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",po=provider.ChatModelSchema(u,b).parse({name:Ce,description:_n,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[Ce]}),Xo=f,Te=class extends M{constructor(e){super(po,e);}};var Me="gemini-1.5-flash-002",On="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",co=provider.ChatModelSchema(u,b).parse({name:Me,description:On,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,40).def,schema:p.c1(2,1,8192,4,.95,40).schema},price:h[Me]}),Zo=f,Ge=class extends M{constructor(e){super(co,e);}};var be="gemini-1.5-flash-latest",xn="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",go=provider.ChatModelSchema(u,b).parse({name:be,description:xn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[be]}),Qo=f,Pe=class extends M{constructor(e){super(go,e);}};var _e="gemini-1.5-flash",kn="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",ho=provider.ChatModelSchema(u,b).parse({name:_e,description:kn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[_e]}),et=f,Ee=class extends M{constructor(e){super(ho,e);}};var Oe="gemini-1.5-pro-001",vn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",fo=provider.ChatModelSchema(u,b).parse({name:Oe,description:vn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[Oe]}),ot=f,Se=class extends M{constructor(e){super(fo,e);}};var xe="gemini-1.5-pro-002",In="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",uo=provider.ChatModelSchema(u,b).parse({name:xe,description:In,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,40).def,schema:p.c1(2,1,8192,4,.95,40).schema},price:h[xe]}),tt=f,Re=class extends M{constructor(e){super(uo,e);}};var ke="gemini-1.5-pro-latest",Dn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",yo=provider.ChatModelSchema(u,b).parse({name:ke,description:Dn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[ke]}),nt=f,we=class extends M{constructor(e){super(yo,e);}};var ve="gemini-1.5-pro",Un="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",Co=provider.ChatModelSchema(u,b).parse({name:ve,description:Un,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[ve]}),it=f,Ne=class extends M{constructor(e){super(Co,e);}};var Ie="gemini-2.0-flash-exp",qn="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",To=provider.ChatModelSchema(u,b).parse({name:Ie,description:qn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:p.c1(2,1,8192,4,.95,64).def,schema:p.c1(2,1,8192,4,.95,64).schema},price:h[Ie]}),st=f,Le=class extends M{constructor(e){super(To,e);}};var De="gemini-2.5-flash-preview-04-17",Bn="Google's best model in Gemini 2.5 family in terms of price-performance, offering well-rounded capabilities.",Mo=provider.ChatModelSchema(u,b).parse({name:De,description:Bn,maxInputTokens:1048576,maxOutputTokens:65536,roles:y,modalities:G,config:{def:p.reasoning(2,1,65536,4,.95,64).def,schema:p.reasoning(2,1,65536,4,.95,64).schema},price:h[De]}),at=f,Fe=class extends M{constructor(e){super(Mo,e);}};var Ue="gemini-2.5-pro-preview-03-25",An="Google's preview model in Gemini 2.5 family for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Go=provider.ChatModelSchema(u,b).parse({name:Ue,description:An,maxInputTokens:1048576,maxOutputTokens:65536,roles:y,modalities:G,config:{def:p.reasoning(2,1,65536,4,.95,64).def,schema:p.reasoning(2,1,65536,4,.95,64).schema},price:h[Ue]}),rt=f,$e=class extends M{constructor(e){super(Go,e);}};var qe="gemini-pro-vision",Vn="An image understanding model to handle a broad range of applications",bo=provider.ChatModelSchema(u,Xe).parse({name:qe,description:Vn,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:We,config:{def:p.c1(1,.4,4096,4,1,32).def,schema:p.c1(1,.4,4096,4,1,32).schema},price:h[qe]}),lt=f,ze=class extends R{constructor(e){super(bo,e);}};var Be="gemini-pro",Yn="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Po=provider.ChatModelSchema(u,j).parse({name:Be,description:Yn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:p.base(1,.9,2048,4,1).def,schema:p.base(1,.9,2048,4,1).schema},price:h[Be]}),mt=f,je=class extends R{constructor(e){super(Po,e);}};var eo=[types.EmbeddingTextModalityLiteral],oo=zod.z.enum([types.EmbeddingTextModalityLiteral]);var Ot=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var Wn=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)})}),St=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(Wn).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var re=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),oe=class{constructor(e,o){this.version="v1";let t=re.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||K.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=St.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=t.model,i={outputDimensionality:t.outputDimensionality},a=types.Config().parse(provider.removeUndefinedEntries(i)),r={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((m,l)=>(m.push(...l.content.parts.map(g=>g.text)),m),[])};return {modelName:n,config:a,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 n=t.data;return Object.keys(n).forEach(a=>{if(!this.modelSchema.config.def[a])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${a}',
|
|
16
|
-
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(n).reduce((a,r)=>{let l=this.modelSchema.config.def[r].param,
|
|
13
|
+
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let n={parts:[]},i=[];if(t.forEach(r=>{switch(r.role){case types.SystemRoleLiteral:r.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)n.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(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 : '${r.role}' cannot have content with modality : '${l.modality}'`)})}),i.push({role:this.modelSchema.roles[r.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];r.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ImageModalityLiteral){if(l.value.type==="base64"){let p=l.value.base64;p=o(p),m.push({inline_data:{mime_type:`image/${l.value.mediaType}`,data:p}});}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 : '${r.role}' cannot have content with modality : '${l.modality}'`)})}),i.push({role:this.modelSchema.roles[r.role],parts:m});}break;case types.ToolRoleLiteral:{let m=[];r.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 : '${r.role}' cannot have content with modality : '${l.modality}'`)})}),i.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(", ")}]`)})}}),i[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=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<i.length;r++)if(!a(i[r-1].role).includes(i[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 : '${i[r].role}' after message with role : '${i[r-1].role}'`)});if(i[i.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral]&&i[i.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:i},n.parts.length>0?{system_instruction:n}:{})}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(n=>{let i=types.Tool().safeParse(n);if(!i.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:i.error});return i.data}).map(n=>({name:n.definition.schema.name,description:n.definition.schema.description,parameters:n.definition.schema.parameters}))}]}}getCompleteChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return S(this,null,function*(){let n=this.transformConfig(e,o,t),i=this.transformMessages(o);if(i.messages&&i.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let a=t?this.transformTools(t):{};return new Promise(r=>{r(E(E(E(E({},this.getDefaultParams()),n),i),a));})})}transformCompleteChatResponse(e){let o=gt.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,n=[],i,a=t.candidates[0].content;if(a){let l=a.parts.map((p,C)=>{if("text"in p&&p.text!==void 0)return types.createTextContent(p.text);if("functionCall"in p&&p.functionCall!==void 0)return types.createToolCallContent(C,`${p.functionCall.name}_${C}`,p.functionCall.name,JSON.stringify(p.functionCall.args))});return n.push({role:types.AssistantRoleLiteral,content:l}),t.usageMetadata&&(i={promptTokens:t.usageMetadata.promptTokenCount,totalTokens:t.usageMetadata.totalTokenCount,completionTokens:t.usageMetadata.candidatesTokenCount||0}),{messages:n,usage:i,logProbs:void 0}}let r=t.candidates[0].safetyRatings;if(r&&r.length>0&&r.forEach(l=>{if(l.blocked)throw new provider.ModelResponseError({info:`Blocked content for category: ${l.category} with probability: ${l.probability}`,cause:new Error(`Blocked content for category: ${l.category} with probability: ${l.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 S(this,null,function*(){return new Promise(n=>{n(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return S(this,null,function*(){let n=this.transformConfig(e,o,t),i=this.transformMessages(o);if(i.messages&&i.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let a=t?this.transformTools(t):{};return new Promise(r=>{r(E(E(E(E({},this.getDefaultParams()),n),i),a));})})}transformStreamChatResponseChunk(e,o){return no(this,null,function*(){let t=(o+e).split(",\r").filter(n=>n.trim()!=="");for(let n of t){let i=n;if(i=i.replace(/\n/g,""),i.startsWith("[")||i.startsWith(",{"))i=i.slice(1);else if(i.endsWith("]")){if(i==="]")return;i=i.slice(0,-1);}let a;try{a=JSON.parse(i);}catch(m){if(m instanceof SyntaxError){o=i;continue}else throw m}o="";let r=Ro.safeParse(a);if(r.success){let m={partialMessages:[]},l=r.data;if(l.candidates.length>0){let p=l.candidates[0].content;p&&"parts"in p&&p.parts.length>0&&p.parts.forEach((C,P)=>{if("text"in C&&C.text!==void 0&&m.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,C.text)),"functionCall"in C&&C.functionCall!==void 0){let T=C.functionCall;m.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,P,`${T.name}_${P}`,T.name,JSON.stringify(T.args)));}});}l.usageMetadata&&(m.usage={promptTokens:l.usageMetadata.promptTokenCount,completionTokens:l.usageMetadata.candidatesTokenCount,totalTokens:l.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,n,i){return no(this,null,function*(){if((i==null?void 0:i.alt)!=="sse"){yield*Fo(this.transformStreamChatResponseChunk(e,o));return}let a=o+e,r=[],m="",l=0;for(;l<a.length;){let p=a.indexOf(`
|
|
15
|
+
`,l);if(p===-1){m=a.substring(l);break}else {let C=a.substring(l,p).trim();C&&r.push(C),l=p+1;}}for(let p of r){if(p==="data: [DONE]")return;if(p.startsWith("data: ")){let C=p.substring(6);try{let P=JSON.parse(C),T=Ro.safeParse(P);if(T.success){let k={partialMessages:[]},w=T.data;if(w.candidates.length>0){let v=w.candidates[0].content;v&&"parts"in v&&v.parts.length>0&&v.parts.forEach((_,q)=>{if("text"in _&&_.text!==void 0&&k.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,_.text)),"functionCall"in _&&_.functionCall!==void 0){let to=_.functionCall;k.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,q,`${to.name}_${q}`,to.name,JSON.stringify(to.args)));}});}w.usageMetadata&&w.usageMetadata.totalTokenCount&&w.usageMetadata.promptTokenCount&&w.usageMetadata.candidatesTokenCount&&(k.usage={promptTokens:w.usageMetadata.promptTokenCount,completionTokens:w.usageMetadata.candidatesTokenCount,totalTokens:w.usageMetadata.totalTokenCount}),yield {partialResponse:k,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:T.error})}catch(P){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${C}`,cause:P})}}}yield {partialResponse:{partialMessages:[]},buffer:m};})}getProxyCompleteChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{n(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return S(this,null,function*(){return new Promise(n=>{if(!t||Object.keys(t).length===0){n(this.streamChatUrl);return}let i=new URL(this.streamChatUrl);Object.entries(t).forEach(([a,r])=>{r!=null&&i.searchParams.set(a,r);}),n(i.toString());})})}getProxyCompleteChatHeaders(e,o,t){return S(this,null,function*(){if(!o)return {};let n=E({},o);return delete n.host,delete n["content-length"],n})}getProxyStreamChatHeaders(e,o,t){return S(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}getModelPricing(){if(!(this.modelName in h))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return h[this.modelName]}};var R=class extends M{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 de="gemini-1.0-pro-001",Tn="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",ao=provider.ChatModelSchema(u,j).parse({name:de,description:Tn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema},price:h[de]}),Yo=f,pe=class extends R{constructor(e){super(ao,e);}};var ce="gemini-1.0-pro-latest",Gn="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",ro=provider.ChatModelSchema(u,j).parse({name:ce,description:Gn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema},price:h[ce]}),Jo=f,ge=class extends R{constructor(e){super(ro,e);}};var he="gemini-1.0-pro-vision",Pn="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",lo=provider.ChatModelSchema(u,Xe).parse({name:he,description:Pn,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:We,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema},price:h[he]}),Wo=f,fe=class extends R{constructor(e){super(lo,e);}};var ue="gemini-1.0-pro",En="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",mo=provider.ChatModelSchema(u,j).parse({name:ue,description:En,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema},price:h[ue]}),Xo=f,ye=class extends R{constructor(e){super(mo,e);}};var Ce="gemini-1.5-flash-001",Sn="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",po=provider.ChatModelSchema(u,b).parse({name:Ce,description:Sn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[Ce]}),Zo=f,Te=class extends M{constructor(e){super(po,e);}};var Me="gemini-1.5-flash-002",Rn="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",co=provider.ChatModelSchema(u,b).parse({name:Me,description:Rn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema},price:h[Me]}),Qo=f,Ge=class extends M{constructor(e){super(co,e);}};var be="gemini-1.5-flash-latest",wn="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",go=provider.ChatModelSchema(u,b).parse({name:be,description:wn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[be]}),et=f,Pe=class extends M{constructor(e){super(go,e);}};var _e="gemini-1.5-flash",Nn="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",ho=provider.ChatModelSchema(u,b).parse({name:_e,description:Nn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[_e]}),ot=f,Ee=class extends M{constructor(e){super(ho,e);}};var Oe="gemini-1.5-pro-001",Ln="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",fo=provider.ChatModelSchema(u,b).parse({name:Oe,description:Ln,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[Oe]}),tt=f,Se=class extends M{constructor(e){super(fo,e);}};var xe="gemini-1.5-pro-002",Fn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",uo=provider.ChatModelSchema(u,b).parse({name:xe,description:Fn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema},price:h[xe]}),nt=f,Re=class extends M{constructor(e){super(uo,e);}};var ke="gemini-1.5-pro-latest",$n="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",yo=provider.ChatModelSchema(u,b).parse({name:ke,description:$n,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[ke]}),it=f,we=class extends M{constructor(e){super(yo,e);}};var ve="gemini-1.5-pro",zn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",Co=provider.ChatModelSchema(u,b).parse({name:ve,description:zn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[ve]}),st=f,Ne=class extends M{constructor(e){super(Co,e);}};var Ie="gemini-2.0-flash-exp",jn="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",To=provider.ChatModelSchema(u,b).parse({name:Ie,description:jn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:G,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema},price:h[Ie]}),at=f,Le=class extends M{constructor(e){super(To,e);}};var De="gemini-2.5-flash-preview-04-17",Hn="Google's best model in Gemini 2.5 family in terms of price-performance, offering well-rounded capabilities.",Mo=provider.ChatModelSchema(u,b).parse({name:De,description:Hn,maxInputTokens:1048576,maxOutputTokens:65536,roles:y,modalities:G,config:{def:c.reasoning(2,1,65536,4,.95,64).def,schema:c.reasoning(2,1,65536,4,.95,64).schema},price:h[De]}),rt=f,Fe=class extends M{constructor(e){super(Mo,e);}};var Ue="gemini-2.5-pro-preview-03-25",Kn="Google's preview model in Gemini 2.5 family for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Go=provider.ChatModelSchema(u,b).parse({name:Ue,description:Kn,maxInputTokens:1048576,maxOutputTokens:65536,roles:y,modalities:G,config:{def:c.reasoning(2,1,65536,4,.95,64).def,schema:c.reasoning(2,1,65536,4,.95,64).schema},price:h[Ue]}),lt=f,$e=class extends M{constructor(e){super(Go,e);}};var qe="gemini-pro-vision",Jn="An image understanding model to handle a broad range of applications",bo=provider.ChatModelSchema(u,Xe).parse({name:qe,description:Jn,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:We,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema},price:h[qe]}),mt=f,ze=class extends R{constructor(e){super(bo,e);}};var Be="gemini-pro",Xn="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Po=provider.ChatModelSchema(u,j).parse({name:Be,description:Xn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:B,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema},price:h[Be]}),dt=f,je=class extends R{constructor(e){super(Po,e);}};var eo=[types.EmbeddingTextModalityLiteral],oo=zod.z.enum([types.EmbeddingTextModalityLiteral]);var St=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var Qn=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)})}),xt=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(Qn).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var re=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),oe=class{constructor(e,o){this.version="v1";let t=re.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||K.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=xt.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=t.model,i={outputDimensionality:t.outputDimensionality},a=types.Config().parse(provider.removeUndefinedEntries(i)),r={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((m,l)=>(m.push(...l.content.parts.map(p=>p.text)),m),[])};return {modelName:n,config:a,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 n=t.data;return Object.keys(n).forEach(a=>{if(!this.modelSchema.config.def[a])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${a}',
|
|
16
|
+
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(n).reduce((a,r)=>{let l=this.modelSchema.config.def[r].param,p=n[r];return a[l]=p,a},{})}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(n=>({model:`models/${this.modelName}`,content:{parts:[{text:n}]}}))}}getGetEmbeddingsUrl(e,o){return S(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return S(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return S(this,null,function*(){return new Promise(t=>{let n=this.transformConfig(e),i=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")});n.outputDimensionality&&(i.requests.forEach(a=>{a.outputDimensionality=n.outputDimensionality;}),delete n.outputDimensionality),t(E(E(E({},this.getDefaultParams()),n),i));})})}transformGetEmbeddingsResponse(e){let o=St.safeParse(e);if(o.success){let n=o.data.embeddings.map((i,a)=>({index:a,embedding:i.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:n}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var _o="text-embedding-001",ri="text-embedding-001",Eo=provider.EmbeddingModelSchema(oo).parse({name:_o,description:ri,modalities:eo,maxInputTokens:2048,maxOutputTokens:768,config:{def:Z.base(768).def,schema:Z.base(768).schema}}),pt=re,Ae=class extends oe{constructor(e){super(Eo,e);}};var Oo="text-embedding-004",mi="text-embedding-004",So=provider.EmbeddingModelSchema(oo).parse({name:Oo,description:mi,modalities:eo,maxInputTokens:2048,maxOutputTokens:768,config:{def:Z.base(768).def,schema:Z.base(768).schema}}),ct=re,He=class extends oe{constructor(e){super(So,e);}};
|
|
17
17
|
|
|
18
18
|
exports.BaseChatModel = M;
|
|
19
19
|
exports.BaseChatModelGemini1 = R;
|
|
20
20
|
exports.BaseChatModelOptions = f;
|
|
21
21
|
exports.BaseEmbeddingModel = oe;
|
|
22
22
|
exports.BaseEmbeddingModelOptions = re;
|
|
23
|
-
exports.ChatModelBaseConfigDef =
|
|
24
|
-
exports.ChatModelBaseConfigSchema =
|
|
25
|
-
exports.ChatModelC1ConfigDef =
|
|
26
|
-
exports.ChatModelC1ConfigSchema =
|
|
27
|
-
exports.ChatModelReasoningConfigDef =
|
|
28
|
-
exports.ChatModelReasoningConfigSchema =
|
|
29
|
-
exports.EmbeddingModelBaseConfigDef =
|
|
30
|
-
exports.EmbeddingModelBaseConfigSchema =
|
|
23
|
+
exports.ChatModelBaseConfigDef = $o;
|
|
24
|
+
exports.ChatModelBaseConfigSchema = Uo;
|
|
25
|
+
exports.ChatModelC1ConfigDef = zo;
|
|
26
|
+
exports.ChatModelC1ConfigSchema = qo;
|
|
27
|
+
exports.ChatModelReasoningConfigDef = jo;
|
|
28
|
+
exports.ChatModelReasoningConfigSchema = Bo;
|
|
29
|
+
exports.EmbeddingModelBaseConfigDef = Vo;
|
|
30
|
+
exports.EmbeddingModelBaseConfigSchema = Ho;
|
|
31
31
|
exports.Gemini1_0Pro = ye;
|
|
32
32
|
exports.Gemini1_0ProLatest = ge;
|
|
33
33
|
exports.Gemini1_0ProLatestLiteral = ce;
|
|
34
|
-
exports.Gemini1_0ProLatestOptions =
|
|
34
|
+
exports.Gemini1_0ProLatestOptions = Jo;
|
|
35
35
|
exports.Gemini1_0ProLatestSchema = ro;
|
|
36
36
|
exports.Gemini1_0ProLiteral = ue;
|
|
37
|
-
exports.Gemini1_0ProOptions =
|
|
37
|
+
exports.Gemini1_0ProOptions = Xo;
|
|
38
38
|
exports.Gemini1_0ProSchema = mo;
|
|
39
39
|
exports.Gemini1_0ProVision = fe;
|
|
40
40
|
exports.Gemini1_0ProVisionLiteral = he;
|
|
41
|
-
exports.Gemini1_0ProVisionOptions =
|
|
41
|
+
exports.Gemini1_0ProVisionOptions = Wo;
|
|
42
42
|
exports.Gemini1_0ProVisionSchema = lo;
|
|
43
43
|
exports.Gemini1_0Pro_001 = pe;
|
|
44
44
|
exports.Gemini1_0Pro_001Literal = de;
|
|
45
|
-
exports.Gemini1_0Pro_001Options =
|
|
45
|
+
exports.Gemini1_0Pro_001Options = Yo;
|
|
46
46
|
exports.Gemini1_0Pro_001Schema = ao;
|
|
47
47
|
exports.Gemini1_5Flash = Ee;
|
|
48
48
|
exports.Gemini1_5Flash001 = Te;
|
|
49
49
|
exports.Gemini1_5Flash001Literal = Ce;
|
|
50
|
-
exports.Gemini1_5Flash001Options =
|
|
50
|
+
exports.Gemini1_5Flash001Options = Zo;
|
|
51
51
|
exports.Gemini1_5Flash001Schema = po;
|
|
52
52
|
exports.Gemini1_5Flash002 = Ge;
|
|
53
53
|
exports.Gemini1_5Flash002Literal = Me;
|
|
54
|
-
exports.Gemini1_5Flash002Options =
|
|
54
|
+
exports.Gemini1_5Flash002Options = Qo;
|
|
55
55
|
exports.Gemini1_5Flash002Schema = co;
|
|
56
56
|
exports.Gemini1_5FlashLatest = Pe;
|
|
57
57
|
exports.Gemini1_5FlashLatestLiteral = be;
|
|
58
|
-
exports.Gemini1_5FlashLatestOptions =
|
|
58
|
+
exports.Gemini1_5FlashLatestOptions = et;
|
|
59
59
|
exports.Gemini1_5FlashLatestSchema = go;
|
|
60
60
|
exports.Gemini1_5FlashLiteral = _e;
|
|
61
|
-
exports.Gemini1_5FlashOptions =
|
|
61
|
+
exports.Gemini1_5FlashOptions = ot;
|
|
62
62
|
exports.Gemini1_5FlashSchema = ho;
|
|
63
63
|
exports.Gemini1_5Pro = Ne;
|
|
64
64
|
exports.Gemini1_5Pro001 = Se;
|
|
65
65
|
exports.Gemini1_5Pro001Literal = Oe;
|
|
66
|
-
exports.Gemini1_5Pro001Options =
|
|
66
|
+
exports.Gemini1_5Pro001Options = tt;
|
|
67
67
|
exports.Gemini1_5Pro001Schema = fo;
|
|
68
68
|
exports.Gemini1_5Pro002 = Re;
|
|
69
69
|
exports.Gemini1_5Pro002Literal = xe;
|
|
70
|
-
exports.Gemini1_5Pro002Options =
|
|
70
|
+
exports.Gemini1_5Pro002Options = nt;
|
|
71
71
|
exports.Gemini1_5Pro002Schema = uo;
|
|
72
72
|
exports.Gemini1_5ProLatest = we;
|
|
73
73
|
exports.Gemini1_5ProLatestLiteral = ke;
|
|
74
|
-
exports.Gemini1_5ProLatestOptions =
|
|
74
|
+
exports.Gemini1_5ProLatestOptions = it;
|
|
75
75
|
exports.Gemini1_5ProLatestSchema = yo;
|
|
76
76
|
exports.Gemini1_5ProLiteral = ve;
|
|
77
|
-
exports.Gemini1_5ProOptions =
|
|
77
|
+
exports.Gemini1_5ProOptions = st;
|
|
78
78
|
exports.Gemini1_5ProSchema = Co;
|
|
79
79
|
exports.Gemini2_0FlashExp = Le;
|
|
80
80
|
exports.Gemini2_0FlashExpLiteral = Ie;
|
|
81
|
-
exports.Gemini2_0FlashExpOptions =
|
|
81
|
+
exports.Gemini2_0FlashExpOptions = at;
|
|
82
82
|
exports.Gemini2_0FlashExpSchema = To;
|
|
83
83
|
exports.Gemini2_5FlashPreview0417 = Fe;
|
|
84
84
|
exports.Gemini2_5FlashPreview0417Literal = De;
|
|
85
|
-
exports.Gemini2_5FlashPreview0417Options =
|
|
85
|
+
exports.Gemini2_5FlashPreview0417Options = rt;
|
|
86
86
|
exports.Gemini2_5FlashPreview0417Schema = Mo;
|
|
87
87
|
exports.Gemini2_5ProPreview0325 = $e;
|
|
88
88
|
exports.Gemini2_5ProPreview0325Literal = Ue;
|
|
89
|
-
exports.Gemini2_5ProPreview0325Options =
|
|
89
|
+
exports.Gemini2_5ProPreview0325Options = lt;
|
|
90
90
|
exports.Gemini2_5ProPreview0325Schema = Go;
|
|
91
91
|
exports.GeminiPro = je;
|
|
92
92
|
exports.GeminiProLiteral = Be;
|
|
93
|
-
exports.GeminiProOptions =
|
|
93
|
+
exports.GeminiProOptions = dt;
|
|
94
94
|
exports.GeminiProSchema = Po;
|
|
95
95
|
exports.GeminiProVision = ze;
|
|
96
96
|
exports.GeminiProVisionLiteral = qe;
|
|
97
|
-
exports.GeminiProVisionOptions =
|
|
97
|
+
exports.GeminiProVisionOptions = mt;
|
|
98
98
|
exports.GeminiProVisionSchema = bo;
|
|
99
99
|
exports.Google = K;
|
|
100
|
-
exports.GoogleChatAssistantRoleLiteral =
|
|
101
|
-
exports.GoogleChatContent =
|
|
102
|
-
exports.GoogleChatContentPartFunctionCall =
|
|
103
|
-
exports.GoogleChatContentPartFunctionResponse =
|
|
104
|
-
exports.GoogleChatContentPartInlineData =
|
|
105
|
-
exports.GoogleChatContentPartText =
|
|
106
|
-
exports.GoogleChatGenerationConfig =
|
|
107
|
-
exports.GoogleChatModelConfigs =
|
|
100
|
+
exports.GoogleChatAssistantRoleLiteral = Zt;
|
|
101
|
+
exports.GoogleChatContent = ln;
|
|
102
|
+
exports.GoogleChatContentPartFunctionCall = an;
|
|
103
|
+
exports.GoogleChatContentPartFunctionResponse = rn;
|
|
104
|
+
exports.GoogleChatContentPartInlineData = sn;
|
|
105
|
+
exports.GoogleChatContentPartText = Ct;
|
|
106
|
+
exports.GoogleChatGenerationConfig = ut;
|
|
107
|
+
exports.GoogleChatModelConfigs = c;
|
|
108
108
|
exports.GoogleChatModelModalities = G;
|
|
109
109
|
exports.GoogleChatModelModalitiesEnum = b;
|
|
110
110
|
exports.GoogleChatModelRoles = u;
|
|
111
111
|
exports.GoogleChatModelRolesMap = y;
|
|
112
|
-
exports.GoogleChatModelTextModalities =
|
|
113
|
-
exports.GoogleChatModelTextModalitiesEnum =
|
|
112
|
+
exports.GoogleChatModelTextModalities = Hi;
|
|
113
|
+
exports.GoogleChatModelTextModalitiesEnum = Vi;
|
|
114
114
|
exports.GoogleChatModelTextToolModalities = B;
|
|
115
115
|
exports.GoogleChatModelTextToolModalitiesEnum = j;
|
|
116
116
|
exports.GoogleChatModelTextVisionModalities = We;
|
|
117
117
|
exports.GoogleChatModelTextVisionModalitiesEnum = Xe;
|
|
118
|
-
exports.GoogleChatRequest =
|
|
119
|
-
exports.GoogleChatSafetySettings =
|
|
120
|
-
exports.GoogleChatSystemInstruction =
|
|
121
|
-
exports.GoogleChatTool =
|
|
122
|
-
exports.GoogleChatToolConfig =
|
|
123
|
-
exports.GoogleChatToolRoleLiteral =
|
|
124
|
-
exports.GoogleCompleteChatResponse =
|
|
125
|
-
exports.GoogleCompleteChatTextResponse =
|
|
126
|
-
exports.GoogleCompleteChatToolResponse =
|
|
118
|
+
exports.GoogleChatRequest = Tt;
|
|
119
|
+
exports.GoogleChatSafetySettings = yt;
|
|
120
|
+
exports.GoogleChatSystemInstruction = ht;
|
|
121
|
+
exports.GoogleChatTool = mn;
|
|
122
|
+
exports.GoogleChatToolConfig = ft;
|
|
123
|
+
exports.GoogleChatToolRoleLiteral = Qt;
|
|
124
|
+
exports.GoogleCompleteChatResponse = gt;
|
|
125
|
+
exports.GoogleCompleteChatTextResponse = en;
|
|
126
|
+
exports.GoogleCompleteChatToolResponse = on;
|
|
127
127
|
exports.GoogleEmbeddingModelConfigs = Z;
|
|
128
128
|
exports.GoogleEmbeddingModelModalities = eo;
|
|
129
129
|
exports.GoogleEmbeddingModelModalitiesEnum = oo;
|
|
130
|
-
exports.GoogleEmbeddingRequest =
|
|
131
|
-
exports.GoogleEmbeddingRequestInput =
|
|
132
|
-
exports.GoogleGetEmbeddingsResponse =
|
|
130
|
+
exports.GoogleEmbeddingRequest = xt;
|
|
131
|
+
exports.GoogleEmbeddingRequestInput = Qn;
|
|
132
|
+
exports.GoogleGetEmbeddingsResponse = St;
|
|
133
133
|
exports.GoogleStreamChatResponse = Ro;
|
|
134
|
-
exports.GoogleStreamChatTextResponse =
|
|
135
|
-
exports.GoogleStreamChatToolResponse =
|
|
136
|
-
exports.ProviderLiteral =
|
|
134
|
+
exports.GoogleStreamChatTextResponse = tn;
|
|
135
|
+
exports.GoogleStreamChatToolResponse = nn;
|
|
136
|
+
exports.ProviderLiteral = Vt;
|
|
137
137
|
exports.Text_Embedding_001 = Ae;
|
|
138
138
|
exports.Text_Embedding_001Literal = _o;
|
|
139
|
-
exports.Text_Embedding_001Options =
|
|
139
|
+
exports.Text_Embedding_001Options = pt;
|
|
140
140
|
exports.Text_Embedding_001Schema = Eo;
|
|
141
141
|
exports.Text_Embedding_004 = He;
|
|
142
142
|
exports.Text_Embedding_004Literal = Oo;
|
|
143
|
-
exports.Text_Embedding_004Options =
|
|
143
|
+
exports.Text_Embedding_004Options = ct;
|
|
144
144
|
exports.Text_Embedding_004Schema = So;
|
|
145
145
|
exports.dimensions = so;
|
|
146
146
|
exports.frequencyPenalty = J;
|