"use strict";(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[41],{7376:function(e,a,n){n.r(a),n.d(a,{VERSION:function(){return p},createDeepInfra:function(){return l},deepinfra:function(){return c}});var r=n(7374),i=n(7256),t=n(7259),o=class{constructor(e,a){this.modelId=e,this.config=a,this.specificationVersion="v2",this.maxImagesPerCall=1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:a,size:n,aspectRatio:r,seed:t,providerOptions:o,headers:p,abortSignal:l}){var c,h,m,u;const g=null==n?void 0:n.split("x"),f=null!=(m=null==(h=null==(c=this.config._internal)?void 0:c.currentDate)?void 0:h.call(c))?m:new Date,{value:b,responseHeaders:v}=await(0,i.postJsonToApi)({url:`${this.config.baseURL}/${this.modelId}`,headers:(0,i.combineHeaders)(this.config.headers(),p),body:{prompt:e,num_images:a,...r&&{aspect_ratio:r},...g&&{width:g[0],height:g[1]},...null!=t&&{seed:t},...null!=(u=o.deepinfra)?u:{}},failedResponseHandler:(0,i.createJsonErrorResponseHandler)({errorSchema:s,errorToMessage:e=>e.detail.error}),successfulResponseHandler:(0,i.createJsonResponseHandler)(d),abortSignal:l,fetch:this.config.fetch});return{images:b.images.map(e=>e.replace(/^data:image\/\w+;base64,/,"")),warnings:[],response:{timestamp:f,modelId:this.modelId,headers:v}}}},s=t.z.object({detail:t.z.object({error:t.z.string()})}),d=t.z.object({images:t.z.array(t.z.string())}),p="1.0.23";function l(e={}){var a;const n=(0,i.withoutTrailingSlash)(null!=(a=e.baseURL)?a:"https://api.deepinfra.com/v1"),t=()=>(0,i.withUserAgentSuffix)({Authorization:`Bearer ${(0,i.loadApiKey)({apiKey:e.apiKey,environmentVariableName:"DEEPINFRA_API_KEY",description:"DeepInfra's API key"})}`,...e.headers},`ai-sdk/deepinfra/${p}`),s=a=>({provider:`deepinfra.${a}`,url:({path:e})=>`${n}/openai${e}`,headers:t,fetch:e.fetch}),d=e=>new r.OpenAICompatibleChatLanguageModel(e,s("chat")),l=e=>new o(e,{...s("image"),baseURL:n?`${n}/inference`:"https://api.deepinfra.com/v1/inference"}),c=e=>d(e);return c.completionModel=e=>new r.OpenAICompatibleCompletionLanguageModel(e,s("completion")),c.chatModel=d,c.image=l,c.imageModel=l,c.languageModel=d,c.textEmbeddingModel=e=>new r.OpenAICompatibleEmbeddingModel(e,s("embedding")),c}var c=l()}}]);