"use strict";(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[42],{7518:function(e,r,o){o.r(r),o.d(r,{FireworksImageModel:function(){return l},VERSION:function(){return p},createFireworks:function(){return c},fireworks:function(){return m}});var t=o(7396),s=o(7514),i=o(7399),a={"accounts/fireworks/models/flux-1-dev-fp8":{urlFormat:"workflows"},"accounts/fireworks/models/flux-1-schnell-fp8":{urlFormat:"workflows"},"accounts/fireworks/models/playground-v2-5-1024px-aesthetic":{urlFormat:"image_generation",supportsSize:!0},"accounts/fireworks/models/japanese-stable-diffusion-xl":{urlFormat:"image_generation",supportsSize:!0},"accounts/fireworks/models/playground-v2-1024px-aesthetic":{urlFormat:"image_generation",supportsSize:!0},"accounts/fireworks/models/stable-diffusion-xl-1024-v1-0":{urlFormat:"image_generation",supportsSize:!0},"accounts/fireworks/models/SSD-1B":{urlFormat:"image_generation",supportsSize:!0}};function n(e,r){var o;return"image_generation"===(null==(o=a[r])?void 0:o.urlFormat)?`${e}/image_generation/${r}`:`${e}/workflows/${r}/text_to_image`}var l=class{constructor(e,r){this.modelId=e,this.config=r,this.specificationVersion="v2",this.maxImagesPerCall=1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:r,size:o,aspectRatio:s,seed:i,providerOptions:l,headers:p,abortSignal:u}){var d,c,m,g;const h=[],f=a[this.modelId];(null==f?void 0:f.supportsSize)||null==o||h.push({type:"unsupported-setting",setting:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."}),(null==f?void 0:f.supportsSize)&&null!=s&&h.push({type:"unsupported-setting",setting:"aspectRatio",details:"This model does not support the `aspectRatio` option."});const w=null==o?void 0:o.split("x"),k=null!=(m=null==(c=null==(d=this.config._internal)?void 0:d.currentDate)?void 0:c.call(d))?m:new Date,{value:v,responseHeaders:S}=await(0,t.postJsonToApi)({url:n(this.config.baseURL,this.modelId),headers:(0,t.combineHeaders)(this.config.headers(),p),body:{prompt:e,aspect_ratio:s,seed:i,samples:r,...w&&{width:w[0],height:w[1]},...null!=(g=l.fireworks)?g:{}},failedResponseHandler:(0,t.createStatusCodeErrorResponseHandler)(),successfulResponseHandler:(0,t.createBinaryResponseHandler)(),abortSignal:u,fetch:this.config.fetch});return{images:[v],warnings:h,response:{timestamp:k,modelId:this.modelId,headers:S}}}},p="1.0.23",u={errorSchema:i.z.object({error:i.z.string()}),errorToMessage:e=>e.error},d="https://api.fireworks.ai/inference/v1";function c(e={}){var r;const o=(0,t.withoutTrailingSlash)(null!=(r=e.baseURL)?r:d),i=()=>(0,t.withUserAgentSuffix)({Authorization:`Bearer ${(0,t.loadApiKey)({apiKey:e.apiKey,environmentVariableName:"FIREWORKS_API_KEY",description:"Fireworks API key"})}`,...e.headers},`ai-sdk/fireworks/${p}`),a=r=>({provider:`fireworks.${r}`,url:({path:e})=>`${o}${e}`,headers:i,fetch:e.fetch}),n=e=>new s.OpenAICompatibleChatLanguageModel(e,{...a("chat"),errorStructure:u}),c=e=>new l(e,{...a("image"),baseURL:null!=o?o:d}),m=e=>n(e);return m.completionModel=e=>new s.OpenAICompatibleCompletionLanguageModel(e,{...a("completion"),errorStructure:u}),m.chatModel=n,m.languageModel=n,m.textEmbeddingModel=e=>new s.OpenAICompatibleEmbeddingModel(e,{...a("embedding"),errorStructure:u}),m.image=c,m.imageModel=c,m}var m=c()}}]);