@adaline/google 1.14.3 → 1.15.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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var Kt=Object.defineProperty,Yt=Object.defineProperties;var Vt=Object.getOwnProp
|
|
|
12
12
|
available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),t.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
13
|
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),t.forEach(n=>{n.content=n.content.filter(r=>r.modality!=="error"&&r.modality!=="search-result");});let s={parts:[]},p=[];if(t.forEach(n=>{switch(n.role){case types.SystemRoleLiteral:n.content.forEach(r=>{if(r.modality===types.TextModalityLiteral)s.parts.push({text:r.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 : '${r.modality}'`)})});break;case types.AssistantRoleLiteral:{let r=[];n.content.forEach(i=>{if(i.modality===types.TextModalityLiteral)r.push({text:i.value});else if(i.modality===types.ToolCallModalityLiteral)r.push({function_call:{name:i.name,args:JSON.parse(i.arguments)}});else if(i.modality===types.ReasoningModalityLiteral)i.value.type==="thinking"&&i.value.thinking&&r.push({text:i.value.thinking,thought:!0,thought_signature:i.value.signature});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 : '${i.modality}'`)})}),p.push({role:this.modelSchema.roles[n.role],parts:r});}break;case types.UserRoleLiteral:{let r=[];n.content.forEach(i=>{if(i.modality===types.TextModalityLiteral)r.push({text:i.value});else if(i.modality===types.ImageModalityLiteral){if(i.value.type==="base64"){let c=i.value.base64;c=o(c),r.push({inline_data:{mime_type:`image/${i.value.mediaType}`,data:c}});}else if(i.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: '${i.value.type}'`)})}else if(i.modality===types.PdfModalityLiteral)if(i.value.type==="base64"){let c=i.value.base64;c=o(c),r.push({inline_data:{mime_type:"application/pdf",data:c}});}else i.value.type==="url"&&r.push({file_data:{mime_type:"application/pdf",file_uri:i.value.url}});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 : '${i.modality}'`)})}),p.push({role:this.modelSchema.roles[n.role],parts:r});}break;case types.ToolRoleLiteral:{let r=[];n.content.forEach(i=>{if(i.modality===types.ToolResponseModalityLiteral)r.push({function_response:{name:i.name,response:JSON.parse(i.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 : '${i.modality}'`)})}),p.push({role:this.modelSchema.roles[n.role],parts:r});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' is not supported,
|
|
14
14
|
available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),p[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 m=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<p.length;n++)if(!m(p[n-1].role).includes(p[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 : '${p[n].role}' after message with role : '${p[n-1].role}'`)});if(p[p.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral]&&p[p.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:p},s.parts.length>0?{system_instruction:s}:{})}stripAdditionalProperties(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(t=>this.stripAdditionalProperties(t));let o={};for(let[t,s]of Object.entries(e))t!=="additionalProperties"&&(o[t]=this.stripAdditionalProperties(s));return o}transformTools(e,o){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}'`)});if((!e||e.length===0)&&!(o!=null&&o.googleSearchTool))return {tools:[]};let s=(e!=null?e:[]).map(p=>{let m=types.Tool().safeParse(p);if(!m.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:m.error});return m.data}).map(p=>({name:p.definition.schema.name,description:p.definition.schema.description,parameters:this.stripAdditionalProperties(p.definition.schema.parameters)}));return {tools:[E(E({},s.length>0?{function_declarations:s}:{}),o!=null&&o.googleSearchTool?{google_search:{}}:{})]}}getCompleteChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return R(this,null,function*(){let s=this.transformConfig(e,o,t),p=yield this.transformPdfMessages(o),m=this.transformMessages(p);if(m.messages&&m.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=this.transformTools(t||[],e);return E(E(E(E({},this.getDefaultParams()),s),m),n)})}transformCompleteChatResponse(e){var t,s,p,m,n,r;let o=Ct.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 i={messages:[],usage:void 0,logProbs:void 0},c=o.data;c.usageMetadata&&(i.usage={promptTokens:c.usageMetadata.promptTokenCount,totalTokens:c.usageMetadata.totalTokenCount,completionTokens:c.usageMetadata.candidatesTokenCount||0});let h=c.candidates[0];if(h.content){let d=h.content.parts.map((f,y)=>{if("text"in f&&f.text!==void 0)return f.thought===!0?types.createReasoningContent(f.text,""):types.createTextContent(f.text);if("functionCall"in f&&f.functionCall!==void 0)return types.createToolCallContent(y,`${f.functionCall.name}_${y}`,f.functionCall.name,JSON.stringify(f.functionCall.args))});i.messages.push({role:types.AssistantRoleLiteral,content:d});}h.groundingMetadata&&(i.messages.length===0?i.messages.push({role:types.AssistantRoleLiteral,content:[types.createSearchResultGoogleContent(((t=h.groundingMetadata.webSearchQueries)==null?void 0:t[0])||"",((s=h.groundingMetadata.groundingChunks)==null?void 0:s.map(d=>{var f,y;return {source:d.web?"web":"",url:((f=d.web)==null?void 0:f.uri)||"",title:((y=d.web)==null?void 0:y.title)||""}}))||[],((p=h.groundingMetadata.groundingSupports)==null?void 0:p.map(d=>{var f,y,w;return {text:((f=d.segment)==null?void 0:f.text)||"",responseIndices:d.groundingChunkIndices||[],startIndex:((y=d.segment)==null?void 0:y.startIndex)||void 0,endIndex:((w=d.segment)==null?void 0:w.endIndex)||void 0,confidenceScores:d.confidenceScores||void 0}}))||[])]}):i.messages[0].content.push(types.createSearchResultGoogleContent(((m=h.groundingMetadata.webSearchQueries)==null?void 0:m[0])||"",((n=h.groundingMetadata.groundingChunks)==null?void 0:n.map(d=>{var f,y;return {source:d.web?"web":"",url:((f=d.web)==null?void 0:f.uri)||"",title:((y=d.web)==null?void 0:y.title)||""}}))||[],((r=h.groundingMetadata.groundingSupports)==null?void 0:r.map(d=>{var f,y,w;return {text:((f=d.segment)==null?void 0:f.text)||"",responseIndices:d.groundingChunkIndices||[],startIndex:((y=d.segment)==null?void 0:y.startIndex)||void 0,endIndex:((w=d.segment)==null?void 0:w.endIndex)||void 0,confidenceScores:d.confidenceScores||void 0}}))||[])));let T=h.safetyRatings;if(T&&T.length>0&&T.forEach(d=>{d.blocked&&(i.messages.length===0?i.messages.push({role:types.AssistantRoleLiteral,content:[types.createSafetyErrorContent(d.category,d.probability,d.blocked,`Blocked content for category: ${d.category} with probability: ${d.probability}`)]}):i.messages[0].content.push(types.createSafetyErrorContent(d.category,d.probability,d.blocked,`Blocked content for category: ${d.category} with probability: ${d.probability}`)));}),i.messages.length>0)return i;if(i.messages.length===0&&h.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 R(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return R(this,null,function*(){let s=this.transformConfig(e,o,t),p=yield this.transformPdfMessages(o),m=this.transformMessages(p);if(m.messages&&m.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=this.transformTools(t||[],e);return E(E(E(E({},this.getDefaultParams()),s),m),n)})}transformStreamChatResponseChunk(e,o){return We(this,null,function*(){var s,p,m;let t=(o+e).split(",\r").filter(n=>n.trim()!=="");for(let n of t){let r=n;if(r=r.replace(/\n/g,""),r.startsWith("[")||r.startsWith(",{"))r=r.slice(1);else if(r.endsWith("]")){if(r==="]")return;r=r.slice(0,-1);}let i;try{i=JSON.parse(r);}catch(h){if(h instanceof SyntaxError){o=r;continue}else throw h}o="";let c=ko.safeParse(i);if(c.success){let h={partialMessages:[]},T=c.data;if(T.candidates.length>0){let d=T.candidates[0].content;d&&"parts"in d&&d.parts.length>0&&d.parts.forEach((f,y)=>{if("text"in f&&f.text!==void 0&&(f.thought===!0?h.partialMessages.push(types.createPartialReasoningMessage(types.AssistantRoleLiteral,f.text,"")):h.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,f.text))),"functionCall"in f&&f.functionCall!==void 0){let w=f.functionCall;h.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,y,`${w.name}_${y}`,w.name,JSON.stringify(w.args)));}});}if(T.usageMetadata&&(h.usage={promptTokens:T.usageMetadata.promptTokenCount,completionTokens:T.usageMetadata.candidatesTokenCount,totalTokens:T.usageMetadata.totalTokenCount}),T.candidates.length>0){let d=T.candidates[0];d.groundingMetadata&&h.partialMessages.push(types.createPartialSearchResultGoogleMessage(types.AssistantRoleLiteral,((s=d.groundingMetadata.webSearchQueries)==null?void 0:s[0])||"",((p=d.groundingMetadata.groundingChunks)==null?void 0:p.map(y=>{var w,O;return {source:y.web?"web":"",url:((w=y.web)==null?void 0:w.uri)||"",title:((O=y.web)==null?void 0:O.title)||""}}))||[],((m=d.groundingMetadata.groundingSupports)==null?void 0:m.map(y=>{var w,O,k;return {text:((w=y.segment)==null?void 0:w.text)||"",responseIndices:y.groundingChunkIndices||[],startIndex:((O=y.segment)==null?void 0:O.startIndex)||void 0,endIndex:((k=y.segment)==null?void 0:k.endIndex)||void 0,confidenceScores:y.confidenceScores||void 0}}))||[]));let f=d.safetyRatings;f&&f.length>0&&f.forEach(y=>{y.blocked&&h.partialMessages.push(types.createPartialSafetyErrorMessage(types.AssistantRoleLiteral,y.category,y.probability,y.blocked,`Blocked content for category: ${y.category} with probability: ${y.probability}`));});}yield {partialResponse:h,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:c.error})}yield {partialResponse:{partialMessages:[]},buffer:o};})}transformProxyStreamChatResponseChunk(e,o,t,s,p){return We(this,null,function*(){var c,h,T;if((p==null?void 0:p.alt)!=="sse"){yield*Do(this.transformStreamChatResponseChunk(e,o));return}let m=o+e,n=[],r="",i=0;for(;i<m.length;){let d=m.indexOf(`
|
|
15
|
-
`,i);if(d===-1){r=m.substring(i);break}else {let f=m.substring(i,d).trim();f&&n.push(f),i=d+1;}}for(let d of n){if(d==="data: [DONE]")return;if(d.startsWith("data: ")){let f=d.substring(6);try{let y=JSON.parse(f),w=ko.safeParse(y);if(w.success){let O={partialMessages:[]},k=w.data;if(k.candidates.length>0){let N=k.candidates[0].content;N&&"parts"in N&&N.parts.length>0&&N.parts.forEach((L,x)=>{if("text"in L&&L.text!==void 0&&(L.thought===!0?O.partialMessages.push(types.createPartialReasoningMessage(types.AssistantRoleLiteral,L.text,"")):O.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,L.text))),"functionCall"in L&&L.functionCall!==void 0){let $=L.functionCall;O.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,x,`${$.name}_${x}`,$.name,JSON.stringify($.args)));}});}if(k.usageMetadata&&k.usageMetadata.totalTokenCount&&k.usageMetadata.promptTokenCount&&k.usageMetadata.candidatesTokenCount&&(O.usage={promptTokens:k.usageMetadata.promptTokenCount,completionTokens:k.usageMetadata.candidatesTokenCount,totalTokens:k.usageMetadata.totalTokenCount}),k.candidates.length>0){let N=k.candidates[0];N.groundingMetadata&&O.partialMessages.push(types.createPartialSearchResultGoogleMessage(types.AssistantRoleLiteral,((c=N.groundingMetadata.webSearchQueries)==null?void 0:c[0])||"",((h=N.groundingMetadata.groundingChunks)==null?void 0:h.map(x=>{var $,W;return {source:x.web?"web":"",url:(($=x.web)==null?void 0:$.uri)||"",title:((W=x.web)==null?void 0:W.title)||""}}))||[],((T=N.groundingMetadata.groundingSupports)==null?void 0:T.map(x=>{var $,W,Fo;return {text:(($=x.segment)==null?void 0:$.text)||"",responseIndices:x.groundingChunkIndices||[],startIndex:((W=x.segment)==null?void 0:W.startIndex)||void 0,endIndex:((Fo=x.segment)==null?void 0:Fo.endIndex)||void 0,confidenceScores:x.confidenceScores||void 0}}))||[]));let L=N.safetyRatings;L&&L.length>0&&L.forEach(x=>{x.blocked&&O.partialMessages.push(types.createPartialSafetyErrorMessage(types.AssistantRoleLiteral,x.category,x.probability,x.blocked,`Blocked content for category: ${x.category} with probability: ${x.probability}`));});}yield {partialResponse:O,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:w.error})}catch(y){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${f}`,cause:y})}}}yield {partialResponse:{partialMessages:[]},buffer:r};})}getProxyCompleteChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{if(!t||Object.keys(t).length===0){s(this.streamChatUrl);return}let p=new URL(this.streamChatUrl);Object.entries(t).forEach(([m,n])=>{n!=null&&p.searchParams.set(m,n);}),s(p.toString());})})}getProxyCompleteChatHeaders(e,o,t){return R(this,null,function*(){if(!o)return {};let s=E({},o);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,o,t){return R(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}getModelPricing(){if(!(this.modelName in C))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return C[this.modelName]}};var le="gemini-1.5-flash-001",Yn="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",ro=provider.ChatModelSchema(b,S).parse({name:le,description:Yn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[le]}),Wo=G,me=class extends M{constructor(e){super(ro,e);}};var de="gemini-1.5-flash-002",Wn="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",lo=provider.ChatModelSchema(b,S).parse({name:de,description:Wn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[de]}),Jo=G,pe=class extends M{constructor(e){super(lo,e);}};var ce="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",mo=provider.ChatModelSchema(b,S).parse({name:ce,description:Xn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[ce]}),Xo=G,ge=class extends M{constructor(e){super(mo,e);}};var he="gemini-1.5-flash",Zn="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(b,S).parse({name:he,description:Zn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[he]}),Qo=G,fe=class extends M{constructor(e){super(po,e);}};var ue="gemini-1.5-pro-001",oi="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(b,S).parse({name:ue,description:oi,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[ue]}),Zo=G,ye=class extends M{constructor(e){super(co,e);}};var Ce="gemini-1.5-pro-002",ni="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",go=provider.ChatModelSchema(b,S).parse({name:Ce,description:ni,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[Ce]}),et=G,Te=class extends M{constructor(e){super(go,e);}};var Me="gemini-1.5-pro-latest",si="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ho=provider.ChatModelSchema(b,S).parse({name:Me,description:si,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[Me]}),ot=G,Ge=class extends M{constructor(e){super(ho,e);}};var be="gemini-1.5-pro",ri="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(b,S).parse({name:be,description:ri,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[be]}),tt=G,Pe=class extends M{constructor(e){super(fo,e);}};var $t="gemini-2.0-flash-exp",mi="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",di=provider.ChatModelSchema(b,S).parse({name:$t,description:mi,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[$t]}),Tr=G,Bt=class extends M{constructor(e){super(di,e);}};var _e="gemini-2.0-flash",ci="Google's Gemini 2.0 Flash model optimized for low-latency, high-performance tasks. Supports multimodal inputs including text, images, video, and audio with enhanced speed and efficiency.",uo=provider.ChatModelSchema(b,S).parse({name:_e,description:ci,maxInputTokens:1048576,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[_e]}),nt=G,Se=class extends M{constructor(e){super(uo,e);}};var Ee="gemini-2.5-flash-lite",hi="Google's most cost-efficient and fastest model in the 2.5 series. Optimized for high-volume, latency-sensitive tasks like translation and classification with enhanced reasoning capabilities.",yo=provider.ChatModelSchema(b,S).parse({name:Ee,description:hi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.responseSchema(2,1,65536,4,.95).def,schema:u.responseSchema(2,1,65536,4,.95).schema},price:C[Ee]}),it=G,Oe=class extends M{constructor(e){super(yo,e);}};var we="gemini-2.5-flash-preview-04-17",ui="Google's best model in Gemini 2.5 family in terms of price-performance, offering well-rounded capabilities.",Co=provider.ChatModelSchema(b,S).parse({name:we,description:ui,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.responseSchema(2,1,65536,4,.95).def,schema:u.responseSchema(2,1,65536,4,.95).schema},price:C[we]}),st=G,ke=class extends M{constructor(e){super(Co,e);}};var Re="gemini-2.5-flash",Ci="Google's Gemini 2.5 Flash model for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",To=provider.ChatModelSchema(b,S).parse({name:Re,description:Ci,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.responseSchema(2,1,65536,4,.95).def,schema:u.responseSchema(2,1,65536,4,.95).schema},price:C[Re]}),at=G,xe=class extends M{constructor(e){super(To,e);}};var ve="gemini-2.5-pro-preview-03-25",Mi="Google's preview model in Gemini 2.5 family for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Mo=provider.ChatModelSchema(b,S).parse({name:ve,description:Mi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[ve]}),rt=G,Fe=class extends M{constructor(e){super(Mo,e);}};var Ie="gemini-2.5-pro",bi="Google's Gemini 2.5 Pro model for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Go=provider.ChatModelSchema(b,S).parse({name:Ie,description:bi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ie]}),lt=G,Le=class extends M{constructor(e){super(Go,e);}};var Ne="gemini-3-flash-preview",_i="Google's Gemini 3 Flash Preview model - a lightweight and efficient AI model with enhanced multimodal understanding, reasoning, and advanced coding capabilities. Optimized for speed and cost-effectiveness. Supports Text, Image, Video, Audio, and PDF inputs. Knowledge cutoff: January 2025.",bo=provider.ChatModelSchema(b,S).parse({name:Ne,description:_i,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ne]}),mt=G,De=class extends M{constructor(e){super(bo,e);}};var Ue="gemini-3-pro-preview",Ei="Google's latest Gemini 3 Pro Preview model with enhanced multimodal understanding, reasoning, and thinking capabilities. Supports Text, Image, Video, Audio, and PDF inputs. Knowledge cutoff: January 2025.",Po=provider.ChatModelSchema(b,S).parse({name:Ue,description:Ei,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ue]}),dt=G,$e=class extends M{constructor(e){super(Po,e);}};var Ye=[types.EmbeddingTextModalityLiteral],Ve=zod.z.enum([types.EmbeddingTextModalityLiteral]);var At=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var wi=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)})}),zt=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(wi).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var oe=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),V=class{constructor(e,o){this.version="v1";let t=oe.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||A.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=zt.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model,p={outputDimensionality:t.outputDimensionality},m=types.Config().parse(provider.removeUndefinedEntries(p)),n={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((r,i)=>(r.push(...i.content.parts.map(c=>c.text)),r),[])};return {modelName:s,config:m,embeddingRequests:n}}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(m=>{if(!this.modelSchema.config.def[m])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${m}',
|
|
15
|
+
`,i);if(d===-1){r=m.substring(i);break}else {let f=m.substring(i,d).trim();f&&n.push(f),i=d+1;}}for(let d of n){if(d==="data: [DONE]")return;if(d.startsWith("data: ")){let f=d.substring(6);try{let y=JSON.parse(f),w=ko.safeParse(y);if(w.success){let O={partialMessages:[]},k=w.data;if(k.candidates.length>0){let N=k.candidates[0].content;N&&"parts"in N&&N.parts.length>0&&N.parts.forEach((L,x)=>{if("text"in L&&L.text!==void 0&&(L.thought===!0?O.partialMessages.push(types.createPartialReasoningMessage(types.AssistantRoleLiteral,L.text,"")):O.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,L.text))),"functionCall"in L&&L.functionCall!==void 0){let $=L.functionCall;O.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,x,`${$.name}_${x}`,$.name,JSON.stringify($.args)));}});}if(k.usageMetadata&&k.usageMetadata.totalTokenCount&&k.usageMetadata.promptTokenCount&&k.usageMetadata.candidatesTokenCount&&(O.usage={promptTokens:k.usageMetadata.promptTokenCount,completionTokens:k.usageMetadata.candidatesTokenCount,totalTokens:k.usageMetadata.totalTokenCount}),k.candidates.length>0){let N=k.candidates[0];N.groundingMetadata&&O.partialMessages.push(types.createPartialSearchResultGoogleMessage(types.AssistantRoleLiteral,((c=N.groundingMetadata.webSearchQueries)==null?void 0:c[0])||"",((h=N.groundingMetadata.groundingChunks)==null?void 0:h.map(x=>{var $,W;return {source:x.web?"web":"",url:(($=x.web)==null?void 0:$.uri)||"",title:((W=x.web)==null?void 0:W.title)||""}}))||[],((T=N.groundingMetadata.groundingSupports)==null?void 0:T.map(x=>{var $,W,Fo;return {text:(($=x.segment)==null?void 0:$.text)||"",responseIndices:x.groundingChunkIndices||[],startIndex:((W=x.segment)==null?void 0:W.startIndex)||void 0,endIndex:((Fo=x.segment)==null?void 0:Fo.endIndex)||void 0,confidenceScores:x.confidenceScores||void 0}}))||[]));let L=N.safetyRatings;L&&L.length>0&&L.forEach(x=>{x.blocked&&O.partialMessages.push(types.createPartialSafetyErrorMessage(types.AssistantRoleLiteral,x.category,x.probability,x.blocked,`Blocked content for category: ${x.category} with probability: ${x.probability}`));});}yield {partialResponse:O,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:w.error})}catch(y){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${f}`,cause:y})}}}yield {partialResponse:{partialMessages:[]},buffer:r};})}getProxyCompleteChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyStreamChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{if(!t||Object.keys(t).length===0){s(this.streamChatUrl);return}let p=new URL(this.streamChatUrl);Object.entries(t).forEach(([m,n])=>{n!=null&&p.searchParams.set(m,n);}),s(p.toString());})})}getProxyCompleteChatHeaders(e,o,t){return R(this,null,function*(){if(!o)return {};let s=E({},o);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,o,t){return R(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,o,t)})}getModelPricing(){if(!(this.modelName in C))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return C[this.modelName]}};var le="gemini-1.5-flash-001",Yn="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",ro=provider.ChatModelSchema(b,S).parse({name:le,description:Yn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[le]}),Wo=G,me=class extends M{constructor(e){super(ro,e);}};var de="gemini-1.5-flash-002",Wn="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",lo=provider.ChatModelSchema(b,S).parse({name:de,description:Wn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[de]}),Jo=G,pe=class extends M{constructor(e){super(lo,e);}};var ce="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",mo=provider.ChatModelSchema(b,S).parse({name:ce,description:Xn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[ce]}),Xo=G,ge=class extends M{constructor(e){super(mo,e);}};var he="gemini-1.5-flash",Zn="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(b,S).parse({name:he,description:Zn,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[he]}),Qo=G,fe=class extends M{constructor(e){super(po,e);}};var ue="gemini-1.5-pro-001",oi="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(b,S).parse({name:ue,description:oi,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[ue]}),Zo=G,ye=class extends M{constructor(e){super(co,e);}};var Ce="gemini-1.5-pro-002",ni="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",go=provider.ChatModelSchema(b,S).parse({name:Ce,description:ni,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[Ce]}),et=G,Te=class extends M{constructor(e){super(go,e);}};var Me="gemini-1.5-pro-latest",si="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ho=provider.ChatModelSchema(b,S).parse({name:Me,description:si,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[Me]}),ot=G,Ge=class extends M{constructor(e){super(ho,e);}};var be="gemini-1.5-pro",ri="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(b,S).parse({name:be,description:ri,maxInputTokens:2e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[be]}),tt=G,Pe=class extends M{constructor(e){super(fo,e);}};var $t="gemini-2.0-flash-exp",mi="Google's experimental multimodal model with enhanced capabilities. Designed for cutting-edge performance across complex and high-frequency tasks.",di=provider.ChatModelSchema(b,S).parse({name:$t,description:mi,maxInputTokens:1e6,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[$t]}),Tr=G,Bt=class extends M{constructor(e){super(di,e);}};var _e="gemini-2.0-flash",ci="Google's Gemini 2.0 Flash model optimized for low-latency, high-performance tasks. Supports multimodal inputs including text, images, video, and audio with enhanced speed and efficiency.",uo=provider.ChatModelSchema(b,S).parse({name:_e,description:ci,maxInputTokens:1048576,maxOutputTokens:8192,roles:P,modalities:_,config:{def:u.responseSchema(2,1,8192,4,.95).def,schema:u.responseSchema(2,1,8192,4,.95).schema},price:C[_e]}),nt=G,Se=class extends M{constructor(e){super(uo,e);}};var Ee="gemini-2.5-flash-lite",hi="Google's most cost-efficient and fastest model in the 2.5 series. Optimized for high-volume, latency-sensitive tasks like translation and classification with enhanced reasoning capabilities.",yo=provider.ChatModelSchema(b,S).parse({name:Ee,description:hi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.responseSchema(2,1,65536,4,.95).def,schema:u.responseSchema(2,1,65536,4,.95).schema},price:C[Ee]}),it=G,Oe=class extends M{constructor(e){super(yo,e);}};var we="gemini-2.5-flash-preview-04-17",ui="Google's best model in Gemini 2.5 family in terms of price-performance, offering well-rounded capabilities.",Co=provider.ChatModelSchema(b,S).parse({name:we,description:ui,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,24576).def,schema:u.reasoning(2,1,65536,4,.95,1,24576).schema},price:C[we]}),st=G,ke=class extends M{constructor(e){super(Co,e);}};var Re="gemini-2.5-flash",Ci="Google's Gemini 2.5 Flash model for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",To=provider.ChatModelSchema(b,S).parse({name:Re,description:Ci,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,24576).def,schema:u.reasoning(2,1,65536,4,.95,1,24576).schema},price:C[Re]}),at=G,xe=class extends M{constructor(e){super(To,e);}};var ve="gemini-2.5-pro-preview-03-25",Mi="Google's preview model in Gemini 2.5 family for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Mo=provider.ChatModelSchema(b,S).parse({name:ve,description:Mi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[ve]}),rt=G,Fe=class extends M{constructor(e){super(Mo,e);}};var Ie="gemini-2.5-pro",bi="Google's Gemini 2.5 Pro model for enhanced thinking, reasoning, multimodal understanding, and advanced coding.",Go=provider.ChatModelSchema(b,S).parse({name:Ie,description:bi,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ie]}),lt=G,Le=class extends M{constructor(e){super(Go,e);}};var Ne="gemini-3-flash-preview",_i="Google's Gemini 3 Flash Preview model - a lightweight and efficient AI model with enhanced multimodal understanding, reasoning, and advanced coding capabilities. Optimized for speed and cost-effectiveness. Supports Text, Image, Video, Audio, and PDF inputs. Knowledge cutoff: January 2025.",bo=provider.ChatModelSchema(b,S).parse({name:Ne,description:_i,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ne]}),mt=G,De=class extends M{constructor(e){super(bo,e);}};var Ue="gemini-3-pro-preview",Ei="Google's latest Gemini 3 Pro Preview model with enhanced multimodal understanding, reasoning, and thinking capabilities. Supports Text, Image, Video, Audio, and PDF inputs. Knowledge cutoff: January 2025.",Po=provider.ChatModelSchema(b,S).parse({name:Ue,description:Ei,maxInputTokens:1048576,maxOutputTokens:65536,roles:P,modalities:_,config:{def:u.reasoning(2,1,65536,4,.95,1,65536).def,schema:u.reasoning(2,1,65536,4,.95,1,65536).schema},price:C[Ue]}),dt=G,$e=class extends M{constructor(e){super(Po,e);}};var Ye=[types.EmbeddingTextModalityLiteral],Ve=zod.z.enum([types.EmbeddingTextModalityLiteral]);var At=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var wi=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)})}),zt=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(wi).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var oe=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),V=class{constructor(e,o){this.version="v1";let t=oe.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl||A.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=zt.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model,p={outputDimensionality:t.outputDimensionality},m=types.Config().parse(provider.removeUndefinedEntries(p)),n={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((r,i)=>(r.push(...i.content.parts.map(c=>c.text)),r),[])};return {modelName:s,config:m,embeddingRequests:n}}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(m=>{if(!this.modelSchema.config.def[m])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${m}',
|
|
16
16
|
available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((m,n)=>{let i=this.modelSchema.config.def[n].param,c=s[n];return m[i]=c,m},{})}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 R(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return R(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return R(this,null,function*(){return new Promise(t=>{let s=this.transformConfig(e),p=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&&(p.requests.forEach(m=>{m.outputDimensionality=s.outputDimensionality;}),delete s.outputDimensionality),t(E(E(E({},this.getDefaultParams()),s),p));})})}transformGetEmbeddingsResponse(e){let o=At.safeParse(e);if(o.success){let s=o.data.embeddings.map((p,m)=>({index:m,embedding:p.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:s}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var _o="text-embedding-001",Ni="text-embedding-001",So=provider.EmbeddingModelSchema(Ve).parse({name:_o,description:Ni,modalities:Ye,maxInputTokens:2048,maxOutputTokens:768,config:{def:q.base(768).def,schema:q.base(768).schema}}),pt=oe,Be=class extends V{constructor(e){super(So,e);}};var Eo="text-embedding-004",Ui="text-embedding-004",Oo=provider.EmbeddingModelSchema(Ve).parse({name:Eo,description:Ui,modalities:Ye,maxInputTokens:2048,maxOutputTokens:768,config:{def:q.base(768).def,schema:q.base(768).schema}}),ct=oe,je=class extends V{constructor(e){super(Oo,e);}};
|
|
17
17
|
|
|
18
18
|
exports.BaseChatModel = M;
|