opik 1.7.21 → 1.7.23

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.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),Xn=require('fs'),xp=require('ini'),Ec=require('qs'),uuid=require('uuid'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Xn__default=/*#__PURE__*/_interopDefault(Xn);var xp__default=/*#__PURE__*/_interopDefault(xp);var Ec__default=/*#__PURE__*/_interopDefault(Ec);var bp=Object.defineProperty;var lt=(s,t)=>()=>(s&&(t=s(s=0)),t);var v=(s,t)=>{for(var r in t)bp(s,r,{get:t[r],enumerable:true});};var zs={};v(zs,{Node18UniversalStreamWrapper:()=>yt});var yt,ks=lt(()=>{yt=class s{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(t,r){var o;(o=this.events[t])==null||o.push(r);}off(t,r){var o;this.events[t]=(o=this.events[t])==null?void 0:o.filter(i=>i!==r);}pipe(t){return this.on("data",async r=>{if(t instanceof s)t._write(r);else if(t instanceof WritableStream){let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}else t.write(r);}),this.on("end",async()=>{t instanceof s?t._end():t instanceof WritableStream?t.getWriter().close():t.end();}),this.on("error",async r=>{t instanceof s?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r);}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async r=>{if(t instanceof s)t._write(r);else if(t instanceof WritableStream){let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}else t.write(r);}),this.off("end",async()=>{t instanceof s?t._end():t instanceof WritableStream?t.getWriter().close():t.end();}),this.off("error",async r=>{t instanceof s?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r);});}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(!t)return r}setEncoding(t){this.encoding=t;}async text(){let t=[];for(;;){let{done:o,value:i}=await this.reader.read();if(o)break;i&&t.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t);}_end(){this._emit("end");}_error(t){this._emit("error",t);}_emit(t,r){if(this.events[t])for(let o of this.events[t]||[])o(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(t){this._emit("error",t);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();return t?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};});var Ss={};v(Ss,{UndiciStreamWrapper:()=>zt});var zt,xs=lt(()=>{zt=class s{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(t,r){var o;(o=this.events[t])==null||o.push(r);}off(t,r){var o;this.events[t]=(o=this.events[t])==null?void 0:o.filter(i=>i!==r);}pipe(t){return this.on("data",r=>{if(t instanceof s)t._write(r);else {let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}}),this.on("end",()=>{t instanceof s?t._end():t.getWriter().close();}),this.on("error",r=>{t instanceof s?t._error(r):t.getWriter().abort(r);}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",r=>{if(t instanceof s)t._write(r);else {let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}}),this.off("end",()=>{t instanceof s?t._end():t.getWriter().close();}),this.off("error",r=>{t instanceof s?t._error(r):t.getWriter().abort(r);});}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(!t)return r}setEncoding(t){this.encoding=t;}async text(){let t=[];for(;;){let{done:o,value:i}=await this.reader.read();if(o)break;i&&t.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t);}_end(){this._emit("end");}_error(t){this._emit("error",t);}_emit(t,r){if(this.events[t])for(let o of this.events[t]||[])o(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(t){this._emit("error",t);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();return t?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};});var _s={};v(_s,{NodePre18StreamWrapper:()=>kt});var kt,Ps=lt(()=>{kt=class{constructor(t){this.readableStream=t;}on(t,r){this.readableStream.on(t,r);}off(t,r){this.readableStream.off(t,r);}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe();}destroy(t){this.readableStream.destroy(t);}pause(){this.readableStream.pause();}resume(){this.readableStream.resume();}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((t,r)=>{let o=this.readableStream.read();o?t(o):(this.readableStream.once("readable",()=>{let i=this.readableStream.read();t(i);}),this.readableStream.once("error",r));})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t;}async text(){let t=[],r=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let i of this.readableStream)t.push(r.encode(i));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(t))}async json(){let t=await this.text();return JSON.parse(t)}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return {async next(){let{value:o,done:i}=await r.next();return {value:o,done:i}},[Symbol.asyncIterator](){return this}}}};});var kp={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Hn(s,t=s){return ansiEscapes.link(t,s)}var E=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Kn=s=>{E.settings.minLevel=kp[s];},Sp=()=>{E.settings.minLevel=100;};Kn(process.env.OPIK_LOG_LEVEL||"INFO");var _p="~/.opik.config",Pp={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function Gn(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function Ap(){return Gn({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function Tp(){let s=process.env.OPIK_CONFIG_PATH||_p;if(!Xn__default.default.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=xp__default.default.parse(Xn__default.default.readFileSync(s,"utf8"));return t.opik?Gn({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return E.error(`Error loading config file ${s}: ${t}`),{}}}function $n(s){let t=Ap(),r=Tp();return vp({...Pp,...r,...t,...s})}function vp(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=Ep(s.apiUrl);if(t&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(t&&(!s.workspaceName||s.workspaceName==="default"))throw new Error("OPIK_WORKSPACE is not set");return s}function Ep(s){return new URL(s).hostname.endsWith("comet.com")}var H={};v(H,{AssistantMessageRole:()=>Op,AttachmentListRequestEntityType:()=>Qn,BadRequestError:()=>j,CheckName:()=>xc,CheckPublicName:()=>Pc,CheckPublicResult:()=>Ac,CheckResult:()=>_c,ColumnCompareTypesItem:()=>Xp,ColumnPublicTypesItem:()=>Zp,ColumnTypesItem:()=>qp,CompleteMultipartUploadRequestEntityType:()=>Cp,ConflictError:()=>J,DatasetItemCompareSource:()=>Gp,DatasetItemPublicSource:()=>Yp,DatasetItemSource:()=>Jp,DatasetItemWriteSource:()=>Kp,DatasetPublicVisibility:()=>Qp,DatasetUpdateVisibility:()=>rs,DatasetVisibility:()=>Lp,DatasetWriteVisibility:()=>es,DeleteAttachmentsRequestEntityType:()=>jp,DeltaRole:()=>Wp,DownloadAttachmentRequestEntityType:()=>Yn,ExperimentPublicType:()=>rc,ExperimentType:()=>ec,ExperimentWriteType:()=>os,FeedbackScoreBatchItemSource:()=>kc,FeedbackScoreCompareSource:()=>$p,FeedbackScorePublicSource:()=>yc,FeedbackScoreSource:()=>Hp,FindFeedbackDefinitionsRequestType:()=>ts,FindFeedbackScoreNames1RequestType:()=>us,ForbiddenError:()=>O,GetSpanStatsRequestType:()=>ws,GetSpansByProjectRequestType:()=>ds,GuardrailName:()=>oc,GuardrailResult:()=>tc,GuardrailWriteName:()=>ic,GuardrailWriteResult:()=>ac,LlmAsJudgeMessagePublicRole:()=>Dp,LlmAsJudgeMessageRole:()=>Ip,LlmAsJudgeMessageWriteRole:()=>Np,LlmAsJudgeOutputSchemaPublicType:()=>Mp,LlmAsJudgeOutputSchemaType:()=>Up,LlmAsJudgeOutputSchemaWriteType:()=>Fp,LogItemLevel:()=>Bp,NotFoundError:()=>P,NotImplementedError:()=>ge,OptimizationPublicStatus:()=>cc,OptimizationStatus:()=>pc,OptimizationUpdateStatus:()=>ns,OptimizationWriteStatus:()=>as,ProjectDetailedVisibility:()=>wc,ProjectMetricRequestPublicInterval:()=>ls,ProjectMetricRequestPublicMetricType:()=>cs,ProjectMetricResponsePublicInterval:()=>uc,ProjectMetricResponsePublicMetricType:()=>dc,ProjectPublicVisibility:()=>mc,ProjectUpdateVisibility:()=>ps,ProjectVisibility:()=>lc,ProjectWriteVisibility:()=>ss,PromptType:()=>fc,PromptVersionDetailType:()=>hc,PromptVersionPublicType:()=>Rc,PromptVersionType:()=>gc,PromptWriteType:()=>ms,ProviderApiKeyProvider:()=>sc,ProviderApiKeyPublicProvider:()=>nc,ProviderApiKeyWriteProvider:()=>is,ResponseFormatType:()=>Vp,SpanFilterPublicOperator:()=>Sc,SpanPublicType:()=>zc,SpanSearchStreamRequestPublicType:()=>fs,SpanType:()=>gs,SpanWriteType:()=>bc,StartMultipartUploadRequestEntityType:()=>Zn,TraceFilterPublicOperator:()=>Tc,UnauthorizedError:()=>F,UnprocessableEntityError:()=>X,UploadAttachmentRequestEntityType:()=>qn,attachments:()=>Dr,automationRuleEvaluators:()=>ut,chatCompletions:()=>wt,check:()=>dt,datasets:()=>Mr,experiments:()=>Br,feedbackDefinitions:()=>Or,guardrails:()=>ft,llmProviderKey:()=>Wr,openTelemetryIngestion:()=>gt,optimizations:()=>Vr,projects:()=>Lr,prompts:()=>Jr,redirect:()=>bt,serviceToggles:()=>ht,spans:()=>Hr,systemUsage:()=>mt,traces:()=>Rt});var Dr={};v(Dr,{AttachmentListRequestEntityType:()=>Qn,DownloadAttachmentRequestEntityType:()=>Yn,StartMultipartUploadRequestEntityType:()=>Zn,UploadAttachmentRequestEntityType:()=>qn});var Qn={Trace:"trace",Span:"span"};var Yn={Trace:"trace",Span:"span"};var Zn={Trace:"trace",Span:"span"};var qn={Trace:"trace",Span:"span"};var Mr={};v(Mr,{DatasetUpdateVisibility:()=>rs,DatasetWriteVisibility:()=>es});var es={Private:"private",Public:"public"};var rs={Private:"private",Public:"public"};var Br={};v(Br,{ExperimentWriteType:()=>os});var os={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Or={};v(Or,{FindFeedbackDefinitionsRequestType:()=>ts});var ts={Numerical:"numerical",Categorical:"categorical"};var Wr={};v(Wr,{ProviderApiKeyWriteProvider:()=>is});var is={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var Vr={};v(Vr,{OptimizationUpdateStatus:()=>ns,OptimizationWriteStatus:()=>as});var as={Running:"running",Completed:"completed",Cancelled:"cancelled"};var ns={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Lr={};v(Lr,{ProjectMetricRequestPublicInterval:()=>ls,ProjectMetricRequestPublicMetricType:()=>cs,ProjectUpdateVisibility:()=>ps,ProjectWriteVisibility:()=>ss});var ss={Private:"private",Public:"public"};var ps={Private:"private",Public:"public"};var cs={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var ls={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Jr={};v(Jr,{PromptWriteType:()=>ms});var ms={Mustache:"mustache",Jinja2:"jinja2"};var Hr={};v(Hr,{FindFeedbackScoreNames1RequestType:()=>us,GetSpanStatsRequestType:()=>ws,GetSpansByProjectRequestType:()=>ds,SpanSearchStreamRequestPublicType:()=>fs});var ds={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var us={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ws={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var fs={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var mt={};var dt={};var ut={};var wt={};var ft={};var gt={};var ht={};var Rt={};var bt={};var Cp={Trace:"trace",Span:"span"};var jp={Trace:"trace",Span:"span"};var Ip={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Up={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Np={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Fp={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Dp={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Mp={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Bp={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Op={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Wp={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Vp={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Lp={Private:"private",Public:"public"};var Jp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Hp={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Kp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Xp={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Gp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var $p={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Qp={Private:"private",Public:"public"};var Yp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Zp={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var qp={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var ec={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var rc={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var oc={Topic:"TOPIC",Pii:"PII"};var tc={Passed:"passed",Failed:"failed"};var ic={Topic:"TOPIC",Pii:"PII"};var ac={Passed:"passed",Failed:"failed"};var nc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var sc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var pc={Running:"running",Completed:"completed",Cancelled:"cancelled"};var cc={Running:"running",Completed:"completed",Cancelled:"cancelled"};var lc={Private:"private",Public:"public"};var mc={Private:"private",Public:"public"};var dc={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var uc={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var wc={Private:"private",Public:"public"};var fc={Mustache:"mustache",Jinja2:"jinja2"};var gc={Mustache:"mustache",Jinja2:"jinja2"};var hc={Mustache:"mustache",Jinja2:"jinja2"};var Rc={Mustache:"mustache",Jinja2:"jinja2"};var gs={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var bc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var yc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var zc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var kc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Sc={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var xc={Topic:"TOPIC",Pii:"PII"};var _c={Passed:"passed",Failed:"failed"};var Pc={Topic:"TOPIC",Pii:"PII"};var Ac={Passed:"passed",Failed:"failed"};var Tc={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var ne=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(vc({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function vc({message:s,statusCode:t,body:r}){let o=[];return s!=null&&o.push(s),t!=null&&o.push(`Status code: ${t.toString()}`),r!=null&&o.push(`Body: ${ne(r,void 0,2)}`),o.join(`
2
- `)}var g=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var F=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var O=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var j=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var P=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var J=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var ge=class s extends p{constructor(t,r){super({message:"NotImplementedError",statusCode:501,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var R={Default:"http://localhost:5173/api"};var he;typeof globalThis.Headers!="undefined"?he=globalThis.Headers:he=class hs{constructor(t){if(this.headers=new Map,t)if(t instanceof hs)t.forEach((r,o)=>this.append(o,r));else if(Array.isArray(t))for(let[r,o]of t)if(typeof r=="string"&&typeof o=="string")this.append(r,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,o]of Object.entries(t))if(typeof o=="string")this.append(r,o);else throw new TypeError("Header values must be strings")}append(t,r){let o=t.toLowerCase(),i=this.headers.get(o)||[];this.headers.set(o,[...i,r]);}delete(t){let r=t.toLowerCase();this.headers.delete(r);}get(t){let r=t.toLowerCase(),o=this.headers.get(r);return o?o.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let o=t.toLowerCase();this.headers.set(o,[r]);}forEach(t,r){let o=r?t.bind(r):t;this.headers.forEach((i,n)=>o(i.join(", "),n,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield [t,r.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let t of this.headers.values())yield t.join(", ");}[Symbol.iterator](){return this.entries()}};var Kr={headers:new he,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},Xr={headers:new he,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function Gr(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Rs(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${Ec__default.default.stringify(t,{arrayFormat:"repeat"})}`:s}var m=Cc();function Cc(){var u,w,f,z,k;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((u=globalThis==null?void 0:globalThis.navigator)==null?void 0:u.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((w=self.constructor)==null?void 0:w.name)==="DedicatedWorkerGlobalScope"||((f=self.constructor)==null?void 0:f.name)==="ServiceWorkerGlobalScope"||((z=self.constructor)==null?void 0:z.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((k=process.versions)!=null&&k.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function bs(){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?fetch:m.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function ys({body:s,type:t}){return t.includes("json")?ne(s):s}async function As(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await Promise.resolve().then(()=>(ks(),zs))).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(xs(),Ss))).UndiciStreamWrapper(s):new(await Promise.resolve().then(()=>(Ps(),_s))).NodePre18StreamWrapper(s)}async function Ts(s,t){if(s.body!=null&&t==="blob")return await s.blob();if(s.body!=null&&t==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&t==="sse")return s.body;if(s.body!=null&&t==="streaming")return As(s.body);if(s.body!=null&&t==="text")return await s.text();{let r=await s.text();if(r.length>0)try{return JSON.parse(r)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:r}}}else return}}var jc="timeout";function vs(s){let t=new AbortController,r=setTimeout(()=>t.abort(jc),s);return {signal:t.signal,abortId:r}}function Es(...s){let t=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of t){if(o.aborted){r.abort(o==null?void 0:o.reason);break}o.addEventListener("abort",()=>r.abort(o==null?void 0:o.reason),{signal:r.signal});}return r.signal}var Cs=async(s,t,r,o,i,n,l,d,u)=>{let w=[],f;if(n!=null){let{signal:_,abortId:I}=vs(n);f=I,w.push(_);}l!=null&&w.push(l);let z=Es(w),k=await s(t,{method:r,headers:o,body:i,signal:z,credentials:d?"include":void 0,duplex:u});return f!=null&&clearTimeout(f),k};function Ic(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function js(s,t=2){let r=await s();for(let o=0;o<t&&([408,429].includes(r.status)||r.status>=500);++o){let i=Math.min(1e3*Math.pow(2,o),6e4),n=Ic(i);await new Promise(l=>setTimeout(l,n)),r=await s();}return r}async function Uc(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[n,l]of Object.entries(s.headers))l!=null&&(t[n]=l);let r=Rs(s.url,s.queryParameters),o=await ys({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await bs();try{let n=await js(async()=>Cs(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Ts(n,s.responseType);return n.status>=200&&n.status<400?{ok:!0,body:l,headers:n.headers,rawResponse:Gr(n)}:{ok:!1,error:{reason:"status-code",statusCode:n.status,body:l},rawResponse:Gr(n)}}catch(n){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Kr}:n instanceof Error&&n.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:Kr}:n instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:n.message},rawResponse:Xr}:{ok:false,error:{reason:"unknown",errorMessage:ne(n)},rawResponse:Xr}}}var b=Uc;var a={get:async s=>typeof s=="function"?s():s};var h=class s extends Promise{constructor(t){super(r=>{r(void 0);}),this.innerPromise=t;}static fromFunction(t,...r){return new s(t(...r))}static interceptFunction(t){return (...r)=>s.fromPromise(t(...r))}static fromPromise(t){return new s(t)}static fromExecutor(t){let r=new Promise(t);return new s(r)}static fromResult(t){let r=Promise.resolve(t);return new s(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var e={};v(e,{JsonError:()=>se,ParseError:()=>pe,any:()=>Xs,bigint:()=>Us,boolean:()=>Gs,booleanLiteral:()=>Ks,date:()=>Ns,discriminant:()=>tp,enum_:()=>Qr,getObjectLikeUtils:()=>G,getObjectUtils:()=>te,getSchemaUtils:()=>T,isProperty:()=>oe,lazy:()=>Fs,lazyObject:()=>Ls,list:()=>Zr,number:()=>$s,object:()=>Yr,objectWithoutOptionalProperties:()=>Vs,optional:()=>St,property:()=>Ms,record:()=>qs,set:()=>ep,string:()=>Qs,stringLiteral:()=>Hs,transform:()=>xt,undiscriminatedUnion:()=>op,union:()=>ap,unknown:()=>Ys,withParsedProperties:()=>Pt});var x={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function A(s,t){return `Expected ${t}. Received ${Nc(s)}.`}function Nc(s){if(Array.isArray(s))return "list";if(s===null)return "null";if(s instanceof BigInt)return "BigInt";switch(typeof s){case "string":return `"${s}"`;case "bigint":case "number":case "boolean":case "undefined":return `${s}`}return typeof s}function D(s){return {...s,json:Is(s.json),parse:Is(s.parse)}}function Is(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(n=>" - "+(n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message))].join(`
3
- `)),{ok:true,value:t}):o}}function $r(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var se=class s extends Error{constructor(r){super(r.map($r).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var pe=class s extends Error{constructor(r){super(r.map($r).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function T(s){return {nullable:()=>Fc(s),optional:()=>St(s),optionalNullable:()=>Dc(s),transform:t=>xt(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new pe(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new se(o.errors)}}}function Fc(s){let t={parse:(r,o)=>r==null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r==null?{ok:true,value:null}:s.json(r,o),getType:()=>x.NULLABLE};return {...t,...T(t)}}function St(s){let t={parse:(r,o)=>r==null?{ok:true,value:void 0}:s.parse(r,o),json:(r,o)=>o!=null&&o.omitUndefined&&r===void 0?{ok:true,value:void 0}:r==null?{ok:true,value:null}:s.json(r,o),getType:()=>x.OPTIONAL};return {...t,...T(t)}}function Dc(s){let t={parse:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.json(r,o),getType:()=>x.OPTIONAL_NULLABLE};return {...t,...T(t)}}function xt(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);return n.ok?{ok:true,value:t.transform(n.value)}:n},json:(o,i)=>{let n=t.untransform(o);return s.json(n,i)},getType:()=>s.getType()};return {...r,...T(r)}}function Us(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:true,value:t}:typeof t=="number"?{ok:true,value:BigInt(t)}:{ok:false,errors:[{path:r,message:A(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:A(t,"bigint")}]}:{ok:true,value:t},getType:()=>x.BIGINT};return {...D(s),...T(s)}}var Mc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Ns(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:A(t,"string")}]}:Mc.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:A(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:A(t,"Date object")}]},getType:()=>x.DATE};return {...D(s),...T(s)}}function W(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...D(r),...T(r)}}}function Qr(s){let t=new Set(s);return W(x.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:n=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:n,message:A(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:n,message:A(o,"enum")}]}:{ok:true,value:o})()}function Fs(s){let t=_t(s);return {...t,...T(t)}}function _t(s){return {parse:(t,r)=>ce(s).parse(t,r),json:(t,r)=>ce(s).json(t,r),getType:()=>ce(s).getType()}}function ce(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function Re(s){return Object.entries(s)}function be(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,n])=>(r.has(i)&&(o[i]=n),o),{})}function re(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t}function ye(s){return Object.keys(s)}function Ds(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function G(s){return {withParsedProperties:t=>Pt(s,t)}}function Pt(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);if(!n.ok)return n;let l=Object.entries(t).reduce((d,[u,w])=>({...d,[u]:typeof w=="function"?w(n.value):w}),{});return {ok:true,value:{...n.value,...l}}},json:(o,i)=>{var d;if(!re(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:A(o,"object")}]};let n=new Set(Object.keys(t)),l=be(o,Object.keys(o).filter(u=>!n.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...T(r),...G(r)}}function Ms(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function oe(s){return s.isProperty}function Yr(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>oe(o)?o.rawKey:r),_getParsedProperties:()=>ye(s),parse:(r,o)=>{let i={},n=[];for(let[l,d]of Re(s)){let u=oe(d)?d.rawKey:l,w=oe(d)?d.valueSchema:d,f={rawKey:u,parsedKey:l,valueSchema:w};i[u]=f,Ws(w)&&n.push(u);}return Bs({value:r,requiredKeys:n,getProperty:l=>{let d=i[l];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var w;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(w=o==null?void 0:o.breadcrumbsPrefix)!=null?w:[],l]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},json:(r,o)=>{let i=[];for(let[n,l]of Re(s)){let d=oe(l)?l.valueSchema:l;Ws(d)&&i.push(n);}return Bs({value:r,requiredKeys:i,getProperty:n=>{let l=s[n];if(l!=null)return oe(l)?{transformedKey:l.rawKey,transform:d=>{var u;return l.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}:{transformedKey:n,transform:d=>{var u;return l.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},getType:()=>x.OBJECT};return {...D(t),...T(t),...G(t),...te(t)}}function Bs({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:n=[]}){if(!re(s))return {ok:false,errors:[{path:n,message:A(s,"object")}]};let l=new Set(t),d=[],u={};for(let[w,f]of Object.entries(s)){let z=r(w);if(z!=null){l.delete(w);let k=z.transform(f);k.ok?u[z.transformedKey]=k.value:(u[w]=f,d.push(...k.errors));}else switch(o){case "fail":d.push({path:[...n,w],message:`Unexpected key "${w}"`});break;case "strip":break;case "passthrough":u[w]=f;break}}return d.push(...t.filter(w=>l.has(w)).map(w=>({path:n,message:`Missing required key "${w}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function te(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Os({extensionKeys:t._getRawProperties(),value:o,transformBase:n=>s.parse(n,i),transformExtension:n=>t.parse(n,i)}),json:(o,i)=>Os({extensionKeys:t._getParsedProperties(),value:o,transformBase:n=>s.json(n,i),transformExtension:n=>t.json(n,i)}),getType:()=>x.OBJECT};return {...r,...T(r),...G(r),...te(r)}},passthrough:()=>{let t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let i=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},json:(r,o)=>{let i=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},getType:()=>x.OBJECT};return {...t,...T(t),...G(t),...te(t)}}}}function Os({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[n,l]=Ds(ye(t),w=>i.has(w)),d=r(be(t,l)),u=o(be(t,n));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function Ws(s){return !Bc(s)}function Bc(s){switch(s.getType()){case x.ANY:case x.UNKNOWN:case x.OPTIONAL:case x.OPTIONAL_NULLABLE:return true;default:return false}}function Vs(s){return Yr(s)}function Ls(s){let t={..._t(s),_getRawProperties:()=>ce(s)._getRawProperties(),_getParsedProperties:()=>ce(s)._getParsedProperties()};return {...t,...T(t),...G(t),...te(t)}}function Zr(s){let t={parse:(r,o)=>Js(r,(i,n)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${n}]`]})}),json:(r,o)=>Js(r,(i,n)=>{var l;return s.json(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${n}]`]})}),getType:()=>x.LIST};return {...D(t),...T(t)}}function Js(s,t){return Array.isArray(s)?s.map((o,i)=>t(o,i)).reduce((o,i)=>{if(o.ok&&i.ok)return {ok:true,value:[...o.value,i.value]};let n=[];return o.ok||n.push(...o.errors),i.ok||n.push(...i.errors),{ok:false,errors:n}},{ok:true,value:[]}):{ok:false,errors:[{message:A(s,"list"),path:[]}]}}function Hs(s){return W(x.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:A(r,`"${s}"`)}]})()}function Ks(s){return W(x.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:A(r,`${s.toString()}`)}]})()}var Xs=W(x.ANY,s=>({ok:true,value:s}));var Gs=W(x.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"boolean")}]});var $s=W(x.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"number")}]});var Qs=W(x.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"string")}]});var Ys=W(x.UNKNOWN,s=>({ok:true,value:s}));function qs(s,t){let r={parse:(o,i)=>Zs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var l;return s.parse(n,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${n} (key)`]})},transformValue:(n,l)=>{var d;return t.parse(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>Zs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var l;return s.json(n,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${n} (key)`]})},transformValue:(n,l)=>{var d;return t.json(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>x.RECORD};return {...D(r),...T(r)}}function Zs({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return re(s)?Re(s).reduce((n,[l,d])=>{if(d===void 0)return n;let u=n,w=l;if(t){let _=l.length>0?Number(l):NaN;isNaN(_)||(w=_);}let f=r(w),z=o(d,w);if(u.ok&&f.ok&&z.ok)return {ok:true,value:{...u.value,[f.value]:z.value}};let k=[];return u.ok||k.push(...u.errors),f.ok||k.push(...f.errors),z.ok||k.push(...z.errors),{ok:false,errors:k}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:A(s,"object")}]}}function ep(s){let t=Zr(s),r={parse:(o,i)=>{let n=t.parse(o,i);return n.ok?{ok:true,value:new Set(n.value)}:n},json:(o,i)=>{var l;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],message:A(o,"Set")}]}},getType:()=>x.SET};return {...D(r),...T(r)}}function op(s){let t={parse:(r,o)=>rp((i,n)=>i.parse(r,n),s,o),json:(r,o)=>rp((i,n)=>i.json(r,n),s,o),getType:()=>x.UNDISCRIMINATED_UNION};return {...D(t),...T(t)}}function rp(s,t,r){let o=[];for(let[i,n]of t.entries()){let l=s(n,{...r,skipValidation:false});if(l.ok)return l;for(let d of l.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function tp(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function ap(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=Qr(ye(t)),n={parse:(l,d)=>ip({value:l,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var w;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(w=d==null?void 0:d.breadcrumbsPrefix)!=null?w:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,w)=>w.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(l,d)=>ip({value:l,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var w;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(w=d==null?void 0:d.breadcrumbsPrefix)!=null?w:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,w)=>w.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>x.UNION};return {...D(n),...T(n),...G(n)}}function ip({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!re(s))return {ok:false,errors:[{path:d,message:A(s,"object")}]};let{[t]:u,...w}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let f=o(u);if(!f.ok)return {ok:false,errors:f.errors};let z=i(f.value);if(z==null)return n?{ok:true,value:{[r]:f.value,...w}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let k=l(w,z);return k.ok?{ok:true,value:{[r]:u,...k.value}}:k}function Oc(s){var t=[];if(s.length===0)return "";if(typeof s[0]!="string")throw new TypeError("Url must be a string. Received "+s[0]);if(s[0].match(/^[^/:]+:\/*$/)&&s.length>1){var r=s.shift();s[0]=r+s[0];}s[0].match(/^file:\/\/\//)?s[0]=s[0].replace(/^([^/:]+):\/*/,"$1:///"):s[0]=s[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<s.length;o++){var i=s[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<s.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i));}var n=t.join("/");n=n.replace(/\/(\?|&|#[^!])/g,"$1");var l=n.split("?");return n=l.shift()+(l.length>0?"?":"")+l.join("&"),n}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),Oc(s)}var N={};v(N,{AssistantMessage:()=>Bi,AssistantMessageRole:()=>Mi,Attachment:()=>Yt,AttachmentListRequestEntityType:()=>qr,AttachmentPage:()=>Zt,AuthDetailsHolder:()=>ti,AutomationRuleEvaluator:()=>Kc,AutomationRuleEvaluatorLlmAsJudge:()=>li,AutomationRuleEvaluatorLlmAsJudgePublic:()=>mr,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Ri,AutomationRuleEvaluatorObjectPublic:()=>vi,AutomationRuleEvaluatorPagePublic:()=>Ei,AutomationRuleEvaluatorPublic:()=>Ci,AutomationRuleEvaluatorUpdate:()=>Di,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>Ni,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>Fi,AutomationRuleEvaluatorUserDefinedMetricPython:()=>mi,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>dr,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>yi,AutomationRuleEvaluatorWrite:()=>zi,AvgValueStatPublic:()=>xn,BatchDelete:()=>M,BiInformation:()=>Kt,BiInformationResponse:()=>pr,CategoricalFeedbackDefinition:()=>ba,CategoricalFeedbackDefinitionCreate:()=>Sa,CategoricalFeedbackDefinitionPublic:()=>yr,CategoricalFeedbackDefinitionUpdate:()=>Ia,CategoricalFeedbackDetail:()=>Ra,CategoricalFeedbackDetailCreate:()=>ka,CategoricalFeedbackDetailPublic:()=>Aa,CategoricalFeedbackDetailUpdate:()=>ja,ChatCompletionChoice:()=>Vi,ChatCompletionRequest:()=>nr,ChatCompletionResponse:()=>Hi,Check:()=>In,CheckName:()=>Cn,CheckPublic:()=>Mn,CheckPublicName:()=>Fn,CheckPublicResult:()=>Dn,CheckResult:()=>jn,ChunkedOutputJsonNode:()=>$c,ChunkedOutputJsonNodePublic:()=>Zc,ChunkedOutputJsonNodePublicType:()=>ha,ChunkedOutputJsonNodeType:()=>ua,Column:()=>ma,ColumnCompare:()=>Qi,ColumnCompareTypesItem:()=>$i,ColumnPublic:()=>pa,ColumnPublicTypesItem:()=>sa,ColumnTypesItem:()=>la,Comment:()=>B,CommentCompare:()=>Yi,CommentPublic:()=>ae,CompleteMultipartUploadRequest:()=>Uo,CompleteMultipartUploadRequestEntityType:()=>qt,CompletionTokensDetails:()=>Li,CountValueStatPublic:()=>_n,CreatePromptVersionDetail:()=>Je,DataPointNumberPublic:()=>Ya,Dataset:()=>Xc,DatasetIdentifier:()=>_e,DatasetIdentifierPublic:()=>Ae,DatasetItem:()=>Gi,DatasetItemBatch:()=>Gc,DatasetItemBatchWrite:()=>Se,DatasetItemCompare:()=>oa,DatasetItemCompareSource:()=>Zi,DatasetItemPageCompare:()=>ta,DatasetItemPagePublic:()=>ca,DatasetItemPublic:()=>fr,DatasetItemPublicSource:()=>na,DatasetItemSource:()=>Xi,DatasetItemStreamRequest:()=>Te,DatasetItemWrite:()=>Tt,DatasetItemWriteSource:()=>At,DatasetItemsDelete:()=>Pe,DatasetPagePublic:()=>aa,DatasetPublic:()=>we,DatasetPublicVisibility:()=>ia,DatasetUpdate:()=>xe,DatasetUpdateVisibility:()=>ao,DatasetVisibility:()=>Ki,DatasetWrite:()=>ke,DatasetWriteVisibility:()=>io,DeleteAttachmentsRequest:()=>Hc,DeleteAttachmentsRequestEntityType:()=>ri,DeleteFeedbackScore:()=>_r,DeleteIdsHolder:()=>gr,DeleteTraceThreads:()=>rr,Delta:()=>Wi,DeltaRole:()=>Oi,DownloadAttachmentRequestEntityType:()=>eo,ErrorInfo:()=>Z,ErrorInfoPublic:()=>Pr,ErrorInfoWrite:()=>Xe,ErrorMessage:()=>K,ErrorMessageDetail:()=>sl,ErrorMessageDetailed:()=>al,ErrorMessagePublic:()=>Yc,Experiment:()=>Qc,ExperimentItem:()=>Ee,ExperimentItemCompare:()=>ra,ExperimentItemPublic:()=>wr,ExperimentItemStreamRequest:()=>Ie,ExperimentItemsBatch:()=>Ce,ExperimentItemsDelete:()=>je,ExperimentPagePublic:()=>ga,ExperimentPublic:()=>br,ExperimentPublicType:()=>fa,ExperimentStreamRequestPublic:()=>Ue,ExperimentType:()=>wa,ExperimentWrite:()=>ve,ExperimentWriteType:()=>so,ExportTraceServiceRequest:()=>ol,Feedback:()=>qc,FeedbackCreate:()=>Pa,FeedbackDefinitionPagePublic:()=>Ea,FeedbackObjectPublic:()=>va,FeedbackPublic:()=>Ca,FeedbackScore:()=>$,FeedbackScoreAverage:()=>ee,FeedbackScoreAverageDetailed:()=>an,FeedbackScoreAveragePublic:()=>hr,FeedbackScoreBatch:()=>Er,FeedbackScoreBatchItem:()=>En,FeedbackScoreBatchItemSource:()=>vn,FeedbackScoreCompare:()=>ea,FeedbackScoreCompareSource:()=>qi,FeedbackScoreNames:()=>Qa,FeedbackScorePublic:()=>Ar,FeedbackScorePublicSource:()=>zn,FeedbackScoreSource:()=>vt,FeedbackUpdate:()=>Fa,FindFeedbackDefinitionsRequestType:()=>lo,FindFeedbackScoreNames1RequestType:()=>Po,Function:()=>ar,FunctionCall:()=>q,GetSpanStatsRequestType:()=>Ao,GetSpansByProjectRequestType:()=>_o,Guardrail:()=>Ba,GuardrailBatch:()=>el,GuardrailBatchWrite:()=>sr,GuardrailName:()=>Da,GuardrailResult:()=>Ma,GuardrailWrite:()=>Ht,GuardrailWriteName:()=>Lt,GuardrailWriteResult:()=>Jt,GuardrailsValidation:()=>Un,GuardrailsValidationPublic:()=>Bn,JsonNode:()=>S,JsonNodeCompare:()=>No,JsonNodeDetail:()=>Et,JsonNodePublic:()=>L,JsonNodeWrite:()=>V,JsonObjectSchema:()=>ir,JsonSchema:()=>Ot,JsonSchemaElement:()=>Co,LlmAsJudgeCode:()=>cr,LlmAsJudgeCodePublic:()=>Ai,LlmAsJudgeCodeWrite:()=>hi,LlmAsJudgeMessage:()=>si,LlmAsJudgeMessagePublic:()=>xi,LlmAsJudgeMessagePublicRole:()=>Si,LlmAsJudgeMessageRole:()=>ni,LlmAsJudgeMessageWrite:()=>wi,LlmAsJudgeMessageWriteRole:()=>ui,LlmAsJudgeModelParameters:()=>ai,LlmAsJudgeModelParametersPublic:()=>ki,LlmAsJudgeModelParametersWrite:()=>di,LlmAsJudgeOutputSchema:()=>ci,LlmAsJudgeOutputSchemaPublic:()=>Pi,LlmAsJudgeOutputSchemaPublicType:()=>_i,LlmAsJudgeOutputSchemaType:()=>pi,LlmAsJudgeOutputSchemaWrite:()=>gi,LlmAsJudgeOutputSchemaWriteType:()=>fi,LogItem:()=>Ii,LogItemLevel:()=>ji,LogPage:()=>Ui,Message:()=>Dt,MultipartUploadPart:()=>ei,NumericalFeedbackDefinition:()=>za,NumericalFeedbackDefinitionCreate:()=>_a,NumericalFeedbackDefinitionPublic:()=>zr,NumericalFeedbackDefinitionUpdate:()=>Na,NumericalFeedbackDetail:()=>ya,NumericalFeedbackDetailCreate:()=>xa,NumericalFeedbackDetailPublic:()=>Ta,NumericalFeedbackDetailUpdate:()=>Ua,Optimization:()=>tl,OptimizationPagePublic:()=>Ha,OptimizationPublic:()=>Sr,OptimizationPublicStatus:()=>Ja,OptimizationStatus:()=>La,OptimizationUpdate:()=>Me,OptimizationUpdateStatus:()=>go,OptimizationWrite:()=>De,OptimizationWriteStatus:()=>fo,PageColumns:()=>da,PercentageValueStatPublic:()=>Pn,PercentageValues:()=>ie,PercentageValuesDetailed:()=>nn,PercentageValuesPublic:()=>Rr,Project:()=>il,ProjectDetailed:()=>pn,ProjectDetailedVisibility:()=>sn,ProjectMetricRequestPublic:()=>We,ProjectMetricRequestPublicInterval:()=>zo,ProjectMetricRequestPublicMetricType:()=>yo,ProjectMetricResponsePublic:()=>rn,ProjectMetricResponsePublicInterval:()=>qa,ProjectMetricResponsePublicMetricType:()=>Za,ProjectPagePublic:()=>Ga,ProjectPublic:()=>xr,ProjectPublicVisibility:()=>Xa,ProjectRetrieveDetailed:()=>Ve,ProjectStatItemObjectPublic:()=>Tn,ProjectStatsPublic:()=>vr,ProjectStatsSummary:()=>tn,ProjectStatsSummaryItem:()=>on,ProjectUpdate:()=>Oe,ProjectUpdateVisibility:()=>bo,ProjectVisibility:()=>Ka,ProjectWrite:()=>Be,ProjectWriteVisibility:()=>Ro,Prompt:()=>nl,PromptDetail:()=>dn,PromptPagePublic:()=>hn,PromptPublic:()=>gn,PromptType:()=>cn,PromptUpdatable:()=>He,PromptVersion:()=>mn,PromptVersionDetail:()=>Y,PromptVersionDetailType:()=>Ct,PromptVersionLink:()=>Fo,PromptVersionLinkPublic:()=>Do,PromptVersionLinkWrite:()=>co,PromptVersionPagePublic:()=>fn,PromptVersionPublic:()=>wn,PromptVersionPublicType:()=>un,PromptVersionRetrieveDetail:()=>Ke,PromptVersionType:()=>ln,PromptWrite:()=>Le,PromptWriteType:()=>So,ProviderApiKey:()=>rl,ProviderApiKeyPagePublic:()=>Wa,ProviderApiKeyProvider:()=>Va,ProviderApiKeyPublic:()=>kr,ProviderApiKeyPublicProvider:()=>Oa,ProviderApiKeyUpdate:()=>Fe,ProviderApiKeyWrite:()=>Ne,ProviderApiKeyWriteProvider:()=>uo,ResponseFormat:()=>Wt,ResponseFormatType:()=>Bt,ResultsNumberPublic:()=>en,ScoreName:()=>$a,ServiceTogglesConfig:()=>Rn,Span:()=>yn,SpanBatch:()=>pl,SpanBatchWrite:()=>$e,SpanFilterPublic:()=>Ut,SpanFilterPublicOperator:()=>It,SpanPagePublic:()=>Sn,SpanPublic:()=>Tr,SpanPublicType:()=>kn,SpanSearchStreamRequestPublic:()=>Ye,SpanSearchStreamRequestPublicType:()=>To,SpanType:()=>bn,SpanUpdate:()=>Qe,SpanWrite:()=>Ge,SpanWriteType:()=>jt,SpansCountResponse:()=>Gt,StartMultipartUploadRequest:()=>ze,StartMultipartUploadRequestEntityType:()=>ro,StartMultipartUploadResponse:()=>oi,StreamOptions:()=>Mt,Tool:()=>Vt,ToolCall:()=>ur,Trace:()=>Nn,TraceBatch:()=>cl,TraceBatchWrite:()=>qe,TraceCountResponse:()=>Qt,TraceFilterPublic:()=>Ft,TraceFilterPublicOperator:()=>Nt,TracePagePublic:()=>Wn,TracePublic:()=>Cr,TraceSearchStreamRequestPublic:()=>tr,TraceThread:()=>jr,TraceThreadIdentifier:()=>or,TraceThreadPage:()=>On,TraceUpdate:()=>er,TraceWrite:()=>Ze,UploadAttachmentRequestEntityType:()=>oo,Usage:()=>Ji,UserDefinedMetricPythonCode:()=>lr,UserDefinedMetricPythonCodePublic:()=>Ti,UserDefinedMetricPythonCodeWrite:()=>bi,WorkspaceNameHolder:()=>ii,WorkspaceSpansCount:()=>Xt,WorkspaceTraceCount:()=>$t,attachments:()=>le,chatCompletions:()=>jo,datasets:()=>no,experiments:()=>me,feedbackDefinitions:()=>mo,guardrails:()=>Io,llmProviderKey:()=>wo,optimizations:()=>ho,projects:()=>ko,prompts:()=>xo,spans:()=>de,traces:()=>ue});var le={};v(le,{AttachmentListRequestEntityType:()=>qr,DownloadAttachmentRequestEntityType:()=>eo,StartMultipartUploadRequest:()=>ze,StartMultipartUploadRequestEntityType:()=>ro,UploadAttachmentRequestEntityType:()=>oo,uploadAttachment:()=>to});var qr=e.enum_(["trace","span"]);var eo=e.enum_(["trace","span"]);var ro=e.enum_(["trace","span"]);var oo=e.enum_(["trace","span"]);var to={};v(to,{Request:()=>Wc});var Wc=e.record(e.string(),e.unknown());var ze=e.object({fileName:e.property("file_name",e.string()),numOfFileParts:e.property("num_of_file_parts",e.number()),mimeType:e.property("mime_type",e.string().optional()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",ro),entityId:e.property("entity_id",e.string()),path:e.string()});var no={};v(no,{DatasetIdentifier:()=>_e,DatasetIdentifierPublic:()=>Ae,DatasetItemBatchWrite:()=>Se,DatasetItemStreamRequest:()=>Te,DatasetItemsDelete:()=>Pe,DatasetUpdate:()=>xe,DatasetUpdateVisibility:()=>ao,DatasetWrite:()=>ke,DatasetWriteVisibility:()=>io});var io=e.enum_(["private","public"]);var ao=e.enum_(["private","public"]);var ke=e.object({id:e.string().optional(),name:e.string(),visibility:io.optional(),description:e.string().optional()});var At=e.enum_(["manual","trace","span","sdk"]);var S=e.record(e.string(),e.unknown());var Tt=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:At,data:S});var Se=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Tt)});var xe=e.object({name:e.string(),description:e.string().optional(),visibility:ao.optional()});var _e=e.object({datasetName:e.property("dataset_name",e.string())});var Pe=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Ae=e.object({datasetName:e.property("dataset_name",e.string())});var Te=e.object({datasetName:e.property("dataset_name",e.string()),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),steamLimit:e.property("steam_limit",e.number().optional())});var me={};v(me,{ExperimentItemStreamRequest:()=>Ie,ExperimentItemsBatch:()=>Ce,ExperimentItemsDelete:()=>je,ExperimentStreamRequestPublic:()=>Ue,ExperimentWrite:()=>ve,ExperimentWriteType:()=>so,findFeedbackScoreNames:()=>po});var so=e.enum_(["regular","trial","mini-batch"]);var po={};v(po,{Response:()=>Vc});var Vc=e.list(e.string());var V=e.record(e.string(),e.unknown());var co=e.object({id:e.string()});var ve=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:V.optional(),type:so.optional(),optimizationId:e.property("optimization_id",e.string().optional()),promptVersion:e.property("prompt_version",co.optional()),promptVersions:e.property("prompt_versions",e.list(co).optional())});var vt=e.enum_(["ui","sdk","online_scoring"]);var $=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:vt,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var B=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ee=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:S.optional(),output:S.optional(),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ce=e.object({experimentItems:e.property("experiment_items",e.list(Ee))});var je=e.object({ids:e.list(e.string())});var Ie=e.object({experimentName:e.property("experiment_name",e.string()),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var Ue=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var mo={};v(mo,{FindFeedbackDefinitionsRequestType:()=>lo});var lo=e.enum_(["numerical","categorical"]);var wo={};v(wo,{ProviderApiKeyUpdate:()=>Fe,ProviderApiKeyWrite:()=>Ne,ProviderApiKeyWriteProvider:()=>uo});var uo=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var Ne=e.object({provider:uo,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var Fe=e.object({apiKey:e.property("api_key",e.string()),name:e.string().optional()});var ho={};v(ho,{OptimizationUpdate:()=>Me,OptimizationUpdateStatus:()=>go,OptimizationWrite:()=>De,OptimizationWriteStatus:()=>fo});var fo=e.enum_(["running","completed","cancelled"]);var go=e.enum_(["running","completed","cancelled"]);var De=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:fo,metadata:V.optional()});var Me=e.object({name:e.string().optional(),status:go.optional()});var ko={};v(ko,{ProjectMetricRequestPublic:()=>We,ProjectMetricRequestPublicInterval:()=>zo,ProjectMetricRequestPublicMetricType:()=>yo,ProjectRetrieveDetailed:()=>Ve,ProjectUpdate:()=>Oe,ProjectUpdateVisibility:()=>bo,ProjectWrite:()=>Be,ProjectWriteVisibility:()=>Ro});var Ro=e.enum_(["private","public"]);var bo=e.enum_(["private","public"]);var yo=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var zo=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Be=e.object({name:e.string(),visibility:Ro.optional(),description:e.string().optional()});var Oe=e.object({name:e.string().optional(),description:e.string().optional(),visibility:bo.optional()});var We=e.object({metricType:e.property("metric_type",yo.optional()),interval:zo.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional())});var Ve=e.object({name:e.string()});var xo={};v(xo,{CreatePromptVersionDetail:()=>Je,PromptUpdatable:()=>He,PromptVersionRetrieveDetail:()=>Ke,PromptWrite:()=>Le,PromptWriteType:()=>So});var So=e.enum_(["mustache","jinja2"]);var Le=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:V.optional(),changeDescription:e.property("change_description",e.string().optional()),type:So.optional()});var Et=e.record(e.string(),e.unknown());var Ct=e.enum_(["mustache","jinja2"]);var Y=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:Et.optional(),type:Ct.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Je=e.object({name:e.string(),version:Y});var He=e.object({name:e.string(),description:e.string().optional()});var Ke=e.object({name:e.string(),commit:e.string().optional()});var de={};v(de,{FindFeedbackScoreNames1RequestType:()=>Po,GetSpanStatsRequestType:()=>Ao,GetSpansByProjectRequestType:()=>_o,SpanBatchWrite:()=>$e,SpanSearchStreamRequestPublic:()=>Ye,SpanSearchStreamRequestPublicType:()=>To,SpanUpdate:()=>Qe,findFeedbackScoreNames1:()=>vo});var _o=e.enum_(["general","tool","llm","guardrail"]);var Po=e.enum_(["general","tool","llm","guardrail"]);var Ao=e.enum_(["general","tool","llm","guardrail"]);var To=e.enum_(["general","tool","llm","guardrail"]);var vo={};v(vo,{Response:()=>Lc});var Lc=e.list(e.string());var jt=e.enum_(["general","tool","llm","guardrail"]);var Xe=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ge=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:jt,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:V.optional(),output:V.optional(),metadata:V.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Xe.optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var $e=e.object({spans:e.list(Ge)});var Z=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Qe=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),errorInfo:e.property("error_info",Z.optional())});var It=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ut=e.object({field:e.string().optional(),operator:It.optional(),key:e.string().optional(),value:e.string().optional()});var Ye=e.object({traceId:e.property("trace_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),type:To.optional(),filters:e.list(Ut).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var ue={};v(ue,{DeleteTraceThreads:()=>rr,TraceBatchWrite:()=>qe,TraceSearchStreamRequestPublic:()=>tr,TraceThreadIdentifier:()=>or,TraceUpdate:()=>er,findFeedbackScoreNames2:()=>Eo});var Eo={};v(Eo,{Response:()=>Jc});var Jc=e.list(e.string());var Ze=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:V.optional(),output:V.optional(),metadata:V.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Xe.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var qe=e.object({traces:e.list(Ze)});var er=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Z.optional()),threadId:e.property("thread_id",e.string().optional())});var rr=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()))});var or=e.object({projectId:e.property("project_id",e.string()),threadId:e.property("thread_id",e.string())});var Nt=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ft=e.object({field:e.string().optional(),operator:Nt.optional(),key:e.string().optional(),value:e.string().optional()});var tr=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(Ft).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional()});var jo={};v(jo,{ChatCompletionRequest:()=>nr});var Dt=e.record(e.string(),e.unknown());var Mt=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var Bt=e.enum_(["text","json_object","json_schema"]);var Co=e.object({type:e.string().optional()});var ir=e.object({type:e.string().optional(),description:e.string().optional(),properties:e.record(e.string(),Co).optional(),required:e.list(e.string()).optional(),additionalProperties:e.boolean().optional(),defs:e.property("$defs",e.record(e.string(),Co).optional())});var Ot=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:ir.optional()});var Wt=e.object({type:Bt.optional(),jsonSchema:e.property("json_schema",Ot.optional())});var ar=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:ir.optional()});var Vt=e.object({type:e.stringLiteral("function").optional(),function:ar.optional()});var q=e.object({name:e.string().optional(),arguments:e.string().optional()});var nr=e.object({model:e.string().optional(),messages:e.list(Dt).optional(),temperature:e.number().optional(),topP:e.property("top_p",e.number().optional()),n:e.number().optional(),stream:e.boolean().optional(),streamOptions:e.property("stream_options",Mt.optional()),stop:e.list(e.string()).optional(),maxTokens:e.property("max_tokens",e.number().optional()),maxCompletionTokens:e.property("max_completion_tokens",e.number().optional()),presencePenalty:e.property("presence_penalty",e.number().optional()),frequencyPenalty:e.property("frequency_penalty",e.number().optional()),logitBias:e.property("logit_bias",e.record(e.string(),e.number()).optional()),user:e.string().optional(),responseFormat:e.property("response_format",Wt.optional()),seed:e.number().optional(),tools:e.list(Vt).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),functions:e.list(ar).optional(),functionCall:e.property("function_call",q.optional())});var Io={};v(Io,{GuardrailBatchWrite:()=>sr});var Lt=e.enum_(["TOPIC","PII"]);var Jt=e.enum_(["passed","failed"]);var Ht=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:Lt,result:Jt,config:S,details:S});var sr=e.object({guardrails:e.list(Ht)});var Kt=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var pr=e.object({biInformation:e.property("bi_information",e.list(Kt).optional())});var Xt=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Gt=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Xt).optional())});var $t=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Qt=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list($t).optional())});var Yt=e.object({link:e.string().optional(),fileName:e.property("file_name",e.string()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string())});var Zt=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Yt).optional(),sortableBy:e.list(e.string()).optional()});var K=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var qt=e.enum_(["trace","span"]);var ei=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var Uo=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",qt),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string().optional()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string().optional()),uploadId:e.property("upload_id",e.string()),uploadedFileParts:e.property("uploaded_file_parts",e.list(ei))});var ri=e.enum_(["trace","span"]);var Hc=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",ri),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var oi=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var ti=e.record(e.string(),e.unknown());var ii=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var ai=e.object({name:e.string(),temperature:e.number()});var ni=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var si=e.object({role:ni,content:e.string()});var pi=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var ci=e.object({name:e.string(),type:pi,description:e.string()});var cr=e.object({model:ai,messages:e.list(si),variables:e.record(e.string(),e.string()),schema:e.list(ci)});var li=e.object({code:cr.optional()});var lr=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var mi=e.object({code:lr.optional()});var np=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Kc=e.union("type",{llm_as_judge:li.extend(np),user_defined_metric_python:mi.extend(np)}).transform({transform:s=>s,untransform:s=>s});var di=e.object({name:e.string(),temperature:e.number()});var ui=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var wi=e.object({role:ui,content:e.string()});var fi=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var gi=e.object({name:e.string(),type:fi,description:e.string()});var hi=e.object({model:di,messages:e.list(wi),variables:e.record(e.string(),e.string()),schema:e.list(gi)});var Ri=e.object({code:hi.optional()});var bi=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var yi=e.object({code:bi.optional()});var sp=e.object({projectId:e.property("project_id",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),action:e.stringLiteral("evaluator").optional()}),zi=e.union("type",{llm_as_judge:Ri.extend(sp),user_defined_metric_python:yi.extend(sp)}).transform({transform:s=>s,untransform:s=>s});var M=e.object({ids:e.list(e.string())});var ki=e.object({name:e.string(),temperature:e.number()});var Si=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var xi=e.object({role:Si,content:e.string()});var _i=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Pi=e.object({name:e.string(),type:_i,description:e.string()});var Ai=e.object({model:ki,messages:e.list(xi),variables:e.record(e.string(),e.string()),schema:e.list(Pi)});var mr=e.object({code:Ai.optional()});var Ti=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var dr=e.object({code:Ti.optional()});var pp=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),vi=e.union("type",{llm_as_judge:mr.extend(pp),user_defined_metric_python:dr.extend(pp)}).transform({transform:s=>s,untransform:s=>s});var Ei=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(vi).optional()});var cp=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Ci=e.union("type",{llm_as_judge:mr.extend(cp),user_defined_metric_python:dr.extend(cp)}).transform({transform:s=>s,untransform:s=>s});var ji=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var Ii=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:ji.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var Ui=e.object({content:e.list(Ii).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Ni=e.object({code:cr.optional()});var Fi=e.object({code:lr.optional()});var lp=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),projectId:e.property("project_id",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Di=e.union("type",{llm_as_judge:Ni.extend(lp),user_defined_metric_python:Fi.extend(lp)}).transform({transform:s=>s,untransform:s=>s});var Mi=e.enum_(["system","user","assistant","tool","function"]);var ur=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:q.optional()});var Bi=e.object({role:Mi.optional(),content:e.string().optional(),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(ur).optional()),refusal:e.boolean().optional(),functionCall:e.property("function_call",q.optional())});var Oi=e.enum_(["system","user","assistant","tool","function"]);var Wi=e.object({role:Oi.optional(),content:e.string().optional(),toolCalls:e.property("tool_calls",e.list(ur).optional()),functionCall:e.property("function_call",q.optional())});var Vi=e.object({index:e.number().optional(),message:Bi.optional(),delta:Wi.optional(),finishReason:e.property("finish_reason",e.string().optional())});var Li=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Ji=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",Li.optional())});var Hi=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(Vi).optional(),usage:Ji.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional())});var Ki=e.enum_(["private","public"]);var Xc=e.object({id:e.string().optional(),name:e.string(),visibility:Ki.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var Xi=e.enum_(["manual","trace","span","sdk"]);var Gi=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Xi,data:S,experimentItems:e.property("experiment_items",e.list(Ee).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Gc=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Gi)});var $i=e.enum_(["string","number","object","boolean","array","null"]);var Qi=e.object({name:e.string().optional(),types:e.list($i).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Yi=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Zi=e.enum_(["manual","trace","span","sdk"]);var No=e.record(e.string(),e.unknown());var qi=e.enum_(["ui","sdk","online_scoring"]);var ea=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:qi,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ra=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:No.optional(),output:No.optional(),feedbackScores:e.property("feedback_scores",e.list(ea).optional()),comments:e.list(Yi).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var oa=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Zi,data:S,experimentItems:e.property("experiment_items",e.list(ra).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ta=e.object({content:e.list(oa).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Qi).optional()});var ia=e.enum_(["private","public"]);var we=e.object({id:e.string().optional(),name:e.string(),visibility:ia.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var aa=e.object({content:e.list(we).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var na=e.enum_(["manual","trace","span","sdk"]);var wr=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var fr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:na,data:S,experimentItems:e.property("experiment_items",e.list(wr).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var sa=e.enum_(["string","number","object","boolean","array","null"]);var pa=e.object({name:e.string().optional(),types:e.list(sa).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var ca=e.object({content:e.list(fr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(pa).optional()});var la=e.enum_(["string","number","object","boolean","array","null"]);var ma=e.object({name:e.string().optional(),types:e.list(la).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var da=e.object({columns:e.list(ma).optional()});var ua=e.object({typeName:e.string().optional()});var $c=e.object({type:ua.optional(),closed:e.boolean().optional()});var wa=e.enum_(["regular","trial","mini-batch"]);var ee=e.object({name:e.string(),value:e.number()});var ie=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Fo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Qc=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:S.optional(),type:wa.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),comments:e.list(B).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),promptVersion:e.property("prompt_version",Fo.optional()),promptVersions:e.property("prompt_versions",e.list(Fo).optional())});var gr=e.object({ids:e.list(e.string())});var ae=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var L=e.record(e.string(),e.unknown());var fa=e.enum_(["regular","trial","mini-batch"]);var hr=e.object({name:e.string(),value:e.number()});var Rr=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Do=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var br=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:L.optional(),type:fa.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(hr).optional()),comments:e.list(ae).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:Rr.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),promptVersion:e.property("prompt_version",Do.optional()),promptVersions:e.property("prompt_versions",e.list(Do).optional())});var ga=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(br).optional(),sortableBy:e.list(e.string()).optional()});var Yc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var ha=e.object({typeName:e.string().optional()});var Zc=e.object({type:ha.optional(),closed:e.boolean().optional()});var Ra=e.object({categories:e.record(e.string(),e.number())});var ba=e.object({details:Ra.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ya=e.object({max:e.number(),min:e.number()});var za=e.object({details:ya.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var mp=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),qc=e.union("type",{numerical:za.extend(mp),categorical:ba.extend(mp)}).transform({transform:s=>s,untransform:s=>s});var ka=e.object({categories:e.record(e.string(),e.number())});var Sa=e.object({details:ka.optional()});var xa=e.object({max:e.number(),min:e.number()});var _a=e.object({details:xa.optional()});var dp=e.object({id:e.string().optional(),name:e.string()}),Pa=e.union("type",{numerical:_a.extend(dp),categorical:Sa.extend(dp)}).transform({transform:s=>s,untransform:s=>s});var Aa=e.object({categories:e.record(e.string(),e.number())});var yr=e.object({details:Aa.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ta=e.object({max:e.number(),min:e.number()});var zr=e.object({details:Ta.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var up=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),va=e.union("type",{numerical:zr.extend(up),categorical:yr.extend(up)}).transform({transform:s=>s,untransform:s=>s});var Ea=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(va).optional()});var wp=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Ca=e.union("type",{numerical:zr.extend(wp),categorical:yr.extend(wp)}).transform({transform:s=>s,untransform:s=>s});var ja=e.object({categories:e.record(e.string(),e.number())});var Ia=e.object({details:ja.optional()});var Ua=e.object({max:e.number(),min:e.number()});var Na=e.object({details:Ua.optional()});var fp=e.object({id:e.string().optional(),name:e.string()}),Fa=e.union("type",{numerical:Na.extend(fp),categorical:Ia.extend(fp)}).transform({transform:s=>s,untransform:s=>s});var Da=e.enum_(["TOPIC","PII"]);var Ma=e.enum_(["passed","failed"]);var Ba=e.object({id:e.string().optional(),entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:Da,result:Ma,config:S,details:S});var el=e.object({guardrails:e.list(Ba)});var Oa=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var kr=e.object({id:e.string().optional(),provider:Oa,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Wa=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(kr).optional(),sortableBy:e.list(e.string()).optional()});var Va=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var rl=e.object({id:e.string().optional(),provider:Va,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ol=S;var La=e.enum_(["running","completed","cancelled"]);var tl=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:La,metadata:S.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ja=e.enum_(["running","completed","cancelled"]);var Sr=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Ja,metadata:L.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(hr).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ha=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Sr).optional(),sortableBy:e.list(e.string()).optional()});var Ka=e.enum_(["private","public"]);var il=e.object({id:e.string().optional(),name:e.string(),visibility:Ka.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var Xa=e.enum_(["private","public"]);var xr=e.object({id:e.string().optional(),name:e.string(),visibility:Xa.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var Ga=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(xr).optional(),sortableBy:e.list(e.string()).optional()});var $a=e.object({name:e.string().optional()});var Qa=e.object({scores:e.list($a).optional()});var Ya=e.object({time:e.date(),value:e.number().optional()});var Za=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var qa=e.enum_(["HOURLY","DAILY","WEEKLY"]);var en=e.object({name:e.string().optional(),data:e.list(Ya).optional()});var rn=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Za.optional()),interval:qa.optional(),results:e.list(en).optional()});var on=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var tn=e.object({content:e.list(on).optional()});var an=e.object({name:e.string(),value:e.number()});var nn=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var sn=e.enum_(["private","public"]);var pn=e.object({id:e.string().optional(),name:e.string(),visibility:sn.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(an).optional()),duration:nn.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var al=e.object({errors:e.list(e.string()).optional()});var cn=e.enum_(["mustache","jinja2"]);var ln=e.enum_(["mustache","jinja2"]);var mn=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:S.optional(),type:ln.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var nl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:S.optional(),changeDescription:e.property("change_description",e.string().optional()),type:cn.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",mn.optional())});var sl=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var dn=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",Y.optional())});var un=e.enum_(["mustache","jinja2"]);var wn=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:L.optional(),type:un.optional(),changeDescription:e.property("change_description",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var fn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wn).optional()});var gn=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var hn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(gn).optional()});var Rn=e.object({pythonEvaluatorEnabled:e.boolean(),guardrailsEnabled:e.boolean()});var bn=e.enum_(["general","tool","llm","guardrail"]);var yn=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:bn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Z.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var pl=e.object({spans:e.list(yn)});var _r=e.object({name:e.string()});var Pr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zn=e.enum_(["ui","sdk","online_scoring"]);var Ar=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:zn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var kn=e.enum_(["general","tool","llm","guardrail"]);var Tr=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:kn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:L.optional(),output:L.optional(),metadata:L.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Pr.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Ar).optional()),comments:e.list(ae).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var Sn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Tr).optional(),sortableBy:e.list(e.string()).optional()});var xn=e.object({value:e.number().optional()});var _n=e.object({value:e.number().optional()});var Pn=e.object({value:Rr.optional()});var An=e.object({name:e.string().optional()}),Tn=e.union("type",{PERCENTAGE:Pn.extend(An),COUNT:_n.extend(An),AVG:xn.extend(An)}).transform({transform:s=>s,untransform:s=>s});var vr=e.object({stats:e.list(Tn).optional()});var vn=e.enum_(["ui","sdk","online_scoring"]);var En=e.object({id:e.string(),projectName:e.property("project_name",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:vn});var Er=e.object({scores:e.list(En)});var Cn=e.enum_(["TOPIC","PII"]);var jn=e.enum_(["passed","failed"]);var In=e.object({name:Cn.optional(),result:jn.optional()});var Un=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(In).optional()});var Nn=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Z.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Un).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional())});var cl=e.object({traces:e.list(Nn)});var Fn=e.enum_(["TOPIC","PII"]);var Dn=e.enum_(["passed","failed"]);var Mn=e.object({name:Fn.optional(),result:Dn.optional()});var Bn=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Mn).optional()});var Cr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:L.optional(),output:L.optional(),metadata:L.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Pr.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Ar).optional()),comments:e.list(ae).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Bn).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional())});var jr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),startTime:e.property("start_time",e.date().optional()),endTime:e.property("end_time",e.date().optional()),duration:e.number().optional(),firstMessage:e.property("first_message",S.optional()),lastMessage:e.property("last_message",S.optional()),numberOfMessages:e.property("number_of_messages",e.number().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var On=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(jr).optional()});var Wn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Cr).optional(),sortableBy:e.list(e.string()).optional()});var Mo=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return h.fromPromise(this.__getDatasetBiInfo(t))}async __getDatasetBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:pr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExperimentBiInfo(t){return h.fromPromise(this.__getExperimentBiInfo(t))}async __getExperimentBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:pr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansCountForWorkspaces(t){return h.fromPromise(this.__getSpansCountForWorkspaces(t))}async __getSpansCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Gt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesBiInfo(t){return h.fromPromise(this.__getTracesBiInfo(t))}async __getTracesBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:pr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesCountForWorkspaces(t){return h.fromPromise(this.__getTracesCountForWorkspaces(t))}async __getTracesCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Qt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Bo=class{constructor(t={}){this._options=t;}attachmentList(t,r){return h.fromPromise(this.__attachmentList(t,r))}async __attachmentList(t,r){var z,k;let{page:o,size:i,projectId:n,entityType:l,entityId:d,path:u}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),w.project_id=n,w.entity_type=qr.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),w.entity_id=d,w.path=u;let f=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(f.ok)return {data:Zt.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 401:throw new F(f.error.body,f.rawResponse);case 403:throw new O(K.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),f.rawResponse);default:throw new p({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case "non-json":throw new p({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new p({message:f.error.errorMessage,rawResponse:f.rawResponse})}}completeMultiPartUpload(t,r){return h.fromPromise(this.__completeMultiPartUpload(t,r))}async __completeMultiPartUpload(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAttachments(t,r){return h.fromPromise(this.__deleteAttachments(t,r))}async __deleteAttachments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}downloadAttachment(t,r){return h.fromPromise(this.__downloadAttachment(t,r))}async __downloadAttachment(t,r){var z,k;let{workspaceName:o,containerId:i,entityType:n,entityId:l,fileName:d,mimeType:u}=t,w={};o!=null&&(w.workspace_name=o),w.container_id=i,w.entity_type=eo.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),w.entity_id=l,w.file_name=d,w.mime_type=u;let f=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(f.ok)return {data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 401:throw new F(f.error.body,f.rawResponse);case 403:throw new O(K.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),f.rawResponse);default:throw new p({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case "non-json":throw new p({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new p({message:f.error.errorMessage,rawResponse:f.rawResponse})}}startMultiPartUpload(t,r){return h.fromPromise(this.__startMultiPartUpload(t,r))}async __startMultiPartUpload(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ze.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:oi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}uploadAttachment(t,r){return h.fromPromise(this.__uploadAttachment(t,r))}async __uploadAttachment(t,r){var z,k;let{fileName:o,projectName:i,mimeType:n,entityType:l,entityId:d,body:u}=t,w={};w.file_name=o,i!=null&&(w.project_name=i),n!=null&&(w.mime_type=n),w.entity_type=oo.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),w.entity_id=d;let f=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",body:le.uploadAttachment.Request.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(f.ok)return {data:void 0,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 401:throw new F(f.error.body,f.rawResponse);case 403:throw new O(K.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),f.rawResponse);default:throw new p({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case "non-json":throw new p({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new p({message:f.error.errorMessage,rawResponse:f.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Oo=class{constructor(t={}){this._options=t;}access(t,r){return h.fromPromise(this.__access(t,r))}async __access(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return h.fromPromise(this.__getWorkspaceName(t))}async __getWorkspaceName(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:ii.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new F(r.error.body,r.rawResponse);case 403:throw new O(K.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Wo=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return h.fromPromise(this.__findEvaluators(t,r))}async __findEvaluators(t={},r){var w,f;let{projectId:o,name:i,page:n,size:l}=t,d={};o!=null&&(d.project_id=o),i!=null&&(d.name=i),n!=null&&(d.page=n.toString()),l!=null&&(d.size=l.toString());let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ei.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAutomationRuleEvaluator(t,r){return h.fromPromise(this.__createAutomationRuleEvaluator(t,r))}async __createAutomationRuleEvaluator(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAutomationRuleEvaluatorBatch(t,r){return h.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(t,r))}async __deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,n={};o!=null&&(n.project_id=o);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,requestType:"json",body:M.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getEvaluatorById(t,r={},o){return h.fromPromise(this.__getEvaluatorById(t,r,o))}async __getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,n={};i!=null&&(n.project_id=i);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Ci.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}updateAutomationRuleEvaluator(t,r,o){return h.fromPromise(this.__updateAutomationRuleEvaluator(t,r,o))}async __updateAutomationRuleEvaluator(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Di.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getEvaluatorLogsById(t,r={},o){return h.fromPromise(this.__getEvaluatorLogsById(t,r,o))}async __getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,n={};i!=null&&(n.size=i.toString());let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Ui.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Vo=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return h.fromPromise(this.__createChatCompletions(t,r))}async __createChatCompletions(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:nr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Hi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Lo=class{constructor(t={}){this._options=t;}findDatasets(t={},r){return h.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var k,_;let{page:o,size:i,withExperimentsOnly:n,withOptimizationsOnly:l,promptId:d,name:u,sorting:w}=t,f={};o!=null&&(f.page=o.toString()),i!=null&&(f.size=i.toString()),n!=null&&(f.with_experiments_only=n.toString()),l!=null&&(f.with_optimizations_only=l.toString()),d!=null&&(f.prompt_id=d),u!=null&&(f.name=u),w!=null&&(f.sorting=w);let z=await b({url:y((_=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?_:R.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:f,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(z.ok)return {data:aa.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")throw new p({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse});switch(z.error.reason){case "non-json":throw new p({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:z.error.errorMessage,rawResponse:z.rawResponse})}}createDataset(t,r){return h.fromPromise(this.__createDataset(t,r))}async __createDataset(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ke.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return h.fromPromise(this.__createOrUpdateDatasetItems(t,r))}async __createOrUpdateDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Se.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetById(t,r){return h.fromPromise(this.__getDatasetById(t,r))}async __getDatasetById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:we.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDataset(t,r,o){return h.fromPromise(this.__updateDataset(t,r,o))}async __updateDataset(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDataset(t,r){return h.fromPromise(this.__deleteDataset(t,r))}async __deleteDataset(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetByName(t,r){return h.fromPromise(this.__deleteDatasetByName(t,r))}async __deleteDatasetByName(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:_e.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetItems(t,r){return h.fromPromise(this.__deleteDatasetItems(t,r))}async __deleteDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Pe.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetsBatch(t,r){return h.fromPromise(this.__deleteDatasetsBatch(t,r))}async __deleteDatasetsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findDatasetItemsWithExperimentItems(t,r,o){return h.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var z,k;let{page:i,size:n,experimentIds:l,filters:d,truncate:u}=r,w={};i!=null&&(w.page=i.toString()),n!=null&&(w.size=n.toString()),w.experiment_ids=l,d!=null&&(w.filters=d),u!=null&&(w.truncate=u.toString());let f=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(f.ok)return {data:ta.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new p({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});switch(f.error.reason){case "non-json":throw new p({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new p({message:f.error.errorMessage,rawResponse:f.rawResponse})}}getDatasetByIdentifier(t,r){return h.fromPromise(this.__getDatasetByIdentifier(t,r))}async __getDatasetByIdentifier(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ae.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:we.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetItemById(t,r){return h.fromPromise(this.__getDatasetItemById(t,r))}async __getDatasetItemById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetItems(t,r={},o){return h.fromPromise(this.__getDatasetItems(t,r,o))}async __getDatasetItems(t,r={},o){var w,f;let{page:i,size:n,truncate:l}=r,d={};i!=null&&(d.page=i.toString()),n!=null&&(d.size=n.toString()),l!=null&&(d.truncate=l.toString());let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(u.ok)return {data:ca.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getDatasetItemsOutputColumns(t,r={},o){return h.fromPromise(this.__getDatasetItemsOutputColumns(t,r,o))}async __getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,n={};i!=null&&(n.experiment_ids=i);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:da.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}streamDatasetItems(t,r){return h.fromPromise(this.__streamDatasetItems(t,r))}async __streamDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Te.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Jo=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return h.fromPromise(this.__findExperiments(t,r))}async __findExperiments(t={},r){var I,fe;let{page:o,size:i,datasetId:n,optimizationId:l,types:d,name:u,datasetDeleted:w,promptId:f,sorting:z}=t,k={};o!=null&&(k.page=o.toString()),i!=null&&(k.size=i.toString()),n!=null&&(k.datasetId=n),l!=null&&(k.optimization_id=l),d!=null&&(k.types=d),u!=null&&(k.name=u),w!=null&&(k.dataset_deleted=w.toString()),f!=null&&(k.prompt_id=f),z!=null&&(k.sorting=z);let _=await b({url:y((fe=(I=await a.get(this._options.baseUrl))!=null?I:await a.get(this._options.environment))!=null?fe:R.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(_.ok)return {data:ga.parseOrThrow(_.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new j(_.error.body,_.rawResponse);default:throw new p({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case "non-json":throw new p({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:_.error.errorMessage,rawResponse:_.rawResponse})}}createExperiment(t,r){return h.fromPromise(this.__createExperiment(t,r))}async __createExperiment(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ve.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return h.fromPromise(this.__createExperimentItems(t,r))}async __createExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ce.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentItems(t,r){return h.fromPromise(this.__deleteExperimentItems(t,r))}async __deleteExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:je.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentsById(t,r){return h.fromPromise(this.__deleteExperimentsById(t,r))}async __deleteExperimentsById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames(t={},r){return h.fromPromise(this.__findFeedbackScoreNames(t,r))}async __findFeedbackScoreNames(t={},r){var l,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:me.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getExperimentById(t,r){return h.fromPromise(this.__getExperimentById(t,r))}async __getExperimentById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getExperimentItemById(t,r){return h.fromPromise(this.__getExperimentItemById(t,r))}async __getExperimentItemById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/experiments/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:wr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperimentItems(t,r){return h.fromPromise(this.__streamExperimentItems(t,r))}async __streamExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperiments(t,r){return h.fromPromise(this.__streamExperiments(t,r))}async __streamExperiments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ue.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ho=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return h.fromPromise(this.__findFeedbackDefinitions(t,r))}async __findFeedbackDefinitions(t={},r){var w,f;let{page:o,size:i,name:n,type:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.type=lo.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}));let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ea.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createFeedbackDefinition(t,r){return h.fromPromise(this.__createFeedbackDefinition(t,r))}async __createFeedbackDefinition(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Pa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getFeedbackDefinitionById(t,r){return h.fromPromise(this.__getFeedbackDefinitionById(t,r))}async __getFeedbackDefinitionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ca.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateFeedbackDefinition(t,r,o){return h.fromPromise(this.__updateFeedbackDefinition(t,r,o))}async __updateFeedbackDefinition(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fa.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeedbackDefinitionById(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionById(t,r))}async __deleteFeedbackDefinitionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteFeedbackDefinitionsBatch(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionsBatch(t,r))}async __deleteFeedbackDefinitionsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ko=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return h.fromPromise(this.__createGuardrails(t,r))}async __createGuardrails(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:sr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Xo=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return h.fromPromise(this.__deleteLlmProviderApiKeysBatch(t,r))}async __deleteLlmProviderApiKeysBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findLlmProviderKeys(t){return h.fromPromise(this.__findLlmProviderKeys(t))}async __findLlmProviderKeys(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Wa.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}storeLlmProviderApiKey(t,r){return h.fromPromise(this.__storeLlmProviderApiKey(t,r))}async __storeLlmProviderApiKey(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ne.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getLlmProviderApiKeyById(t,r){return h.fromPromise(this.__getLlmProviderApiKeyById(t,r))}async __getLlmProviderApiKeyById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:kr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateLlmProviderApiKey(t,r,o){return h.fromPromise(this.__updateLlmProviderApiKey(t,r,o))}async __updateLlmProviderApiKey(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new F(i.error.body,i.rawResponse);case 403:throw new O(K.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Go=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return h.fromPromise(this.__receiveProtobufTraces(t))}async __receiveProtobufTraces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var $o=class{constructor(t={}){this._options=t;}findOptimizations(t={},r){return h.fromPromise(this.__findOptimizations(t,r))}async __findOptimizations(t={},r){var f,z;let{page:o,size:i,datasetId:n,name:l,datasetDeleted:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),n!=null&&(u.dataset_id=n),l!=null&&(u.name=l),d!=null&&(u.dataset_deleted=d.toString());let w=await b({url:y((z=(f=await a.get(this._options.baseUrl))!=null?f:await a.get(this._options.environment))!=null?z:R.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:Ha.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new j(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return h.fromPromise(this.__createOptimization(t,r))}async __createOptimization(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:De.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return h.fromPromise(this.__deleteOptimizationsById(t,r))}async __deleteOptimizationsById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getOptimizationById(t,r){return h.fromPromise(this.__getOptimizationById(t,r))}async __getOptimizationById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Sr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateOptimizationsById(t,r={},o){return h.fromPromise(this.__updateOptimizationsById(t,r,o))}async __updateOptimizationsById(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Me.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Qo=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var w,f;let{page:o,size:i,name:n,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.sorting=l);let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ga.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Be.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return h.fromPromise(this.__getProjectById(t,r))}async __getProjectById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:xr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteProjectById(t,r){return h.fromPromise(this.__deleteProjectById(t,r))}async __deleteProjectById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProject(t,r={},o){return h.fromPromise(this.__updateProject(t,r,o))}async __updateProject(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Oe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 422:throw new X(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteProjectsBatch(t,r){return h.fromPromise(this.__deleteProjectsBatch(t,r))}async __deleteProjectsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNamesByProjectIds(t={},r){return h.fromPromise(this.__findFeedbackScoreNamesByProjectIds(t,r))}async __findFeedbackScoreNamesByProjectIds(t={},r){var l,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:Qa.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getProjectMetrics(t,r={},o){return h.fromPromise(this.__getProjectMetrics(t,r,o))}async __getProjectMetrics(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}/metrics`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:We.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:rn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getProjectStats(t={},r){return h.fromPromise(this.__getProjectStats(t,r))}async __getProjectStats(t={},r){var w,f;let{page:o,size:i,name:n,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.sorting=l);let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:tn.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}retrieveProject(t,r){return h.fromPromise(this.__retrieveProject(t,r))}async __retrieveProject(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ve.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pn.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 404:throw new P(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Yo=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return h.fromPromise(this.__getPrompts(t,r))}async __getPrompts(t={},r){var u,w;let{page:o,size:i,name:n}=t,l={};o!=null&&(l.page=o.toString()),i!=null&&(l.size=i.toString()),n!=null&&(l.name=n);let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:hn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createPrompt(t,r){return h.fromPromise(this.__createPrompt(t,r))}async __createPrompt(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Le.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 409:throw new J(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return h.fromPromise(this.__createPromptVersion(t,r))}async __createPromptVersion(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Je.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 409:throw new J(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dn.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePrompt(t,r,o){return h.fromPromise(this.__updatePrompt(t,r,o))}async __updatePrompt(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:He.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);case 409:throw new J(i.error.body,i.rawResponse);case 422:throw new X(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePrompt(t,r){return h.fromPromise(this.__deletePrompt(t,r))}async __deletePrompt(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePromptsBatch(t,r){return h.fromPromise(this.__deletePromptsBatch(t,r))}async __deletePromptsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersionById(t,r){return h.fromPromise(this.__getPromptVersionById(t,r))}async __getPromptVersionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/versions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersions(t,r={},o){return h.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var u,w;let{page:i,size:n}=r,l={};i!=null&&(l.page=i.toString()),n!=null&&(l.size=n.toString());let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:fn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}retrievePromptVersion(t,r){return h.fromPromise(this.__retrievePromptVersion(t,r))}async __retrievePromptVersion(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ke.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 404:throw new P(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Zo=class{constructor(t={}){this._options=t;}getServiceToggles(t){return h.fromPromise(this.__getServiceToggles(t))}async __getServiceToggles(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Rn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var qo=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return h.fromPromise(this.__addSpanComment(t,r,o))}async __addSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addSpanFeedbackScore(t,r,o){return h.fromPromise(this.__addSpanFeedbackScore(t,r,o))}async __addSpanFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:$.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpansByProject(t={},r){return h.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var fe,Jn;let{page:o,size:i,projectName:n,projectId:l,traceId:d,type:u,filters:w,truncate:f,sorting:z,exclude:k}=t,_={};o!=null&&(_.page=o.toString()),i!=null&&(_.size=i.toString()),n!=null&&(_.project_name=n),l!=null&&(_.project_id=l),d!=null&&(_.trace_id=d),u!=null&&(_.type=_o.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),w!=null&&(_.filters=w),f!=null&&(_.truncate=f.toString()),z!=null&&(_.sorting=z),k!=null&&(_.exclude=k);let I=await b({url:y((Jn=(fe=await a.get(this._options.baseUrl))!=null?fe:await a.get(this._options.environment))!=null?Jn:R.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:_,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(I.ok)return {data:Sn.parseOrThrow(I.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:I.rawResponse};if(I.error.reason==="status-code")throw new p({statusCode:I.error.statusCode,body:I.error.body,rawResponse:I.rawResponse});switch(I.error.reason){case "non-json":throw new p({statusCode:I.error.statusCode,body:I.error.rawBody,rawResponse:I.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:I.error.errorMessage,rawResponse:I.rawResponse})}}createSpan(t,r){return h.fromPromise(this.__createSpan(t,r))}async __createSpan(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ge.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createSpans(t,r){return h.fromPromise(this.__createSpans(t,r))}async __createSpans(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$e.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpanById(t,r){return h.fromPromise(this.__getSpanById(t,r))}async __getSpanById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Tr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanById(t,r){return h.fromPromise(this.__deleteSpanById(t,r))}async __deleteSpanById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new ge(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpan(t,r,o){return h.fromPromise(this.__updateSpan(t,r,o))}async __updateSpan(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Qe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteSpanComments(t,r){return h.fromPromise(this.__deleteSpanComments(t,r))}async __deleteSpanComments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanFeedbackScore(t,r,o){return h.fromPromise(this.__deleteSpanFeedbackScore(t,r,o))}async __deleteSpanFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_r.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findFeedbackScoreNames1(t={},r){return h.fromPromise(this.__findFeedbackScoreNames1(t,r))}async __findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,n={};o!=null&&(n.project_id=o),i!=null&&(n.type=Po.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:de.findFeedbackScoreNames1.Response.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getSpanComment(t,r,o){return h.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:B.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpanStats(t={},r){return h.fromPromise(this.__getSpanStats(t,r))}async __getSpanStats(t={},r){var f,z;let{projectId:o,projectName:i,traceId:n,type:l,filters:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),n!=null&&(u.trace_id=n),l!=null&&(u.type=Ao.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),d!=null&&(u.filters=d);let w=await b({url:y((z=(f=await a.get(this._options.baseUrl))!=null?f:await a.get(this._options.environment))!=null?z:R.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:vr.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}scoreBatchOfSpans(t,r){return h.fromPromise(this.__scoreBatchOfSpans(t,r))}async __scoreBatchOfSpans(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchSpans(t={},r){return h.fromPromise(this.__searchSpans(t,r))}async __searchSpans(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ye.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpanComment(t,r,o){return h.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var et=class{constructor(t={}){this._options=t;}addTraceComment(t,r,o){return h.fromPromise(this.__addTraceComment(t,r,o))}async __addTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceFeedbackScore(t,r,o){return h.fromPromise(this.__addTraceFeedbackScore(t,r,o))}async __addTraceFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:$.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTracesByProject(t={},r){return h.fromPromise(this.__getTracesByProject(t,r))}async __getTracesByProject(t={},r){var _,I;let{page:o,size:i,projectName:n,projectId:l,filters:d,truncate:u,sorting:w,exclude:f}=t,z={};o!=null&&(z.page=o.toString()),i!=null&&(z.size=i.toString()),n!=null&&(z.project_name=n),l!=null&&(z.project_id=l),d!=null&&(z.filters=d),u!=null&&(z.truncate=u.toString()),w!=null&&(z.sorting=w),f!=null&&(z.exclude=f);let k=await b({url:y((I=(_=await a.get(this._options.baseUrl))!=null?_:await a.get(this._options.environment))!=null?I:R.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:Wn.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createTrace(t,r){return h.fromPromise(this.__createTrace(t,r))}async __createTrace(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ze.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createTraces(t,r){return h.fromPromise(this.__createTraces(t,r))}async __createTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:qe.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceById(t,r){return h.fromPromise(this.__getTraceById(t,r))}async __getTraceById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Cr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceById(t,r){return h.fromPromise(this.__deleteTraceById(t,r))}async __deleteTraceById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTrace(t,r={},o){return h.fromPromise(this.__updateTrace(t,r,o))}async __updateTrace(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:er.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceComments(t,r){return h.fromPromise(this.__deleteTraceComments(t,r))}async __deleteTraceComments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceFeedbackScore(t,r,o){return h.fromPromise(this.__deleteTraceFeedbackScore(t,r,o))}async __deleteTraceFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_r.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceThreads(t,r){return h.fromPromise(this.__deleteTraceThreads(t,r))}async __deleteTraceThreads(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraces(t,r){return h.fromPromise(this.__deleteTraces(t,r))}async __deleteTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames2(t={},r){return h.fromPromise(this.__findFeedbackScoreNames2(t,r))}async __findFeedbackScoreNames2(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:ue.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getTraceStats(t={},r){return h.fromPromise(this.__getTraceStats(t,r))}async __getTraceStats(t={},r){var u,w;let{projectId:o,projectName:i,filters:n}=t,l={};o!=null&&(l.project_id=o),i!=null&&(l.project_name=i),n!=null&&(l.filters=n);let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:vr.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getTraceComment(t,r,o){return h.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:B.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThread(t,r){return h.fromPromise(this.__getTraceThread(t,r))}async __getTraceThread(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:or.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:jr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceThreads(t={},r){return h.fromPromise(this.__getTraceThreads(t,r))}async __getTraceThreads(t={},r){var z,k;let{page:o,size:i,projectName:n,projectId:l,truncate:d,filters:u}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),n!=null&&(w.project_name=n),l!=null&&(w.project_id=l),d!=null&&(w.truncate=d.toString()),u!=null&&(w.filters=u);let f=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(f.ok)return {data:On.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new p({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});switch(f.error.reason){case "non-json":throw new p({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:f.error.errorMessage,rawResponse:f.rawResponse})}}scoreBatchOfTraces(t,r){return h.fromPromise(this.__scoreBatchOfTraces(t,r))}async __scoreBatchOfTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraces(t={},r){return h.fromPromise(this.__searchTraces(t,r))}async __searchTraces(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:tr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 401:throw new F(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new g("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTraceComment(t,r,o){return h.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new g("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var rt=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return h.fromPromise(this.__datasetsRedirect(t,r))}async __datasetsRedirect(t,r){var u,w;let{datasetId:o,workspaceName:i,path:n}=t,l={};l.dataset_id=o,i!=null&&(l.workspace_name=i),l.path=n;let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body,d.rawResponse);case 404:throw new P(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}experimentsRedirect(t,r){return h.fromPromise(this.__experimentsRedirect(t,r))}async __experimentsRedirect(t,r){var w,f;let{datasetId:o,experimentId:i,workspaceName:n,path:l}=t,d={};d.dataset_id=o,d.experiment_id=i,n!=null&&(d.workspace_name=n),d.path=l;let u=await b({url:y((f=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?f:R.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new j(u.error.body,u.rawResponse);case 404:throw new P(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}projectsRedirect(t,r){return h.fromPromise(this.__projectsRedirect(t,r))}async __projectsRedirect(t,r){var u,w;let{traceId:o,workspaceName:i,path:n}=t,l={};l.trace_id=o,i!=null&&(l.workspace_name=i),l.path=n;let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body,d.rawResponse);case 404:throw new P(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ir=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new Mo(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new Bo(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new Oo(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new Wo(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new Vo(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new Lo(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new Jo(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new Ho(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new Ko(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new Xo(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Go(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new $o(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new Qo(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Yo(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Zo(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new qo(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new et(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new rt(this._options)}isAlive(t){return h.fromPromise(this.__isAlive(t))}async __isAlive(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return h.fromPromise(this.__version(t))}async __version(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new g("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ur=()=>uuid.v7();var ot=class{constructor(t,r){this.data=t;this.opik=r;this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=t=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...t};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...t},this};}};var tt=class{constructor(t,r){this.data=t;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=t=>{var n,l;let r=(l=(n=this.data.projectName)!=null?n:t.projectName)!=null?l:this.opik.config.projectName,o={id:Ur(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new ot(o,this.opik);return this.spans.push(i),i};this.update=t=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...t};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var ml=s=>s.replace("/api",""),gp=({apiUrl:s,projectName:t,workspaceName:r})=>{let o=encodeURIComponent(t);return `${ml(s)}/${r}/redirect/projects?name=${o}`};var dl=300,ul=100,Nr=class{constructor({action:t,batchSize:r=ul,delay:o,enableBatch:i,name:n="ActionQueue"}){this.timerId=null;this.promise=Promise.resolve();this.queue=new Map;this.debounceFlush=()=>{this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>this.flush(),this.delay);};this.add=(t,r)=>{if(this.queue.set(t,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(t,r)=>{let o=this.queue.get(t);o&&(this.queue.set(t,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let t=new Map(this.queue);this.queue.clear(),E.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(E.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{E.error(`Failed to flush ${this.name}:`,r,t);}),await this.promise;};this.action=t,this.batchSize=r,this.delay=o,this.enableBatch=i,this.name=n;}},Q=class{constructor({delay:t=dl,enableCreateBatch:r=true,enableDeleteBatch:o=true,name:i="BatchQueue"}){this.create=t=>{let r=this.getId(t);this.createQueue.add(r,t);};this.get=async t=>{let r=this.createQueue.queue.get(t);return r||this.getEntity(t)};this.update=(t,r)=>{if(this.createQueue.queue.get(t)){this.createQueue.update(t,r);return}this.updateQueue.add(t,r);};this.delete=t=>{if(this.createQueue.queue.has(t)){this.createQueue.queue.delete(t);return}this.deleteQueue.add(t);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=i,this.createQueue=new Nr({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:t,enableBatch:r,name:`${i}:createQueue`}),this.updateQueue=new Nr({action:async n=>{await this.createQueue.flush();let l=Array.from(n.entries());for(let[d,u]of l)await this.updateEntity(d,u);},delay:t,enableBatch:false,name:`${i}:updateQueue`}),this.deleteQueue=new Nr({action:async n=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(n.keys()));},delay:t,enableBatch:o,name:`${i}:deleteQueue`});}};var it=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r});}async getEntity(r){return await this.api.spans.getSpanById(r)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o);}};var at=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanFeedbackScore(o.id,{name:o.name});}};var nt=class extends Q{constructor(r,o){super({delay:o,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r});}async getEntity(r){return await this.api.traces.getTraceById(r)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r});}};var st=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.traces.deleteTraceFeedbackScore(o.id,{name:o.name});}};var Vn=[],Fr=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=gp({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});E.info(`Started logging traces to the "${t}" project at ${Hn(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;E.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new tt({id:Ur(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),E.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.flush=async()=>{E.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),E.info("Successfully flushed all data to Opik");}catch(t){E.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};E.debug("Initializing OpikClient with config:",t),this.config=$n(t),this.api=new Ir({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new it(this.api),this.traceBatchQueue=new nt(this.api),this.spanFeedbackScoresBatchQueue=new at(this.api),this.traceFeedbackScoresBatchQueue=new st(this.api),Vn.push(this);}};var fl="track.decorator",Ln=new async_hooks.AsyncLocalStorage,gl=()=>{let{span:s,trace:t}=Ln.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function hl(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function Rl({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){E.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let n=o;n||(n=ct.trace({name:s,projectName:r}));let l=n.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return E.debug("Span created with ID:",l.data.id),{span:l,trace:n}}function bl({args:s,span:t,trace:r}){if(E.debug("Starting span execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};E.debug("Recording span input"),t.update({input:o}),r&&(E.debug("Recording trace input"),r.update({input:o}));}function hp({result:s,span:t,trace:r}){E.debug("Recording successful execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id});let o=typeof s=="object"?s:{result:s},i=new Date;t.update({endTime:i,output:o}),r&&r.update({endTime:i,output:o});}function Rp({span:s,error:t,trace:r}){var o,i;E.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function pt({name:s,projectName:t,type:r}={},o){return function(...n){let l=Ln.getStore(),{span:d,trace:u}=Rl({name:s!=null?s:o.name||fl,parentSpan:l==null?void 0:l.span,projectName:t,trace:l==null?void 0:l.trace,type:r}),w=!l,f=this;return Ln.run({span:d,trace:u},()=>{try{bl({args:n,span:d,trace:w?u:void 0});let z=o.apply(f,n);return hl(z)?z.then(k=>(hp({span:d,result:k,trace:w?u:void 0}),k),k=>{throw Rp({span:d,error:k,trace:w?u:void 0}),k}):(hp({span:d,result:z,trace:w?u:void 0}),z)}catch(z){throw Rp({span:d,error:z,trace:w?u:void 0}),z}})}}function yl(s,t){if(typeof s=="function")return pt({},s);let r=s;return t?pt(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return pt(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let n=i.value;return i.value=pt(r,n),i}}var ct=new Fr;var zl=async()=>{E.debug("Starting flushAll operation");try{await Promise.all([ct.flush(),...Vn.map(s=>s.flush())]),E.debug("flushAll operation completed successfully");}catch(s){throw E.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};
4
- exports.Opik=Fr;exports.OpikSpanType=gs;exports.disableLogger=Sp;exports.flushAll=zl;exports.generateId=Ur;exports.getTrackContext=gl;exports.logger=E;exports.setLoggerLevel=Kn;exports.track=yl;exports.trackOpikClient=ct;
1
+ 'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),Jn=require('fs'),kp=require('ini'),Ac=require('qs'),uuid=require('uuid'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Jn__default=/*#__PURE__*/_interopDefault(Jn);var kp__default=/*#__PURE__*/_interopDefault(kp);var Ac__default=/*#__PURE__*/_interopDefault(Ac);var hp=Object.defineProperty;var pt=(s,t)=>()=>(s&&(t=s(s=0)),t);var v=(s,t)=>{for(var r in t)hp(s,r,{get:t[r],enumerable:true});};var bs={};v(bs,{Node18UniversalStreamWrapper:()=>Rt});var Rt,ys=pt(()=>{Rt=class s{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(t,r){var o;(o=this.events[t])==null||o.push(r);}off(t,r){var o;this.events[t]=(o=this.events[t])==null?void 0:o.filter(i=>i!==r);}pipe(t){return this.on("data",async r=>{if(t instanceof s)t._write(r);else if(t instanceof WritableStream){let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}else t.write(r);}),this.on("end",async()=>{t instanceof s?t._end():t instanceof WritableStream?t.getWriter().close():t.end();}),this.on("error",async r=>{t instanceof s?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r);}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async r=>{if(t instanceof s)t._write(r);else if(t instanceof WritableStream){let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}else t.write(r);}),this.off("end",async()=>{t instanceof s?t._end():t instanceof WritableStream?t.getWriter().close():t.end();}),this.off("error",async r=>{t instanceof s?t._error(r):t instanceof WritableStream?t.getWriter().abort(r):t.destroy(r);});}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(!t)return r}setEncoding(t){this.encoding=t;}async text(){let t=[];for(;;){let{done:o,value:i}=await this.reader.read();if(o)break;i&&t.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t);}_end(){this._emit("end");}_error(t){this._emit("error",t);}_emit(t,r){if(this.events[t])for(let o of this.events[t]||[])o(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(t){this._emit("error",t);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();return t?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};});var zs={};v(zs,{UndiciStreamWrapper:()=>bt});var bt,ks=pt(()=>{bt=class s{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(t,r){var o;(o=this.events[t])==null||o.push(r);}off(t,r){var o;this.events[t]=(o=this.events[t])==null?void 0:o.filter(i=>i!==r);}pipe(t){return this.on("data",r=>{if(t instanceof s)t._write(r);else {let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}}),this.on("end",()=>{t instanceof s?t._end():t.getWriter().close();}),this.on("error",r=>{t instanceof s?t._error(r):t.getWriter().abort(r);}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",r=>{if(t instanceof s)t._write(r);else {let o=t.getWriter();o.write(r).then(()=>o.releaseLock());}}),this.off("end",()=>{t instanceof s?t._end():t.getWriter().close();}),this.off("error",r=>{t instanceof s?t._error(r):t.getWriter().abort(r);});}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(!t)return r}setEncoding(t){this.encoding=t;}async text(){let t=[];for(;;){let{done:o,value:i}=await this.reader.read();if(o)break;i&&t.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t);}_end(){this._emit("end");}_error(t){this._emit("error",t);}_emit(t,r){if(this.events[t])for(let o of this.events[t]||[])o(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(t){this._emit("error",t);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(o=>{this.resumeCallback=o;});let{done:t,value:r}=await this.reader.read();return t?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};});var Ss={};v(Ss,{NodePre18StreamWrapper:()=>yt});var yt,xs=pt(()=>{yt=class{constructor(t){this.readableStream=t;}on(t,r){this.readableStream.on(t,r);}off(t,r){this.readableStream.off(t,r);}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe();}destroy(t){this.readableStream.destroy(t);}pause(){this.readableStream.pause();}resume(){this.readableStream.resume();}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((t,r)=>{let o=this.readableStream.read();o?t(o):(this.readableStream.once("readable",()=>{let i=this.readableStream.read();t(i);}),this.readableStream.once("error",r));})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t;}async text(){let t=[],r=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let i of this.readableStream)t.push(r.encode(i));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(t))}async json(){let t=await this.text();return JSON.parse(t)}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return {async next(){let{value:o,done:i}=await r.next();return {value:o,done:i}},[Symbol.asyncIterator](){return this}}}};});var yp={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Ln(s,t=s){return ansiEscapes.link(t,s)}var E=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Hn=s=>{E.settings.minLevel=yp[s];},zp=()=>{E.settings.minLevel=100;};Hn(process.env.OPIK_LOG_LEVEL||"INFO");var Sp="~/.opik.config",xp={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function Kn(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function _p(){return Kn({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function Pp(){let s=process.env.OPIK_CONFIG_PATH||Sp;if(!Jn__default.default.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=kp__default.default.parse(Jn__default.default.readFileSync(s,"utf8"));return t.opik?Kn({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return E.error(`Error loading config file ${s}: ${t}`),{}}}function Xn(s){let t=_p(),r=Pp();return Ap({...xp,...r,...t,...s})}function Ap(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=Tp(s.apiUrl);if(t&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(t&&(!s.workspaceName||s.workspaceName==="default"))throw new Error("OPIK_WORKSPACE is not set");return s}function Tp(s){return new URL(s).hostname.endsWith("comet.com")}var J={};v(J,{AssistantMessageRole:()=>Mp,AttachmentListRequestEntityType:()=>Gn,BadRequestError:()=>j,CheckName:()=>zc,CheckPublicName:()=>Sc,CheckPublicResult:()=>xc,CheckResult:()=>kc,ColumnCompareTypesItem:()=>Hp,ColumnPublicTypesItem:()=>$p,ColumnTypesItem:()=>Qp,CompleteMultipartUploadRequestEntityType:()=>vp,ConflictError:()=>H,DatasetItemCompareSource:()=>Jp,DatasetItemPublicSource:()=>Gp,DatasetItemSource:()=>Wp,DatasetItemWriteSource:()=>Lp,DatasetPublicVisibility:()=>Xp,DatasetUpdateVisibility:()=>qn,DatasetVisibility:()=>Op,DatasetWriteVisibility:()=>Zn,DeleteAttachmentsRequestEntityType:()=>Ep,DownloadAttachmentRequestEntityType:()=>$n,ExperimentPublicType:()=>Zp,ExperimentType:()=>Yp,ExperimentWriteType:()=>es,FeedbackScoreBatchItemSource:()=>bc,FeedbackScoreCompareSource:()=>Kp,FeedbackScorePublicSource:()=>hc,FeedbackScoreSource:()=>Vp,FindFeedbackDefinitionsRequestType:()=>rs,FindFeedbackScoreNames1RequestType:()=>ms,ForbiddenError:()=>O,GetSpanStatsRequestType:()=>ds,GetSpansByProjectRequestType:()=>ls,GuardrailName:()=>qp,GuardrailResult:()=>ec,GuardrailWriteName:()=>rc,GuardrailWriteResult:()=>oc,LlmAsJudgeMessagePublicRole:()=>Np,LlmAsJudgeMessageRole:()=>Cp,LlmAsJudgeMessageWriteRole:()=>Ip,LlmAsJudgeOutputSchemaPublicType:()=>Fp,LlmAsJudgeOutputSchemaType:()=>jp,LlmAsJudgeOutputSchemaWriteType:()=>Up,LogItemLevel:()=>Dp,NotFoundError:()=>P,NotImplementedError:()=>fe,OptimizationPublicStatus:()=>nc,OptimizationStatus:()=>ac,OptimizationUpdateStatus:()=>is,OptimizationWriteStatus:()=>ts,ProjectDetailedVisibility:()=>mc,ProjectMetricRequestPublicInterval:()=>ps,ProjectMetricRequestPublicMetricType:()=>ss,ProjectMetricResponsePublicInterval:()=>lc,ProjectMetricResponsePublicMetricType:()=>cc,ProjectPublicVisibility:()=>pc,ProjectUpdateVisibility:()=>ns,ProjectVisibility:()=>sc,ProjectWriteVisibility:()=>as,PromptType:()=>dc,PromptVersionDetailType:()=>wc,PromptVersionPublicType:()=>gc,PromptVersionType:()=>uc,PromptWriteType:()=>cs,ProviderApiKeyProvider:()=>ic,ProviderApiKeyPublicProvider:()=>tc,ProviderApiKeyWriteProvider:()=>os,ResponseFormatType:()=>Bp,SpanFilterPublicOperator:()=>yc,SpanPublicType:()=>Rc,SpanSearchStreamRequestPublicType:()=>us,SpanType:()=>ws,SpanWriteType:()=>fc,StartMultipartUploadRequestEntityType:()=>Qn,TraceFilterPublicOperator:()=>_c,UnauthorizedError:()=>F,UnprocessableEntityError:()=>X,UploadAttachmentRequestEntityType:()=>Yn,attachments:()=>Fr,automationRuleEvaluators:()=>mt,chatCompletions:()=>dt,check:()=>lt,datasets:()=>Dr,experiments:()=>Mr,feedbackDefinitions:()=>Br,guardrails:()=>ut,llmProviderKey:()=>Or,openTelemetryIngestion:()=>wt,optimizations:()=>Wr,projects:()=>Vr,prompts:()=>Lr,redirect:()=>ht,serviceToggles:()=>gt,spans:()=>Hr,systemUsage:()=>ct,traces:()=>ft});var Fr={};v(Fr,{AttachmentListRequestEntityType:()=>Gn,DownloadAttachmentRequestEntityType:()=>$n,StartMultipartUploadRequestEntityType:()=>Qn,UploadAttachmentRequestEntityType:()=>Yn});var Gn={Trace:"trace",Span:"span"};var $n={Trace:"trace",Span:"span"};var Qn={Trace:"trace",Span:"span"};var Yn={Trace:"trace",Span:"span"};var Dr={};v(Dr,{DatasetUpdateVisibility:()=>qn,DatasetWriteVisibility:()=>Zn});var Zn={Private:"private",Public:"public"};var qn={Private:"private",Public:"public"};var Mr={};v(Mr,{ExperimentWriteType:()=>es});var es={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Br={};v(Br,{FindFeedbackDefinitionsRequestType:()=>rs});var rs={Numerical:"numerical",Categorical:"categorical"};var Or={};v(Or,{ProviderApiKeyWriteProvider:()=>os});var os={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var Wr={};v(Wr,{OptimizationUpdateStatus:()=>is,OptimizationWriteStatus:()=>ts});var ts={Running:"running",Completed:"completed",Cancelled:"cancelled"};var is={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Vr={};v(Vr,{ProjectMetricRequestPublicInterval:()=>ps,ProjectMetricRequestPublicMetricType:()=>ss,ProjectUpdateVisibility:()=>ns,ProjectWriteVisibility:()=>as});var as={Private:"private",Public:"public"};var ns={Private:"private",Public:"public"};var ss={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var ps={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Lr={};v(Lr,{PromptWriteType:()=>cs});var cs={Mustache:"mustache",Jinja2:"jinja2"};var Hr={};v(Hr,{FindFeedbackScoreNames1RequestType:()=>ms,GetSpanStatsRequestType:()=>ds,GetSpansByProjectRequestType:()=>ls,SpanSearchStreamRequestPublicType:()=>us});var ls={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ms={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ds={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var us={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ct={};var lt={};var mt={};var dt={};var ut={};var wt={};var gt={};var ft={};var ht={};var vp={Trace:"trace",Span:"span"};var Ep={Trace:"trace",Span:"span"};var Cp={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var jp={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ip={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Up={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Np={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Fp={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Dp={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Mp={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Bp={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Op={Private:"private",Public:"public"};var Wp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Vp={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Lp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Hp={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Jp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Kp={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Xp={Private:"private",Public:"public"};var Gp={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var $p={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Qp={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Yp={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Zp={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var qp={Topic:"TOPIC",Pii:"PII"};var ec={Passed:"passed",Failed:"failed"};var rc={Topic:"TOPIC",Pii:"PII"};var oc={Passed:"passed",Failed:"failed"};var tc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var ic={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai"};var ac={Running:"running",Completed:"completed",Cancelled:"cancelled"};var nc={Running:"running",Completed:"completed",Cancelled:"cancelled"};var sc={Private:"private",Public:"public"};var pc={Private:"private",Public:"public"};var cc={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var lc={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var mc={Private:"private",Public:"public"};var dc={Mustache:"mustache",Jinja2:"jinja2"};var uc={Mustache:"mustache",Jinja2:"jinja2"};var wc={Mustache:"mustache",Jinja2:"jinja2"};var gc={Mustache:"mustache",Jinja2:"jinja2"};var ws={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var fc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var hc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Rc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var bc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var yc={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var zc={Topic:"TOPIC",Pii:"PII"};var kc={Passed:"passed",Failed:"failed"};var Sc={Topic:"TOPIC",Pii:"PII"};var xc={Passed:"passed",Failed:"failed"};var _c={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var ne=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(Pc({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function Pc({message:s,statusCode:t,body:r}){let o=[];return s!=null&&o.push(s),t!=null&&o.push(`Status code: ${t.toString()}`),r!=null&&o.push(`Body: ${ne(r,void 0,2)}`),o.join(`
2
+ `)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var F=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var O=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var j=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var P=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var H=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var fe=class s extends p{constructor(t,r){super({message:"NotImplementedError",statusCode:501,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var R={Default:"http://localhost:5173/api"};var he;typeof globalThis.Headers!="undefined"?he=globalThis.Headers:he=class gs{constructor(t){if(this.headers=new Map,t)if(t instanceof gs)t.forEach((r,o)=>this.append(o,r));else if(Array.isArray(t))for(let[r,o]of t)if(typeof r=="string"&&typeof o=="string")this.append(r,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,o]of Object.entries(t))if(typeof o=="string")this.append(r,o);else throw new TypeError("Header values must be strings")}append(t,r){let o=t.toLowerCase(),i=this.headers.get(o)||[];this.headers.set(o,[...i,r]);}delete(t){let r=t.toLowerCase();this.headers.delete(r);}get(t){let r=t.toLowerCase(),o=this.headers.get(r);return o?o.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let o=t.toLowerCase();this.headers.set(o,[r]);}forEach(t,r){let o=r?t.bind(r):t;this.headers.forEach((i,n)=>o(i.join(", "),n,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield [t,r.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let t of this.headers.values())yield t.join(", ");}[Symbol.iterator](){return this.entries()}};var Jr={headers:new he,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},Kr={headers:new he,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function Xr(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function fs(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${Ac__default.default.stringify(t,{arrayFormat:"repeat"})}`:s}var m=Tc();function Tc(){var u,w,g,z,k;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((u=globalThis==null?void 0:globalThis.navigator)==null?void 0:u.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((w=self.constructor)==null?void 0:w.name)==="DedicatedWorkerGlobalScope"||((g=self.constructor)==null?void 0:g.name)==="ServiceWorkerGlobalScope"||((z=self.constructor)==null?void 0:z.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((k=process.versions)!=null&&k.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function hs(){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?fetch:m.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function Rs({body:s,type:t}){return t.includes("json")?ne(s):s}async function _s(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await Promise.resolve().then(()=>(ys(),bs))).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(ks(),zs))).UndiciStreamWrapper(s):new(await Promise.resolve().then(()=>(xs(),Ss))).NodePre18StreamWrapper(s)}async function Ps(s,t){if(s.body!=null&&t==="blob")return await s.blob();if(s.body!=null&&t==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&t==="sse")return s.body;if(s.body!=null&&t==="streaming")return _s(s.body);if(s.body!=null&&t==="text")return await s.text();{let r=await s.text();if(r.length>0)try{return JSON.parse(r)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:r}}}else return}}var vc="timeout";function As(s){let t=new AbortController,r=setTimeout(()=>t.abort(vc),s);return {signal:t.signal,abortId:r}}function Ts(...s){let t=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of t){if(o.aborted){r.abort(o==null?void 0:o.reason);break}o.addEventListener("abort",()=>r.abort(o==null?void 0:o.reason),{signal:r.signal});}return r.signal}var vs=async(s,t,r,o,i,n,l,d,u)=>{let w=[],g;if(n!=null){let{signal:_,abortId:I}=As(n);g=I,w.push(_);}l!=null&&w.push(l);let z=Ts(w),k=await s(t,{method:r,headers:o,body:i,signal:z,credentials:d?"include":void 0,duplex:u});return g!=null&&clearTimeout(g),k};function Ec(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Es(s,t=2){let r=await s();for(let o=0;o<t&&([408,429].includes(r.status)||r.status>=500);++o){let i=Math.min(1e3*Math.pow(2,o),6e4),n=Ec(i);await new Promise(l=>setTimeout(l,n)),r=await s();}return r}async function Cc(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[n,l]of Object.entries(s.headers))l!=null&&(t[n]=l);let r=fs(s.url,s.queryParameters),o=await Rs({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await hs();try{let n=await Es(async()=>vs(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Ps(n,s.responseType);return n.status>=200&&n.status<400?{ok:!0,body:l,headers:n.headers,rawResponse:Xr(n)}:{ok:!1,error:{reason:"status-code",statusCode:n.status,body:l},rawResponse:Xr(n)}}catch(n){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Jr}:n instanceof Error&&n.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:Jr}:n instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:n.message},rawResponse:Kr}:{ok:false,error:{reason:"unknown",errorMessage:ne(n)},rawResponse:Kr}}}var b=Cc;var a={get:async s=>typeof s=="function"?s():s};var h=class s extends Promise{constructor(t){super(r=>{r(void 0);}),this.innerPromise=t;}static fromFunction(t,...r){return new s(t(...r))}static interceptFunction(t){return (...r)=>s.fromPromise(t(...r))}static fromPromise(t){return new s(t)}static fromExecutor(t){let r=new Promise(t);return new s(r)}static fromResult(t){let r=Promise.resolve(t);return new s(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var e={};v(e,{JsonError:()=>se,ParseError:()=>pe,any:()=>Js,bigint:()=>js,boolean:()=>Ks,booleanLiteral:()=>Hs,date:()=>Is,discriminant:()=>rp,enum_:()=>$r,getObjectLikeUtils:()=>G,getObjectUtils:()=>te,getSchemaUtils:()=>T,isProperty:()=>oe,lazy:()=>Us,lazyObject:()=>Ws,list:()=>Yr,number:()=>Xs,object:()=>Qr,objectWithoutOptionalProperties:()=>Os,optional:()=>zt,property:()=>Fs,record:()=>Ys,set:()=>Zs,string:()=>Gs,stringLiteral:()=>Ls,transform:()=>kt,undiscriminatedUnion:()=>ep,union:()=>tp,unknown:()=>$s,withParsedProperties:()=>xt});var x={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function A(s,t){return `Expected ${t}. Received ${jc(s)}.`}function jc(s){if(Array.isArray(s))return "list";if(s===null)return "null";if(s instanceof BigInt)return "BigInt";switch(typeof s){case "string":return `"${s}"`;case "bigint":case "number":case "boolean":case "undefined":return `${s}`}return typeof s}function D(s){return {...s,json:Cs(s.json),parse:Cs(s.parse)}}function Cs(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(n=>" - "+(n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message))].join(`
3
+ `)),{ok:true,value:t}):o}}function Gr(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var se=class s extends Error{constructor(r){super(r.map(Gr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var pe=class s extends Error{constructor(r){super(r.map(Gr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function T(s){return {nullable:()=>Ic(s),optional:()=>zt(s),optionalNullable:()=>Uc(s),transform:t=>kt(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new pe(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new se(o.errors)}}}function Ic(s){let t={parse:(r,o)=>r==null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r==null?{ok:true,value:null}:s.json(r,o),getType:()=>x.NULLABLE};return {...t,...T(t)}}function zt(s){let t={parse:(r,o)=>r==null?{ok:true,value:void 0}:s.parse(r,o),json:(r,o)=>o!=null&&o.omitUndefined&&r===void 0?{ok:true,value:void 0}:r==null?{ok:true,value:null}:s.json(r,o),getType:()=>x.OPTIONAL};return {...t,...T(t)}}function Uc(s){let t={parse:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.json(r,o),getType:()=>x.OPTIONAL_NULLABLE};return {...t,...T(t)}}function kt(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);return n.ok?{ok:true,value:t.transform(n.value)}:n},json:(o,i)=>{let n=t.untransform(o);return s.json(n,i)},getType:()=>s.getType()};return {...r,...T(r)}}function js(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:true,value:t}:typeof t=="number"?{ok:true,value:BigInt(t)}:{ok:false,errors:[{path:r,message:A(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:A(t,"bigint")}]}:{ok:true,value:t},getType:()=>x.BIGINT};return {...D(s),...T(s)}}var Nc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Is(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:A(t,"string")}]}:Nc.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:A(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:A(t,"Date object")}]},getType:()=>x.DATE};return {...D(s),...T(s)}}function W(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...D(r),...T(r)}}}function $r(s){let t=new Set(s);return W(x.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:n=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:n,message:A(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:n,message:A(o,"enum")}]}:{ok:true,value:o})()}function Us(s){let t=St(s);return {...t,...T(t)}}function St(s){return {parse:(t,r)=>ce(s).parse(t,r),json:(t,r)=>ce(s).json(t,r),getType:()=>ce(s).getType()}}function ce(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function Re(s){return Object.entries(s)}function be(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,n])=>(r.has(i)&&(o[i]=n),o),{})}function re(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t}function ye(s){return Object.keys(s)}function Ns(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function G(s){return {withParsedProperties:t=>xt(s,t)}}function xt(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);if(!n.ok)return n;let l=Object.entries(t).reduce((d,[u,w])=>({...d,[u]:typeof w=="function"?w(n.value):w}),{});return {ok:true,value:{...n.value,...l}}},json:(o,i)=>{var d;if(!re(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:A(o,"object")}]};let n=new Set(Object.keys(t)),l=be(o,Object.keys(o).filter(u=>!n.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...T(r),...G(r)}}function Fs(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function oe(s){return s.isProperty}function Qr(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>oe(o)?o.rawKey:r),_getParsedProperties:()=>ye(s),parse:(r,o)=>{let i={},n=[];for(let[l,d]of Re(s)){let u=oe(d)?d.rawKey:l,w=oe(d)?d.valueSchema:d,g={rawKey:u,parsedKey:l,valueSchema:w};i[u]=g,Bs(w)&&n.push(u);}return Ds({value:r,requiredKeys:n,getProperty:l=>{let d=i[l];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var w;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(w=o==null?void 0:o.breadcrumbsPrefix)!=null?w:[],l]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},json:(r,o)=>{let i=[];for(let[n,l]of Re(s)){let d=oe(l)?l.valueSchema:l;Bs(d)&&i.push(n);}return Ds({value:r,requiredKeys:i,getProperty:n=>{let l=s[n];if(l!=null)return oe(l)?{transformedKey:l.rawKey,transform:d=>{var u;return l.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}:{transformedKey:n,transform:d=>{var u;return l.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},getType:()=>x.OBJECT};return {...D(t),...T(t),...G(t),...te(t)}}function Ds({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:n=[]}){if(!re(s))return {ok:false,errors:[{path:n,message:A(s,"object")}]};let l=new Set(t),d=[],u={};for(let[w,g]of Object.entries(s)){let z=r(w);if(z!=null){l.delete(w);let k=z.transform(g);k.ok?u[z.transformedKey]=k.value:(u[w]=g,d.push(...k.errors));}else switch(o){case "fail":d.push({path:[...n,w],message:`Unexpected key "${w}"`});break;case "strip":break;case "passthrough":u[w]=g;break}}return d.push(...t.filter(w=>l.has(w)).map(w=>({path:n,message:`Missing required key "${w}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function te(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Ms({extensionKeys:t._getRawProperties(),value:o,transformBase:n=>s.parse(n,i),transformExtension:n=>t.parse(n,i)}),json:(o,i)=>Ms({extensionKeys:t._getParsedProperties(),value:o,transformBase:n=>s.json(n,i),transformExtension:n=>t.json(n,i)}),getType:()=>x.OBJECT};return {...r,...T(r),...G(r),...te(r)}},passthrough:()=>{let t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let i=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},json:(r,o)=>{let i=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},getType:()=>x.OBJECT};return {...t,...T(t),...G(t),...te(t)}}}}function Ms({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[n,l]=Ns(ye(t),w=>i.has(w)),d=r(be(t,l)),u=o(be(t,n));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function Bs(s){return !Fc(s)}function Fc(s){switch(s.getType()){case x.ANY:case x.UNKNOWN:case x.OPTIONAL:case x.OPTIONAL_NULLABLE:return true;default:return false}}function Os(s){return Qr(s)}function Ws(s){let t={...St(s),_getRawProperties:()=>ce(s)._getRawProperties(),_getParsedProperties:()=>ce(s)._getParsedProperties()};return {...t,...T(t),...G(t),...te(t)}}function Yr(s){let t={parse:(r,o)=>Vs(r,(i,n)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${n}]`]})}),json:(r,o)=>Vs(r,(i,n)=>{var l;return s.json(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${n}]`]})}),getType:()=>x.LIST};return {...D(t),...T(t)}}function Vs(s,t){return Array.isArray(s)?s.map((o,i)=>t(o,i)).reduce((o,i)=>{if(o.ok&&i.ok)return {ok:true,value:[...o.value,i.value]};let n=[];return o.ok||n.push(...o.errors),i.ok||n.push(...i.errors),{ok:false,errors:n}},{ok:true,value:[]}):{ok:false,errors:[{message:A(s,"list"),path:[]}]}}function Ls(s){return W(x.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:A(r,`"${s}"`)}]})()}function Hs(s){return W(x.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:A(r,`${s.toString()}`)}]})()}var Js=W(x.ANY,s=>({ok:true,value:s}));var Ks=W(x.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"boolean")}]});var Xs=W(x.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"number")}]});var Gs=W(x.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:A(s,"string")}]});var $s=W(x.UNKNOWN,s=>({ok:true,value:s}));function Ys(s,t){let r={parse:(o,i)=>Qs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var l;return s.parse(n,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${n} (key)`]})},transformValue:(n,l)=>{var d;return t.parse(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>Qs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var l;return s.json(n,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${n} (key)`]})},transformValue:(n,l)=>{var d;return t.json(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>x.RECORD};return {...D(r),...T(r)}}function Qs({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return re(s)?Re(s).reduce((n,[l,d])=>{if(d===void 0)return n;let u=n,w=l;if(t){let _=l.length>0?Number(l):NaN;isNaN(_)||(w=_);}let g=r(w),z=o(d,w);if(u.ok&&g.ok&&z.ok)return {ok:true,value:{...u.value,[g.value]:z.value}};let k=[];return u.ok||k.push(...u.errors),g.ok||k.push(...g.errors),z.ok||k.push(...z.errors),{ok:false,errors:k}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:A(s,"object")}]}}function Zs(s){let t=Yr(s),r={parse:(o,i)=>{let n=t.parse(o,i);return n.ok?{ok:true,value:new Set(n.value)}:n},json:(o,i)=>{var l;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],message:A(o,"Set")}]}},getType:()=>x.SET};return {...D(r),...T(r)}}function ep(s){let t={parse:(r,o)=>qs((i,n)=>i.parse(r,n),s,o),json:(r,o)=>qs((i,n)=>i.json(r,n),s,o),getType:()=>x.UNDISCRIMINATED_UNION};return {...D(t),...T(t)}}function qs(s,t,r){let o=[];for(let[i,n]of t.entries()){let l=s(n,{...r,skipValidation:false});if(l.ok)return l;for(let d of l.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function rp(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function tp(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=$r(ye(t)),n={parse:(l,d)=>op({value:l,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var w;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(w=d==null?void 0:d.breadcrumbsPrefix)!=null?w:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,w)=>w.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(l,d)=>op({value:l,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var w;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(w=d==null?void 0:d.breadcrumbsPrefix)!=null?w:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,w)=>w.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>x.UNION};return {...D(n),...T(n),...G(n)}}function op({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!re(s))return {ok:false,errors:[{path:d,message:A(s,"object")}]};let{[t]:u,...w}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let g=o(u);if(!g.ok)return {ok:false,errors:g.errors};let z=i(g.value);if(z==null)return n?{ok:true,value:{[r]:g.value,...w}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let k=l(w,z);return k.ok?{ok:true,value:{[r]:u,...k.value}}:k}function Dc(s){var t=[];if(s.length===0)return "";if(typeof s[0]!="string")throw new TypeError("Url must be a string. Received "+s[0]);if(s[0].match(/^[^/:]+:\/*$/)&&s.length>1){var r=s.shift();s[0]=r+s[0];}s[0].match(/^file:\/\/\//)?s[0]=s[0].replace(/^([^/:]+):\/*/,"$1:///"):s[0]=s[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<s.length;o++){var i=s[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<s.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i));}var n=t.join("/");n=n.replace(/\/(\?|&|#[^!])/g,"$1");var l=n.split("?");return n=l.shift()+(l.length>0?"?":"")+l.join("&"),n}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),Dc(s)}var N={};v(N,{AssistantMessage:()=>Di,AssistantMessageRole:()=>Fi,Attachment:()=>$t,AttachmentListRequestEntityType:()=>Zr,AttachmentPage:()=>Qt,AuthDetailsHolder:()=>ri,AutomationRuleEvaluator:()=>Lc,AutomationRuleEvaluatorLlmAsJudge:()=>pi,AutomationRuleEvaluatorLlmAsJudgePublic:()=>lr,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>fi,AutomationRuleEvaluatorObjectPublic:()=>Ai,AutomationRuleEvaluatorPagePublic:()=>Ti,AutomationRuleEvaluatorPublic:()=>vi,AutomationRuleEvaluatorUpdate:()=>Ni,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>Ii,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>Ui,AutomationRuleEvaluatorUserDefinedMetricPython:()=>ci,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>mr,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Ri,AutomationRuleEvaluatorWrite:()=>bi,AvgValueStatPublic:()=>kn,BatchDelete:()=>M,BiInformation:()=>Ht,BiInformationResponse:()=>sr,CategoricalFeedbackDefinition:()=>ha,CategoricalFeedbackDefinitionCreate:()=>za,CategoricalFeedbackDefinitionPublic:()=>br,CategoricalFeedbackDefinitionUpdate:()=>Ca,CategoricalFeedbackDetail:()=>fa,CategoricalFeedbackDetailCreate:()=>ya,CategoricalFeedbackDetailPublic:()=>_a,CategoricalFeedbackDetailUpdate:()=>Ea,ChatCompletionChoice:()=>Bi,ChatCompletionRequest:()=>ar,ChatCompletionResponse:()=>Li,Check:()=>Cn,CheckName:()=>vn,CheckPublic:()=>Fn,CheckPublicName:()=>Un,CheckPublicResult:()=>Nn,CheckResult:()=>En,ChunkedOutputJsonNode:()=>Kc,ChunkedOutputJsonNodePublic:()=>$c,ChunkedOutputJsonNodePublicType:()=>ga,ChunkedOutputJsonNodeType:()=>ma,Column:()=>ca,ColumnCompare:()=>Gi,ColumnCompareTypesItem:()=>Xi,ColumnPublic:()=>na,ColumnPublicTypesItem:()=>aa,ColumnTypesItem:()=>pa,Comment:()=>B,CommentCompare:()=>$i,CommentPublic:()=>ae,CompleteMultipartUploadRequest:()=>jo,CompleteMultipartUploadRequestEntityType:()=>Yt,CompletionTokensDetails:()=>Wi,CountValueStatPublic:()=>Sn,CreatePromptVersionDetail:()=>He,DataPointNumberPublic:()=>$a,Dataset:()=>Hc,DatasetIdentifier:()=>_e,DatasetIdentifierPublic:()=>Ae,DatasetItem:()=>Ki,DatasetItemBatch:()=>Jc,DatasetItemBatchWrite:()=>Se,DatasetItemCompare:()=>ea,DatasetItemCompareSource:()=>Qi,DatasetItemPageCompare:()=>ra,DatasetItemPagePublic:()=>sa,DatasetItemPublic:()=>wr,DatasetItemPublicSource:()=>ia,DatasetItemSource:()=>Ji,DatasetItemStreamRequest:()=>Te,DatasetItemWrite:()=>Pt,DatasetItemWriteSource:()=>_t,DatasetItemsDelete:()=>Pe,DatasetPagePublic:()=>ta,DatasetPublic:()=>we,DatasetPublicVisibility:()=>oa,DatasetUpdate:()=>xe,DatasetUpdateVisibility:()=>io,DatasetVisibility:()=>Hi,DatasetWrite:()=>ke,DatasetWriteVisibility:()=>to,DeleteAttachmentsRequest:()=>Vc,DeleteAttachmentsRequestEntityType:()=>qt,DeleteFeedbackScore:()=>xr,DeleteIdsHolder:()=>gr,DeleteTraceThreads:()=>rr,Delta:()=>Mi,DownloadAttachmentRequestEntityType:()=>qr,ErrorInfo:()=>Z,ErrorInfoPublic:()=>_r,ErrorInfoWrite:()=>Xe,ErrorMessage:()=>K,ErrorMessageDetail:()=>il,ErrorMessageDetailed:()=>ol,ErrorMessagePublic:()=>Gc,Experiment:()=>Xc,ExperimentItem:()=>Ee,ExperimentItemCompare:()=>qi,ExperimentItemPublic:()=>ur,ExperimentItemStreamRequest:()=>Ie,ExperimentItemsBatch:()=>Ce,ExperimentItemsDelete:()=>je,ExperimentPagePublic:()=>wa,ExperimentPublic:()=>Rr,ExperimentPublicType:()=>ua,ExperimentStreamRequestPublic:()=>Ue,ExperimentType:()=>da,ExperimentWrite:()=>ve,ExperimentWriteType:()=>no,ExportTraceServiceRequest:()=>qc,Feedback:()=>Qc,FeedbackCreate:()=>xa,FeedbackDefinitionPagePublic:()=>Ta,FeedbackObjectPublic:()=>Aa,FeedbackPublic:()=>va,FeedbackScore:()=>$,FeedbackScoreAverage:()=>ee,FeedbackScoreAverageDetailed:()=>on,FeedbackScoreAveragePublic:()=>fr,FeedbackScoreBatch:()=>vr,FeedbackScoreBatchItem:()=>Tn,FeedbackScoreBatchItemSource:()=>An,FeedbackScoreCompare:()=>Zi,FeedbackScoreCompareSource:()=>Yi,FeedbackScoreNames:()=>Ga,FeedbackScorePublic:()=>Pr,FeedbackScorePublicSource:()=>bn,FeedbackScoreSource:()=>At,FeedbackUpdate:()=>Ua,FindFeedbackDefinitionsRequestType:()=>co,FindFeedbackScoreNames1RequestType:()=>_o,Function:()=>ir,FunctionCall:()=>q,GetSpanStatsRequestType:()=>Po,GetSpansByProjectRequestType:()=>xo,Guardrail:()=>Da,GuardrailBatch:()=>Yc,GuardrailBatchWrite:()=>nr,GuardrailName:()=>Na,GuardrailResult:()=>Fa,GuardrailWrite:()=>Lt,GuardrailWriteName:()=>Wt,GuardrailWriteResult:()=>Vt,GuardrailsValidation:()=>jn,GuardrailsValidationPublic:()=>Dn,JsonNode:()=>S,JsonNodeCompare:()=>Io,JsonNodeDetail:()=>Tt,JsonNodePublic:()=>L,JsonNodeWrite:()=>V,JsonSchema:()=>Mt,LlmAsJudgeCode:()=>pr,LlmAsJudgeCodePublic:()=>_i,LlmAsJudgeCodeWrite:()=>gi,LlmAsJudgeMessage:()=>ai,LlmAsJudgeMessagePublic:()=>ki,LlmAsJudgeMessagePublicRole:()=>zi,LlmAsJudgeMessageRole:()=>ii,LlmAsJudgeMessageWrite:()=>di,LlmAsJudgeMessageWriteRole:()=>mi,LlmAsJudgeModelParameters:()=>ti,LlmAsJudgeModelParametersPublic:()=>yi,LlmAsJudgeModelParametersWrite:()=>li,LlmAsJudgeOutputSchema:()=>si,LlmAsJudgeOutputSchemaPublic:()=>xi,LlmAsJudgeOutputSchemaPublicType:()=>Si,LlmAsJudgeOutputSchemaType:()=>ni,LlmAsJudgeOutputSchemaWrite:()=>wi,LlmAsJudgeOutputSchemaWriteType:()=>ui,LogItem:()=>Ci,LogItemLevel:()=>Ei,LogPage:()=>ji,Message:()=>Nt,MultipartUploadPart:()=>Zt,NumericalFeedbackDefinition:()=>ba,NumericalFeedbackDefinitionCreate:()=>Sa,NumericalFeedbackDefinitionPublic:()=>yr,NumericalFeedbackDefinitionUpdate:()=>Ia,NumericalFeedbackDetail:()=>Ra,NumericalFeedbackDetailCreate:()=>ka,NumericalFeedbackDetailPublic:()=>Pa,NumericalFeedbackDetailUpdate:()=>ja,Optimization:()=>el,OptimizationPagePublic:()=>La,OptimizationPublic:()=>kr,OptimizationPublicStatus:()=>Va,OptimizationStatus:()=>Wa,OptimizationUpdate:()=>Me,OptimizationUpdateStatus:()=>go,OptimizationWrite:()=>De,OptimizationWriteStatus:()=>wo,PageColumns:()=>la,PercentageValueStatPublic:()=>xn,PercentageValues:()=>ie,PercentageValuesDetailed:()=>tn,PercentageValuesPublic:()=>hr,Project:()=>rl,ProjectDetailed:()=>nn,ProjectDetailedVisibility:()=>an,ProjectMetricRequestPublic:()=>We,ProjectMetricRequestPublicInterval:()=>yo,ProjectMetricRequestPublicMetricType:()=>bo,ProjectMetricResponsePublic:()=>qa,ProjectMetricResponsePublicInterval:()=>Ya,ProjectMetricResponsePublicMetricType:()=>Qa,ProjectPagePublic:()=>Ka,ProjectPublic:()=>Sr,ProjectPublicVisibility:()=>Ja,ProjectRetrieveDetailed:()=>Ve,ProjectStatItemObjectPublic:()=>Pn,ProjectStatsPublic:()=>Tr,ProjectStatsSummary:()=>rn,ProjectStatsSummaryItem:()=>en,ProjectUpdate:()=>Oe,ProjectUpdateVisibility:()=>Ro,ProjectVisibility:()=>Ha,ProjectWrite:()=>Be,ProjectWriteVisibility:()=>ho,Prompt:()=>tl,PromptDetail:()=>ln,PromptPagePublic:()=>gn,PromptPublic:()=>wn,PromptTokensDetails:()=>Oi,PromptType:()=>sn,PromptUpdatable:()=>Je,PromptVersion:()=>cn,PromptVersionDetail:()=>Y,PromptVersionDetailType:()=>vt,PromptVersionLink:()=>Uo,PromptVersionLinkPublic:()=>No,PromptVersionLinkWrite:()=>po,PromptVersionPagePublic:()=>un,PromptVersionPublic:()=>dn,PromptVersionPublicType:()=>mn,PromptVersionRetrieveDetail:()=>Ke,PromptVersionType:()=>pn,PromptWrite:()=>Le,PromptWriteType:()=>ko,ProviderApiKey:()=>Zc,ProviderApiKeyPagePublic:()=>Ba,ProviderApiKeyProvider:()=>Oa,ProviderApiKeyPublic:()=>zr,ProviderApiKeyPublicProvider:()=>Ma,ProviderApiKeyUpdate:()=>Fe,ProviderApiKeyWrite:()=>Ne,ProviderApiKeyWriteProvider:()=>mo,ResponseFormat:()=>Bt,ResponseFormatType:()=>Dt,ResultsNumberPublic:()=>Za,ScoreName:()=>Xa,ServiceTogglesConfig:()=>fn,Span:()=>Rn,SpanBatch:()=>al,SpanBatchWrite:()=>$e,SpanFilterPublic:()=>jt,SpanFilterPublicOperator:()=>Ct,SpanPagePublic:()=>zn,SpanPublic:()=>Ar,SpanPublicType:()=>yn,SpanSearchStreamRequestPublic:()=>Ye,SpanSearchStreamRequestPublicType:()=>Ao,SpanType:()=>hn,SpanUpdate:()=>Qe,SpanWrite:()=>Ge,SpanWriteType:()=>Et,SpansCountResponse:()=>Kt,StartMultipartUploadRequest:()=>ze,StartMultipartUploadRequestEntityType:()=>eo,StartMultipartUploadResponse:()=>ei,StreamOptions:()=>Ft,Tool:()=>Ot,ToolCall:()=>dr,Trace:()=>In,TraceBatch:()=>nl,TraceBatchWrite:()=>qe,TraceCountResponse:()=>Gt,TraceFilterPublic:()=>Ut,TraceFilterPublicOperator:()=>It,TracePagePublic:()=>Bn,TracePublic:()=>Er,TraceSearchStreamRequestPublic:()=>tr,TraceThread:()=>Cr,TraceThreadIdentifier:()=>or,TraceThreadPage:()=>Mn,TraceUpdate:()=>er,TraceWrite:()=>Ze,UploadAttachmentRequestEntityType:()=>ro,Usage:()=>Vi,UserDefinedMetricPythonCode:()=>cr,UserDefinedMetricPythonCodePublic:()=>Pi,UserDefinedMetricPythonCodeWrite:()=>hi,WorkspaceNameHolder:()=>oi,WorkspaceSpansCount:()=>Jt,WorkspaceTraceCount:()=>Xt,attachments:()=>le,chatCompletions:()=>Eo,datasets:()=>ao,experiments:()=>me,feedbackDefinitions:()=>lo,guardrails:()=>Co,llmProviderKey:()=>uo,optimizations:()=>fo,projects:()=>zo,prompts:()=>So,spans:()=>de,traces:()=>ue});var le={};v(le,{AttachmentListRequestEntityType:()=>Zr,DownloadAttachmentRequestEntityType:()=>qr,StartMultipartUploadRequest:()=>ze,StartMultipartUploadRequestEntityType:()=>eo,UploadAttachmentRequestEntityType:()=>ro,uploadAttachment:()=>oo});var Zr=e.enum_(["trace","span"]);var qr=e.enum_(["trace","span"]);var eo=e.enum_(["trace","span"]);var ro=e.enum_(["trace","span"]);var oo={};v(oo,{Request:()=>Mc});var Mc=e.record(e.string(),e.unknown());var ze=e.object({fileName:e.property("file_name",e.string()),numOfFileParts:e.property("num_of_file_parts",e.number()),mimeType:e.property("mime_type",e.string().optional()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",eo),entityId:e.property("entity_id",e.string()),path:e.string()});var ao={};v(ao,{DatasetIdentifier:()=>_e,DatasetIdentifierPublic:()=>Ae,DatasetItemBatchWrite:()=>Se,DatasetItemStreamRequest:()=>Te,DatasetItemsDelete:()=>Pe,DatasetUpdate:()=>xe,DatasetUpdateVisibility:()=>io,DatasetWrite:()=>ke,DatasetWriteVisibility:()=>to});var to=e.enum_(["private","public"]);var io=e.enum_(["private","public"]);var ke=e.object({id:e.string().optional(),name:e.string(),visibility:to.optional(),description:e.string().optional()});var _t=e.enum_(["manual","trace","span","sdk"]);var S=e.record(e.string(),e.unknown());var Pt=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:_t,data:S});var Se=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Pt)});var xe=e.object({name:e.string(),description:e.string().optional(),visibility:io.optional()});var _e=e.object({datasetName:e.property("dataset_name",e.string())});var Pe=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Ae=e.object({datasetName:e.property("dataset_name",e.string())});var Te=e.object({datasetName:e.property("dataset_name",e.string()),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),steamLimit:e.property("steam_limit",e.number().optional())});var me={};v(me,{ExperimentItemStreamRequest:()=>Ie,ExperimentItemsBatch:()=>Ce,ExperimentItemsDelete:()=>je,ExperimentStreamRequestPublic:()=>Ue,ExperimentWrite:()=>ve,ExperimentWriteType:()=>no,findFeedbackScoreNames:()=>so});var no=e.enum_(["regular","trial","mini-batch"]);var so={};v(so,{Response:()=>Bc});var Bc=e.list(e.string());var V=e.record(e.string(),e.unknown());var po=e.object({id:e.string()});var ve=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:V.optional(),type:no.optional(),optimizationId:e.property("optimization_id",e.string().optional()),promptVersion:e.property("prompt_version",po.optional()),promptVersions:e.property("prompt_versions",e.list(po).optional())});var At=e.enum_(["ui","sdk","online_scoring"]);var $=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:At,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var B=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ee=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:S.optional(),output:S.optional(),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ce=e.object({experimentItems:e.property("experiment_items",e.list(Ee))});var je=e.object({ids:e.list(e.string())});var Ie=e.object({experimentName:e.property("experiment_name",e.string()),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var Ue=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var lo={};v(lo,{FindFeedbackDefinitionsRequestType:()=>co});var co=e.enum_(["numerical","categorical"]);var uo={};v(uo,{ProviderApiKeyUpdate:()=>Fe,ProviderApiKeyWrite:()=>Ne,ProviderApiKeyWriteProvider:()=>mo});var mo=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var Ne=e.object({provider:mo,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var Fe=e.object({apiKey:e.property("api_key",e.string()),name:e.string().optional()});var fo={};v(fo,{OptimizationUpdate:()=>Me,OptimizationUpdateStatus:()=>go,OptimizationWrite:()=>De,OptimizationWriteStatus:()=>wo});var wo=e.enum_(["running","completed","cancelled"]);var go=e.enum_(["running","completed","cancelled"]);var De=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:wo,metadata:V.optional()});var Me=e.object({name:e.string().optional(),status:go.optional()});var zo={};v(zo,{ProjectMetricRequestPublic:()=>We,ProjectMetricRequestPublicInterval:()=>yo,ProjectMetricRequestPublicMetricType:()=>bo,ProjectRetrieveDetailed:()=>Ve,ProjectUpdate:()=>Oe,ProjectUpdateVisibility:()=>Ro,ProjectWrite:()=>Be,ProjectWriteVisibility:()=>ho});var ho=e.enum_(["private","public"]);var Ro=e.enum_(["private","public"]);var bo=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var yo=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Be=e.object({name:e.string(),visibility:ho.optional(),description:e.string().optional()});var Oe=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Ro.optional()});var We=e.object({metricType:e.property("metric_type",bo.optional()),interval:yo.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional())});var Ve=e.object({name:e.string()});var So={};v(So,{CreatePromptVersionDetail:()=>He,PromptUpdatable:()=>Je,PromptVersionRetrieveDetail:()=>Ke,PromptWrite:()=>Le,PromptWriteType:()=>ko});var ko=e.enum_(["mustache","jinja2"]);var Le=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:V.optional(),changeDescription:e.property("change_description",e.string().optional()),type:ko.optional()});var Tt=e.record(e.string(),e.unknown());var vt=e.enum_(["mustache","jinja2"]);var Y=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:Tt.optional(),type:vt.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var He=e.object({name:e.string(),version:Y});var Je=e.object({name:e.string(),description:e.string().optional()});var Ke=e.object({name:e.string(),commit:e.string().optional()});var de={};v(de,{FindFeedbackScoreNames1RequestType:()=>_o,GetSpanStatsRequestType:()=>Po,GetSpansByProjectRequestType:()=>xo,SpanBatchWrite:()=>$e,SpanSearchStreamRequestPublic:()=>Ye,SpanSearchStreamRequestPublicType:()=>Ao,SpanUpdate:()=>Qe,findFeedbackScoreNames1:()=>To});var xo=e.enum_(["general","tool","llm","guardrail"]);var _o=e.enum_(["general","tool","llm","guardrail"]);var Po=e.enum_(["general","tool","llm","guardrail"]);var Ao=e.enum_(["general","tool","llm","guardrail"]);var To={};v(To,{Response:()=>Oc});var Oc=e.list(e.string());var Et=e.enum_(["general","tool","llm","guardrail"]);var Xe=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ge=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:Et,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:V.optional(),output:V.optional(),metadata:V.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Xe.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var $e=e.object({spans:e.list(Ge)});var Z=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Qe=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),errorInfo:e.property("error_info",Z.optional())});var Ct=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var jt=e.object({field:e.string().optional(),operator:Ct.optional(),key:e.string().optional(),value:e.string().optional()});var Ye=e.object({traceId:e.property("trace_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),type:Ao.optional(),filters:e.list(jt).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var ue={};v(ue,{DeleteTraceThreads:()=>rr,TraceBatchWrite:()=>qe,TraceSearchStreamRequestPublic:()=>tr,TraceThreadIdentifier:()=>or,TraceUpdate:()=>er,findFeedbackScoreNames2:()=>vo});var vo={};v(vo,{Response:()=>Wc});var Wc=e.list(e.string());var Ze=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:V.optional(),output:V.optional(),metadata:V.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Xe.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var qe=e.object({traces:e.list(Ze)});var er=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Z.optional()),threadId:e.property("thread_id",e.string().optional())});var rr=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()))});var or=e.object({projectId:e.property("project_id",e.string()),threadId:e.property("thread_id",e.string())});var It=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ut=e.object({field:e.string().optional(),operator:It.optional(),key:e.string().optional(),value:e.string().optional()});var tr=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(Ut).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional()});var Eo={};v(Eo,{ChatCompletionRequest:()=>ar});var Nt=e.record(e.string(),e.unknown());var Ft=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var Dt=e.enum_(["text","json_object","json_schema"]);var Mt=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var Bt=e.object({type:Dt.optional(),jsonSchema:e.property("json_schema",Mt.optional())});var ir=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var Ot=e.object({type:e.stringLiteral("function").optional(),function:ir.optional()});var q=e.object({name:e.string().optional(),arguments:e.string().optional()});var ar=e.object({model:e.string().optional(),messages:e.list(Nt).optional(),temperature:e.number().optional(),topP:e.property("top_p",e.number().optional()),n:e.number().optional(),stream:e.boolean().optional(),streamOptions:e.property("stream_options",Ft.optional()),stop:e.list(e.string()).optional(),maxTokens:e.property("max_tokens",e.number().optional()),maxCompletionTokens:e.property("max_completion_tokens",e.number().optional()),presencePenalty:e.property("presence_penalty",e.number().optional()),frequencyPenalty:e.property("frequency_penalty",e.number().optional()),logitBias:e.property("logit_bias",e.record(e.string(),e.number()).optional()),user:e.string().optional(),responseFormat:e.property("response_format",Bt.optional()),seed:e.number().optional(),tools:e.list(Ot).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),store:e.boolean().optional(),metadata:e.record(e.string(),e.string()).optional(),reasoningEffort:e.property("reasoning_effort",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional()),functions:e.list(ir).optional(),functionCall:e.property("function_call",q.optional())});var Co={};v(Co,{GuardrailBatchWrite:()=>nr});var Wt=e.enum_(["TOPIC","PII"]);var Vt=e.enum_(["passed","failed"]);var Lt=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:Wt,result:Vt,config:S,details:S});var nr=e.object({guardrails:e.list(Lt)});var Ht=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var sr=e.object({biInformation:e.property("bi_information",e.list(Ht).optional())});var Jt=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Kt=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Jt).optional())});var Xt=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Gt=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Xt).optional())});var $t=e.object({link:e.string().optional(),fileName:e.property("file_name",e.string()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string())});var Qt=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list($t).optional(),sortableBy:e.list(e.string()).optional()});var K=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Yt=e.enum_(["trace","span"]);var Zt=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var jo=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",Yt),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string().optional()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string().optional()),uploadId:e.property("upload_id",e.string()),uploadedFileParts:e.property("uploaded_file_parts",e.list(Zt))});var qt=e.enum_(["trace","span"]);var Vc=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",qt),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var ei=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var ri=e.record(e.string(),e.unknown());var oi=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var ti=e.object({name:e.string(),temperature:e.number()});var ii=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var ai=e.object({role:ii,content:e.string()});var ni=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var si=e.object({name:e.string(),type:ni,description:e.string()});var pr=e.object({model:ti,messages:e.list(ai),variables:e.record(e.string(),e.string()),schema:e.list(si)});var pi=e.object({code:pr.optional()});var cr=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var ci=e.object({code:cr.optional()});var ip=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Lc=e.union("type",{llm_as_judge:pi.extend(ip),user_defined_metric_python:ci.extend(ip)}).transform({transform:s=>s,untransform:s=>s});var li=e.object({name:e.string(),temperature:e.number()});var mi=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var di=e.object({role:mi,content:e.string()});var ui=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var wi=e.object({name:e.string(),type:ui,description:e.string()});var gi=e.object({model:li,messages:e.list(di),variables:e.record(e.string(),e.string()),schema:e.list(wi)});var fi=e.object({code:gi.optional()});var hi=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Ri=e.object({code:hi.optional()});var ap=e.object({projectId:e.property("project_id",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),action:e.stringLiteral("evaluator").optional()}),bi=e.union("type",{llm_as_judge:fi.extend(ap),user_defined_metric_python:Ri.extend(ap)}).transform({transform:s=>s,untransform:s=>s});var M=e.object({ids:e.list(e.string())});var yi=e.object({name:e.string(),temperature:e.number()});var zi=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var ki=e.object({role:zi,content:e.string()});var Si=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var xi=e.object({name:e.string(),type:Si,description:e.string()});var _i=e.object({model:yi,messages:e.list(ki),variables:e.record(e.string(),e.string()),schema:e.list(xi)});var lr=e.object({code:_i.optional()});var Pi=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var mr=e.object({code:Pi.optional()});var np=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Ai=e.union("type",{llm_as_judge:lr.extend(np),user_defined_metric_python:mr.extend(np)}).transform({transform:s=>s,untransform:s=>s});var Ti=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ai).optional()});var sp=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),vi=e.union("type",{llm_as_judge:lr.extend(sp),user_defined_metric_python:mr.extend(sp)}).transform({transform:s=>s,untransform:s=>s});var Ei=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var Ci=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:Ei.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var ji=e.object({content:e.list(Ci).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Ii=e.object({code:pr.optional()});var Ui=e.object({code:cr.optional()});var pp=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),projectId:e.property("project_id",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Ni=e.union("type",{llm_as_judge:Ii.extend(pp),user_defined_metric_python:Ui.extend(pp)}).transform({transform:s=>s,untransform:s=>s});var Fi=e.enum_(["system","user","assistant","tool","function"]);var dr=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:q.optional()});var Di=e.object({role:Fi.optional(),content:e.string().optional(),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(dr).optional()),refusal:e.boolean().optional(),functionCall:e.property("function_call",q.optional())});var Mi=e.object({role:e.string().optional(),content:e.string().optional(),toolCalls:e.property("tool_calls",e.list(dr).optional()),functionCall:e.property("function_call",q.optional())});var Bi=e.object({index:e.number().optional(),message:Di.optional(),delta:Mi.optional(),finishReason:e.property("finish_reason",e.string().optional())});var Oi=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var Wi=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Vi=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",Oi.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",Wi.optional())});var Li=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(Bi).optional(),usage:Vi.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var Hi=e.enum_(["private","public"]);var Hc=e.object({id:e.string().optional(),name:e.string(),visibility:Hi.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var Ji=e.enum_(["manual","trace","span","sdk"]);var Ki=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ji,data:S,experimentItems:e.property("experiment_items",e.list(Ee).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Jc=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Ki)});var Xi=e.enum_(["string","number","object","boolean","array","null"]);var Gi=e.object({name:e.string().optional(),types:e.list(Xi).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var $i=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Qi=e.enum_(["manual","trace","span","sdk"]);var Io=e.record(e.string(),e.unknown());var Yi=e.enum_(["ui","sdk","online_scoring"]);var Zi=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Yi,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var qi=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:Io.optional(),output:Io.optional(),feedbackScores:e.property("feedback_scores",e.list(Zi).optional()),comments:e.list($i).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ea=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Qi,data:S,experimentItems:e.property("experiment_items",e.list(qi).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ra=e.object({content:e.list(ea).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Gi).optional()});var oa=e.enum_(["private","public"]);var we=e.object({id:e.string().optional(),name:e.string(),visibility:oa.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var ta=e.object({content:e.list(we).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var ia=e.enum_(["manual","trace","span","sdk"]);var ur=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var wr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:ia,data:S,experimentItems:e.property("experiment_items",e.list(ur).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var aa=e.enum_(["string","number","object","boolean","array","null"]);var na=e.object({name:e.string().optional(),types:e.list(aa).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var sa=e.object({content:e.list(wr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(na).optional()});var pa=e.enum_(["string","number","object","boolean","array","null"]);var ca=e.object({name:e.string().optional(),types:e.list(pa).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var la=e.object({columns:e.list(ca).optional()});var ma=e.object({typeName:e.string().optional()});var Kc=e.object({type:ma.optional(),closed:e.boolean().optional()});var da=e.enum_(["regular","trial","mini-batch"]);var ee=e.object({name:e.string(),value:e.number()});var ie=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Uo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Xc=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:S.optional(),type:da.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),comments:e.list(B).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),promptVersion:e.property("prompt_version",Uo.optional()),promptVersions:e.property("prompt_versions",e.list(Uo).optional())});var gr=e.object({ids:e.list(e.string())});var ae=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var L=e.record(e.string(),e.unknown());var ua=e.enum_(["regular","trial","mini-batch"]);var fr=e.object({name:e.string(),value:e.number()});var hr=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var No=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Rr=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:L.optional(),type:ua.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(fr).optional()),comments:e.list(ae).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:hr.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),promptVersion:e.property("prompt_version",No.optional()),promptVersions:e.property("prompt_versions",e.list(No).optional())});var wa=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rr).optional(),sortableBy:e.list(e.string()).optional()});var Gc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var ga=e.object({typeName:e.string().optional()});var $c=e.object({type:ga.optional(),closed:e.boolean().optional()});var fa=e.object({categories:e.record(e.string(),e.number())});var ha=e.object({details:fa.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ra=e.object({max:e.number(),min:e.number()});var ba=e.object({details:Ra.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var cp=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Qc=e.union("type",{numerical:ba.extend(cp),categorical:ha.extend(cp)}).transform({transform:s=>s,untransform:s=>s});var ya=e.object({categories:e.record(e.string(),e.number())});var za=e.object({details:ya.optional()});var ka=e.object({max:e.number(),min:e.number()});var Sa=e.object({details:ka.optional()});var lp=e.object({id:e.string().optional(),name:e.string()}),xa=e.union("type",{numerical:Sa.extend(lp),categorical:za.extend(lp)}).transform({transform:s=>s,untransform:s=>s});var _a=e.object({categories:e.record(e.string(),e.number())});var br=e.object({details:_a.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Pa=e.object({max:e.number(),min:e.number()});var yr=e.object({details:Pa.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var mp=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Aa=e.union("type",{numerical:yr.extend(mp),categorical:br.extend(mp)}).transform({transform:s=>s,untransform:s=>s});var Ta=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Aa).optional()});var dp=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),va=e.union("type",{numerical:yr.extend(dp),categorical:br.extend(dp)}).transform({transform:s=>s,untransform:s=>s});var Ea=e.object({categories:e.record(e.string(),e.number())});var Ca=e.object({details:Ea.optional()});var ja=e.object({max:e.number(),min:e.number()});var Ia=e.object({details:ja.optional()});var up=e.object({id:e.string().optional(),name:e.string()}),Ua=e.union("type",{numerical:Ia.extend(up),categorical:Ca.extend(up)}).transform({transform:s=>s,untransform:s=>s});var Na=e.enum_(["TOPIC","PII"]);var Fa=e.enum_(["passed","failed"]);var Da=e.object({id:e.string().optional(),entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:Na,result:Fa,config:S,details:S});var Yc=e.object({guardrails:e.list(Da)});var Ma=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var zr=e.object({id:e.string().optional(),provider:Ma,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ba=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(zr).optional(),sortableBy:e.list(e.string()).optional()});var Oa=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai"]);var Zc=e.object({id:e.string().optional(),provider:Oa,apiKey:e.property("api_key",e.string()),name:e.string().optional(),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var qc=S;var Wa=e.enum_(["running","completed","cancelled"]);var el=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Wa,metadata:S.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Va=e.enum_(["running","completed","cancelled"]);var kr=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Va,metadata:L.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(fr).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var La=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(kr).optional(),sortableBy:e.list(e.string()).optional()});var Ha=e.enum_(["private","public"]);var rl=e.object({id:e.string().optional(),name:e.string(),visibility:Ha.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var Ja=e.enum_(["private","public"]);var Sr=e.object({id:e.string().optional(),name:e.string(),visibility:Ja.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var Ka=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Sr).optional(),sortableBy:e.list(e.string()).optional()});var Xa=e.object({name:e.string().optional()});var Ga=e.object({scores:e.list(Xa).optional()});var $a=e.object({time:e.date(),value:e.number().optional()});var Qa=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var Ya=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Za=e.object({name:e.string().optional(),data:e.list($a).optional()});var qa=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Qa.optional()),interval:Ya.optional(),results:e.list(Za).optional()});var en=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(ee).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var rn=e.object({content:e.list(en).optional()});var on=e.object({name:e.string(),value:e.number()});var tn=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var an=e.enum_(["private","public"]);var nn=e.object({id:e.string().optional(),name:e.string(),visibility:an.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(on).optional()),duration:tn.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional())});var ol=e.object({errors:e.list(e.string()).optional()});var sn=e.enum_(["mustache","jinja2"]);var pn=e.enum_(["mustache","jinja2"]);var cn=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:S.optional(),type:pn.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var tl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:S.optional(),changeDescription:e.property("change_description",e.string().optional()),type:sn.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",cn.optional())});var il=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var ln=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",Y.optional())});var mn=e.enum_(["mustache","jinja2"]);var dn=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:L.optional(),type:mn.optional(),changeDescription:e.property("change_description",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var un=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(dn).optional()});var wn=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var gn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wn).optional()});var fn=e.object({pythonEvaluatorEnabled:e.boolean(),guardrailsEnabled:e.boolean()});var hn=e.enum_(["general","tool","llm","guardrail"]);var Rn=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:hn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Z.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var al=e.object({spans:e.list(Rn)});var xr=e.object({name:e.string()});var _r=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var bn=e.enum_(["ui","sdk","online_scoring"]);var Pr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:bn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var yn=e.enum_(["general","tool","llm","guardrail"]);var Ar=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:yn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:L.optional(),output:L.optional(),metadata:L.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",_r.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Pr).optional()),comments:e.list(ae).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var zn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ar).optional(),sortableBy:e.list(e.string()).optional()});var kn=e.object({value:e.number().optional()});var Sn=e.object({value:e.number().optional()});var xn=e.object({value:hr.optional()});var _n=e.object({name:e.string().optional()}),Pn=e.union("type",{PERCENTAGE:xn.extend(_n),COUNT:Sn.extend(_n),AVG:kn.extend(_n)}).transform({transform:s=>s,untransform:s=>s});var Tr=e.object({stats:e.list(Pn).optional()});var An=e.enum_(["ui","sdk","online_scoring"]);var Tn=e.object({id:e.string(),projectName:e.property("project_name",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:An});var vr=e.object({scores:e.list(Tn)});var vn=e.enum_(["TOPIC","PII"]);var En=e.enum_(["passed","failed"]);var Cn=e.object({name:vn.optional(),result:En.optional()});var jn=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Cn).optional()});var In=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Z.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list($).optional()),comments:e.list(B).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(jn).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional())});var nl=e.object({traces:e.list(In)});var Un=e.enum_(["TOPIC","PII"]);var Nn=e.enum_(["passed","failed"]);var Fn=e.object({name:Un.optional(),result:Nn.optional()});var Dn=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Fn).optional()});var Er=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:L.optional(),output:L.optional(),metadata:L.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",_r.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Pr).optional()),comments:e.list(ae).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Dn).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional())});var Cr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),startTime:e.property("start_time",e.date().optional()),endTime:e.property("end_time",e.date().optional()),duration:e.number().optional(),firstMessage:e.property("first_message",S.optional()),lastMessage:e.property("last_message",S.optional()),numberOfMessages:e.property("number_of_messages",e.number().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var Mn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Cr).optional()});var Bn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Er).optional(),sortableBy:e.list(e.string()).optional()});var Fo=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return h.fromPromise(this.__getDatasetBiInfo(t))}async __getDatasetBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:sr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExperimentBiInfo(t){return h.fromPromise(this.__getExperimentBiInfo(t))}async __getExperimentBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:sr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansCountForWorkspaces(t){return h.fromPromise(this.__getSpansCountForWorkspaces(t))}async __getSpansCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Kt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesBiInfo(t){return h.fromPromise(this.__getTracesBiInfo(t))}async __getTracesBiInfo(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:sr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesCountForWorkspaces(t){return h.fromPromise(this.__getTracesCountForWorkspaces(t))}async __getTracesCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Gt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Do=class{constructor(t={}){this._options=t;}attachmentList(t,r){return h.fromPromise(this.__attachmentList(t,r))}async __attachmentList(t,r){var z,k;let{page:o,size:i,projectId:n,entityType:l,entityId:d,path:u}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),w.project_id=n,w.entity_type=Zr.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),w.entity_id=d,w.path=u;let g=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Qt.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new F(g.error.body,g.rawResponse);case 403:throw new O(K.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}completeMultiPartUpload(t,r){return h.fromPromise(this.__completeMultiPartUpload(t,r))}async __completeMultiPartUpload(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAttachments(t,r){return h.fromPromise(this.__deleteAttachments(t,r))}async __deleteAttachments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}downloadAttachment(t,r){return h.fromPromise(this.__downloadAttachment(t,r))}async __downloadAttachment(t,r){var z,k;let{workspaceName:o,containerId:i,entityType:n,entityId:l,fileName:d,mimeType:u}=t,w={};o!=null&&(w.workspace_name=o),w.container_id=i,w.entity_type=qr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),w.entity_id=l,w.file_name=d,w.mime_type=u;let g=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new F(g.error.body,g.rawResponse);case 403:throw new O(K.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}startMultiPartUpload(t,r){return h.fromPromise(this.__startMultiPartUpload(t,r))}async __startMultiPartUpload(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ze.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ei.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}uploadAttachment(t,r){return h.fromPromise(this.__uploadAttachment(t,r))}async __uploadAttachment(t,r){var z,k;let{fileName:o,projectName:i,mimeType:n,entityType:l,entityId:d,body:u}=t,w={};w.file_name=o,i!=null&&(w.project_name=i),n!=null&&(w.mime_type=n),w.entity_type=ro.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),w.entity_id=d;let g=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",body:le.uploadAttachment.Request.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:void 0,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new F(g.error.body,g.rawResponse);case 403:throw new O(K.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Mo=class{constructor(t={}){this._options=t;}access(t,r){return h.fromPromise(this.__access(t,r))}async __access(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ri.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return h.fromPromise(this.__getWorkspaceName(t))}async __getWorkspaceName(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:oi.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new F(r.error.body,r.rawResponse);case 403:throw new O(K.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Bo=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return h.fromPromise(this.__findEvaluators(t,r))}async __findEvaluators(t={},r){var w,g;let{projectId:o,name:i,page:n,size:l}=t,d={};o!=null&&(d.project_id=o),i!=null&&(d.name=i),n!=null&&(d.page=n.toString()),l!=null&&(d.size=l.toString());let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ti.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAutomationRuleEvaluator(t,r){return h.fromPromise(this.__createAutomationRuleEvaluator(t,r))}async __createAutomationRuleEvaluator(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:bi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAutomationRuleEvaluatorBatch(t,r){return h.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(t,r))}async __deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,n={};o!=null&&(n.project_id=o);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,requestType:"json",body:M.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getEvaluatorById(t,r={},o){return h.fromPromise(this.__getEvaluatorById(t,r,o))}async __getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,n={};i!=null&&(n.project_id=i);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:vi.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}updateAutomationRuleEvaluator(t,r,o){return h.fromPromise(this.__updateAutomationRuleEvaluator(t,r,o))}async __updateAutomationRuleEvaluator(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ni.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getEvaluatorLogsById(t,r={},o){return h.fromPromise(this.__getEvaluatorLogsById(t,r,o))}async __getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,n={};i!=null&&(n.size=i.toString());let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:ji.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Oo=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return h.fromPromise(this.__createChatCompletions(t,r))}async __createChatCompletions(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ar.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Li.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Wo=class{constructor(t={}){this._options=t;}findDatasets(t={},r){return h.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var k,_;let{page:o,size:i,withExperimentsOnly:n,withOptimizationsOnly:l,promptId:d,name:u,sorting:w}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),n!=null&&(g.with_experiments_only=n.toString()),l!=null&&(g.with_optimizations_only=l.toString()),d!=null&&(g.prompt_id=d),u!=null&&(g.name=u),w!=null&&(g.sorting=w);let z=await b({url:y((_=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?_:R.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(z.ok)return {data:ta.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")throw new p({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse});switch(z.error.reason){case "non-json":throw new p({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:z.error.errorMessage,rawResponse:z.rawResponse})}}createDataset(t,r){return h.fromPromise(this.__createDataset(t,r))}async __createDataset(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ke.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return h.fromPromise(this.__createOrUpdateDatasetItems(t,r))}async __createOrUpdateDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Se.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetById(t,r){return h.fromPromise(this.__getDatasetById(t,r))}async __getDatasetById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:we.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDataset(t,r,o){return h.fromPromise(this.__updateDataset(t,r,o))}async __updateDataset(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDataset(t,r){return h.fromPromise(this.__deleteDataset(t,r))}async __deleteDataset(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetByName(t,r){return h.fromPromise(this.__deleteDatasetByName(t,r))}async __deleteDatasetByName(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:_e.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetItems(t,r){return h.fromPromise(this.__deleteDatasetItems(t,r))}async __deleteDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Pe.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetsBatch(t,r){return h.fromPromise(this.__deleteDatasetsBatch(t,r))}async __deleteDatasetsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findDatasetItemsWithExperimentItems(t,r,o){return h.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var z,k;let{page:i,size:n,experimentIds:l,filters:d,truncate:u}=r,w={};i!=null&&(w.page=i.toString()),n!=null&&(w.size=n.toString()),w.experiment_ids=l,d!=null&&(w.filters=d),u!=null&&(w.truncate=u.toString());let g=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(g.ok)return {data:ra.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getDatasetByIdentifier(t,r){return h.fromPromise(this.__getDatasetByIdentifier(t,r))}async __getDatasetByIdentifier(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ae.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:we.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetItemById(t,r){return h.fromPromise(this.__getDatasetItemById(t,r))}async __getDatasetItemById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:wr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetItems(t,r={},o){return h.fromPromise(this.__getDatasetItems(t,r,o))}async __getDatasetItems(t,r={},o){var w,g;let{page:i,size:n,truncate:l}=r,d={};i!=null&&(d.page=i.toString()),n!=null&&(d.size=n.toString()),l!=null&&(d.truncate=l.toString());let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(u.ok)return {data:sa.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getDatasetItemsOutputColumns(t,r={},o){return h.fromPromise(this.__getDatasetItemsOutputColumns(t,r,o))}async __getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,n={};i!=null&&(n.experiment_ids=i);let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:la.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}streamDatasetItems(t,r){return h.fromPromise(this.__streamDatasetItems(t,r))}async __streamDatasetItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Te.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Vo=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return h.fromPromise(this.__findExperiments(t,r))}async __findExperiments(t={},r){var I,ge;let{page:o,size:i,datasetId:n,optimizationId:l,types:d,name:u,datasetDeleted:w,promptId:g,sorting:z}=t,k={};o!=null&&(k.page=o.toString()),i!=null&&(k.size=i.toString()),n!=null&&(k.datasetId=n),l!=null&&(k.optimization_id=l),d!=null&&(k.types=d),u!=null&&(k.name=u),w!=null&&(k.dataset_deleted=w.toString()),g!=null&&(k.prompt_id=g),z!=null&&(k.sorting=z);let _=await b({url:y((ge=(I=await a.get(this._options.baseUrl))!=null?I:await a.get(this._options.environment))!=null?ge:R.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(_.ok)return {data:wa.parseOrThrow(_.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new j(_.error.body,_.rawResponse);default:throw new p({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case "non-json":throw new p({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:_.error.errorMessage,rawResponse:_.rawResponse})}}createExperiment(t,r){return h.fromPromise(this.__createExperiment(t,r))}async __createExperiment(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ve.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return h.fromPromise(this.__createExperimentItems(t,r))}async __createExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ce.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentItems(t,r){return h.fromPromise(this.__deleteExperimentItems(t,r))}async __deleteExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:je.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentsById(t,r){return h.fromPromise(this.__deleteExperimentsById(t,r))}async __deleteExperimentsById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames(t={},r){return h.fromPromise(this.__findFeedbackScoreNames(t,r))}async __findFeedbackScoreNames(t={},r){var l,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:me.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getExperimentById(t,r){return h.fromPromise(this.__getExperimentById(t,r))}async __getExperimentById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Rr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getExperimentItemById(t,r){return h.fromPromise(this.__getExperimentItemById(t,r))}async __getExperimentItemById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/experiments/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ur.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperimentItems(t,r){return h.fromPromise(this.__streamExperimentItems(t,r))}async __streamExperimentItems(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ie.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperiments(t,r){return h.fromPromise(this.__streamExperiments(t,r))}async __streamExperiments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ue.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Lo=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return h.fromPromise(this.__findFeedbackDefinitions(t,r))}async __findFeedbackDefinitions(t={},r){var w,g;let{page:o,size:i,name:n,type:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.type=co.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}));let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ta.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createFeedbackDefinition(t,r){return h.fromPromise(this.__createFeedbackDefinition(t,r))}async __createFeedbackDefinition(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:xa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getFeedbackDefinitionById(t,r){return h.fromPromise(this.__getFeedbackDefinitionById(t,r))}async __getFeedbackDefinitionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:va.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateFeedbackDefinition(t,r,o){return h.fromPromise(this.__updateFeedbackDefinition(t,r,o))}async __updateFeedbackDefinition(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ua.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeedbackDefinitionById(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionById(t,r))}async __deleteFeedbackDefinitionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new H(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteFeedbackDefinitionsBatch(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionsBatch(t,r))}async __deleteFeedbackDefinitionsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new H(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ho=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return h.fromPromise(this.__createGuardrails(t,r))}async __createGuardrails(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:nr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Jo=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return h.fromPromise(this.__deleteLlmProviderApiKeysBatch(t,r))}async __deleteLlmProviderApiKeysBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findLlmProviderKeys(t){return h.fromPromise(this.__findLlmProviderKeys(t))}async __findLlmProviderKeys(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Ba.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}storeLlmProviderApiKey(t,r){return h.fromPromise(this.__storeLlmProviderApiKey(t,r))}async __storeLlmProviderApiKey(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ne.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new F(o.error.body,o.rawResponse);case 403:throw new O(K.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getLlmProviderApiKeyById(t,r){return h.fromPromise(this.__getLlmProviderApiKeyById(t,r))}async __getLlmProviderApiKeyById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateLlmProviderApiKey(t,r,o){return h.fromPromise(this.__updateLlmProviderApiKey(t,r,o))}async __updateLlmProviderApiKey(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new F(i.error.body,i.rawResponse);case 403:throw new O(K.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ko=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return h.fromPromise(this.__receiveProtobufTraces(t))}async __receiveProtobufTraces(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Xo=class{constructor(t={}){this._options=t;}findOptimizations(t={},r){return h.fromPromise(this.__findOptimizations(t,r))}async __findOptimizations(t={},r){var g,z;let{page:o,size:i,datasetId:n,name:l,datasetDeleted:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),n!=null&&(u.dataset_id=n),l!=null&&(u.name=l),d!=null&&(u.dataset_deleted=d.toString());let w=await b({url:y((z=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?z:R.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:La.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new j(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return h.fromPromise(this.__createOptimization(t,r))}async __createOptimization(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:De.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return h.fromPromise(this.__deleteOptimizationsById(t,r))}async __deleteOptimizationsById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getOptimizationById(t,r){return h.fromPromise(this.__getOptimizationById(t,r))}async __getOptimizationById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:kr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateOptimizationsById(t,r={},o){return h.fromPromise(this.__updateOptimizationsById(t,r,o))}async __updateOptimizationsById(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Me.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Go=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var w,g;let{page:o,size:i,name:n,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.sorting=l);let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ka.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Be.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return h.fromPromise(this.__getProjectById(t,r))}async __getProjectById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Sr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteProjectById(t,r){return h.fromPromise(this.__deleteProjectById(t,r))}async __deleteProjectById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new H(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProject(t,r={},o){return h.fromPromise(this.__updateProject(t,r,o))}async __updateProject(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Oe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 422:throw new X(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteProjectsBatch(t,r){return h.fromPromise(this.__deleteProjectsBatch(t,r))}async __deleteProjectsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNamesByProjectIds(t={},r){return h.fromPromise(this.__findFeedbackScoreNamesByProjectIds(t,r))}async __findFeedbackScoreNamesByProjectIds(t={},r){var l,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:Ga.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getProjectMetrics(t,r={},o){return h.fromPromise(this.__getProjectMetrics(t,r,o))}async __getProjectMetrics(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}/metrics`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:We.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:qa.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getProjectStats(t={},r){return h.fromPromise(this.__getProjectStats(t,r))}async __getProjectStats(t={},r){var w,g;let{page:o,size:i,name:n,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),l!=null&&(d.sorting=l);let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:rn.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}retrieveProject(t,r){return h.fromPromise(this.__retrieveProject(t,r))}async __retrieveProject(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ve.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:nn.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 404:throw new P(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var $o=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return h.fromPromise(this.__getPrompts(t,r))}async __getPrompts(t={},r){var u,w;let{page:o,size:i,name:n}=t,l={};o!=null&&(l.page=o.toString()),i!=null&&(l.size=i.toString()),n!=null&&(l.name=n);let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:gn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createPrompt(t,r){return h.fromPromise(this.__createPrompt(t,r))}async __createPrompt(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Le.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 409:throw new H(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return h.fromPromise(this.__createPromptVersion(t,r))}async __createPromptVersion(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:He.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 409:throw new H(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ln.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePrompt(t,r,o){return h.fromPromise(this.__updatePrompt(t,r,o))}async __updatePrompt(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Je.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body,i.rawResponse);case 404:throw new P(i.error.body,i.rawResponse);case 409:throw new H(i.error.body,i.rawResponse);case 422:throw new X(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePrompt(t,r){return h.fromPromise(this.__deletePrompt(t,r))}async __deletePrompt(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePromptsBatch(t,r){return h.fromPromise(this.__deletePromptsBatch(t,r))}async __deletePromptsBatch(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersionById(t,r){return h.fromPromise(this.__getPromptVersionById(t,r))}async __getPromptVersionById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/prompts/versions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersions(t,r={},o){return h.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var u,w;let{page:i,size:n}=r,l={};i!=null&&(l.page=i.toString()),n!=null&&(l.size=n.toString());let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:un.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}retrievePromptVersion(t,r){return h.fromPromise(this.__retrievePromptVersion(t,r))}async __retrievePromptVersion(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ke.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Y.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 404:throw new P(o.error.body,o.rawResponse);case 422:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Qo=class{constructor(t={}){this._options=t;}getServiceToggles(t){return h.fromPromise(this.__getServiceToggles(t))}async __getServiceToggles(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:fn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Yo=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return h.fromPromise(this.__addSpanComment(t,r,o))}async __addSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addSpanFeedbackScore(t,r,o){return h.fromPromise(this.__addSpanFeedbackScore(t,r,o))}async __addSpanFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:$.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpansByProject(t={},r){return h.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var ge,Vn;let{page:o,size:i,projectName:n,projectId:l,traceId:d,type:u,filters:w,truncate:g,sorting:z,exclude:k}=t,_={};o!=null&&(_.page=o.toString()),i!=null&&(_.size=i.toString()),n!=null&&(_.project_name=n),l!=null&&(_.project_id=l),d!=null&&(_.trace_id=d),u!=null&&(_.type=xo.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),w!=null&&(_.filters=w),g!=null&&(_.truncate=g.toString()),z!=null&&(_.sorting=z),k!=null&&(_.exclude=k);let I=await b({url:y((Vn=(ge=await a.get(this._options.baseUrl))!=null?ge:await a.get(this._options.environment))!=null?Vn:R.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:_,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(I.ok)return {data:zn.parseOrThrow(I.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:I.rawResponse};if(I.error.reason==="status-code")throw new p({statusCode:I.error.statusCode,body:I.error.body,rawResponse:I.rawResponse});switch(I.error.reason){case "non-json":throw new p({statusCode:I.error.statusCode,body:I.error.rawBody,rawResponse:I.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:I.error.errorMessage,rawResponse:I.rawResponse})}}createSpan(t,r){return h.fromPromise(this.__createSpan(t,r))}async __createSpan(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ge.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new H(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createSpans(t,r){return h.fromPromise(this.__createSpans(t,r))}async __createSpans(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$e.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpanById(t,r){return h.fromPromise(this.__getSpanById(t,r))}async __getSpanById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ar.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanById(t,r){return h.fromPromise(this.__deleteSpanById(t,r))}async __deleteSpanById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new fe(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpan(t,r,o){return h.fromPromise(this.__updateSpan(t,r,o))}async __updateSpan(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Qe.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteSpanComments(t,r){return h.fromPromise(this.__deleteSpanComments(t,r))}async __deleteSpanComments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanFeedbackScore(t,r,o){return h.fromPromise(this.__deleteSpanFeedbackScore(t,r,o))}async __deleteSpanFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findFeedbackScoreNames1(t={},r){return h.fromPromise(this.__findFeedbackScoreNames1(t,r))}async __findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,n={};o!=null&&(n.project_id=o),i!=null&&(n.type=_o.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let l=await b({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:R.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:de.findFeedbackScoreNames1.Response.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getSpanComment(t,r,o){return h.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:B.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpanStats(t={},r){return h.fromPromise(this.__getSpanStats(t,r))}async __getSpanStats(t={},r){var g,z;let{projectId:o,projectName:i,traceId:n,type:l,filters:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),n!=null&&(u.trace_id=n),l!=null&&(u.type=Po.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),d!=null&&(u.filters=d);let w=await b({url:y((z=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?z:R.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:Tr.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}scoreBatchOfSpans(t,r){return h.fromPromise(this.__scoreBatchOfSpans(t,r))}async __scoreBatchOfSpans(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchSpans(t={},r){return h.fromPromise(this.__searchSpans(t,r))}async __searchSpans(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ye.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpanComment(t,r,o){return h.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Zo=class{constructor(t={}){this._options=t;}addTraceComment(t,r,o){return h.fromPromise(this.__addTraceComment(t,r,o))}async __addTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceFeedbackScore(t,r,o){return h.fromPromise(this.__addTraceFeedbackScore(t,r,o))}async __addTraceFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:$.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTracesByProject(t={},r){return h.fromPromise(this.__getTracesByProject(t,r))}async __getTracesByProject(t={},r){var _,I;let{page:o,size:i,projectName:n,projectId:l,filters:d,truncate:u,sorting:w,exclude:g}=t,z={};o!=null&&(z.page=o.toString()),i!=null&&(z.size=i.toString()),n!=null&&(z.project_name=n),l!=null&&(z.project_id=l),d!=null&&(z.filters=d),u!=null&&(z.truncate=u.toString()),w!=null&&(z.sorting=w),g!=null&&(z.exclude=g);let k=await b({url:y((I=(_=await a.get(this._options.baseUrl))!=null?_:await a.get(this._options.environment))!=null?I:R.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:Bn.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createTrace(t,r){return h.fromPromise(this.__createTrace(t,r))}async __createTrace(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ze.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createTraces(t,r){return h.fromPromise(this.__createTraces(t,r))}async __createTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:qe.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceById(t,r){return h.fromPromise(this.__getTraceById(t,r))}async __getTraceById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Er.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceById(t,r){return h.fromPromise(this.__deleteTraceById(t,r))}async __deleteTraceById(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTrace(t,r={},o){return h.fromPromise(this.__updateTrace(t,r,o))}async __updateTrace(t,r={},o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:er.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceComments(t,r){return h.fromPromise(this.__deleteTraceComments(t,r))}async __deleteTraceComments(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceFeedbackScore(t,r,o){return h.fromPromise(this.__deleteTraceFeedbackScore(t,r,o))}async __deleteTraceFeedbackScore(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceThreads(t,r){return h.fromPromise(this.__deleteTraceThreads(t,r))}async __deleteTraceThreads(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraces(t,r){return h.fromPromise(this.__deleteTraces(t,r))}async __deleteTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames2(t={},r){return h.fromPromise(this.__findFeedbackScoreNames2(t,r))}async __findFeedbackScoreNames2(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let n=await b({url:y((d=(l=await a.get(this._options.baseUrl))!=null?l:await a.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return {data:ue.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new p({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});switch(n.error.reason){case "non-json":throw new p({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new p({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getTraceStats(t={},r){return h.fromPromise(this.__getTraceStats(t,r))}async __getTraceStats(t={},r){var u,w;let{projectId:o,projectName:i,filters:n}=t,l={};o!=null&&(l.project_id=o),i!=null&&(l.project_name=i),n!=null&&(l.filters=n);let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:Tr.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getTraceComment(t,r,o){return h.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:B.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThread(t,r){return h.fromPromise(this.__getTraceThread(t,r))}async __getTraceThread(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:or.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Cr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new P(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceThreads(t={},r){return h.fromPromise(this.__getTraceThreads(t,r))}async __getTraceThreads(t={},r){var z,k;let{page:o,size:i,projectName:n,projectId:l,truncate:d,filters:u}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),n!=null&&(w.project_name=n),l!=null&&(w.project_id=l),d!=null&&(w.truncate=d.toString()),u!=null&&(w.filters=u);let g=await b({url:y((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Mn.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}scoreBatchOfTraces(t,r){return h.fromPromise(this.__scoreBatchOfTraces(t,r))}async __scoreBatchOfTraces(t,r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraces(t={},r){return h.fromPromise(this.__searchTraces(t,r))}async __searchTraces(t={},r){var i,n;let o=await b({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:R.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:tr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body,o.rawResponse);case 401:throw new F(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTraceComment(t,r,o){return h.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var n,l;let i=await b({url:y((l=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:B.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new P(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var qo=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return h.fromPromise(this.__datasetsRedirect(t,r))}async __datasetsRedirect(t,r){var u,w;let{datasetId:o,workspaceName:i,path:n}=t,l={};l.dataset_id=o,i!=null&&(l.workspace_name=i),l.path=n;let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body,d.rawResponse);case 404:throw new P(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}experimentsRedirect(t,r){return h.fromPromise(this.__experimentsRedirect(t,r))}async __experimentsRedirect(t,r){var w,g;let{datasetId:o,experimentId:i,workspaceName:n,path:l}=t,d={};d.dataset_id=o,d.experiment_id=i,n!=null&&(d.workspace_name=n),d.path=l;let u=await b({url:y((g=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new j(u.error.body,u.rawResponse);case 404:throw new P(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}projectsRedirect(t,r){return h.fromPromise(this.__projectsRedirect(t,r))}async __projectsRedirect(t,r){var u,w;let{traceId:o,workspaceName:i,path:n}=t,l={};l.trace_id=o,i!=null&&(l.workspace_name=i),l.path=n;let d=await b({url:y((w=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body,d.rawResponse);case 404:throw new P(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var jr=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new Fo(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new Do(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new Mo(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new Bo(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new Oo(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new Wo(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new Vo(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new Lo(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new Ho(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new Jo(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Ko(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new Xo(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new Go(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new $o(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Qo(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Yo(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Zo(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new qo(this._options)}isAlive(t){return h.fromPromise(this.__isAlive(t))}async __isAlive(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return h.fromPromise(this.__version(t))}async __version(t){var o,i;let r=await b({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:R.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ir=()=>uuid.v7();var et=class{constructor(t,r){this.data=t;this.opik=r;this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=t=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...t};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...t},this};}};var rt=class{constructor(t,r){this.data=t;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=t=>{var n,l;let r=(l=(n=this.data.projectName)!=null?n:t.projectName)!=null?l:this.opik.config.projectName,o={id:Ir(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new et(o,this.opik);return this.spans.push(i),i};this.update=t=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...t};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var pl=s=>s.replace("/api",""),wp=({apiUrl:s,projectName:t,workspaceName:r})=>{let o=encodeURIComponent(t);return `${pl(s)}/${r}/redirect/projects?name=${o}`};var cl=300,ll=100,Ur=class{constructor({action:t,batchSize:r=ll,delay:o,enableBatch:i,name:n="ActionQueue"}){this.timerId=null;this.promise=Promise.resolve();this.queue=new Map;this.debounceFlush=()=>{this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>this.flush(),this.delay);};this.add=(t,r)=>{if(this.queue.set(t,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(t,r)=>{let o=this.queue.get(t);o&&(this.queue.set(t,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let t=new Map(this.queue);this.queue.clear(),E.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(E.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{E.error(`Failed to flush ${this.name}:`,r,t);}),await this.promise;};this.action=t,this.batchSize=r,this.delay=o,this.enableBatch=i,this.name=n;}},Q=class{constructor({delay:t=cl,enableCreateBatch:r=true,enableDeleteBatch:o=true,name:i="BatchQueue"}){this.create=t=>{let r=this.getId(t);this.createQueue.add(r,t);};this.get=async t=>{let r=this.createQueue.queue.get(t);return r||this.getEntity(t)};this.update=(t,r)=>{if(this.createQueue.queue.get(t)){this.createQueue.update(t,r);return}this.updateQueue.add(t,r);};this.delete=t=>{if(this.createQueue.queue.has(t)){this.createQueue.queue.delete(t);return}this.deleteQueue.add(t);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=i,this.createQueue=new Ur({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:t,enableBatch:r,name:`${i}:createQueue`}),this.updateQueue=new Ur({action:async n=>{await this.createQueue.flush();let l=Array.from(n.entries());for(let[d,u]of l)await this.updateEntity(d,u);},delay:t,enableBatch:false,name:`${i}:updateQueue`}),this.deleteQueue=new Ur({action:async n=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(n.keys()));},delay:t,enableBatch:o,name:`${i}:deleteQueue`});}};var ot=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r});}async getEntity(r){return await this.api.spans.getSpanById(r)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o);}};var tt=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanFeedbackScore(o.id,{name:o.name});}};var it=class extends Q{constructor(r,o){super({delay:o,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r});}async getEntity(r){return await this.api.traces.getTraceById(r)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r});}};var at=class extends Q{constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.traces.deleteTraceFeedbackScore(o.id,{name:o.name});}};var On=[],Nr=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=wp({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});E.info(`Started logging traces to the "${t}" project at ${Ln(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;E.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new rt({id:Ir(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),E.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.flush=async()=>{E.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),E.info("Successfully flushed all data to Opik");}catch(t){E.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};E.debug("Initializing OpikClient with config:",t),this.config=Xn(t),this.api=new jr({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new ot(this.api),this.traceBatchQueue=new it(this.api),this.spanFeedbackScoresBatchQueue=new tt(this.api),this.traceFeedbackScoresBatchQueue=new at(this.api),On.push(this);}};var dl="track.decorator",Wn=new async_hooks.AsyncLocalStorage,ul=()=>{let{span:s,trace:t}=Wn.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function wl(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function gl({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){E.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let n=o;n||(n=st.trace({name:s,projectName:r}));let l=n.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return E.debug("Span created with ID:",l.data.id),{span:l,trace:n}}function fl({args:s,span:t,trace:r}){if(E.debug("Starting span execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};E.debug("Recording span input"),t.update({input:o}),r&&(E.debug("Recording trace input"),r.update({input:o}));}function gp({result:s,span:t,trace:r}){E.debug("Recording successful execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id});let o=typeof s=="object"?s:{result:s},i=new Date;t.update({endTime:i,output:o}),r&&r.update({endTime:i,output:o});}function fp({span:s,error:t,trace:r}){var o,i;E.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function nt({name:s,projectName:t,type:r}={},o){return function(...n){let l=Wn.getStore(),{span:d,trace:u}=gl({name:s!=null?s:o.name||dl,parentSpan:l==null?void 0:l.span,projectName:t,trace:l==null?void 0:l.trace,type:r}),w=!l,g=this;return Wn.run({span:d,trace:u},()=>{try{fl({args:n,span:d,trace:w?u:void 0});let z=o.apply(g,n);return wl(z)?z.then(k=>(gp({span:d,result:k,trace:w?u:void 0}),k),k=>{throw fp({span:d,error:k,trace:w?u:void 0}),k}):(gp({span:d,result:z,trace:w?u:void 0}),z)}catch(z){throw fp({span:d,error:z,trace:w?u:void 0}),z}})}}function hl(s,t){if(typeof s=="function")return nt({},s);let r=s;return t?nt(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return nt(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let n=i.value;return i.value=nt(r,n),i}}var st=new Nr;var Rl=async()=>{E.debug("Starting flushAll operation");try{await Promise.all([st.flush(),...On.map(s=>s.flush())]),E.debug("flushAll operation completed successfully");}catch(s){throw E.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};
4
+ exports.Opik=Nr;exports.OpikSpanType=ws;exports.disableLogger=zp;exports.flushAll=Rl;exports.generateId=Ir;exports.getTrackContext=ul;exports.logger=E;exports.setLoggerLevel=Hn;exports.track=hl;exports.trackOpikClient=st;