"use strict";(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[49],{7384:function(e,t,a){a.r(t),a.d(t,{VERSION:function(){return p},createTogetherAI:function(){return d},togetherai:function(){return c}});var o=a(7374),n=a(7256),s=a(7259),r=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v2",this.maxImagesPerCall=1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:a,seed:o,providerOptions:s,headers:r,abortSignal:p}){var d,c,h,g;const u=[];null!=a&&u.push({type:"unsupported-setting",setting:"aspectRatio",details:"This model does not support the `aspectRatio` option. Use `size` instead."});const m=null!=(h=null==(c=null==(d=this.config._internal)?void 0:d.currentDate)?void 0:c.call(d))?h:new Date,b=null==a?void 0:a.split("x"),{value:f,responseHeaders:v}=await(0,n.postJsonToApi)({url:`${this.config.baseURL}/images/generations`,headers:(0,n.combineHeaders)(this.config.headers(),r),body:{model:this.modelId,prompt:e,seed:o,n:t,...b&&{width:parseInt(b[0]),height:parseInt(b[1])},response_format:"base64",...null!=(g=s.togetherai)?g:{}},failedResponseHandler:(0,n.createJsonErrorResponseHandler)({errorSchema:l,errorToMessage:e=>e.error.message}),successfulResponseHandler:(0,n.createJsonResponseHandler)(i),abortSignal:p,fetch:this.config.fetch});return{images:f.data.map(e=>e.b64_json),warnings:u,response:{timestamp:m,modelId:this.modelId,headers:v}}}},i=s.z.object({data:s.z.array(s.z.object({b64_json:s.z.string()}))}),l=s.z.object({error:s.z.object({message:s.z.string()})}),p="1.0.23";function d(e={}){var t;const a=(0,n.withoutTrailingSlash)(null!=(t=e.baseURL)?t:"https://api.together.xyz/v1/"),s=()=>(0,n.withUserAgentSuffix)({Authorization:`Bearer ${(0,n.loadApiKey)({apiKey:e.apiKey,environmentVariableName:"TOGETHER_AI_API_KEY",description:"TogetherAI"})}`,...e.headers},`ai-sdk/togetherai/${p}`),i=t=>({provider:`togetherai.${t}`,url:({path:e})=>`${a}${e}`,headers:s,fetch:e.fetch}),l=e=>new o.OpenAICompatibleChatLanguageModel(e,i("chat")),d=e=>new r(e,{...i("image"),baseURL:null!=a?a:"https://api.together.xyz/v1/"}),c=e=>l(e);return c.completionModel=e=>new o.OpenAICompatibleCompletionLanguageModel(e,i("completion")),c.languageModel=l,c.chatModel=l,c.textEmbeddingModel=e=>new o.OpenAICompatibleEmbeddingModel(e,i("embedding")),c.image=d,c.imageModel=d,c}var c=d()}}]);