opik 1.6.13 → 1.6.15
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/{Client-CgkZJ_1L.d.cts → Client-BFXzOx36.d.cts} +133 -39
- package/dist/{Client-CgkZJ_1L.d.ts → Client-BFXzOx36.d.ts} +133 -39
- package/dist/{Node18UniversalStreamWrapper-4W3MJAHL.js → Node18UniversalStreamWrapper-GZXI7BSF.js} +1 -1
- package/dist/{NodePre18StreamWrapper-6SHOOALU.js → NodePre18StreamWrapper-TZYQXHQT.js} +1 -1
- package/dist/{UndiciStreamWrapper-MDO66TBH.js → UndiciStreamWrapper-4QYH36IP.js} +1 -1
- package/dist/chunk-37E5PSYD.js +4 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/vercel/index.cjs +4 -4
- package/dist/vercel/index.d.cts +1 -1
- package/dist/vercel/index.d.ts +1 -1
- package/dist/vercel/index.js +1 -1
- package/package.json +1 -7
- package/dist/chunk-5TBO732O.js +0 -1
- package/dist/chunk-OKUDNHYJ.js +0 -4
- package/dist/langchain/index.cjs +0 -19
- package/dist/langchain/index.d.cts +0 -55
- package/dist/langchain/index.d.ts +0 -55
- package/dist/langchain/index.js +0 -17
package/dist/vercel/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),Qa=require('fs'),hs=require('ini'),cc=require('qs'),uuid=require('uuid'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qa__default=/*#__PURE__*/_interopDefault(Qa);var hs__default=/*#__PURE__*/_interopDefault(hs);var cc__default=/*#__PURE__*/_interopDefault(cc);var gs=Object.defineProperty;var Mo=(s,t)=>()=>(s&&(t=s(s=0)),t);var T=(s,t)=>{for(var r in t)gs(s,r,{get:t[r],enumerable:true});};var wn={};T(wn,{Node18UniversalStreamWrapper:()=>Go});var Go,bn=Mo(()=>{Go=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 hn={};T(hn,{UndiciStreamWrapper:()=>Ho});var Ho,yn=Mo(()=>{Ho=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 kn={};T(kn,{NodePre18StreamWrapper:()=>$o});var $o,zn=Mo(()=>{$o=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 bs={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Ha(s,t=s){return ansiEscapes.link(t,s)}var P=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),$a=s=>{P.settings.minLevel=bs[s];};$a(process.env.OPIK_LOG_LEVEL||"INFO");var ys="~/.opik.config",ks={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function Ya(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function zs(){return Ya({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function Ss(){let s=process.env.OPIK_CONFIG_PATH||ys;if(!Qa__default.default.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=hs__default.default.parse(Qa__default.default.readFileSync(s,"utf8"));return t.opik?Ya({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return P.error(`Error loading config file ${s}: ${t}`),{}}}function Za(s){let t=zs(),r=Ss();return xs({...ks,...r,...t,...s})}function xs(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=Rs(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 Rs(s){return new URL(s).hostname.endsWith("comet.com")}var W={};T(W,{AssistantMessageRole:()=>Us,AttachmentListRequestEntityType:()=>qa,BadRequestError:()=>C,ColumnCompareTypesItem:()=>Ls,ColumnPublicTypesItem:()=>Ks,ColumnTypesItem:()=>Xs,CompleteMultipartUploadRequestEntityType:()=>_s,ConflictError:()=>L,DatasetItemCompareSource:()=>Vs,DatasetItemPublicSource:()=>Js,DatasetItemSource:()=>Ms,DatasetItemWriteSource:()=>Bs,DeleteAttachmentsRequestEntityType:()=>As,DeltaRole:()=>Ns,DownloadAttachmentRequestEntityType:()=>en,FeedbackScoreBatchItemSource:()=>ic,FeedbackScoreCompareSource:()=>Ws,FeedbackScorePublicSource:()=>oc,FeedbackScoreSource:()=>Ds,FindFeedbackDefinitionsRequestType:()=>tn,FindFeedbackScoreNames1RequestType:()=>ln,ForbiddenError:()=>F,GetSpanStatsRequestType:()=>mn,GetSpansByProjectRequestType:()=>pn,LlmAsJudgeMessagePublicRole:()=>Cs,LlmAsJudgeMessageRole:()=>Ts,LlmAsJudgeMessageWriteRole:()=>Ps,LlmAsJudgeOutputSchemaPublicType:()=>js,LlmAsJudgeOutputSchemaType:()=>Es,LlmAsJudgeOutputSchemaWriteType:()=>vs,LogItemLevel:()=>Is,NotFoundError:()=>A,NotImplementedError:()=>fe,ProjectMetricRequestPublicInterval:()=>sn,ProjectMetricRequestPublicMetricType:()=>nn,ProjectMetricResponsePublicInterval:()=>$s,ProjectMetricResponsePublicMetricType:()=>Hs,PromptType:()=>Qs,PromptVersionDetailType:()=>Zs,PromptVersionPublicType:()=>qs,PromptVersionType:()=>Ys,PromptWriteType:()=>cn,ProviderApiKeyProvider:()=>Gs,ProviderApiKeyPublicProvider:()=>Os,ProviderApiKeyWriteProvider:()=>an,ResponseFormatType:()=>Fs,SpanFilterPublicOperator:()=>ac,SpanPublicType:()=>tc,SpanSearchStreamRequestPublicType:()=>dn,SpanType:()=>ec,SpanWriteType:()=>rc,StartMultipartUploadRequestEntityType:()=>rn,TraceFilterPublicOperator:()=>nc,UnauthorizedError:()=>j,UnprocessableEntityError:()=>X,UploadAttachmentRequestEntityType:()=>on,attachments:()=>Pr,automationRuleEvaluators:()=>Lo,chatCompletions:()=>Vo,check:()=>Bo,datasets:()=>Wo,experiments:()=>Jo,feedbackDefinitions:()=>vr,llmProviderKey:()=>Cr,openTelemetryIngestion:()=>Ko,projects:()=>jr,prompts:()=>Ir,redirect:()=>Oo,spans:()=>Ur,systemUsage:()=>Do,traces:()=>Xo});var Pr={};T(Pr,{AttachmentListRequestEntityType:()=>qa,DownloadAttachmentRequestEntityType:()=>en,StartMultipartUploadRequestEntityType:()=>rn,UploadAttachmentRequestEntityType:()=>on});var qa={Trace:"trace",Span:"span"};var en={Trace:"trace",Span:"span"};var rn={Trace:"trace",Span:"span"};var on={Trace:"trace",Span:"span"};var vr={};T(vr,{FindFeedbackDefinitionsRequestType:()=>tn});var tn={Numerical:"numerical",Categorical:"categorical"};var Cr={};T(Cr,{ProviderApiKeyWriteProvider:()=>an});var an={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var jr={};T(jr,{ProjectMetricRequestPublicInterval:()=>sn,ProjectMetricRequestPublicMetricType:()=>nn});var nn={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var sn={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Ir={};T(Ir,{PromptWriteType:()=>cn});var cn={Mustache:"mustache",Jinja2:"jinja2"};var Ur={};T(Ur,{FindFeedbackScoreNames1RequestType:()=>ln,GetSpanStatsRequestType:()=>mn,GetSpansByProjectRequestType:()=>pn,SpanSearchStreamRequestPublicType:()=>dn});var pn={General:"general",Tool:"tool",Llm:"llm"};var ln={General:"general",Tool:"tool",Llm:"llm"};var mn={General:"general",Tool:"tool",Llm:"llm"};var dn={General:"general",Tool:"tool",Llm:"llm"};var Do={};var Bo={};var Lo={};var Vo={};var Wo={};var Jo={};var Ko={};var Xo={};var Oo={};var _s={Trace:"trace",Span:"span"};var As={Trace:"trace",Span:"span"};var Ts={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Es={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ps={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var vs={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Cs={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var js={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Is={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Us={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Ns={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Fs={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Ms={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Ds={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Bs={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Ls={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Vs={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Ws={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Js={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Ks={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Xs={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Os={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Gs={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Hs={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var $s={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Qs={Mustache:"mustache",Jinja2:"jinja2"};var Ys={Mustache:"mustache",Jinja2:"jinja2"};var Zs={Mustache:"mustache",Jinja2:"jinja2"};var qs={Mustache:"mustache",Jinja2:"jinja2"};var ec={General:"general",Tool:"tool",Llm:"llm"};var rc={General:"general",Tool:"tool",Llm:"llm"};var oc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var tc={General:"general",Tool:"tool",Llm:"llm"};var ic={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ac={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 nc={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 ae=(s,t,r)=>JSON.stringify(s,t,r);var c=class s extends Error{constructor({message:t,statusCode:r,body:o}){super(sc({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),r!=null&&(this.statusCode=r),o!==void 0&&(this.body=o);}};function sc({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: ${ae(r,void 0,2)}`),o.join(`
|
|
2
|
-
`)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var
|
|
3
|
-
`)),{ok:true,value:t}):o}}function Nr(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ne=class s extends Error{constructor(r){super(r.map(Nr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var se=class s extends Error{constructor(r){super(r.map(Nr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function _(s){return {nullable:()=>gc(s),optional:()=>Qo(s),optionalNullable:()=>fc(s),transform:t=>Yo(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new se(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new ne(o.errors)}}}function gc(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:()=>S.NULLABLE};return {...t,..._(t)}}function Qo(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:()=>S.OPTIONAL};return {...t,..._(t)}}function fc(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:()=>S.OPTIONAL_NULLABLE};return {...t,..._(t)}}function Yo(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,..._(r)}}function Pn(){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:R(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:R(t,"bigint")}]}:{ok:true,value:t},getType:()=>S.BIGINT};return {...I(s),..._(s)}}var wc=/^([+-]?\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 vn(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:R(t,"string")}]}:wc.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:R(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:R(t,"Date object")}]},getType:()=>S.DATE};return {...I(s),..._(s)}}function D(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...I(r),..._(r)}}}function Fr(s){let t=new Set(s);return D(S.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:n=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:n,message:R(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:n,message:R(o,"enum")}]}:{ok:true,value:o})()}function Cn(s){let t=Zo(s);return {...t,..._(t)}}function Zo(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 we(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 Z(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 he(s){return Object.keys(s)}function jn(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function O(s){return {withParsedProperties:t=>qo(s,t)}}function qo(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);if(!n.ok)return n;let p=Object.entries(t).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(n.value):g}),{});return {ok:true,value:{...n.value,...p}}},json:(o,i)=>{var d;if(!Z(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:R(o,"object")}]};let n=new Set(Object.keys(t)),p=be(o,Object.keys(o).filter(u=>!n.has(u)));return s.json(p,i)},getType:()=>s.getType()};return {...r,..._(r),...O(r)}}function In(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function q(s){return s.isProperty}function Mr(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>q(o)?o.rawKey:r),_getParsedProperties:()=>he(s),parse:(r,o)=>{let i={},n=[];for(let[p,d]of we(s)){let u=q(d)?d.rawKey:p,g=q(d)?d.valueSchema:d,w={rawKey:u,parsedKey:p,valueSchema:g};i[u]=w,Fn(g)&&n.push(u);}return Un({value:r,requiredKeys:n,getProperty:p=>{let d=i[p];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var g;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(g=o==null?void 0:o.breadcrumbsPrefix)!=null?g:[],p]})}}},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,p]of we(s)){let d=q(p)?p.valueSchema:p;Fn(d)&&i.push(n);}return Un({value:r,requiredKeys:i,getProperty:n=>{let p=s[n];if(p!=null)return q(p)?{transformedKey:p.rawKey,transform:d=>{var u;return p.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}:{transformedKey:n,transform:d=>{var u;return p.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:()=>S.OBJECT};return {...I(t),..._(t),...O(t),...ee(t)}}function Un({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:n=[]}){if(!Z(s))return {ok:false,errors:[{path:n,message:R(s,"object")}]};let p=new Set(t),d=[],u={};for(let[g,w]of Object.entries(s)){let k=r(g);if(k!=null){p.delete(g);let z=k.transform(w);z.ok?u[k.transformedKey]=z.value:(u[g]=w,d.push(...z.errors));}else switch(o){case "fail":d.push({path:[...n,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=w;break}}return d.push(...t.filter(g=>p.has(g)).map(g=>({path:n,message:`Missing required key "${g}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function ee(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Nn({extensionKeys:t._getRawProperties(),value:o,transformBase:n=>s.parse(n,i),transformExtension:n=>t.parse(n,i)}),json:(o,i)=>Nn({extensionKeys:t._getParsedProperties(),value:o,transformBase:n=>s.json(n,i),transformExtension:n=>t.json(n,i)}),getType:()=>S.OBJECT};return {...r,..._(r),...O(r),...ee(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:()=>S.OBJECT};return {...t,..._(t),...O(t),...ee(t)}}}}function Nn({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[n,p]=jn(he(t),g=>i.has(g)),d=r(be(t,p)),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 Fn(s){return !bc(s)}function bc(s){switch(s.getType()){case S.ANY:case S.UNKNOWN:case S.OPTIONAL:case S.OPTIONAL_NULLABLE:return true;default:return false}}function Mn(s){return Mr(s)}function Dn(s){let t={...Zo(s),_getRawProperties:()=>ce(s)._getRawProperties(),_getParsedProperties:()=>ce(s)._getParsedProperties()};return {...t,..._(t),...O(t),...ee(t)}}function Dr(s){let t={parse:(r,o)=>Bn(r,(i,n)=>{var p;return s.parse(i,{...o,breadcrumbsPrefix:[...(p=o==null?void 0:o.breadcrumbsPrefix)!=null?p:[],`[${n}]`]})}),json:(r,o)=>Bn(r,(i,n)=>{var p;return s.json(i,{...o,breadcrumbsPrefix:[...(p=o==null?void 0:o.breadcrumbsPrefix)!=null?p:[],`[${n}]`]})}),getType:()=>S.LIST};return {...I(t),..._(t)}}function Bn(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:R(s,"list"),path:[]}]}}function Ln(s){return D(S.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:R(r,`"${s}"`)}]})()}function Vn(s){return D(S.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:R(r,`${s.toString()}`)}]})()}var Wn=D(S.ANY,s=>({ok:true,value:s}));var Jn=D(S.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"boolean")}]});var Kn=D(S.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"number")}]});var Xn=D(S.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"string")}]});var On=D(S.UNKNOWN,s=>({ok:true,value:s}));function Hn(s,t){let r={parse:(o,i)=>Gn({value:o,isKeyNumeric:s.getType()===S.NUMBER,transformKey:n=>{var p;return s.parse(n,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n} (key)`]})},transformValue:(n,p)=>{var d;return t.parse(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${p}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>Gn({value:o,isKeyNumeric:s.getType()===S.NUMBER,transformKey:n=>{var p;return s.json(n,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n} (key)`]})},transformValue:(n,p)=>{var d;return t.json(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${p}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>S.RECORD};return {...I(r),..._(r)}}function Gn({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Z(s)?we(s).reduce((n,[p,d])=>{if(d===void 0)return n;let u=n,g=p;if(t){let E=p.length>0?Number(p):NaN;isNaN(E)||(g=E);}let w=r(g),k=o(d,g);if(u.ok&&w.ok&&k.ok)return {ok:true,value:{...u.value,[w.value]:k.value}};let z=[];return u.ok||z.push(...u.errors),w.ok||z.push(...w.errors),k.ok||z.push(...k.errors),{ok:false,errors:z}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:R(s,"object")}]}}function $n(s){let t=Dr(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 p;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],message:R(o,"Set")}]}},getType:()=>S.SET};return {...I(r),..._(r)}}function Yn(s){let t={parse:(r,o)=>Qn((i,n)=>i.parse(r,n),s,o),json:(r,o)=>Qn((i,n)=>i.json(r,n),s,o),getType:()=>S.UNDISCRIMINATED_UNION};return {...I(t),..._(t)}}function Qn(s,t,r){let o=[];for(let[i,n]of t.entries()){let p=s(n,{...r,skipValidation:false});if(p.ok)return p;for(let d of p.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function Zn(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function es(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=Fr(he(t)),n={parse:(p,d)=>qn({value:p,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(p,d)=>qn({value:p,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>S.UNION};return {...I(n),..._(n),...O(n)}}function qn({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:p,breadcrumbsPrefix:d=[]}){if(!Z(s))return {ok:false,errors:[{path:d,message:R(s,"object")}]};let{[t]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let w=o(u);if(!w.ok)return {ok:false,errors:w.errors};let k=i(w.value);if(k==null)return n?{ok:true,value:{[r]:w.value,...g}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let z=p(g,k);return z.ok?{ok:true,value:{[r]:u,...z.value}}:z}function hc(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 p=n.split("?");return n=p.shift()+(p.length>0?"?":"")+p.join("&"),n}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),hc(s)}var B={};T(B,{AssistantMessage:()=>pi,AssistantMessageRole:()=>ci,Attachment:()=>zt,AttachmentListRequestEntityType:()=>Br,AttachmentPage:()=>St,AuthDetailsHolder:()=>Tt,AutomationRuleEvaluator:()=>Rc,AutomationRuleEvaluatorLlmAsJudge:()=>Ut,AutomationRuleEvaluatorLlmAsJudgePublic:()=>sr,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Wt,AutomationRuleEvaluatorObjectPublic:()=>qt,AutomationRuleEvaluatorPagePublic:()=>ei,AutomationRuleEvaluatorPublic:()=>ri,AutomationRuleEvaluatorUpdate:()=>si,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>ai,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>ni,AutomationRuleEvaluatorUserDefinedMetricPython:()=>Nt,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>cr,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Kt,AutomationRuleEvaluatorWrite:()=>Xt,AvgValueStatPublic:()=>Ia,BatchDelete:()=>U,BiInformation:()=>wt,BiInformationResponse:()=>ir,CategoricalFeedbackDefinition:()=>Bi,CategoricalFeedbackDefinitionCreate:()=>Ji,CategoricalFeedbackDefinitionPublic:()=>dr,CategoricalFeedbackDefinitionUpdate:()=>qi,CategoricalFeedbackDetail:()=>Di,CategoricalFeedbackDetailCreate:()=>Wi,CategoricalFeedbackDetailPublic:()=>Gi,CategoricalFeedbackDetailUpdate:()=>Zi,ChatCompletionChoice:()=>di,ChatCompletionRequest:()=>Qe,ChatCompletionResponse:()=>fi,ChunkedOutputJsonNode:()=>Tc,ChunkedOutputJsonNodePublic:()=>Dc,ChunkedOutputJsonNodePublicType:()=>Va,ChunkedOutputJsonNodeType:()=>Ni,Column:()=>Ii,ColumnCompare:()=>yi,ColumnCompareTypesItem:()=>hi,ColumnPublic:()=>vi,ColumnPublicTypesItem:()=>Pi,ColumnTypesItem:()=>ji,Comment:()=>N,CommentCompare:()=>ki,CommentPublic:()=>oe,CompleteMultipartUploadRequest:()=>lo,CompleteMultipartUploadRequestEntityType:()=>xt,CompletionTokensDetails:()=>ui,CountValueStatPublic:()=>Ua,CreatePromptVersionDetail:()=>Te,DataPointNumberPublic:()=>pa,Dataset:()=>_c,DatasetIdentifier:()=>er,DatasetIdentifierPublic:()=>or,DatasetItem:()=>bi,DatasetItemBatch:()=>Ac,DatasetItemBatchWrite:()=>Ze,DatasetItemCompare:()=>_i,DatasetItemCompareSource:()=>zi,DatasetItemPageCompare:()=>Ai,DatasetItemPagePublic:()=>Ci,DatasetItemPublic:()=>mr,DatasetItemPublicSource:()=>Ei,DatasetItemSource:()=>wi,DatasetItemStreamRequest:()=>tr,DatasetItemWrite:()=>ft,DatasetItemWriteSource:()=>gt,DatasetItemsDelete:()=>rr,DatasetPagePublic:()=>Ti,DatasetPublic:()=>ue,DatasetUpdate:()=>qe,DatasetWrite:()=>Ye,DeleteAttachmentsRequest:()=>xc,DeleteAttachmentsRequestEntityType:()=>_t,DeleteFeedbackScore:()=>br,DeleteTraceThreads:()=>Xe,Delta:()=>mi,DeltaRole:()=>li,DownloadAttachmentRequestEntityType:()=>Lr,ErrorInfo:()=>Q,ErrorInfoPublic:()=>hr,ErrorInfoWrite:()=>ve,ErrorMessage:()=>V,ErrorMessageDetail:()=>Fc,ErrorMessageDetailed:()=>Uc,ErrorMessagePublic:()=>Pc,Experiment:()=>Ec,ExperimentItem:()=>Fe,ExperimentItemCompare:()=>Ri,ExperimentItemPublic:()=>lr,ExperimentItemStreamRequest:()=>Ve,ExperimentItemsBatch:()=>Me,ExperimentItemsDelete:()=>De,ExperimentPagePublic:()=>Mi,ExperimentPublic:()=>ge,ExperimentWrite:()=>Ne,ExperimentsDelete:()=>Be,ExportTraceServiceRequest:()=>jc,Feedback:()=>vc,FeedbackCreate:()=>Oi,FeedbackDefinitionPagePublic:()=>Qi,FeedbackObjectPublic:()=>$i,FeedbackPublic:()=>Yi,FeedbackScore:()=>G,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>wa,FeedbackScoreAveragePublic:()=>Fi,FeedbackScoreBatch:()=>Sr,FeedbackScoreBatchItem:()=>La,FeedbackScoreBatchItemSource:()=>Ba,FeedbackScoreCompare:()=>xi,FeedbackScoreCompareSource:()=>Si,FeedbackScoreNames:()=>ca,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>va,FeedbackScoreSource:()=>at,FeedbackUpdate:()=>oa,FindFeedbackDefinitionsRequestType:()=>Kr,FindFeedbackScoreNames1RequestType:()=>eo,Function:()=>$e,FunctionCall:()=>Y,GetSpanStatsRequestType:()=>ro,GetSpansByProjectRequestType:()=>qr,IdentifierPublic:()=>Le,JsonNode:()=>x,JsonNodeCompare:()=>mo,JsonNodeDetail:()=>et,JsonNodePublic:()=>K,JsonNodeWrite:()=>J,JsonObjectSchema:()=>He,JsonSchema:()=>mt,JsonSchemaElement:()=>so,LlmAsJudgeCode:()=>ar,LlmAsJudgeCodePublic:()=>Yt,LlmAsJudgeCodeWrite:()=>Vt,LlmAsJudgeMessage:()=>Ct,LlmAsJudgeMessagePublic:()=>Ht,LlmAsJudgeMessagePublicRole:()=>Gt,LlmAsJudgeMessageRole:()=>vt,LlmAsJudgeMessageWrite:()=>Dt,LlmAsJudgeMessageWriteRole:()=>Mt,LlmAsJudgeModelParameters:()=>Pt,LlmAsJudgeModelParametersPublic:()=>Ot,LlmAsJudgeModelParametersWrite:()=>Ft,LlmAsJudgeOutputSchema:()=>It,LlmAsJudgeOutputSchemaPublic:()=>Qt,LlmAsJudgeOutputSchemaPublicType:()=>$t,LlmAsJudgeOutputSchemaType:()=>jt,LlmAsJudgeOutputSchemaWrite:()=>Lt,LlmAsJudgeOutputSchemaWriteType:()=>Bt,LogItem:()=>ti,LogItemLevel:()=>oi,LogPage:()=>ii,Message:()=>ct,MultipartUploadPart:()=>Rt,NumericalFeedbackDefinition:()=>Vi,NumericalFeedbackDefinitionCreate:()=>Xi,NumericalFeedbackDefinitionPublic:()=>ur,NumericalFeedbackDefinitionUpdate:()=>ra,NumericalFeedbackDetail:()=>Li,NumericalFeedbackDetailCreate:()=>Ki,NumericalFeedbackDetailPublic:()=>Hi,NumericalFeedbackDetailUpdate:()=>ea,PageColumns:()=>Ui,PercentageValueStatPublic:()=>Fa,PercentageValues:()=>fr,PercentageValuesDetailed:()=>ba,PercentageValuesPublic:()=>Na,Project:()=>Ic,ProjectDetailed:()=>ha,ProjectMetricRequestPublic:()=>Re,ProjectMetricRequestPublicInterval:()=>$r,ProjectMetricRequestPublicMetricType:()=>Hr,ProjectMetricResponsePublic:()=>ua,ProjectMetricResponsePublicInterval:()=>ma,ProjectMetricResponsePublicMetricType:()=>la,ProjectPagePublic:()=>na,ProjectPublic:()=>wr,ProjectRetrieveDetailed:()=>_e,ProjectStatItemObjectPublic:()=>Da,ProjectStatsPublic:()=>zr,ProjectStatsSummary:()=>fa,ProjectStatsSummaryItem:()=>ga,ProjectUpdate:()=>xe,ProjectWrite:()=>Se,Prompt:()=>Nc,PromptDetail:()=>Sa,PromptPagePublic:()=>Ta,PromptPublic:()=>Aa,PromptType:()=>ya,PromptUpdatable:()=>Ee,PromptVersion:()=>za,PromptVersionDetail:()=>$,PromptVersionDetailType:()=>rt,PromptVersionLink:()=>uo,PromptVersionLinkPublic:()=>go,PromptVersionLinkWrite:()=>ao,PromptVersionPagePublic:()=>_a,PromptVersionPublic:()=>Ra,PromptVersionPublicType:()=>xa,PromptVersionRetrieveDetail:()=>Pe,PromptVersionType:()=>ka,PromptWrite:()=>Ae,PromptWriteType:()=>Yr,ProviderApiKey:()=>Cc,ProviderApiKeyPagePublic:()=>ia,ProviderApiKeyProvider:()=>aa,ProviderApiKeyPublic:()=>gr,ProviderApiKeyPublicProvider:()=>ta,ProviderApiKeyUpdate:()=>ze,ProviderApiKeyWrite:()=>ke,ProviderApiKeyWriteProvider:()=>Or,ResponseFormat:()=>dt,ResponseFormatType:()=>lt,ResultsNumberPublic:()=>da,ScoreName:()=>sa,Span:()=>Pa,SpanBatch:()=>Mc,SpanBatchWrite:()=>je,SpanFilterPublic:()=>it,SpanFilterPublicOperator:()=>tt,SpanPagePublic:()=>ja,SpanPublic:()=>kr,SpanPublicType:()=>Ca,SpanSearchStreamRequestPublic:()=>Ue,SpanSearchStreamRequestPublicType:()=>oo,SpanType:()=>Ea,SpanUpdate:()=>Ie,SpanWrite:()=>Ce,SpanWriteType:()=>ot,SpansCountResponse:()=>ht,StartMultipartUploadRequest:()=>ye,StartMultipartUploadRequestEntityType:()=>Vr,StartMultipartUploadResponse:()=>At,StreamOptions:()=>pt,Tool:()=>ut,ToolCall:()=>pr,Trace:()=>Wa,TraceBatch:()=>Bc,TraceBatchWrite:()=>Je,TraceCountResponse:()=>kt,TraceFilterPublic:()=>st,TraceFilterPublicOperator:()=>nt,TracePagePublic:()=>Ka,TracePublic:()=>xr,TraceSearchStreamRequestPublic:()=>Ge,TraceThread:()=>Rr,TraceThreadIdentifier:()=>Oe,TraceThreadPage:()=>Ja,TraceUpdate:()=>Ke,TraceWrite:()=>We,UploadAttachmentRequestEntityType:()=>Wr,Usage:()=>gi,UserDefinedMetricPythonCode:()=>nr,UserDefinedMetricPythonCodePublic:()=>Zt,UserDefinedMetricPythonCodeWrite:()=>Jt,WorkspaceNameHolder:()=>Et,WorkspaceSpansCount:()=>bt,WorkspaceTraceCount:()=>yt,attachments:()=>pe,chatCompletions:()=>co,datasets:()=>po,experiments:()=>me,feedbackDefinitions:()=>Xr,llmProviderKey:()=>Gr,projects:()=>Qr,prompts:()=>Zr,spans:()=>le,traces:()=>de});var pe={};T(pe,{AttachmentListRequestEntityType:()=>Br,DownloadAttachmentRequestEntityType:()=>Lr,StartMultipartUploadRequest:()=>ye,StartMultipartUploadRequestEntityType:()=>Vr,UploadAttachmentRequestEntityType:()=>Wr,uploadAttachment:()=>Jr});var Br=e.enum_(["trace","span"]);var Lr=e.enum_(["trace","span"]);var Vr=e.enum_(["trace","span"]);var Wr=e.enum_(["trace","span"]);var Jr={};T(Jr,{Request:()=>yc});var yc=e.record(e.string(),e.unknown());var ye=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",Vr),entityId:e.property("entity_id",e.string()),path:e.string()});var Xr={};T(Xr,{FindFeedbackDefinitionsRequestType:()=>Kr});var Kr=e.enum_(["numerical","categorical"]);var Gr={};T(Gr,{ProviderApiKeyUpdate:()=>ze,ProviderApiKeyWrite:()=>ke,ProviderApiKeyWriteProvider:()=>Or});var Or=e.enum_(["openai","anthropic","gemini","openrouter"]);var ke=e.object({provider:Or,apiKey:e.property("api_key",e.string()),name:e.string().optional()});var ze=e.object({apiKey:e.property("api_key",e.string()),name:e.string().optional()});var Qr={};T(Qr,{ProjectMetricRequestPublic:()=>Re,ProjectMetricRequestPublicInterval:()=>$r,ProjectMetricRequestPublicMetricType:()=>Hr,ProjectRetrieveDetailed:()=>_e,ProjectUpdate:()=>xe,ProjectWrite:()=>Se});var Hr=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var $r=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Se=e.object({name:e.string(),description:e.string().optional()});var xe=e.object({name:e.string().optional(),description:e.string().optional()});var Re=e.object({metricType:e.property("metric_type",Hr.optional()),interval:$r.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional())});var _e=e.object({name:e.string()});var Zr={};T(Zr,{CreatePromptVersionDetail:()=>Te,PromptUpdatable:()=>Ee,PromptVersionRetrieveDetail:()=>Pe,PromptWrite:()=>Ae,PromptWriteType:()=>Yr});var Yr=e.enum_(["mustache","jinja2"]);var J=e.record(e.string(),e.unknown());var Ae=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:J.optional(),changeDescription:e.property("change_description",e.string().optional()),type:Yr.optional()});var et=e.record(e.string(),e.unknown());var rt=e.enum_(["mustache","jinja2"]);var $=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:rt.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 Te=e.object({name:e.string(),version:$});var Ee=e.object({name:e.string(),description:e.string().optional()});var Pe=e.object({name:e.string(),commit:e.string().optional()});var le={};T(le,{FindFeedbackScoreNames1RequestType:()=>eo,GetSpanStatsRequestType:()=>ro,GetSpansByProjectRequestType:()=>qr,SpanBatchWrite:()=>je,SpanSearchStreamRequestPublic:()=>Ue,SpanSearchStreamRequestPublicType:()=>oo,SpanUpdate:()=>Ie,findFeedbackScoreNames1:()=>to});var qr=e.enum_(["general","tool","llm"]);var eo=e.enum_(["general","tool","llm"]);var ro=e.enum_(["general","tool","llm"]);var oo=e.enum_(["general","tool","llm"]);var to={};T(to,{Response:()=>kc});var kc=e.list(e.string());var ot=e.enum_(["general","tool","llm"]);var ve=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ce=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:ot,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:J.optional(),output:J.optional(),metadata:J.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",ve.optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var je=e.object({spans:e.list(Ce)});var x=e.record(e.string(),e.unknown());var Q=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ie=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:x.optional(),output:x.optional(),metadata:x.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",Q.optional())});var tt=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var it=e.object({field:e.string().optional(),operator:tt.optional(),key:e.string().optional(),value:e.string().optional()});var Ue=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:oo.optional(),filters:e.list(it).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var me={};T(me,{ExperimentItemStreamRequest:()=>Ve,ExperimentItemsBatch:()=>Me,ExperimentItemsDelete:()=>De,ExperimentWrite:()=>Ne,ExperimentsDelete:()=>Be,IdentifierPublic:()=>Le,findFeedbackScoreNames:()=>io});var io={};T(io,{Response:()=>zc});var zc=e.list(e.string());var ao=e.object({id:e.string()});var Ne=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:J.optional(),promptVersion:e.property("prompt_version",ao.optional()),promptVersions:e.property("prompt_versions",e.list(ao).optional())});var at=e.enum_(["ui","sdk","online_scoring"]);var G=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 N=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 Fe=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:x.optional(),output:x.optional(),feedbackScores:e.property("feedback_scores",e.list(G).optional()),comments:e.list(N).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 Me=e.object({experimentItems:e.property("experiment_items",e.list(Fe))});var De=e.object({ids:e.list(e.string())});var Be=e.object({ids:e.list(e.string())});var Le=e.object({name:e.string()});var Ve=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 de={};T(de,{DeleteTraceThreads:()=>Xe,TraceBatchWrite:()=>Je,TraceSearchStreamRequestPublic:()=>Ge,TraceThreadIdentifier:()=>Oe,TraceUpdate:()=>Ke,findFeedbackScoreNames2:()=>no});var no={};T(no,{Response:()=>Sc});var Sc=e.list(e.string());var We=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:J.optional(),output:J.optional(),metadata:J.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ve.optional()),threadId:e.property("thread_id",e.string().optional())});var Je=e.object({traces:e.list(We)});var Ke=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Q.optional()),threadId:e.property("thread_id",e.string().optional())});var Xe=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 Oe=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 st=e.object({field:e.string().optional(),operator:nt.optional(),key:e.string().optional(),value:e.string().optional()});var Ge=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(st).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional()});var co={};T(co,{ChatCompletionRequest:()=>Qe});var ct=e.record(e.string(),e.unknown());var pt=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var lt=e.enum_(["text","json_object","json_schema"]);var so=e.object({type:e.string().optional()});var He=e.object({type:e.string().optional(),description:e.string().optional(),properties:e.record(e.string(),so).optional(),required:e.list(e.string()).optional(),additionalProperties:e.boolean().optional(),defs:e.property("$defs",e.record(e.string(),so).optional())});var mt=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:He.optional()});var dt=e.object({type:lt.optional(),jsonSchema:e.property("json_schema",mt.optional())});var $e=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:He.optional()});var ut=e.object({type:e.stringLiteral("function").optional(),function:$e.optional()});var Y=e.object({name:e.string().optional(),arguments:e.string().optional()});var Qe=e.object({model:e.string().optional(),messages:e.list(ct).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",pt.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",dt.optional()),seed:e.number().optional(),tools:e.list(ut).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($e).optional(),functionCall:e.property("function_call",Y.optional())});var po={};T(po,{DatasetIdentifier:()=>er,DatasetIdentifierPublic:()=>or,DatasetItemBatchWrite:()=>Ze,DatasetItemStreamRequest:()=>tr,DatasetItemsDelete:()=>rr,DatasetUpdate:()=>qe,DatasetWrite:()=>Ye});var Ye=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()});var gt=e.enum_(["manual","trace","span","sdk"]);var ft=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:gt,data:x});var Ze=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(ft)});var qe=e.object({name:e.string(),description:e.string().optional()});var er=e.object({datasetName:e.property("dataset_name",e.string())});var rr=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var or=e.object({datasetName:e.property("dataset_name",e.string())});var tr=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 wt=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var ir=e.object({biInformation:e.property("bi_information",e.list(wt).optional())});var bt=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var ht=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(bt).optional())});var yt=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var kt=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(yt).optional())});var zt=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 St=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(zt).optional(),sortableBy:e.list(e.string()).optional()});var V=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var xt=e.enum_(["trace","span"]);var Rt=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var lo=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",xt),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(Rt))});var _t=e.enum_(["trace","span"]);var xc=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",_t),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var At=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var Tt=e.record(e.string(),e.unknown());var Et=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var Pt=e.object({name:e.string(),temperature:e.number()});var vt=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Ct=e.object({role:vt,content:e.string()});var jt=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var It=e.object({name:e.string(),type:jt,description:e.string()});var ar=e.object({model:Pt,messages:e.list(Ct),variables:e.record(e.string(),e.string()),schema:e.list(It)});var Ut=e.object({code:ar.optional()});var nr=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Nt=e.object({code:nr.optional()});var rs=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()}),Rc=e.union("type",{llm_as_judge:Ut.extend(rs),user_defined_metric_python:Nt.extend(rs)}).transform({transform:s=>s,untransform:s=>s});var Ft=e.object({name:e.string(),temperature:e.number()});var Mt=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Dt=e.object({role:Mt,content:e.string()});var Bt=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Lt=e.object({name:e.string(),type:Bt,description:e.string()});var Vt=e.object({model:Ft,messages:e.list(Dt),variables:e.record(e.string(),e.string()),schema:e.list(Lt)});var Wt=e.object({code:Vt.optional()});var Jt=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Kt=e.object({code:Jt.optional()});var os=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()}),Xt=e.union("type",{llm_as_judge:Wt.extend(os),user_defined_metric_python:Kt.extend(os)}).transform({transform:s=>s,untransform:s=>s});var U=e.object({ids:e.list(e.string())});var Ot=e.object({name:e.string(),temperature:e.number()});var Gt=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Ht=e.object({role:Gt,content:e.string()});var $t=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Qt=e.object({name:e.string(),type:$t,description:e.string()});var Yt=e.object({model:Ot,messages:e.list(Ht),variables:e.record(e.string(),e.string()),schema:e.list(Qt)});var sr=e.object({code:Yt.optional()});var Zt=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var cr=e.object({code:Zt.optional()});var ts=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()}),qt=e.union("type",{llm_as_judge:sr.extend(ts),user_defined_metric_python:cr.extend(ts)}).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(qt).optional()});var is=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()}),ri=e.union("type",{llm_as_judge:sr.extend(is),user_defined_metric_python:cr.extend(is)}).transform({transform:s=>s,untransform:s=>s});var oi=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var ti=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:oi.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var ii=e.object({content:e.list(ti).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var ai=e.object({code:ar.optional()});var ni=e.object({code:nr.optional()});var as=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()}),si=e.union("type",{llm_as_judge:ai.extend(as),user_defined_metric_python:ni.extend(as)}).transform({transform:s=>s,untransform:s=>s});var ci=e.enum_(["system","user","assistant","tool","function"]);var pr=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:Y.optional()});var pi=e.object({role:ci.optional(),content:e.string().optional(),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(pr).optional()),refusal:e.boolean().optional(),functionCall:e.property("function_call",Y.optional())});var li=e.enum_(["system","user","assistant","tool","function"]);var mi=e.object({role:li.optional(),content:e.string().optional(),toolCalls:e.property("tool_calls",e.list(pr).optional()),functionCall:e.property("function_call",Y.optional())});var di=e.object({index:e.number().optional(),message:pi.optional(),delta:mi.optional(),finishReason:e.property("finish_reason",e.string().optional())});var ui=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var gi=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",ui.optional())});var fi=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(di).optional(),usage:gi.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional())});var _c=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()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional())});var wi=e.enum_(["manual","trace","span","sdk"]);var bi=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:wi,data:x,experimentItems:e.property("experiment_items",e.list(Fe).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 Ac=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(bi)});var hi=e.enum_(["string","number","object","boolean","array","null"]);var yi=e.object({name:e.string().optional(),types:e.list(hi).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var ki=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 mo=e.record(e.string(),e.unknown());var Si=e.enum_(["ui","sdk","online_scoring"]);var xi=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Si,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 Ri=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:mo.optional(),output:mo.optional(),feedbackScores:e.property("feedback_scores",e.list(xi).optional()),comments:e.list(ki).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 _i=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:x,experimentItems:e.property("experiment_items",e.list(Ri).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 Ai=e.object({content:e.list(_i).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(yi).optional()});var ue=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()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional())});var Ti=e.object({content:e.list(ue).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Ei=e.enum_(["manual","trace","span","sdk"]);var lr=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 mr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ei,data:x,experimentItems:e.property("experiment_items",e.list(lr).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 Pi=e.enum_(["string","number","object","boolean","array","null"]);var vi=e.object({name:e.string().optional(),types:e.list(Pi).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Ci=e.object({content:e.list(mr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(vi).optional()});var ji=e.enum_(["string","number","object","boolean","array","null"]);var Ii=e.object({name:e.string().optional(),types:e.list(ji).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Ui=e.object({columns:e.list(Ii).optional()});var Ni=e.object({typeName:e.string().optional()});var Tc=e.object({type:Ni.optional(),closed:e.boolean().optional()});var re=e.object({name:e.string(),value:e.number()});var uo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Ec=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:x.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),comments:e.list(N).optional(),traceCount:e.property("trace_count",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()),promptVersion:e.property("prompt_version",uo.optional()),promptVersions:e.property("prompt_versions",e.list(uo).optional())});var oe=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 K=e.record(e.string(),e.unknown());var Fi=e.object({name:e.string(),value:e.number()});var go=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var ge=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:K.optional(),feedbackScores:e.property("feedback_scores",e.list(Fi).optional()),comments:e.list(oe).optional(),traceCount:e.property("trace_count",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()),promptVersion:e.property("prompt_version",go.optional()),promptVersions:e.property("prompt_versions",e.list(go).optional())});var Mi=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ge).optional(),sortableBy:e.list(e.string()).optional()});var Pc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Di=e.object({categories:e.record(e.string(),e.number())});var Bi=e.object({details:Di.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 Li=e.object({max:e.number(),min:e.number()});var Vi=e.object({details:Li.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 ns=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()}),vc=e.union("type",{numerical:Vi.extend(ns),categorical:Bi.extend(ns)}).transform({transform:s=>s,untransform:s=>s});var Wi=e.object({categories:e.record(e.string(),e.number())});var Ji=e.object({details:Wi.optional()});var Ki=e.object({max:e.number(),min:e.number()});var Xi=e.object({details:Ki.optional()});var ss=e.object({id:e.string().optional(),name:e.string()}),Oi=e.union("type",{numerical:Xi.extend(ss),categorical:Ji.extend(ss)}).transform({transform:s=>s,untransform:s=>s});var Gi=e.object({categories:e.record(e.string(),e.number())});var dr=e.object({details:Gi.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 Hi=e.object({max:e.number(),min:e.number()});var ur=e.object({details:Hi.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 cs=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()}),$i=e.union("type",{numerical:ur.extend(cs),categorical:dr.extend(cs)}).transform({transform:s=>s,untransform:s=>s});var Qi=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list($i).optional()});var ps=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()}),Yi=e.union("type",{numerical:ur.extend(ps),categorical:dr.extend(ps)}).transform({transform:s=>s,untransform:s=>s});var Zi=e.object({categories:e.record(e.string(),e.number())});var qi=e.object({details:Zi.optional()});var ea=e.object({max:e.number(),min:e.number()});var ra=e.object({details:ea.optional()});var ls=e.object({id:e.string().optional(),name:e.string()}),oa=e.union("type",{numerical:ra.extend(ls),categorical:qi.extend(ls)}).transform({transform:s=>s,untransform:s=>s});var ta=e.enum_(["openai","anthropic","gemini","openrouter"]);var gr=e.object({id:e.string().optional(),provider:ta,apiKey:e.property("api_key",e.string()),name: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 ia=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(gr).optional(),sortableBy:e.list(e.string()).optional()});var aa=e.enum_(["openai","anthropic","gemini","openrouter"]);var Cc=e.object({id:e.string().optional(),provider:aa,apiKey:e.property("api_key",e.string()),name: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 jc=x;var fr=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Ic=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()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:fr.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())});var wr=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()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wr).optional(),sortableBy:e.list(e.string()).optional()});var sa=e.object({name:e.string().optional()});var ca=e.object({scores:e.list(sa).optional()});var pa=e.object({time:e.date(),value:e.number().optional()});var la=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var ma=e.enum_(["HOURLY","DAILY","WEEKLY"]);var da=e.object({name:e.string().optional(),data:e.list(pa).optional()});var ua=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",la.optional()),interval:ma.optional(),results:e.list(da).optional()});var ga=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:fr.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())});var fa=e.object({content:e.list(ga).optional()});var wa=e.object({name:e.string(),value:e.number()});var ba=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ha=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()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(wa).optional()),duration:ba.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())});var Uc=e.object({errors:e.list(e.string()).optional()});var ya=e.enum_(["mustache","jinja2"]);var ka=e.enum_(["mustache","jinja2"]);var za=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:x.optional(),type:ka.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 Nc=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:x.optional(),changeDescription:e.property("change_description",e.string().optional()),type: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()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",za.optional())});var Fc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Sa=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",$.optional())});var xa=e.enum_(["mustache","jinja2"]);var Ra=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:K.optional(),type:xa.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 _a=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ra).optional()});var Aa=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 Ta=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Aa).optional()});var Ea=e.enum_(["general","tool","llm"]);var Pa=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:Ea,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.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",Q.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(G).optional()),comments:e.list(N).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 Mc=e.object({spans:e.list(Pa)});var br=e.object({name:e.string()});var hr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var va=e.enum_(["ui","sdk","online_scoring"]);var yr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:va,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 Ca=e.enum_(["general","tool","llm"]);var kr=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:Ca,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:K.optional(),output:K.optional(),metadata:K.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",hr.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(yr).optional()),comments:e.list(oe).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 ja=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 Ia=e.object({value:e.number().optional()});var Ua=e.object({value:e.number().optional()});var Na=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Fa=e.object({value:Na.optional()});var Ma=e.object({name:e.string().optional()}),Da=e.union("type",{PERCENTAGE:Fa.extend(Ma),COUNT:Ua.extend(Ma),AVG:Ia.extend(Ma)}).transform({transform:s=>s,untransform:s=>s});var zr=e.object({stats:e.list(Da).optional()});var Ba=e.enum_(["ui","sdk","online_scoring"]);var La=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:Ba});var Sr=e.object({scores:e.list(La)});var Va=e.object({typeName:e.string().optional()});var Dc=e.object({type:Va.optional(),closed:e.boolean().optional()});var Wa=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(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Q.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(G).optional()),comments:e.list(N).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 Bc=e.object({traces:e.list(Wa)});var xr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",hr.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(yr).optional()),comments:e.list(oe).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 Rr=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",x.optional()),lastMessage:e.property("last_message",x.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 Ja=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rr).optional()});var Ka=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 fo=class{constructor(t={}){this._options=t;}async getDatasetBiInfo(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 ir.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new c({message:r.error.errorMessage})}}async getExperimentBiInfo(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 ir.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new c({message:r.error.errorMessage})}}async getSpansCountForWorkspaces(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 ht.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesBiInfo(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 ir.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesCountForWorkspaces(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 kt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var wo=class{constructor(t={}){this._options=t;}async attachmentList(t,r){var k,z;let{page:o,size:i,projectId:n,entityType:p,entityId:d,path:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),g.project_id=n,g.entity_type=Br.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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: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(w.ok)return St.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new j(w.error.body);case 403:throw new F(V.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:w.error.statusCode,body:w.error.body})}switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new c({message:w.error.errorMessage})}}async startMultiPartUpload(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:lo.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new j(o.error.body);case 403:throw new F(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAttachments(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:lo.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new j(o.error.body);case 403:throw new F(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async downloadAttachment(t,r){var k,z;let{workspaceName:o,containerId:i,entityType:n,entityId:p,fileName:d,mimeType:u}=t,g={};o!=null&&(g.workspace_name=o),g.container_id=i,g.entity_type=Lr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),g.entity_id=p,g.file_name=d,g.mime_type=u;let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,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(w.ok)return w.body;if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new j(w.error.body);case 403:throw new F(V.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:w.error.statusCode,body:w.error.body})}switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new c({message:w.error.errorMessage})}}async startMultiPartUpload1(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:ye.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 At.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new j(o.error.body);case 403:throw new F(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new c({message:o.error.errorMessage})}}async uploadAttachment(t,r){var k,z;let{fileName:o,projectName:i,mimeType:n,entityType:p,entityId:d,body:u}=t,g={};g.file_name=o,i!=null&&(g.project_name=i),n!=null&&(g.mime_type=n),g.entity_type=Wr.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,requestType:"json",body:pe.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(!w.ok){if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new j(w.error.body);case 403:throw new F(V.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:w.error.statusCode,body:w.error.body})}switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new c({message:w.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var bo=class{constructor(t={}){this._options=t;}async access(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Tt.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new j(o.error.body);case 403:throw new F(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getWorkspaceName(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 Et.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new j(r.error.body);case 403:throw new F(V.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:r.error.statusCode,body:r.error.body})}switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var ho=class{constructor(t={}){this._options=t;}async findEvaluators(t={},r){var g,w;let{projectId:o,name:i,page:n,size:p}=t,d={};o!=null&&(d.project_id=o),i!=null&&(d.name=i),n!=null&&(d.page=n.toString()),p!=null&&(d.size=p.toString());let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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 ei.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new c({message:u.error.errorMessage})}}async createAutomationRuleEvaluator(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Xt.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,n={};o!=null&&(n.project_id=o);let p=await h({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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:U.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(!p.ok){if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new c({message:p.error.errorMessage})}}}async getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,n={};i!=null&&(n.project_id=i);let p=await h({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return ri.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:p.error.errorMessage})}}async updateAutomationRuleEvaluator(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:si.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,n={};i!=null&&(n.size=i.toString());let p=await h({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return ii.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new c({message:p.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var yo=class{constructor(t={}){this._options=t;}async createChatCompletions(t={},r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 fi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var ko=class{constructor(t={}){this._options=t;}async findDatasets(t={},r){var k,z;let{page:o,size:i,withExperimentsOnly:n,promptId:p,name:d,sorting:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),n!=null&&(g.with_experiments_only=n.toString()),p!=null&&(g.prompt_id=p),d!=null&&(g.name=d),u!=null&&(g.sorting=u);let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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(w.ok)return Ti.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(w.error.reason==="status-code")throw new c({statusCode:w.error.statusCode,body:w.error.body});switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new c({message:w.error.errorMessage})}}async createDataset(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Ye.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createOrUpdateDatasetItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getDatasetById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateDataset(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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: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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteDataset(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetByName(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetsBatch(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findDatasetItemsWithExperimentItems(t,r,o){var k,z;let{page:i,size:n,experimentIds:p,filters:d,truncate:u}=r,g={};i!=null&&(g.page=i.toString()),n!=null&&(g.size=n.toString()),g.experiment_ids=p,d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,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(w.ok)return Ai.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(w.error.reason==="status-code")throw new c({statusCode:w.error.statusCode,body:w.error.body});switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new c({message:w.error.errorMessage})}}async getDatasetByIdentifier(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItemById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 mr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItems(t,r={},o){var g,w;let{page:i,size:n,truncate:p}=r,d={};i!=null&&(d.page=i.toString()),n!=null&&(d.size=n.toString()),p!=null&&(d.truncate=p.toString());let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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 Ci.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new c({message:u.error.errorMessage})}}async getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,n={};i!=null&&(n.experiment_ids=i);let p=await h({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return Ui.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new c({message:p.error.errorMessage})}}async streamDatasetItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var zo=class{constructor(t={}){this._options=t;}async findExperiments(t={},r){var z,E;let{page:o,size:i,datasetId:n,name:p,datasetDeleted:d,promptId:u,sorting:g}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),n!=null&&(w.datasetId=n),p!=null&&(w.name=p),d!=null&&(w.dataset_deleted=d.toString()),u!=null&&(w.prompt_id=u),g!=null&&(w.sorting=g);let k=await h({url:y((E=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?E:b.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: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(k.ok)return Mi.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new C(k.error.body);default:throw new c({statusCode:k.error.statusCode,body:k.error.body})}switch(k.error.reason){case "non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new c({message:k.error.errorMessage})}}async createExperiment(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createExperimentItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Me.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentsById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames(t={},r){var p,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let n=await h({url:y((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 me.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getExperimentById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 ge.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getExperimentByName(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.Default,"v1/private/experiments/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: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 ge.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getExperimentItemById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 lr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async streamExperimentItems(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Ve.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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var So=class{constructor(t={}){this._options=t;}async findFeedbackDefinitions(t={},r){var g,w;let{page:o,size:i,name:n,type:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.type=Kr.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}));let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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 Qi.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new c({message:u.error.errorMessage})}}async createFeedbackDefinition(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Oi.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getFeedbackDefinitionById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 Yi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateFeedbackDefinition(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:oa.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteFeedbackDefinitionById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteFeedbackDefinitionsBatch(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var xo=class{constructor(t={}){this._options=t;}async deleteLlmProviderApiKeysBatch(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findLlmProviderKeys(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 ia.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new c({message:r.error.errorMessage})}}async storeLlmProviderApiKey(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new j(o.error.body);case 403:throw new F(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getLlmProviderApiKeyById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 gr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateLlmProviderApiKey(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:ze.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new j(i.error.body);case 403:throw new F(V.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ro=class{constructor(t={}){this._options=t;}async receiveProtobufTraces(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var _o=class{constructor(t={}){this._options=t;}async findProjects(t={},r){var g,w;let{page:o,size:i,name:n,sorting:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.sorting=p);let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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 na.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new c({message:u.error.errorMessage})}}async createProject(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getProjectById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 wr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteProjectById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateProject(t,r={},o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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: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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new C(i.error.body);case 422:throw new X(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteProjectsBatch(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNamesByProjectIds(t={},r){var p,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let n=await h({url:y((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 ca.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getProjectMetrics(t,r={},o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Re.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 ua.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new C(i.error.body);case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new c({message:i.error.errorMessage})}}async getProjectStats(t={},r){var g,w;let{page:o,size:i,name:n,sorting:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.sorting=p);let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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 fa.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new c({message:u.error.errorMessage})}}async retrieveProject(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:_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 ha.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 404:throw new A(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ao=class{constructor(t={}){this._options=t;}async getPrompts(t={},r){var u,g;let{page:o,size:i,name:n}=t,p={};o!=null&&(p.page=o.toString()),i!=null&&(p.size=i.toString()),n!=null&&(p.name=n);let d=await h({url:y((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 Ta.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new c({message:d.error.errorMessage})}}async createPrompt(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 409:throw new L(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createPromptVersion(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Te.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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 409:throw new L(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 Sa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updatePrompt(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Ee.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new C(i.error.body);case 404:throw new A(i.error.body);case 409:throw new L(i.error.body);case 422:throw new X(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deletePrompt(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deletePromptsBatch(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getPromptVersionById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptVersions(t,r={},o){var u,g;let{page:i,size:n}=r,p={};i!=null&&(p.page=i.toString()),n!=null&&(p.size=n.toString());let d=await h({url:y((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 _a.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new c({message:d.error.errorMessage})}}async retrievePromptVersion(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 404:throw new A(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var To=class{constructor(t={}){this._options=t;}async addSpanComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:N.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new c({message:i.error.errorMessage})}}}async addSpanFeedbackScore(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:G.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getSpansByProject(t={},r){var ie,Er;let{page:o,size:i,projectName:n,projectId:p,traceId:d,type:u,filters:g,truncate:w,sorting:k}=t,z={};o!=null&&(z.page=o.toString()),i!=null&&(z.size=i.toString()),n!=null&&(z.project_name=n),p!=null&&(z.project_id=p),d!=null&&(z.trace_id=d),u!=null&&(z.type=qr.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(z.filters=g),w!=null&&(z.truncate=w.toString()),k!=null&&(z.sorting=k);let E=await h({url:y((Er=(ie=await a.get(this._options.baseUrl))!=null?ie:await a.get(this._options.environment))!=null?Er:b.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: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(E.ok)return ja.parseOrThrow(E.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(E.error.reason==="status-code")throw new c({statusCode:E.error.statusCode,body:E.error.body});switch(E.error.reason){case "non-json":throw new c({statusCode:E.error.statusCode,body:E.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new c({message:E.error.errorMessage})}}async createSpan(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createSpans(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getSpanById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 kr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteSpanById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new fe(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateSpan(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Ie.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteSpanComments(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteSpanFeedbackScore(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:br.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new c({message:i.error.errorMessage})}}}async findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,n={};o!=null&&(n.project_id=o),i!=null&&(n.type=eo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let p=await h({url:y((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return le.findFeedbackScoreNames1.Response.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new c({message:p.error.errorMessage})}}async getSpanComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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 N.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}async getSpanStats(t={},r){var w,k;let{projectId:o,projectName:i,traceId:n,type:p,filters:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),n!=null&&(u.trace_id=n),p!=null&&(u.type=ro.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(u.filters=d);let g=await h({url:y((k=(w=await a.get(this._options.baseUrl))!=null?w:await a.get(this._options.environment))!=null?k:b.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(g.ok)return zr.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(g.error.reason==="status-code")throw new c({statusCode:g.error.statusCode,body:g.error.body});switch(g.error.reason){case "non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new c({message:g.error.errorMessage})}}async scoreBatchOfSpans(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchSpans(t={},r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateSpanComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:N.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Eo=class{constructor(t={}){this._options=t;}async addTraceComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:N.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new c({message:i.error.errorMessage})}}}async addTraceFeedbackScore(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:G.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getTracesByProject(t={},r){var z,E;let{page:o,size:i,projectName:n,projectId:p,filters:d,truncate:u,sorting:g}=t,w={};o!=null&&(w.page=o.toString()),i!=null&&(w.size=i.toString()),n!=null&&(w.project_name=n),p!=null&&(w.project_id=p),d!=null&&(w.filters=d),u!=null&&(w.truncate=u.toString()),g!=null&&(w.sorting=g);let k=await h({url:y((E=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?E:b.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: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(k.ok)return Ka.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(k.error.reason==="status-code")throw new c({statusCode:k.error.statusCode,body:k.error.body});switch(k.error.reason){case "non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new c({message:k.error.errorMessage})}}async createTrace(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:We.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createTraces(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getTraceById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 xr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteTraceById(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateTrace(t,r={},o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Ke.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteTraceComments(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraceFeedbackScore(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:br.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteTraceThreads(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Xe.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraces(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames2(t={},r){var p,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let n=await h({url:y((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 de.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getTraceStats(t={},r){var u,g;let{projectId:o,projectName:i,filters:n}=t,p={};o!=null&&(p.project_id=o),i!=null&&(p.project_name=i),n!=null&&(p.filters=n);let d=await h({url:y((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 zr.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new c({message:d.error.errorMessage})}}async getTraceComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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 N.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}async getTraceThread(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Oe.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 Rr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getTraceThreads(t={},r){var k,z;let{page:o,size:i,projectName:n,projectId:p,truncate:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),n!=null&&(g.project_name=n),p!=null&&(g.project_id=p),d!=null&&(g.truncate=d.toString()),u!=null&&(g.filters=u);let w=await h({url:y((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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: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(w.ok)return Ja.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(w.error.reason==="status-code")throw new c({statusCode:w.error.statusCode,body:w.error.body});switch(w.error.reason){case "non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new c({message:w.error.errorMessage})}}async scoreBatchOfTraces(t,r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchTraces(t={},r){var i,n;let o=await h({url:y((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Ge.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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new C(o.error.body);case 401:throw new j(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateTraceComment(t,r,o){var n,p;let i=await h({url:y((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:N.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Po=class{constructor(t={}){this._options=t;}async datasetsRedirect(t,r){var u,g;let{datasetId:o,workspaceName:i,path:n}=t,p={};p.dataset_id=o,i!=null&&(p.workspace_name=i),p.path=n;let d=await h({url:y((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new C(d.error.body);case 404:throw new A(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new c({message:d.error.errorMessage})}}}async experimentsRedirect(t,r){var g,w;let{datasetId:o,experimentId:i,workspaceName:n,path:p}=t,d={};d.dataset_id=o,d.experiment_id=i,n!=null&&(d.workspace_name=n),d.path=p;let u=await h({url:y((w=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?w:b.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){if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new C(u.error.body);case 404:throw new A(u.error.body);default:throw new c({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new c({message:u.error.errorMessage})}}}async projectsRedirect(t,r){var u,g;let{traceId:o,workspaceName:i,path:n}=t,p={};p.trace_id=o,i!=null&&(p.workspace_name=i),p.path=n;let d=await h({url:y((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new C(d.error.body);case 404:throw new A(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new c({message:d.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var _r=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 wo(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new bo(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ho(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new yo(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new ko(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new zo(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new So(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 Ro(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new _o(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Ao(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new To(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Eo(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Po(this._options)}async isAlive(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new c({message:r.error.errorMessage})}}async version(t){var o,i;let r=await h({url:y((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ar=()=>uuid.v7();var vo=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 Co=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,p;let r=(p=(n=this.data.projectName)!=null?n:t.projectName)!=null?p:this.opik.config.projectName,o={id:Ar(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new vo(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 Vc=s=>s.replace("/api",""),ms=({apiUrl:s,projectName:t,workspaceName:r})=>{let o=encodeURIComponent(t);return `${Vc(s)}/${r}/redirect/projects?name=${o}`};var Wc=300,Jc=100,Tr=class{constructor({action:t,batchSize:r=Jc,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(),P.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(P.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{P.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;}},H=class{constructor({delay:t=Wc,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 Tr({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:t,enableBatch:r,name:`${i}:createQueue`}),this.updateQueue=new Tr({action:async n=>{await this.createQueue.flush();let p=Array.from(n.entries());for(let[d,u]of p)await this.updateEntity(d,u);},delay:t,enableBatch:false,name:`${i}:updateQueue`}),this.deleteQueue=new Tr({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 jo=class extends H{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 Io=class extends H{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 Uo=class extends H{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 No=class extends H{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 te=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=ms({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});P.info(`Started logging traces to the "${t}" project at ${Ha(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;P.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new Co({id:Ar(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),P.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.flush=async()=>{P.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),P.info("Successfully flushed all data to Opik");}catch(t){P.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};P.debug("Initializing OpikClient with config:",t),this.config=Za(t),this.api=new _r({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new jo(this.api),this.traceBatchQueue=new Uo(this.api),this.spanFeedbackScoresBatchQueue=new Io(this.api),this.traceFeedbackScoresBatchQueue=new No(this.api);}};new async_hooks.AsyncLocalStorage;new te;var Xc=new te,Oa=class{constructor({client:t=Xc}={}){this.traces=new Map;this.spans=new Map;this.getSpanInput=t=>{let r={},{attributes:o}=t;return Object.keys(o).forEach(n=>{if(n==="ai.prompt"||n==="gen_ai.request"){let p=Gc(o[n]);p&&(r={...r,...p});}if(n.startsWith("ai.prompt.")){let p=n.replace("ai.prompt.","");r[p]=Xa(o[n]);}if(n.startsWith("gen_ai.request.")){let p=n.replace("gen_ai.request.","");r[p]=Xa(o[n]);}}),Object.keys(r).length>0||("ai.toolCall.name"in o&&(r.toolName=o["ai.toolCall.name"]),"ai.toolCall.args"in o&&(r.args=o["ai.toolCall.args"])),r};this.getSpanOutput=t=>{let{attributes:r}=t;return r["ai.response.text"]?{text:r["ai.response.text"]}:r["ai.toolCall.result"]?{result:r["ai.toolCall.result"]}:r["ai.response.toolCalls"]?{toolCalls:Xa(r["ai.response.toolCalls"])}:{}};this.getSpanMetadata=t=>{let{attributes:r}=t,o={};return r["gen_ai.response.model"]&&(o.model=r["gen_ai.response.model"]),r["gen_ai.system"]&&(o.system=r["gen_ai.system"]),o};this.getSpanUsage=t=>{let{attributes:r}=t,o={};return "ai.usage.promptTokens"in r&&(o.prompt_tokens=r["ai.usage.promptTokens"]),"gen_ai.usage.input_tokens"in r&&(o.prompt_tokens=r["gen_ai.usage.input_tokens"]),"ai.usage.completionTokens"in r&&(o.completion_tokens=r["ai.usage.completionTokens"]),"gen_ai.usage.output_tokens"in r&&(o.completion_tokens=r["gen_ai.usage.output_tokens"]),("prompt_tokens"in o||"completion_tokens"in o)&&(o.total_tokens=(o.prompt_tokens||0)+(o.completion_tokens||0)),o};this.processSpan=({otelSpan:t,parentSpan:r,trace:o})=>o.span({name:t.name,startTime:new Date(Fo(t.startTime)),endTime:new Date(Fo(t.endTime)),parentSpanId:r==null?void 0:r.data.id,input:this.getSpanInput(t),output:this.getSpanOutput(t),metadata:this.getSpanMetadata(t),usage:this.getSpanUsage(t),type:"llm"});this.shutdown=async()=>{await this.client.flush();};this.forceFlush=async()=>{await this.client.flush();};this.export=async(t,r)=>{let o=t.filter(p=>p.instrumentationLibrary.name==="ai"),i=t.length-o.length;if(i>0&&P.debug(`Ignored ${i} non-AI SDK spans`),o.length===0){P.debug("No AI SDK spans found"),r({code:0});return}let n=Oc(o);P.debug("Exporting spans",o),Object.entries(n).forEach(([p,d])=>{var k,z;let[u,...g]=d,w=this.client.trace({startTime:new Date(Fo(u.startTime)),endTime:new Date(Fo(u.endTime)),name:(z=(k=u.attributes["ai.telemetry.metadata.traceName"])==null?void 0:k.toString())!=null?z:u.name,input:this.getSpanInput(u),output:this.getSpanOutput(u),metadata:this.getSpanMetadata(u),usage:this.getSpanUsage(u)});this.traces.set(p,w),g.forEach(E=>{var Ga;let ie=this.spans.get((Ga=E.parentSpanId)!=null?Ga:""),Er=this.processSpan({parentSpan:ie,otelSpan:E,trace:w});this.spans.set(E.spanContext().spanId,Er);});});try{await this.client.flush(),r({code:0});}catch(p){P.error("Error exporting spans",p),r({code:1,error:p instanceof Error?p:new Error("Unknown error")});}};this.client=t;}static getSettings(t){var o,i,n;let r={...t.metadata};return t.name&&(r.traceName=t.name),{isEnabled:(o=t.isEnabled)!=null?o:true,recordInputs:(i=t.recordInputs)!=null?i:true,recordOutputs:(n=t.recordOutputs)!=null?n:true,functionId:t.functionId,metadata:r}}};function Oc(s){let t={};return s.forEach(r=>{let o=r.spanContext();t[o.traceId]||(t[o.traceId]=[]),t[o.traceId].push(r);}),Object.entries(t).forEach(([r,o])=>{t[r]=Hc(o);}),t}function Fo(s){return s[0]*1e3+s[1]/1e6}function Xa(s){try{return JSON.parse(s)}catch{return s}}function Gc(s){if(typeof s=="string")try{let t=JSON.parse(s);if(t!==null&&typeof t=="object"&&!Array.isArray(t))return t}catch{return}}function Hc(s){let t=new Map,r=new Map;for(let p of s){let{spanId:d}=p.spanContext();t.set(d,p),p.parentSpanId&&(r.has(p.parentSpanId)||r.set(p.parentSpanId,[]),r.get(p.parentSpanId).push(p));}let o=s.filter(p=>!p.parentSpanId||!t.has(p.parentSpanId)),i=[],n=[...o];for(;n.length>0;){let p=n.shift();i.push(p);let d=p.spanContext().spanId,u=r.get(d)||[];n.push(...u);}return i}
|
|
4
|
-
exports.OpikExporter=
|
|
1
|
+
'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),an=require('fs'),Es=require('ini'),zc=require('qs'),uuid=require('uuid'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var an__default=/*#__PURE__*/_interopDefault(an);var Es__default=/*#__PURE__*/_interopDefault(Es);var zc__default=/*#__PURE__*/_interopDefault(zc);var _s=Object.defineProperty;var Lo=(s,t)=>()=>(s&&(t=s(s=0)),t);var T=(s,t)=>{for(var r in t)_s(s,r,{get:t[r],enumerable:true});};var Tn={};T(Tn,{Node18UniversalStreamWrapper:()=>Yo});var Yo,Pn=Lo(()=>{Yo=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 En={};T(En,{UndiciStreamWrapper:()=>Zo});var Zo,vn=Lo(()=>{Zo=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 jn={};T(jn,{NodePre18StreamWrapper:()=>qo});var qo,Cn=Lo(()=>{qo=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 Ps={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function on(s,t=s){return ansiEscapes.link(t,s)}var v=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),tn=s=>{v.settings.minLevel=Ps[s];};tn(process.env.OPIK_LOG_LEVEL||"INFO");var vs="~/.opik.config",js={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function nn(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function Cs(){return nn({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function Is(){let s=process.env.OPIK_CONFIG_PATH||vs;if(!an__default.default.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=Es__default.default.parse(an__default.default.readFileSync(s,"utf8"));return t.opik?nn({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return v.error(`Error loading config file ${s}: ${t}`),{}}}function sn(s){let t=Cs(),r=Is();return Us({...js,...r,...t,...s})}function Us(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=Ns(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 Ns(s){return new URL(s).hostname.endsWith("comet.com")}var W={};T(W,{AssistantMessageRole:()=>Xs,AttachmentListRequestEntityType:()=>cn,BadRequestError:()=>j,ColumnCompareTypesItem:()=>Ys,ColumnPublicTypesItem:()=>rc,ColumnTypesItem:()=>oc,CompleteMultipartUploadRequestEntityType:()=>Fs,ConflictError:()=>L,DatasetItemCompareSource:()=>Zs,DatasetItemPublicSource:()=>ec,DatasetItemSource:()=>Hs,DatasetItemWriteSource:()=>Qs,DeleteAttachmentsRequestEntityType:()=>Ms,DeltaRole:()=>Os,DownloadAttachmentRequestEntityType:()=>pn,FeedbackScoreBatchItemSource:()=>wc,FeedbackScoreCompareSource:()=>qs,FeedbackScorePublicSource:()=>fc,FeedbackScoreSource:()=>$s,FindFeedbackDefinitionsRequestType:()=>dn,FindFeedbackScoreNames1RequestType:()=>kn,ForbiddenError:()=>D,GetSpanStatsRequestType:()=>zn,GetSpansByProjectRequestType:()=>yn,LlmAsJudgeMessagePublicRole:()=>Ws,LlmAsJudgeMessageRole:()=>Ds,LlmAsJudgeMessageWriteRole:()=>Ls,LlmAsJudgeOutputSchemaPublicType:()=>Js,LlmAsJudgeOutputSchemaType:()=>Bs,LlmAsJudgeOutputSchemaWriteType:()=>Vs,LogItemLevel:()=>Ks,NotFoundError:()=>A,NotImplementedError:()=>ge,ProjectDetailedVisibility:()=>pc,ProjectMetricRequestPublicInterval:()=>wn,ProjectMetricRequestPublicMetricType:()=>bn,ProjectMetricResponsePublicInterval:()=>cc,ProjectMetricResponsePublicMetricType:()=>sc,ProjectPublicVisibility:()=>nc,ProjectUpdateVisibility:()=>fn,ProjectVisibility:()=>ac,ProjectWriteVisibility:()=>gn,PromptType:()=>lc,PromptVersionDetailType:()=>dc,PromptVersionPublicType:()=>uc,PromptVersionType:()=>mc,PromptWriteType:()=>hn,ProviderApiKeyProvider:()=>ic,ProviderApiKeyPublicProvider:()=>tc,ProviderApiKeyWriteProvider:()=>un,ResponseFormatType:()=>Gs,SpanFilterPublicOperator:()=>hc,SpanPublicType:()=>bc,SpanSearchStreamRequestPublicType:()=>Sn,SpanType:()=>xn,SpanWriteType:()=>gc,StartMultipartUploadRequestEntityType:()=>ln,TraceFilterPublicOperator:()=>yc,UnauthorizedError:()=>C,UnprocessableEntityError:()=>X,UploadAttachmentRequestEntityType:()=>mn,attachments:()=>Er,automationRuleEvaluators:()=>Jo,chatCompletions:()=>Ko,check:()=>Wo,datasets:()=>Xo,experiments:()=>Oo,feedbackDefinitions:()=>vr,llmProviderKey:()=>jr,openTelemetryIngestion:()=>Go,projects:()=>Cr,prompts:()=>Ir,redirect:()=>Qo,serviceToggles:()=>Ho,spans:()=>Ur,systemUsage:()=>Vo,traces:()=>$o});var Er={};T(Er,{AttachmentListRequestEntityType:()=>cn,DownloadAttachmentRequestEntityType:()=>pn,StartMultipartUploadRequestEntityType:()=>ln,UploadAttachmentRequestEntityType:()=>mn});var cn={Trace:"trace",Span:"span"};var pn={Trace:"trace",Span:"span"};var ln={Trace:"trace",Span:"span"};var mn={Trace:"trace",Span:"span"};var vr={};T(vr,{FindFeedbackDefinitionsRequestType:()=>dn});var dn={Numerical:"numerical",Categorical:"categorical"};var jr={};T(jr,{ProviderApiKeyWriteProvider:()=>un});var un={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Cr={};T(Cr,{ProjectMetricRequestPublicInterval:()=>wn,ProjectMetricRequestPublicMetricType:()=>bn,ProjectUpdateVisibility:()=>fn,ProjectWriteVisibility:()=>gn});var gn={Private:"private",Public:"public"};var fn={Private:"private",Public:"public"};var bn={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var wn={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Ir={};T(Ir,{PromptWriteType:()=>hn});var hn={Mustache:"mustache",Jinja2:"jinja2"};var Ur={};T(Ur,{FindFeedbackScoreNames1RequestType:()=>kn,GetSpanStatsRequestType:()=>zn,GetSpansByProjectRequestType:()=>yn,SpanSearchStreamRequestPublicType:()=>Sn});var yn={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var kn={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var zn={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Sn={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Vo={};var Wo={};var Jo={};var Ko={};var Xo={};var Oo={};var Go={};var Ho={};var $o={};var Qo={};var Fs={Trace:"trace",Span:"span"};var Ms={Trace:"trace",Span:"span"};var Ds={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Bs={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ls={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Vs={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ws={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Js={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ks={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Xs={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Os={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Gs={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Hs={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var $s={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Qs={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Ys={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Zs={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var qs={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ec={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var rc={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var oc={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var tc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var ic={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var ac={Private:"private",Public:"public"};var nc={Private:"private",Public:"public"};var sc={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var cc={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var pc={Private:"private",Public:"public"};var lc={Mustache:"mustache",Jinja2:"jinja2"};var mc={Mustache:"mustache",Jinja2:"jinja2"};var dc={Mustache:"mustache",Jinja2:"jinja2"};var uc={Mustache:"mustache",Jinja2:"jinja2"};var xn={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var gc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var fc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var bc={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var wc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var hc={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 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 ae=(s,t,r)=>JSON.stringify(s,t,r);var c=class s extends Error{constructor({message:t,statusCode:r,body:o}){super(kc({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),r!=null&&(this.statusCode=r),o!==void 0&&(this.body=o);}};function kc({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: ${ae(r,void 0,2)}`),o.join(`
|
|
2
|
+
`)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var C=class s extends c{constructor(t){super({message:"UnauthorizedError",statusCode:401,body:t}),Object.setPrototypeOf(this,s.prototype);}};var D=class s extends c{constructor(t){super({message:"ForbiddenError",statusCode:403,body:t}),Object.setPrototypeOf(this,s.prototype);}};var j=class s extends c{constructor(t){super({message:"BadRequestError",statusCode:400,body:t}),Object.setPrototypeOf(this,s.prototype);}};var A=class s extends c{constructor(t){super({message:"NotFoundError",statusCode:404,body:t}),Object.setPrototypeOf(this,s.prototype);}};var L=class s extends c{constructor(t){super({message:"ConflictError",statusCode:409,body:t}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends c{constructor(t){super({message:"UnprocessableEntityError",statusCode:422,body:t}),Object.setPrototypeOf(this,s.prototype);}};var ge=class s extends c{constructor(t){super({message:"NotImplementedError",statusCode:501,body:t}),Object.setPrototypeOf(this,s.prototype);}};var b={Default:"http://localhost:5173/api"};function Rn(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${zc__default.default.stringify(t,{arrayFormat:"repeat"})}`:s}var m=Sc();function Sc(){var u,g,y,k,z;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"&&(((g=self.constructor)==null?void 0:g.name)==="DedicatedWorkerGlobalScope"||((y=self.constructor)==null?void 0:y.name)==="ServiceWorkerGlobalScope"||((k=self.constructor)==null?void 0:k.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&&!!((z=process.versions)!=null&&z.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 _n(){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 An({body:s,type:t}){return t.includes("json")?ae(s):s}async function In(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await Promise.resolve().then(()=>(Pn(),Tn))).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(vn(),En))).UndiciStreamWrapper(s):new(await Promise.resolve().then(()=>(Cn(),jn))).NodePre18StreamWrapper(s)}async function Un(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 In(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 xc="timeout";function Nn(s){let t=new AbortController,r=setTimeout(()=>t.abort(xc),s);return {signal:t.signal,abortId:r}}function Fn(...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 Mn=async(s,t,r,o,i,n,p,d,u)=>{let g=[],y;if(n!=null){let{signal:P,abortId:ie}=Nn(n);y=ie,g.push(P);}p!=null&&g.push(p);let k=Fn(g),z=await s(t,{method:r,headers:o,body:i,signal:k,credentials:d?"include":void 0,duplex:u});return y!=null&&clearTimeout(y),z};function Rc(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Dn(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=Rc(i);await new Promise(p=>setTimeout(p,n)),r=await s();}return r}async function _c(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[n,p]of Object.entries(s.headers))p!=null&&(t[n]=p);let r=Rn(s.url,s.queryParameters),o=await An({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await _n();try{let n=await Dn(async()=>Mn(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),p=await Un(n,s.responseType);return n.status>=200&&n.status<400?{ok:!0,body:p,headers:n.headers}:{ok:!1,error:{reason:"status-code",statusCode:n.status,body:p}}}catch(n){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:n instanceof Error&&n.name==="AbortError"?{ok:false,error:{reason:"timeout"}}:n instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:n.message}}:{ok:false,error:{reason:"unknown",errorMessage:ae(n)}}}}var w=_c;var a={get:async s=>typeof s=="function"?s():s};var e={};T(e,{JsonError:()=>ne,ParseError:()=>se,any:()=>qn,bigint:()=>Ln,boolean:()=>es,booleanLiteral:()=>Zn,date:()=>Vn,discriminant:()=>ps,enum_:()=>Fr,getObjectLikeUtils:()=>O,getObjectUtils:()=>ee,getSchemaUtils:()=>_,isProperty:()=>q,lazy:()=>Wn,lazyObject:()=>$n,list:()=>Dr,number:()=>rs,object:()=>Mr,objectWithoutOptionalProperties:()=>Hn,optional:()=>et,property:()=>Kn,record:()=>as,set:()=>ns,string:()=>os,stringLiteral:()=>Yn,transform:()=>rt,undiscriminatedUnion:()=>cs,union:()=>ms,unknown:()=>ts,withParsedProperties:()=>tt});var S={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 R(s,t){return `Expected ${t}. Received ${Ac(s)}.`}function Ac(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 I(s){return {...s,json:Bn(s.json),parse:Bn(s.parse)}}function Bn(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 Nr(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ne=class s extends Error{constructor(r){super(r.map(Nr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var se=class s extends Error{constructor(r){super(r.map(Nr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function _(s){return {nullable:()=>Tc(s),optional:()=>et(s),optionalNullable:()=>Pc(s),transform:t=>rt(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new se(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new ne(o.errors)}}}function Tc(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:()=>S.NULLABLE};return {...t,..._(t)}}function et(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:()=>S.OPTIONAL};return {...t,..._(t)}}function Pc(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:()=>S.OPTIONAL_NULLABLE};return {...t,..._(t)}}function rt(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,..._(r)}}function Ln(){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:R(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:R(t,"bigint")}]}:{ok:true,value:t},getType:()=>S.BIGINT};return {...I(s),..._(s)}}var Ec=/^([+-]?\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 Vn(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:R(t,"string")}]}:Ec.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:R(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:R(t,"Date object")}]},getType:()=>S.DATE};return {...I(s),..._(s)}}function B(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...I(r),..._(r)}}}function Fr(s){let t=new Set(s);return B(S.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:n=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:n,message:R(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:n,message:R(o,"enum")}]}:{ok:true,value:o})()}function Wn(s){let t=ot(s);return {...t,..._(t)}}function ot(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 fe(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 Z(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 we(s){return Object.keys(s)}function Jn(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function O(s){return {withParsedProperties:t=>tt(s,t)}}function tt(s,t){let r={parse:(o,i)=>{let n=s.parse(o,i);if(!n.ok)return n;let p=Object.entries(t).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(n.value):g}),{});return {ok:true,value:{...n.value,...p}}},json:(o,i)=>{var d;if(!Z(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:R(o,"object")}]};let n=new Set(Object.keys(t)),p=be(o,Object.keys(o).filter(u=>!n.has(u)));return s.json(p,i)},getType:()=>s.getType()};return {...r,..._(r),...O(r)}}function Kn(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function q(s){return s.isProperty}function Mr(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>q(o)?o.rawKey:r),_getParsedProperties:()=>we(s),parse:(r,o)=>{let i={},n=[];for(let[p,d]of fe(s)){let u=q(d)?d.rawKey:p,g=q(d)?d.valueSchema:d,y={rawKey:u,parsedKey:p,valueSchema:g};i[u]=y,Gn(g)&&n.push(u);}return Xn({value:r,requiredKeys:n,getProperty:p=>{let d=i[p];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var g;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(g=o==null?void 0:o.breadcrumbsPrefix)!=null?g:[],p]})}}},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,p]of fe(s)){let d=q(p)?p.valueSchema:p;Gn(d)&&i.push(n);}return Xn({value:r,requiredKeys:i,getProperty:n=>{let p=s[n];if(p!=null)return q(p)?{transformedKey:p.rawKey,transform:d=>{var u;return p.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}:{transformedKey:n,transform:d=>{var u;return p.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:()=>S.OBJECT};return {...I(t),..._(t),...O(t),...ee(t)}}function Xn({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:n=[]}){if(!Z(s))return {ok:false,errors:[{path:n,message:R(s,"object")}]};let p=new Set(t),d=[],u={};for(let[g,y]of Object.entries(s)){let k=r(g);if(k!=null){p.delete(g);let z=k.transform(y);z.ok?u[k.transformedKey]=z.value:(u[g]=y,d.push(...z.errors));}else switch(o){case "fail":d.push({path:[...n,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=y;break}}return d.push(...t.filter(g=>p.has(g)).map(g=>({path:n,message:`Missing required key "${g}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function ee(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>On({extensionKeys:t._getRawProperties(),value:o,transformBase:n=>s.parse(n,i),transformExtension:n=>t.parse(n,i)}),json:(o,i)=>On({extensionKeys:t._getParsedProperties(),value:o,transformBase:n=>s.json(n,i),transformExtension:n=>t.json(n,i)}),getType:()=>S.OBJECT};return {...r,..._(r),...O(r),...ee(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:()=>S.OBJECT};return {...t,..._(t),...O(t),...ee(t)}}}}function On({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[n,p]=Jn(we(t),g=>i.has(g)),d=r(be(t,p)),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 Gn(s){return !vc(s)}function vc(s){switch(s.getType()){case S.ANY:case S.UNKNOWN:case S.OPTIONAL:case S.OPTIONAL_NULLABLE:return true;default:return false}}function Hn(s){return Mr(s)}function $n(s){let t={...ot(s),_getRawProperties:()=>ce(s)._getRawProperties(),_getParsedProperties:()=>ce(s)._getParsedProperties()};return {...t,..._(t),...O(t),...ee(t)}}function Dr(s){let t={parse:(r,o)=>Qn(r,(i,n)=>{var p;return s.parse(i,{...o,breadcrumbsPrefix:[...(p=o==null?void 0:o.breadcrumbsPrefix)!=null?p:[],`[${n}]`]})}),json:(r,o)=>Qn(r,(i,n)=>{var p;return s.json(i,{...o,breadcrumbsPrefix:[...(p=o==null?void 0:o.breadcrumbsPrefix)!=null?p:[],`[${n}]`]})}),getType:()=>S.LIST};return {...I(t),..._(t)}}function Qn(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:R(s,"list"),path:[]}]}}function Yn(s){return B(S.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:R(r,`"${s}"`)}]})()}function Zn(s){return B(S.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:R(r,`${s.toString()}`)}]})()}var qn=B(S.ANY,s=>({ok:true,value:s}));var es=B(S.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"boolean")}]});var rs=B(S.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"number")}]});var os=B(S.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:R(s,"string")}]});var ts=B(S.UNKNOWN,s=>({ok:true,value:s}));function as(s,t){let r={parse:(o,i)=>is({value:o,isKeyNumeric:s.getType()===S.NUMBER,transformKey:n=>{var p;return s.parse(n,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n} (key)`]})},transformValue:(n,p)=>{var d;return t.parse(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${p}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>is({value:o,isKeyNumeric:s.getType()===S.NUMBER,transformKey:n=>{var p;return s.json(n,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n} (key)`]})},transformValue:(n,p)=>{var d;return t.json(n,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${p}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>S.RECORD};return {...I(r),..._(r)}}function is({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Z(s)?fe(s).reduce((n,[p,d])=>{if(d===void 0)return n;let u=n,g=p;if(t){let P=p.length>0?Number(p):NaN;isNaN(P)||(g=P);}let y=r(g),k=o(d,g);if(u.ok&&y.ok&&k.ok)return {ok:true,value:{...u.value,[y.value]:k.value}};let z=[];return u.ok||z.push(...u.errors),y.ok||z.push(...y.errors),k.ok||z.push(...k.errors),{ok:false,errors:z}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:R(s,"object")}]}}function ns(s){let t=Dr(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 p;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],message:R(o,"Set")}]}},getType:()=>S.SET};return {...I(r),..._(r)}}function cs(s){let t={parse:(r,o)=>ss((i,n)=>i.parse(r,n),s,o),json:(r,o)=>ss((i,n)=>i.json(r,n),s,o),getType:()=>S.UNDISCRIMINATED_UNION};return {...I(t),..._(t)}}function ss(s,t,r){let o=[];for(let[i,n]of t.entries()){let p=s(n,{...r,skipValidation:false});if(p.ok)return p;for(let d of p.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function ps(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function ms(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=Fr(we(t)),n={parse:(p,d)=>ls({value:p,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(p,d)=>ls({value:p,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>S.UNION};return {...I(n),..._(n),...O(n)}}function ls({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:p,breadcrumbsPrefix:d=[]}){if(!Z(s))return {ok:false,errors:[{path:d,message:R(s,"object")}]};let{[t]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let y=o(u);if(!y.ok)return {ok:false,errors:y.errors};let k=i(y.value);if(k==null)return n?{ok:true,value:{[r]:y.value,...g}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let z=p(g,k);return z.ok?{ok:true,value:{[r]:u,...z.value}}:z}function jc(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 p=n.split("?");return n=p.shift()+(p.length>0?"?":"")+p.join("&"),n}function h(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),jc(s)}var M={};T(M,{AssistantMessage:()=>ui,AssistantMessageRole:()=>di,Attachment:()=>_t,AttachmentListRequestEntityType:()=>Br,AttachmentPage:()=>At,AuthDetailsHolder:()=>jt,AutomationRuleEvaluator:()=>Mc,AutomationRuleEvaluatorLlmAsJudge:()=>Dt,AutomationRuleEvaluatorLlmAsJudgePublic:()=>nr,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Ot,AutomationRuleEvaluatorObjectPublic:()=>ti,AutomationRuleEvaluatorPagePublic:()=>ii,AutomationRuleEvaluatorPublic:()=>ai,AutomationRuleEvaluatorUpdate:()=>mi,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>pi,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>li,AutomationRuleEvaluatorUserDefinedMetricPython:()=>Bt,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>sr,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Ht,AutomationRuleEvaluatorWrite:()=>$t,AvgValueStatPublic:()=>Wa,BatchDelete:()=>U,BiInformation:()=>kt,BiInformationResponse:()=>tr,CategoricalFeedbackDefinition:()=>Ki,CategoricalFeedbackDefinitionCreate:()=>Hi,CategoricalFeedbackDefinitionPublic:()=>dr,CategoricalFeedbackDefinitionUpdate:()=>ia,CategoricalFeedbackDetail:()=>Ji,CategoricalFeedbackDetailCreate:()=>Gi,CategoricalFeedbackDetailPublic:()=>Zi,CategoricalFeedbackDetailUpdate:()=>ta,ChatCompletionChoice:()=>bi,ChatCompletionRequest:()=>$e,ChatCompletionResponse:()=>yi,ChunkedOutputJsonNode:()=>Lc,ChunkedOutputJsonNodePublic:()=>Jc,ChunkedOutputJsonNodePublicType:()=>Wi,ChunkedOutputJsonNodeType:()=>Bi,Column:()=>Mi,ColumnCompare:()=>xi,ColumnCompareTypesItem:()=>Si,ColumnPublic:()=>Ui,ColumnPublicTypesItem:()=>Ii,ColumnTypesItem:()=>Fi,Comment:()=>F,CommentCompare:()=>Ri,CommentPublic:()=>oe,CompleteMultipartUploadRequest:()=>uo,CompleteMultipartUploadRequestEntityType:()=>Tt,CompletionTokensDetails:()=>wi,CountValueStatPublic:()=>Ja,CreatePromptVersionDetail:()=>Ae,DataPointNumberPublic:()=>ba,Dataset:()=>Dc,DatasetIdentifier:()=>qe,DatasetIdentifierPublic:()=>rr,DatasetItem:()=>zi,DatasetItemBatch:()=>Bc,DatasetItemBatchWrite:()=>Ye,DatasetItemCompare:()=>Ei,DatasetItemCompareSource:()=>_i,DatasetItemPageCompare:()=>vi,DatasetItemPagePublic:()=>Ni,DatasetItemPublic:()=>lr,DatasetItemPublicSource:()=>Ci,DatasetItemSource:()=>ki,DatasetItemStreamRequest:()=>or,DatasetItemWrite:()=>yt,DatasetItemWriteSource:()=>ht,DatasetItemsDelete:()=>er,DatasetPagePublic:()=>ji,DatasetPublic:()=>ue,DatasetUpdate:()=>Ze,DatasetWrite:()=>Qe,DeleteAttachmentsRequest:()=>Fc,DeleteAttachmentsRequestEntityType:()=>Et,DeleteFeedbackScore:()=>wr,DeleteTraceThreads:()=>Ke,Delta:()=>fi,DeltaRole:()=>gi,DownloadAttachmentRequestEntityType:()=>Lr,ErrorInfo:()=>Q,ErrorInfoPublic:()=>hr,ErrorInfoWrite:()=>Ee,ErrorMessage:()=>V,ErrorMessageDetail:()=>Qc,ErrorMessageDetailed:()=>Hc,ErrorMessagePublic:()=>Wc,Experiment:()=>Vc,ExperimentItem:()=>Ne,ExperimentItemCompare:()=>Pi,ExperimentItemPublic:()=>pr,ExperimentItemStreamRequest:()=>Be,ExperimentItemsBatch:()=>Fe,ExperimentItemsDelete:()=>Me,ExperimentPagePublic:()=>Vi,ExperimentPublic:()=>mr,ExperimentStreamRequestPublic:()=>Le,ExperimentWrite:()=>Ue,ExperimentsDelete:()=>De,ExportTraceServiceRequest:()=>Oc,Feedback:()=>Kc,FeedbackCreate:()=>Yi,FeedbackDefinitionPagePublic:()=>ra,FeedbackObjectPublic:()=>ea,FeedbackPublic:()=>oa,FeedbackScore:()=>G,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>xa,FeedbackScoreAveragePublic:()=>Li,FeedbackScoreBatch:()=>Sr,FeedbackScoreBatchItem:()=>$a,FeedbackScoreBatchItemSource:()=>Ha,FeedbackScoreCompare:()=>Ti,FeedbackScoreCompareSource:()=>Ai,FeedbackScoreNames:()=>fa,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>Ba,FeedbackScoreSource:()=>pt,FeedbackUpdate:()=>sa,FindFeedbackDefinitionsRequestType:()=>Kr,FindFeedbackScoreNames1RequestType:()=>oo,Function:()=>He,FunctionCall:()=>Y,GetSpanStatsRequestType:()=>to,GetSpansByProjectRequestType:()=>ro,JsonNode:()=>x,JsonNodeCompare:()=>go,JsonNodeDetail:()=>it,JsonNodePublic:()=>K,JsonNodeWrite:()=>J,JsonObjectSchema:()=>Ge,JsonSchema:()=>ft,JsonSchemaElement:()=>po,LlmAsJudgeCode:()=>ir,LlmAsJudgeCodePublic:()=>ri,LlmAsJudgeCodeWrite:()=>Xt,LlmAsJudgeMessage:()=>Nt,LlmAsJudgeMessagePublic:()=>Zt,LlmAsJudgeMessagePublicRole:()=>Yt,LlmAsJudgeMessageRole:()=>Ut,LlmAsJudgeMessageWrite:()=>Wt,LlmAsJudgeMessageWriteRole:()=>Vt,LlmAsJudgeModelParameters:()=>It,LlmAsJudgeModelParametersPublic:()=>Qt,LlmAsJudgeModelParametersWrite:()=>Lt,LlmAsJudgeOutputSchema:()=>Mt,LlmAsJudgeOutputSchemaPublic:()=>ei,LlmAsJudgeOutputSchemaPublicType:()=>qt,LlmAsJudgeOutputSchemaType:()=>Ft,LlmAsJudgeOutputSchemaWrite:()=>Kt,LlmAsJudgeOutputSchemaWriteType:()=>Jt,LogItem:()=>si,LogItemLevel:()=>ni,LogPage:()=>ci,Message:()=>dt,MultipartUploadPart:()=>Pt,NumericalFeedbackDefinition:()=>Oi,NumericalFeedbackDefinitionCreate:()=>Qi,NumericalFeedbackDefinitionPublic:()=>ur,NumericalFeedbackDefinitionUpdate:()=>na,NumericalFeedbackDetail:()=>Xi,NumericalFeedbackDetailCreate:()=>$i,NumericalFeedbackDetailPublic:()=>qi,NumericalFeedbackDetailUpdate:()=>aa,PageColumns:()=>Di,PercentageValueStatPublic:()=>Xa,PercentageValues:()=>fr,PercentageValuesDetailed:()=>Ra,PercentageValuesPublic:()=>Ka,Project:()=>Gc,ProjectDetailed:()=>Aa,ProjectDetailedVisibility:()=>_a,ProjectMetricRequestPublic:()=>xe,ProjectMetricRequestPublicInterval:()=>Yr,ProjectMetricRequestPublicMetricType:()=>Qr,ProjectMetricResponsePublic:()=>ka,ProjectMetricResponsePublicInterval:()=>ha,ProjectMetricResponsePublicMetricType:()=>wa,ProjectPagePublic:()=>ua,ProjectPublic:()=>br,ProjectPublicVisibility:()=>da,ProjectRetrieveDetailed:()=>Re,ProjectStatItemObjectPublic:()=>Ga,ProjectStatsPublic:()=>zr,ProjectStatsSummary:()=>Sa,ProjectStatsSummaryItem:()=>za,ProjectUpdate:()=>Se,ProjectUpdateVisibility:()=>$r,ProjectVisibility:()=>ma,ProjectWrite:()=>ze,ProjectWriteVisibility:()=>Hr,Prompt:()=>$c,PromptDetail:()=>va,PromptPagePublic:()=>Na,PromptPublic:()=>Ua,PromptType:()=>Ta,PromptUpdatable:()=>Te,PromptVersion:()=>Ea,PromptVersionDetail:()=>$,PromptVersionDetailType:()=>at,PromptVersionLink:()=>fo,PromptVersionLinkPublic:()=>bo,PromptVersionLinkWrite:()=>so,PromptVersionPagePublic:()=>Ia,PromptVersionPublic:()=>Ca,PromptVersionPublicType:()=>ja,PromptVersionRetrieveDetail:()=>Pe,PromptVersionType:()=>Pa,PromptWrite:()=>_e,PromptWriteType:()=>qr,ProviderApiKey:()=>Xc,ProviderApiKeyPagePublic:()=>pa,ProviderApiKeyProvider:()=>la,ProviderApiKeyPublic:()=>gr,ProviderApiKeyPublicProvider:()=>ca,ProviderApiKeyUpdate:()=>ke,ProviderApiKeyWrite:()=>ye,ProviderApiKeyWriteProvider:()=>Or,ResponseFormat:()=>bt,ResponseFormatType:()=>gt,ResultsNumberPublic:()=>ya,ScoreName:()=>ga,ServiceTogglesConfig:()=>Fa,Span:()=>Da,SpanBatch:()=>Yc,SpanBatchWrite:()=>je,SpanFilterPublic:()=>ct,SpanFilterPublicOperator:()=>st,SpanPagePublic:()=>Va,SpanPublic:()=>kr,SpanPublicType:()=>La,SpanSearchStreamRequestPublic:()=>Ie,SpanSearchStreamRequestPublicType:()=>io,SpanType:()=>Ma,SpanUpdate:()=>Ce,SpanWrite:()=>ve,SpanWriteType:()=>nt,SpansCountResponse:()=>St,StartMultipartUploadRequest:()=>he,StartMultipartUploadRequestEntityType:()=>Vr,StartMultipartUploadResponse:()=>vt,StreamOptions:()=>ut,Tool:()=>wt,ToolCall:()=>cr,Trace:()=>Qa,TraceBatch:()=>Zc,TraceBatchWrite:()=>We,TraceCountResponse:()=>Rt,TraceFilterPublic:()=>mt,TraceFilterPublicOperator:()=>lt,TracePagePublic:()=>Za,TracePublic:()=>xr,TraceSearchStreamRequestPublic:()=>Oe,TraceThread:()=>Rr,TraceThreadIdentifier:()=>Xe,TraceThreadPage:()=>Ya,TraceUpdate:()=>Je,TraceWrite:()=>Ve,UploadAttachmentRequestEntityType:()=>Wr,Usage:()=>hi,UserDefinedMetricPythonCode:()=>ar,UserDefinedMetricPythonCodePublic:()=>oi,UserDefinedMetricPythonCodeWrite:()=>Gt,WorkspaceNameHolder:()=>Ct,WorkspaceSpansCount:()=>zt,WorkspaceTraceCount:()=>xt,attachments:()=>pe,chatCompletions:()=>lo,datasets:()=>mo,experiments:()=>me,feedbackDefinitions:()=>Xr,llmProviderKey:()=>Gr,projects:()=>Zr,prompts:()=>eo,spans:()=>le,traces:()=>de});var pe={};T(pe,{AttachmentListRequestEntityType:()=>Br,DownloadAttachmentRequestEntityType:()=>Lr,StartMultipartUploadRequest:()=>he,StartMultipartUploadRequestEntityType:()=>Vr,UploadAttachmentRequestEntityType:()=>Wr,uploadAttachment:()=>Jr});var Br=e.enum_(["trace","span"]);var Lr=e.enum_(["trace","span"]);var Vr=e.enum_(["trace","span"]);var Wr=e.enum_(["trace","span"]);var Jr={};T(Jr,{Request:()=>Cc});var Cc=e.record(e.string(),e.unknown());var he=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",Vr),entityId:e.property("entity_id",e.string()),path:e.string()});var Xr={};T(Xr,{FindFeedbackDefinitionsRequestType:()=>Kr});var Kr=e.enum_(["numerical","categorical"]);var Gr={};T(Gr,{ProviderApiKeyUpdate:()=>ke,ProviderApiKeyWrite:()=>ye,ProviderApiKeyWriteProvider:()=>Or});var Or=e.enum_(["openai","anthropic","gemini","openrouter"]);var ye=e.object({provider:Or,apiKey:e.property("api_key",e.string()),name:e.string().optional()});var ke=e.object({apiKey:e.property("api_key",e.string()),name:e.string().optional()});var Zr={};T(Zr,{ProjectMetricRequestPublic:()=>xe,ProjectMetricRequestPublicInterval:()=>Yr,ProjectMetricRequestPublicMetricType:()=>Qr,ProjectRetrieveDetailed:()=>Re,ProjectUpdate:()=>Se,ProjectUpdateVisibility:()=>$r,ProjectWrite:()=>ze,ProjectWriteVisibility:()=>Hr});var Hr=e.enum_(["private","public"]);var $r=e.enum_(["private","public"]);var Qr=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var Yr=e.enum_(["HOURLY","DAILY","WEEKLY"]);var ze=e.object({name:e.string(),visibility:Hr.optional(),description:e.string().optional()});var Se=e.object({name:e.string().optional(),description:e.string().optional(),visibility:$r.optional()});var xe=e.object({metricType:e.property("metric_type",Qr.optional()),interval:Yr.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional())});var Re=e.object({name:e.string()});var eo={};T(eo,{CreatePromptVersionDetail:()=>Ae,PromptUpdatable:()=>Te,PromptVersionRetrieveDetail:()=>Pe,PromptWrite:()=>_e,PromptWriteType:()=>qr});var qr=e.enum_(["mustache","jinja2"]);var J=e.record(e.string(),e.unknown());var _e=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:J.optional(),changeDescription:e.property("change_description",e.string().optional()),type:qr.optional()});var it=e.record(e.string(),e.unknown());var at=e.enum_(["mustache","jinja2"]);var $=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:it.optional(),type:at.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 Ae=e.object({name:e.string(),version:$});var Te=e.object({name:e.string(),description:e.string().optional()});var Pe=e.object({name:e.string(),commit:e.string().optional()});var le={};T(le,{FindFeedbackScoreNames1RequestType:()=>oo,GetSpanStatsRequestType:()=>to,GetSpansByProjectRequestType:()=>ro,SpanBatchWrite:()=>je,SpanSearchStreamRequestPublic:()=>Ie,SpanSearchStreamRequestPublicType:()=>io,SpanUpdate:()=>Ce,findFeedbackScoreNames1:()=>ao});var ro=e.enum_(["general","tool","llm","guardrail"]);var oo=e.enum_(["general","tool","llm","guardrail"]);var to=e.enum_(["general","tool","llm","guardrail"]);var io=e.enum_(["general","tool","llm","guardrail"]);var ao={};T(ao,{Response:()=>Ic});var Ic=e.list(e.string());var nt=e.enum_(["general","tool","llm","guardrail"]);var Ee=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var ve=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:nt,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:J.optional(),output:J.optional(),metadata:J.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",Ee.optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var je=e.object({spans:e.list(ve)});var x=e.record(e.string(),e.unknown());var Q=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ce=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:x.optional(),output:x.optional(),metadata:x.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",Q.optional())});var st=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ct=e.object({field:e.string().optional(),operator:st.optional(),key:e.string().optional(),value:e.string().optional()});var Ie=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:io.optional(),filters:e.list(ct).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var me={};T(me,{ExperimentItemStreamRequest:()=>Be,ExperimentItemsBatch:()=>Fe,ExperimentItemsDelete:()=>Me,ExperimentStreamRequestPublic:()=>Le,ExperimentWrite:()=>Ue,ExperimentsDelete:()=>De,findFeedbackScoreNames:()=>no});var no={};T(no,{Response:()=>Uc});var Uc=e.list(e.string());var so=e.object({id:e.string()});var Ue=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:J.optional(),promptVersion:e.property("prompt_version",so.optional()),promptVersions:e.property("prompt_versions",e.list(so).optional())});var pt=e.enum_(["ui","sdk","online_scoring"]);var G=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:pt,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 F=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 Ne=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:x.optional(),output:x.optional(),feedbackScores:e.property("feedback_scores",e.list(G).optional()),comments:e.list(F).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 Fe=e.object({experimentItems:e.property("experiment_items",e.list(Ne))});var Me=e.object({ids:e.list(e.string())});var De=e.object({ids:e.list(e.string())});var Be=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 Le=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var de={};T(de,{DeleteTraceThreads:()=>Ke,TraceBatchWrite:()=>We,TraceSearchStreamRequestPublic:()=>Oe,TraceThreadIdentifier:()=>Xe,TraceUpdate:()=>Je,findFeedbackScoreNames2:()=>co});var co={};T(co,{Response:()=>Nc});var Nc=e.list(e.string());var Ve=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:J.optional(),output:J.optional(),metadata:J.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Ee.optional()),threadId:e.property("thread_id",e.string().optional())});var We=e.object({traces:e.list(Ve)});var Je=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Q.optional()),threadId:e.property("thread_id",e.string().optional())});var Ke=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 Xe=e.object({projectId:e.property("project_id",e.string()),threadId:e.property("thread_id",e.string())});var lt=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var mt=e.object({field:e.string().optional(),operator:lt.optional(),key:e.string().optional(),value:e.string().optional()});var Oe=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(mt).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional()});var lo={};T(lo,{ChatCompletionRequest:()=>$e});var dt=e.record(e.string(),e.unknown());var ut=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var gt=e.enum_(["text","json_object","json_schema"]);var po=e.object({type:e.string().optional()});var Ge=e.object({type:e.string().optional(),description:e.string().optional(),properties:e.record(e.string(),po).optional(),required:e.list(e.string()).optional(),additionalProperties:e.boolean().optional(),defs:e.property("$defs",e.record(e.string(),po).optional())});var ft=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:Ge.optional()});var bt=e.object({type:gt.optional(),jsonSchema:e.property("json_schema",ft.optional())});var He=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:Ge.optional()});var wt=e.object({type:e.stringLiteral("function").optional(),function:He.optional()});var Y=e.object({name:e.string().optional(),arguments:e.string().optional()});var $e=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",ut.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(wt).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(He).optional(),functionCall:e.property("function_call",Y.optional())});var mo={};T(mo,{DatasetIdentifier:()=>qe,DatasetIdentifierPublic:()=>rr,DatasetItemBatchWrite:()=>Ye,DatasetItemStreamRequest:()=>or,DatasetItemsDelete:()=>er,DatasetUpdate:()=>Ze,DatasetWrite:()=>Qe});var Qe=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()});var ht=e.enum_(["manual","trace","span","sdk"]);var yt=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:ht,data:x});var Ye=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(yt)});var Ze=e.object({name:e.string(),description:e.string().optional()});var qe=e.object({datasetName:e.property("dataset_name",e.string())});var er=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var rr=e.object({datasetName:e.property("dataset_name",e.string())});var or=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 kt=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var tr=e.object({biInformation:e.property("bi_information",e.list(kt).optional())});var zt=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var St=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(zt).optional())});var xt=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Rt=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 At=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 V=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Tt=e.enum_(["trace","span"]);var Pt=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",Tt),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(Pt))});var Et=e.enum_(["trace","span"]);var Fc=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",Et),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var vt=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var jt=e.record(e.string(),e.unknown());var Ct=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var It=e.object({name:e.string(),temperature:e.number()});var Ut=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Nt=e.object({role:Ut,content:e.string()});var Ft=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Mt=e.object({name:e.string(),type:Ft,description:e.string()});var ir=e.object({model:It,messages:e.list(Nt),variables:e.record(e.string(),e.string()),schema:e.list(Mt)});var Dt=e.object({code:ir.optional()});var ar=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Bt=e.object({code:ar.optional()});var ds=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()}),Mc=e.union("type",{llm_as_judge:Dt.extend(ds),user_defined_metric_python:Bt.extend(ds)}).transform({transform:s=>s,untransform:s=>s});var Lt=e.object({name:e.string(),temperature:e.number()});var Vt=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Wt=e.object({role:Vt,content:e.string()});var Jt=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Kt=e.object({name:e.string(),type:Jt,description:e.string()});var Xt=e.object({model:Lt,messages:e.list(Wt),variables:e.record(e.string(),e.string()),schema:e.list(Kt)});var Ot=e.object({code:Xt.optional()});var Gt=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Ht=e.object({code:Gt.optional()});var us=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()}),$t=e.union("type",{llm_as_judge:Ot.extend(us),user_defined_metric_python:Ht.extend(us)}).transform({transform:s=>s,untransform:s=>s});var U=e.object({ids:e.list(e.string())});var Qt=e.object({name:e.string(),temperature:e.number()});var Yt=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Zt=e.object({role:Yt,content:e.string()});var qt=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var ei=e.object({name:e.string(),type:qt,description:e.string()});var ri=e.object({model:Qt,messages:e.list(Zt),variables:e.record(e.string(),e.string()),schema:e.list(ei)});var nr=e.object({code:ri.optional()});var oi=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var sr=e.object({code:oi.optional()});var gs=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()}),ti=e.union("type",{llm_as_judge:nr.extend(gs),user_defined_metric_python:sr.extend(gs)}).transform({transform:s=>s,untransform:s=>s});var ii=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ti).optional()});var fs=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:nr.extend(fs),user_defined_metric_python:sr.extend(fs)}).transform({transform:s=>s,untransform:s=>s});var ni=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var si=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:ni.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var ci=e.object({content:e.list(si).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var pi=e.object({code:ir.optional()});var li=e.object({code:ar.optional()});var bs=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()}),mi=e.union("type",{llm_as_judge:pi.extend(bs),user_defined_metric_python:li.extend(bs)}).transform({transform:s=>s,untransform:s=>s});var di=e.enum_(["system","user","assistant","tool","function"]);var cr=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:Y.optional()});var ui=e.object({role:di.optional(),content:e.string().optional(),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(cr).optional()),refusal:e.boolean().optional(),functionCall:e.property("function_call",Y.optional())});var gi=e.enum_(["system","user","assistant","tool","function"]);var fi=e.object({role:gi.optional(),content:e.string().optional(),toolCalls:e.property("tool_calls",e.list(cr).optional()),functionCall:e.property("function_call",Y.optional())});var bi=e.object({index:e.number().optional(),message:ui.optional(),delta:fi.optional(),finishReason:e.property("finish_reason",e.string().optional())});var wi=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var hi=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",wi.optional())});var yi=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(bi).optional(),usage:hi.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional())});var Dc=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()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional())});var ki=e.enum_(["manual","trace","span","sdk"]);var zi=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:ki,data:x,experimentItems:e.property("experiment_items",e.list(Ne).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 Bc=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(zi)});var Si=e.enum_(["string","number","object","boolean","array","null"]);var xi=e.object({name:e.string().optional(),types:e.list(Si).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Ri=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 _i=e.enum_(["manual","trace","span","sdk"]);var go=e.record(e.string(),e.unknown());var Ai=e.enum_(["ui","sdk","online_scoring"]);var Ti=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Ai,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 Pi=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:go.optional(),output:go.optional(),feedbackScores:e.property("feedback_scores",e.list(Ti).optional()),comments:e.list(Ri).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 Ei=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:_i,data:x,experimentItems:e.property("experiment_items",e.list(Pi).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 vi=e.object({content:e.list(Ei).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(xi).optional()});var ue=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()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional())});var ji=e.object({content:e.list(ue).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Ci=e.enum_(["manual","trace","span","sdk"]);var pr=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 lr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ci,data:x,experimentItems:e.property("experiment_items",e.list(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())});var Ii=e.enum_(["string","number","object","boolean","array","null"]);var Ui=e.object({name:e.string().optional(),types:e.list(Ii).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Ni=e.object({content:e.list(lr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Ui).optional()});var Fi=e.enum_(["string","number","object","boolean","array","null"]);var Mi=e.object({name:e.string().optional(),types:e.list(Fi).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Di=e.object({columns:e.list(Mi).optional()});var Bi=e.object({typeName:e.string().optional()});var Lc=e.object({type:Bi.optional(),closed:e.boolean().optional()});var re=e.object({name:e.string(),value:e.number()});var fo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Vc=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:x.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),comments:e.list(F).optional(),traceCount:e.property("trace_count",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()),promptVersion:e.property("prompt_version",fo.optional()),promptVersions:e.property("prompt_versions",e.list(fo).optional())});var oe=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 K=e.record(e.string(),e.unknown());var Li=e.object({name:e.string(),value:e.number()});var bo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var mr=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:K.optional(),feedbackScores:e.property("feedback_scores",e.list(Li).optional()),comments:e.list(oe).optional(),traceCount:e.property("trace_count",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()),promptVersion:e.property("prompt_version",bo.optional()),promptVersions:e.property("prompt_versions",e.list(bo).optional())});var Vi=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(mr).optional(),sortableBy:e.list(e.string()).optional()});var Wc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Wi=e.object({typeName:e.string().optional()});var Jc=e.object({type:Wi.optional(),closed:e.boolean().optional()});var Ji=e.object({categories:e.record(e.string(),e.number())});var Ki=e.object({details:Ji.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 Xi=e.object({max:e.number(),min:e.number()});var Oi=e.object({details:Xi.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 ws=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()}),Kc=e.union("type",{numerical:Oi.extend(ws),categorical:Ki.extend(ws)}).transform({transform:s=>s,untransform:s=>s});var Gi=e.object({categories:e.record(e.string(),e.number())});var Hi=e.object({details:Gi.optional()});var $i=e.object({max:e.number(),min:e.number()});var Qi=e.object({details:$i.optional()});var hs=e.object({id:e.string().optional(),name:e.string()}),Yi=e.union("type",{numerical:Qi.extend(hs),categorical:Hi.extend(hs)}).transform({transform:s=>s,untransform:s=>s});var Zi=e.object({categories:e.record(e.string(),e.number())});var dr=e.object({details:Zi.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 qi=e.object({max:e.number(),min:e.number()});var ur=e.object({details:qi.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 ys=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()}),ea=e.union("type",{numerical:ur.extend(ys),categorical:dr.extend(ys)}).transform({transform:s=>s,untransform:s=>s});var ra=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ea).optional()});var ks=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()}),oa=e.union("type",{numerical:ur.extend(ks),categorical:dr.extend(ks)}).transform({transform:s=>s,untransform:s=>s});var ta=e.object({categories:e.record(e.string(),e.number())});var ia=e.object({details:ta.optional()});var aa=e.object({max:e.number(),min:e.number()});var na=e.object({details:aa.optional()});var zs=e.object({id:e.string().optional(),name:e.string()}),sa=e.union("type",{numerical:na.extend(zs),categorical:ia.extend(zs)}).transform({transform:s=>s,untransform:s=>s});var ca=e.enum_(["openai","anthropic","gemini","openrouter"]);var gr=e.object({id:e.string().optional(),provider:ca,apiKey:e.property("api_key",e.string()),name: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 pa=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(gr).optional(),sortableBy:e.list(e.string()).optional()});var la=e.enum_(["openai","anthropic","gemini","openrouter"]);var Xc=e.object({id:e.string().optional(),provider:la,apiKey:e.property("api_key",e.string()),name: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 Oc=x;var fr=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ma=e.enum_(["private","public"]);var Gc=e.object({id:e.string().optional(),name:e.string(),visibility:ma.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(re).optional()),duration:fr.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())});var da=e.enum_(["private","public"]);var br=e.object({id:e.string().optional(),name:e.string(),visibility:da.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 ua=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 ga=e.object({name:e.string().optional()});var fa=e.object({scores:e.list(ga).optional()});var ba=e.object({time:e.date(),value:e.number().optional()});var wa=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var ha=e.enum_(["HOURLY","DAILY","WEEKLY"]);var ya=e.object({name:e.string().optional(),data:e.list(ba).optional()});var ka=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",wa.optional()),interval:ha.optional(),results:e.list(ya).optional()});var za=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:fr.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())});var Sa=e.object({content:e.list(za).optional()});var xa=e.object({name:e.string(),value:e.number()});var Ra=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var _a=e.enum_(["private","public"]);var Aa=e.object({id:e.string().optional(),name:e.string(),visibility:_a.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(xa).optional()),duration:Ra.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())});var Hc=e.object({errors:e.list(e.string()).optional()});var Ta=e.enum_(["mustache","jinja2"]);var Pa=e.enum_(["mustache","jinja2"]);var Ea=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:x.optional(),type:Pa.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 $c=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:x.optional(),changeDescription:e.property("change_description",e.string().optional()),type: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()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",Ea.optional())});var Qc=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var va=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",$.optional())});var ja=e.enum_(["mustache","jinja2"]);var Ca=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:K.optional(),type:ja.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 Ia=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ca).optional()});var Ua=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 Na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ua).optional()});var Fa=e.object({pythonEvaluatorEnabled:e.boolean()});var Ma=e.enum_(["general","tool","llm","guardrail"]);var Da=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:Ma,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.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",Q.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(G).optional()),comments:e.list(F).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 Yc=e.object({spans:e.list(Da)});var wr=e.object({name:e.string()});var hr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ba=e.enum_(["ui","sdk","online_scoring"]);var yr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Ba,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 La=e.enum_(["general","tool","llm","guardrail"]);var kr=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:La,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:K.optional(),output:K.optional(),metadata:K.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",hr.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(yr).optional()),comments:e.list(oe).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 Va=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 Wa=e.object({value:e.number().optional()});var Ja=e.object({value:e.number().optional()});var Ka=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Xa=e.object({value:Ka.optional()});var Oa=e.object({name:e.string().optional()}),Ga=e.union("type",{PERCENTAGE:Xa.extend(Oa),COUNT:Ja.extend(Oa),AVG:Wa.extend(Oa)}).transform({transform:s=>s,untransform:s=>s});var zr=e.object({stats:e.list(Ga).optional()});var Ha=e.enum_(["ui","sdk","online_scoring"]);var $a=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:Ha});var Sr=e.object({scores:e.list($a)});var Qa=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(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:x.optional(),output:x.optional(),metadata:x.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Q.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(G).optional()),comments:e.list(F).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 Zc=e.object({traces:e.list(Qa)});var xr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",hr.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(yr).optional()),comments:e.list(oe).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 Rr=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",x.optional()),lastMessage:e.property("last_message",x.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 Ya=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rr).optional()});var Za=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 wo=class{constructor(t={}){this._options=t;}async getDatasetBiInfo(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 tr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new c({message:r.error.errorMessage})}}async getExperimentBiInfo(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 tr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new c({message:r.error.errorMessage})}}async getSpansCountForWorkspaces(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 St.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesBiInfo(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 tr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesCountForWorkspaces(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 Rt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var ho=class{constructor(t={}){this._options=t;}async attachmentList(t,r){var k,z;let{page:o,size:i,projectId:n,entityType:p,entityId:d,path:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),g.project_id=n,g.entity_type=Br.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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: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(y.ok)return At.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new C(y.error.body);case 403:throw new D(V.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new c({message:y.error.errorMessage})}}async completeMultiPartUpload(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new C(o.error.body);case 403:throw new D(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAttachments(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new C(o.error.body);case 403:throw new D(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async downloadAttachment(t,r){var k,z;let{workspaceName:o,containerId:i,entityType:n,entityId:p,fileName:d,mimeType:u}=t,g={};o!=null&&(g.workspace_name=o),g.container_id=i,g.entity_type=Lr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),g.entity_id=p,g.file_name=d,g.mime_type=u;let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,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(y.ok)return y.body;if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new C(y.error.body);case 403:throw new D(V.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new c({message:y.error.errorMessage})}}async startMultiPartUpload(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 vt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new C(o.error.body);case 403:throw new D(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new c({message:o.error.errorMessage})}}async uploadAttachment(t,r){var k,z;let{fileName:o,projectName:i,mimeType:n,entityType:p,entityId:d,body:u}=t,g={};g.file_name=o,i!=null&&(g.project_name=i),n!=null&&(g.mime_type=n),g.entity_type=Wr.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,requestType:"json",body:pe.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(!y.ok){if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new C(y.error.body);case 403:throw new D(V.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new c({message:y.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var yo=class{constructor(t={}){this._options=t;}async access(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:jt.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new C(o.error.body);case 403:throw new D(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getWorkspaceName(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 Ct.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new C(r.error.body);case 403:throw new D(V.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:r.error.statusCode,body:r.error.body})}switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var ko=class{constructor(t={}){this._options=t;}async findEvaluators(t={},r){var g,y;let{projectId:o,name:i,page:n,size:p}=t,d={};o!=null&&(d.project_id=o),i!=null&&(d.name=i),n!=null&&(d.page=n.toString()),p!=null&&(d.size=p.toString());let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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 ii.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new c({message:u.error.errorMessage})}}async createAutomationRuleEvaluator(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:$t.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,n={};o!=null&&(n.project_id=o);let p=await w({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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:U.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(!p.ok){if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new c({message:p.error.errorMessage})}}}async getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,n={};i!=null&&(n.project_id=i);let p=await w({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return ai.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:p.error.errorMessage})}}async updateAutomationRuleEvaluator(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:mi.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,n={};i!=null&&(n.size=i.toString());let p=await w({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return ci.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new c({message:p.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var zo=class{constructor(t={}){this._options=t;}async createChatCompletions(t={},r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:$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 yi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var So=class{constructor(t={}){this._options=t;}async findDatasets(t={},r){var k,z;let{page:o,size:i,withExperimentsOnly:n,promptId:p,name:d,sorting:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),n!=null&&(g.with_experiments_only=n.toString()),p!=null&&(g.prompt_id=p),d!=null&&(g.name=d),u!=null&&(g.sorting=u);let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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(y.ok)return ji.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new c({message:y.error.errorMessage})}}async createDataset(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createOrUpdateDatasetItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Ye.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getDatasetById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateDataset(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Ze.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteDataset(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetByName(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetsBatch(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findDatasetItemsWithExperimentItems(t,r,o){var k,z;let{page:i,size:n,experimentIds:p,filters:d,truncate:u}=r,g={};i!=null&&(g.page=i.toString()),n!=null&&(g.size=n.toString()),g.experiment_ids=p,d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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:g,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(y.ok)return vi.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new c({message:y.error.errorMessage})}}async getDatasetByIdentifier(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItemById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 lr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItems(t,r={},o){var g,y;let{page:i,size:n,truncate:p}=r,d={};i!=null&&(d.page=i.toString()),n!=null&&(d.size=n.toString()),p!=null&&(d.truncate=p.toString());let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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 Ni.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new c({message:u.error.errorMessage})}}async getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,n={};i!=null&&(n.experiment_ids=i);let p=await w({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return Di.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new c({message:p.error.errorMessage})}}async streamDatasetItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:or.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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var xo=class{constructor(t={}){this._options=t;}async findExperiments(t={},r){var z,P;let{page:o,size:i,datasetId:n,name:p,datasetDeleted:d,promptId:u,sorting:g}=t,y={};o!=null&&(y.page=o.toString()),i!=null&&(y.size=i.toString()),n!=null&&(y.datasetId=n),p!=null&&(y.name=p),d!=null&&(y.dataset_deleted=d.toString()),u!=null&&(y.prompt_id=u),g!=null&&(y.sorting=g);let k=await w({url:h((P=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?P:b.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:y,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 Vi.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new j(k.error.body);default:throw new c({statusCode:k.error.statusCode,body:k.error.body})}switch(k.error.reason){case "non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new c({message:k.error.errorMessage})}}async createExperiment(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Ue.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createExperimentItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Fe.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Me.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentsById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames(t={},r){var p,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let n=await w({url:h((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 me.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getExperimentById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 mr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getExperimentItemById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 pr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async streamExperimentItems(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Be.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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async streamExperiments(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Le.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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ro=class{constructor(t={}){this._options=t;}async findFeedbackDefinitions(t={},r){var g,y;let{page:o,size:i,name:n,type:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.type=Kr.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"}));let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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 ra.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new c({message:u.error.errorMessage})}}async createFeedbackDefinition(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Yi.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getFeedbackDefinitionById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 oa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateFeedbackDefinition(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:sa.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteFeedbackDefinitionById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteFeedbackDefinitionsBatch(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var _o=class{constructor(t={}){this._options=t;}async deleteLlmProviderApiKeysBatch(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findLlmProviderKeys(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 pa.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new c({message:r.error.errorMessage})}}async storeLlmProviderApiKey(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:ye.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new C(o.error.body);case 403:throw new D(V.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getLlmProviderApiKeyById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 gr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateLlmProviderApiKey(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:ke.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new C(i.error.body);case 403:throw new D(V.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ao=class{constructor(t={}){this._options=t;}async receiveProtobufTraces(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var To=class{constructor(t={}){this._options=t;}async findProjects(t={},r){var g,y;let{page:o,size:i,name:n,sorting:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.sorting=p);let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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 ua.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new c({message:u.error.errorMessage})}}async createProject(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getProjectById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteProjectById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateProject(t,r={},o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Se.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body);case 422:throw new X(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteProjectsBatch(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNamesByProjectIds(t={},r){var p,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let n=await w({url:h((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 fa.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getProjectMetrics(t,r={},o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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: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 ka.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body);case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new c({message:i.error.errorMessage})}}async getProjectStats(t={},r){var g,y;let{page:o,size:i,name:n,sorting:p}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),n!=null&&(d.name=n),p!=null&&(d.sorting=p);let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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 Sa.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new c({message:u.error.errorMessage})}}async retrieveProject(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Re.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 Aa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 404:throw new A(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Po=class{constructor(t={}){this._options=t;}async getPrompts(t={},r){var u,g;let{page:o,size:i,name:n}=t,p={};o!=null&&(p.page=o.toString()),i!=null&&(p.size=i.toString()),n!=null&&(p.name=n);let d=await w({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 Na.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new c({message:d.error.errorMessage})}}async createPrompt(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:_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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 409:throw new L(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createPromptVersion(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 409:throw new L(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 va.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updatePrompt(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Te.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new j(i.error.body);case 404:throw new A(i.error.body);case 409:throw new L(i.error.body);case 422:throw new X(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deletePrompt(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deletePromptsBatch(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getPromptVersionById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptVersions(t,r={},o){var u,g;let{page:i,size:n}=r,p={};i!=null&&(p.page=i.toString()),n!=null&&(p.size=n.toString());let d=await w({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 Ia.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new c({message:d.error.errorMessage})}}async retrievePromptVersion(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 $.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 404:throw new A(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Eo=class{constructor(t={}){this._options=t;}async getServiceToggles(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 Fa.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var vo=class{constructor(t={}){this._options=t;}async addSpanComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:F.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new c({message:i.error.errorMessage})}}}async addSpanFeedbackScore(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:G.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getSpansByProject(t={},r){var ie,Pr;let{page:o,size:i,projectName:n,projectId:p,traceId:d,type:u,filters:g,truncate:y,sorting:k}=t,z={};o!=null&&(z.page=o.toString()),i!=null&&(z.size=i.toString()),n!=null&&(z.project_name=n),p!=null&&(z.project_id=p),d!=null&&(z.trace_id=d),u!=null&&(z.type=ro.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(z.filters=g),y!=null&&(z.truncate=y.toString()),k!=null&&(z.sorting=k);let P=await w({url:h((Pr=(ie=await a.get(this._options.baseUrl))!=null?ie:await a.get(this._options.environment))!=null?Pr:b.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: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(P.ok)return Va.parseOrThrow(P.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(P.error.reason==="status-code")throw new c({statusCode:P.error.statusCode,body:P.error.body});switch(P.error.reason){case "non-json":throw new c({statusCode:P.error.statusCode,body:P.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new c({message:P.error.errorMessage})}}async createSpan(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new L(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createSpans(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getSpanById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 kr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteSpanById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new ge(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateSpan(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:Ce.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteSpanComments(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteSpanFeedbackScore(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:wr.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new c({message:i.error.errorMessage})}}}async findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,n={};o!=null&&(n.project_id=o),i!=null&&(n.type=oo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let p=await w({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:b.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(p.ok)return le.findFeedbackScoreNames1.Response.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(p.error.reason==="status-code")throw new c({statusCode:p.error.statusCode,body:p.error.body});switch(p.error.reason){case "non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new c({message:p.error.errorMessage})}}async getSpanComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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 F.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}async getSpanStats(t={},r){var y,k;let{projectId:o,projectName:i,traceId:n,type:p,filters:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),n!=null&&(u.trace_id=n),p!=null&&(u.type=to.jsonOrThrow(p,{unrecognizedObjectKeys:"strip"})),d!=null&&(u.filters=d);let g=await w({url:h((k=(y=await a.get(this._options.baseUrl))!=null?y:await a.get(this._options.environment))!=null?k:b.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(g.ok)return zr.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(g.error.reason==="status-code")throw new c({statusCode:g.error.statusCode,body:g.error.body});switch(g.error.reason){case "non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new c({message:g.error.errorMessage})}}async scoreBatchOfSpans(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchSpans(t={},r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateSpanComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:F.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var jo=class{constructor(t={}){this._options=t;}async addTraceComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:F.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new c({message:i.error.errorMessage})}}}async addTraceFeedbackScore(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:G.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new c({message:i.error.errorMessage})}}}async getTracesByProject(t={},r){var z,P;let{page:o,size:i,projectName:n,projectId:p,filters:d,truncate:u,sorting:g}=t,y={};o!=null&&(y.page=o.toString()),i!=null&&(y.size=i.toString()),n!=null&&(y.project_name=n),p!=null&&(y.project_id=p),d!=null&&(y.filters=d),u!=null&&(y.truncate=u.toString()),g!=null&&(y.sorting=g);let k=await w({url:h((P=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?P:b.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:y,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 Za.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(k.error.reason==="status-code")throw new c({statusCode:k.error.statusCode,body:k.error.body});switch(k.error.reason){case "non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new c({message:k.error.errorMessage})}}async createTrace(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createTraces(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:We.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getTraceById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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 xr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteTraceById(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateTrace(t,r={},o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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: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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteTraceComments(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraceFeedbackScore(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:wr.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){if(i.error.reason==="status-code")throw new c({statusCode:i.error.statusCode,body:i.error.body});switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new c({message:i.error.errorMessage})}}}async deleteTraceThreads(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraces(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:U.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames2(t={},r){var p,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let n=await w({url:h((d=(p=await a.get(this._options.baseUrl))!=null?p:await a.get(this._options.environment))!=null?d:b.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 de.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getTraceStats(t={},r){var u,g;let{projectId:o,projectName:i,filters:n}=t,p={};o!=null&&(p.project_id=o),i!=null&&(p.project_name=i),n!=null&&(p.filters=n);let d=await w({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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 zr.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new c({message:d.error.errorMessage})}}async getTraceComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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 F.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}async getTraceThread(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Xe.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 Rr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getTraceThreads(t={},r){var k,z;let{page:o,size:i,projectName:n,projectId:p,truncate:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),n!=null&&(g.project_name=n),p!=null&&(g.project_id=p),d!=null&&(g.truncate=d.toString()),u!=null&&(g.filters=u);let y=await w({url:h((z=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?z:b.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: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(y.ok)return Ya.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new c({message:y.error.errorMessage})}}async scoreBatchOfTraces(t,r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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: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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchTraces(t={},r){var i,n;let o=await w({url:h((n=(i=await a.get(this._options.baseUrl))!=null?i:await a.get(this._options.environment))!=null?n:b.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:Oe.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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new j(o.error.body);case 401:throw new C(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateTraceComment(t,r,o){var n,p;let i=await w({url:h((p=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?p:b.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:F.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){if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body);default:throw new c({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case "non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new c({message:i.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Co=class{constructor(t={}){this._options=t;}async datasetsRedirect(t,r){var u,g;let{datasetId:o,workspaceName:i,path:n}=t,p={};p.dataset_id=o,i!=null&&(p.workspace_name=i),p.path=n;let d=await w({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body);case 404:throw new A(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new c({message:d.error.errorMessage})}}}async experimentsRedirect(t,r){var g,y;let{datasetId:o,experimentId:i,workspaceName:n,path:p}=t,d={};d.dataset_id=o,d.experiment_id=i,n!=null&&(d.workspace_name=n),d.path=p;let u=await w({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:b.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){if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new j(u.error.body);case 404:throw new A(u.error.body);default:throw new c({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new c({message:u.error.errorMessage})}}}async projectsRedirect(t,r){var u,g;let{traceId:o,workspaceName:i,path:n}=t,p={};p.trace_id=o,i!=null&&(p.workspace_name=i),p.path=n;let d=await w({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:b.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:p,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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new j(d.error.body);case 404:throw new A(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new c({message:d.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var _r=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new wo(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new ho(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new yo(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ko(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new zo(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new So(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new xo(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new Ro(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new _o(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Ao(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new To(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Po(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Eo(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new vo(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new jo(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Co(this._options)}async isAlive(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new c({message:r.error.errorMessage})}}async version(t){var o,i;let r=await w({url:h((i=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?i:b.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 r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ar=()=>uuid.v7();var Io=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 Uo=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,p;let r=(p=(n=this.data.projectName)!=null?n:t.projectName)!=null?p:this.opik.config.projectName,o={id:Ar(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new Io(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 ep=s=>s.replace("/api",""),Ss=({apiUrl:s,projectName:t,workspaceName:r})=>{let o=encodeURIComponent(t);return `${ep(s)}/${r}/redirect/projects?name=${o}`};var rp=300,op=100,Tr=class{constructor({action:t,batchSize:r=op,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(),v.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(v.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{v.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;}},H=class{constructor({delay:t=rp,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 Tr({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:t,enableBatch:r,name:`${i}:createQueue`}),this.updateQueue=new Tr({action:async n=>{await this.createQueue.flush();let p=Array.from(n.entries());for(let[d,u]of p)await this.updateEntity(d,u);},delay:t,enableBatch:false,name:`${i}:updateQueue`}),this.deleteQueue=new Tr({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 No=class extends H{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 Fo=class extends H{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 Mo=class extends H{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 Do=class extends H{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 te=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=Ss({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});v.info(`Started logging traces to the "${t}" project at ${on(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;v.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new Uo({id:Ar(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),v.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.flush=async()=>{v.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),v.info("Successfully flushed all data to Opik");}catch(t){v.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};v.debug("Initializing OpikClient with config:",t),this.config=sn(t),this.api=new _r({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new No(this.api),this.traceBatchQueue=new Mo(this.api),this.spanFeedbackScoresBatchQueue=new Fo(this.api),this.traceFeedbackScoresBatchQueue=new Do(this.api);}};new async_hooks.AsyncLocalStorage;new te;var ip=new te,en=class{constructor({client:t=ip}={}){this.traces=new Map;this.spans=new Map;this.getSpanInput=t=>{let r={},{attributes:o}=t;return Object.keys(o).forEach(n=>{if(n==="ai.prompt"||n==="gen_ai.request"){let p=np(o[n]);p&&(r={...r,...p});}if(n.startsWith("ai.prompt.")){let p=n.replace("ai.prompt.","");r[p]=qa(o[n]);}if(n.startsWith("gen_ai.request.")){let p=n.replace("gen_ai.request.","");r[p]=qa(o[n]);}}),Object.keys(r).length>0||("ai.toolCall.name"in o&&(r.toolName=o["ai.toolCall.name"]),"ai.toolCall.args"in o&&(r.args=o["ai.toolCall.args"])),r};this.getSpanOutput=t=>{let{attributes:r}=t;return r["ai.response.text"]?{text:r["ai.response.text"]}:r["ai.toolCall.result"]?{result:r["ai.toolCall.result"]}:r["ai.response.toolCalls"]?{toolCalls:qa(r["ai.response.toolCalls"])}:{}};this.getSpanMetadata=t=>{let{attributes:r}=t,o={};return r["gen_ai.response.model"]&&(o.model=r["gen_ai.response.model"]),r["gen_ai.system"]&&(o.system=r["gen_ai.system"]),o};this.getSpanUsage=t=>{let{attributes:r}=t,o={};return "ai.usage.promptTokens"in r&&(o.prompt_tokens=r["ai.usage.promptTokens"]),"gen_ai.usage.input_tokens"in r&&(o.prompt_tokens=r["gen_ai.usage.input_tokens"]),"ai.usage.completionTokens"in r&&(o.completion_tokens=r["ai.usage.completionTokens"]),"gen_ai.usage.output_tokens"in r&&(o.completion_tokens=r["gen_ai.usage.output_tokens"]),("prompt_tokens"in o||"completion_tokens"in o)&&(o.total_tokens=(o.prompt_tokens||0)+(o.completion_tokens||0)),o};this.processSpan=({otelSpan:t,parentSpan:r,trace:o})=>o.span({name:t.name,startTime:new Date(Bo(t.startTime)),endTime:new Date(Bo(t.endTime)),parentSpanId:r==null?void 0:r.data.id,input:this.getSpanInput(t),output:this.getSpanOutput(t),metadata:this.getSpanMetadata(t),usage:this.getSpanUsage(t),type:"llm"});this.shutdown=async()=>{await this.client.flush();};this.forceFlush=async()=>{await this.client.flush();};this.export=async(t,r)=>{let o=t.filter(p=>p.instrumentationLibrary.name==="ai"),i=t.length-o.length;if(i>0&&v.debug(`Ignored ${i} non-AI SDK spans`),o.length===0){v.debug("No AI SDK spans found"),r({code:0});return}let n=ap(o);v.debug("Exporting spans",o),Object.entries(n).forEach(([p,d])=>{var k,z;let[u,...g]=d,y=this.client.trace({startTime:new Date(Bo(u.startTime)),endTime:new Date(Bo(u.endTime)),name:(z=(k=u.attributes["ai.telemetry.metadata.traceName"])==null?void 0:k.toString())!=null?z:u.name,input:this.getSpanInput(u),output:this.getSpanOutput(u),metadata:this.getSpanMetadata(u),usage:this.getSpanUsage(u)});this.traces.set(p,y),g.forEach(P=>{var rn;let ie=this.spans.get((rn=P.parentSpanId)!=null?rn:""),Pr=this.processSpan({parentSpan:ie,otelSpan:P,trace:y});this.spans.set(P.spanContext().spanId,Pr);});});try{await this.client.flush(),r({code:0});}catch(p){v.error("Error exporting spans",p),r({code:1,error:p instanceof Error?p:new Error("Unknown error")});}};this.client=t;}static getSettings(t){var o,i,n;let r={...t.metadata};return t.name&&(r.traceName=t.name),{isEnabled:(o=t.isEnabled)!=null?o:true,recordInputs:(i=t.recordInputs)!=null?i:true,recordOutputs:(n=t.recordOutputs)!=null?n:true,functionId:t.functionId,metadata:r}}};function ap(s){let t={};return s.forEach(r=>{let o=r.spanContext();t[o.traceId]||(t[o.traceId]=[]),t[o.traceId].push(r);}),Object.entries(t).forEach(([r,o])=>{t[r]=sp(o);}),t}function Bo(s){return s[0]*1e3+s[1]/1e6}function qa(s){try{return JSON.parse(s)}catch{return s}}function np(s){if(typeof s=="string")try{let t=JSON.parse(s);if(t!==null&&typeof t=="object"&&!Array.isArray(t))return t}catch{return}}function sp(s){let t=new Map,r=new Map;for(let p of s){let{spanId:d}=p.spanContext();t.set(d,p),p.parentSpanId&&(r.has(p.parentSpanId)||r.set(p.parentSpanId,[]),r.get(p.parentSpanId).push(p));}let o=s.filter(p=>!p.parentSpanId||!t.has(p.parentSpanId)),i=[],n=[...o];for(;n.length>0;){let p=n.shift();i.push(p);let d=p.spanContext().spanId,u=r.get(d)||[];n.push(...u);}return i}
|
|
4
|
+
exports.OpikExporter=en;
|