opik 1.10.10 → 1.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +35 -35
- package/dist/index.d.cts +201 -1
- package/dist/index.d.ts +201 -1
- package/dist/index.js +35 -35
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),jf=require('fs'),Ef=require('os'),dy=require('path'),uy=require('ini');require('dotenv/config');var uuid=require('uuid'),Dx=require('fast-json-stable-stringify'),Ix=require('xxhash-wasm'),util=require('util'),Wx=require('mustache'),Lx=require('nunjucks'),dateFns=require('date-fns'),jestDiff=require('jest-diff'),Gx=require('fast-deep-equal'),async_hooks=require('async_hooks'),Xn=require('chalk'),tw=require('boxen'),ow=require('ora'),ai$1=require('ai'),openai=require('@ai-sdk/openai'),anthropic=require('@ai-sdk/anthropic'),google=require('@ai-sdk/google'),zod=require('zod');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var jf__default=/*#__PURE__*/_interopDefault(jf);var Ef__default=/*#__PURE__*/_interopDefault(Ef);var dy__default=/*#__PURE__*/_interopDefault(dy);var uy__default=/*#__PURE__*/_interopDefault(uy);var Dx__default=/*#__PURE__*/_interopDefault(Dx);var Ix__default=/*#__PURE__*/_interopDefault(Ix);var Wx__default=/*#__PURE__*/_interopDefault(Wx);var Lx__default=/*#__PURE__*/_interopDefault(Lx);var Gx__default=/*#__PURE__*/_interopDefault(Gx);var Xn__default=/*#__PURE__*/_interopDefault(Xn);var tw__default=/*#__PURE__*/_interopDefault(tw);var ow__default=/*#__PURE__*/_interopDefault(ow);var ty=Object.create;var Mi=Object.defineProperty;var oy=Object.getOwnPropertyDescriptor;var kf=(s,o)=>(o=Symbol[s])?o:Symbol.for("Symbol."+s),nt=s=>{throw TypeError(s)};var iy=(s,o,e)=>o in s?Mi(s,o,{enumerable:true,configurable:true,writable:true,value:e}):s[o]=e;var W=(s,o)=>{for(var e in o)Mi(s,e,{get:o[e],enumerable:true});};var Pf=s=>{var o;return [,,,ty((o=void 0)!=null?o:null)]},Sf=["class","method","getter","setter","accessor","field","value","get","set"],at=s=>s!==void 0&&typeof s!="function"?nt("Function expected"):s,ay=(s,o,e,t,i)=>({kind:Sf[s],name:o,metadata:t,addInitializer:a=>e._?nt("Already initialized"):i.push(at(a||null))}),ns=(s,o)=>iy(o,kf("metadata"),s[3]),Af=(s,o,e,t)=>{for(var i=0,a=s[o>>1],n=a&&a.length;i<n;i++)a[i].call(e);return t},Tf=(s,o,e,t,i,a)=>{var p,l,c,d,m=o&7,u=false,f=false,h=2,g=Sf[m+5],T=s[h]||(s[h]=[]),v=((i=i.prototype),oy(i,e));for(var E=t.length-1;E>=0;E--)c=ay(m,e,l={},s[3],T),(c.static=u,c.private=f,d=c.access={has:C=>e in C},(d.get=C=>C[e]),m>2),p=(0, t[E])(v[g],c),l._=1,at(p)&&(v[g]=p);return v&&Mi(i,e,v),i};var ly={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Wi(s,o=s){return ansiEscapes.link(o,s)}var j=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),vf=s=>{j.settings.minLevel=ly[s];},my=()=>{j.settings.minLevel=100;};vf(process.env.OPIK_LOG_LEVEL||"INFO");var fy=dy__default.default.join(Ef__default.default.homedir(),".opik.config"),ps={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function Cf(s){return Object.fromEntries(Object.entries(s).filter(([,o])=>o!==void 0))}function hy(){return Cf({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE,batchDelayMs:process.env.OPIK_BATCH_DELAY_MS?Number(process.env.OPIK_BATCH_DELAY_MS):void 0,holdUntilFlush:process.env.OPIK_HOLD_UNTIL_FLUSH===void 0?void 0:["1","true","yes"].includes(String(process.env.OPIK_HOLD_UNTIL_FLUSH).toLowerCase())})}function gy(s){return s.replace(/^~(?=$|\/|\\)/,Ef__default.default.homedir())}function yy(){let s=process.env.OPIK_CONFIG_PATH||fy,o=gy(s);if(!jf__default.default.existsSync(o)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${o}`);return {}}try{let e=uy__default.default.parse(jf__default.default.readFileSync(o,"utf8"));return e.opik?Cf({apiKey:e.opik.api_key,apiUrl:e.opik.url_override,projectName:e.opik.project_name,workspaceName:e.opik.workspace}):{}}catch(e){return j.error(`Error loading config file ${o}: ${e}`),{}}}function If(s){let o=hy(),e=yy(),{headers:t,...i}=s||{};return by({...ps,...e,...o,...i})}function by(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let o=Ry(s.apiUrl);if(o&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(o&&!s.workspaceName)throw new Error("OPIK_WORKSPACE is not set");return s}function Ry(s){return new URL(s).hostname.endsWith("comet.com")}var q={};W(q,{AlertAlertType:()=>wy,AlertPublicAlertType:()=>_y,AlertTriggerConfigPublicType:()=>zy,AlertTriggerConfigType:()=>ky,AlertTriggerConfigWriteType:()=>Py,AlertTriggerEventType:()=>Sy,AlertTriggerPublicEventType:()=>Ay,AlertTriggerWriteEventType:()=>Ty,AlertWriteAlertType:()=>vy,AnnotationQueuePublicScope:()=>jy,AnnotationQueueScope:()=>Ey,AnnotationQueueWriteScope:()=>Cy,AssistantMessageRole:()=>Iy,AttachmentListRequestEntityType:()=>Uf,AutomationRuleEvaluatorAction:()=>Dy,AutomationRuleEvaluatorObjectObjectPublicAction:()=>Uy,AutomationRuleEvaluatorPublicAction:()=>Fy,AutomationRuleEvaluatorUpdateAction:()=>Ny,AutomationRuleEvaluatorWriteAction:()=>My,BadGatewayError:()=>pt,BadRequestError:()=>D,BreakdownConfigPublicField:()=>Wy,CheckName:()=>By,CheckPublicName:()=>Vy,CheckPublicResult:()=>Ly,CheckResult:()=>Hy,ColumnCompareTypesItem:()=>Jy,ColumnPublicTypesItem:()=>Gy,ColumnTypesItem:()=>Ky,CompleteMultipartUploadRequestEntityType:()=>$y,ConflictError:()=>$,CreatePromptVersionDetailTemplateStructure:()=>Xf,DatasetExportJobPublicStatus:()=>Qy,DatasetItemCompareSource:()=>Yy,DatasetItemFilterOperator:()=>Xy,DatasetItemPublicSource:()=>Zy,DatasetItemSource:()=>Oy,DatasetItemWriteSource:()=>ks,DatasetPublicStatus:()=>qy,DatasetPublicVisibility:()=>eb,DatasetStatus:()=>rb,DatasetUpdateVisibility:()=>Wf,DatasetVisibility:()=>tb,DatasetWriteVisibility:()=>Bf,DeleteAttachmentsRequestEntityType:()=>ob,DownloadAttachmentRequestEntityType:()=>Ff,ExperimentItemCompareTraceVisibilityMode:()=>ib,ExperimentItemPublicTraceVisibilityMode:()=>ab,ExperimentItemTraceVisibilityMode:()=>nb,ExperimentPublicStatus:()=>sb,ExperimentPublicType:()=>pb,ExperimentStatus:()=>cb,ExperimentType:()=>Ps,ExperimentUpdateStatus:()=>lb,ExperimentUpdateType:()=>mb,ExperimentWriteStatus:()=>Vf,ExperimentWriteType:()=>Lf,FeedbackScoreBatchItemSource:()=>Ss,FeedbackScoreBatchItemThreadSource:()=>db,FeedbackScoreCompareSource:()=>ub,FeedbackScoreExperimentItemBulkWriteViewSource:()=>fb,FeedbackScorePublicSource:()=>hb,FeedbackScoreSource:()=>gb,FindFeedbackDefinitionsRequestType:()=>Hf,FindFeedbackScoreNames1RequestType:()=>qf,ForbiddenError:()=>se,GetSpanStatsRequestType:()=>eh,GetSpansByProjectRequestType:()=>rh,GetWebhookExamplesRequestAlertType:()=>Df,GuardrailName:()=>yb,GuardrailResult:()=>bb,GuardrailWriteName:()=>Rb,GuardrailWriteResult:()=>xb,InternalServerError:()=>ct,LlmAsJudgeMessagePublicRole:()=>wb,LlmAsJudgeMessageRole:()=>_b,LlmAsJudgeMessageWriteRole:()=>zb,LlmAsJudgeOutputSchemaPublicType:()=>kb,LlmAsJudgeOutputSchemaType:()=>Pb,LlmAsJudgeOutputSchemaWriteType:()=>Sb,LogItemLevel:()=>Ab,ManualEvaluationRequestEntityType:()=>Tb,NotFoundError:()=>I,NotImplementedError:()=>er,OptimizationPublicStatus:()=>vb,OptimizationStatus:()=>jb,OptimizationUpdateStatus:()=>Gf,OptimizationWriteStatus:()=>Eb,ProjectDetailedVisibility:()=>Cb,ProjectMetricRequestPublicInterval:()=>Kf,ProjectMetricRequestPublicMetricType:()=>$f,ProjectMetricResponsePublicInterval:()=>Ib,ProjectMetricResponsePublicMetricType:()=>Db,ProjectPublicVisibility:()=>Ub,ProjectUpdateVisibility:()=>Qf,ProjectVisibility:()=>Fb,ProjectWriteVisibility:()=>Yf,PromptDetailTemplateStructure:()=>Nb,PromptPublicTemplateStructure:()=>Mb,PromptTemplateStructure:()=>Wb,PromptType:()=>Bb,PromptVersionDetailTemplateStructure:()=>Vb,PromptVersionDetailType:()=>Lb,PromptVersionPublicTemplateStructure:()=>Hb,PromptVersionPublicType:()=>Jb,PromptVersionTemplateStructure:()=>Gb,PromptVersionType:()=>Kb,PromptWriteTemplateStructure:()=>Zf,PromptWriteType:()=>Of,ProviderApiKeyProvider:()=>$b,ProviderApiKeyPublicProvider:()=>Qb,ProviderApiKeyWriteProvider:()=>Jf,ResponseFormatType:()=>Yb,ServiceUnavailableError:()=>Ar,SpanExperimentItemBulkWriteViewType:()=>Xb,SpanFilterOperator:()=>Zb,SpanFilterPublicOperator:()=>Ob,SpanFilterWriteOperator:()=>qb,SpanPublicType:()=>eR,SpanSearchStreamRequestPublicType:()=>th,SpanType:()=>Ce,SpanUpdateType:()=>rR,SpanWriteType:()=>tR,StartMultipartUploadRequestEntityType:()=>Nf,ToolCallType:()=>oR,ToolType:()=>iR,TraceFilterOperator:()=>aR,TraceFilterPublicOperator:()=>nR,TraceFilterWriteOperator:()=>sR,TracePublicVisibilityMode:()=>pR,TraceThreadFilterOperator:()=>cR,TraceThreadFilterPublicOperator:()=>lR,TraceThreadFilterWriteOperator:()=>mR,TraceThreadStatus:()=>dR,TraceVisibilityMode:()=>uR,UnauthorizedError:()=>re,UnprocessableEntityError:()=>Q,UploadAttachmentRequestEntityType:()=>Mf,ValueEntryCompareSource:()=>fR,ValueEntryExperimentItemBulkWriteViewSource:()=>hR,ValueEntryPublicSource:()=>gR,ValueEntrySource:()=>yR,WebhookTestResultStatus:()=>bR,alerts:()=>Bi,annotationQueues:()=>cs,attachments:()=>Vi,automationRuleEvaluators:()=>ls,chatCompletions:()=>ms,check:()=>ds,dashboards:()=>us,datasets:()=>Li,experiments:()=>Hi,feedbackDefinitions:()=>Ji,guardrails:()=>fs,llmProviderKey:()=>Gi,manualEvaluation:()=>hs,ollama:()=>gs,openTelemetryIngestion:()=>ys,optimizations:()=>Ki,projects:()=>$i,prompts:()=>Qi,redirect:()=>bs,serviceToggles:()=>Rs,spans:()=>Yi,systemUsage:()=>xs,traces:()=>ws,welcomeWizard:()=>_s,workspaces:()=>zs});var Pe=(s,o,e)=>JSON.stringify(s,o,e);function st(s,o){return JSON.parse(s,o)}var w=class extends Error{constructor({message:o,statusCode:e,body:t,rawResponse:i}){super(xy({message:o,statusCode:e,body:t})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=e,this.body=t,this.rawResponse=i;}};function xy({message:s,statusCode:o,body:e}){let t=[];return s!=null&&t.push(s),o!=null&&t.push(`Status code: ${o.toString()}`),e!=null&&t.push(`Body: ${Pe(e,void 0,2)}`),t.join(`
|
|
2
|
-
`)}var Sr=class extends Error{constructor(o){super(o),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var pt=class extends w{constructor(o,e){super({message:"BadGatewayError",statusCode:502,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var D=class extends w{constructor(o,e){super({message:"BadRequestError",statusCode:400,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var $=class extends w{constructor(o,e){super({message:"ConflictError",statusCode:409,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var se=class extends w{constructor(o,e){super({message:"ForbiddenError",statusCode:403,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var ct=class extends w{constructor(o,e){super({message:"InternalServerError",statusCode:500,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var I=class extends w{constructor(o,e){super({message:"NotFoundError",statusCode:404,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var er=class extends w{constructor(o,e){super({message:"NotImplementedError",statusCode:501,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var Ar=class extends w{constructor(o,e){super({message:"ServiceUnavailableError",statusCode:503,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var re=class extends w{constructor(o,e){super({message:"UnauthorizedError",statusCode:401,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var Q=class extends w{constructor(o,e){super({message:"UnprocessableEntityError",statusCode:422,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var Bi={};W(Bi,{GetWebhookExamplesRequestAlertType:()=>Df});var Df={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var cs={};var Vi={};W(Vi,{AttachmentListRequestEntityType:()=>Uf,DownloadAttachmentRequestEntityType:()=>Ff,StartMultipartUploadRequestEntityType:()=>Nf,UploadAttachmentRequestEntityType:()=>Mf});var Uf={Trace:"trace",Span:"span"};var Ff={Trace:"trace",Span:"span"};var Nf={Trace:"trace",Span:"span"};var Mf={Trace:"trace",Span:"span"};var ls={};var ms={};var ds={};var us={};var Li={};W(Li,{DatasetUpdateVisibility:()=>Wf,DatasetWriteVisibility:()=>Bf});var Wf={Private:"private",Public:"public"};var Bf={Private:"private",Public:"public"};var Hi={};W(Hi,{ExperimentWriteStatus:()=>Vf,ExperimentWriteType:()=>Lf});var Vf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Lf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ji={};W(Ji,{FindFeedbackDefinitionsRequestType:()=>Hf});var Hf={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var fs={};var Gi={};W(Gi,{ProviderApiKeyWriteProvider:()=>Jf});var Jf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var hs={};var gs={};var ys={};var Ki={};W(Ki,{OptimizationUpdateStatus:()=>Gf});var Gf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var $i={};W($i,{ProjectMetricRequestPublicInterval:()=>Kf,ProjectMetricRequestPublicMetricType:()=>$f,ProjectUpdateVisibility:()=>Qf,ProjectWriteVisibility:()=>Yf});var Kf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var $f={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES",SpanFeedbackScores:"SPAN_FEEDBACK_SCORES",SpanCount:"SPAN_COUNT",SpanDuration:"SPAN_DURATION",SpanTokenUsage:"SPAN_TOKEN_USAGE"};var Qf={Private:"private",Public:"public"};var Yf={Private:"private",Public:"public"};var Qi={};W(Qi,{CreatePromptVersionDetailTemplateStructure:()=>Xf,PromptWriteTemplateStructure:()=>Zf,PromptWriteType:()=>Of});var Xf={Text:"text",Chat:"chat"};var Zf={Text:"text",Chat:"chat"};var Of={Mustache:"mustache",Jinja2:"jinja2"};var bs={};var Rs={};var Yi={};W(Yi,{FindFeedbackScoreNames1RequestType:()=>qf,GetSpanStatsRequestType:()=>eh,GetSpansByProjectRequestType:()=>rh,SpanSearchStreamRequestPublicType:()=>th});var qf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var th={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var xs={};var ws={};var _s={};var zs={};var wy={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var _y={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var zy={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var ky={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Py={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Sy={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Ay={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Ty={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var vy={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var jy={Trace:"trace",Thread:"thread"};var Ey={Trace:"trace",Thread:"thread"};var Cy={Trace:"trace",Thread:"thread"};var Iy={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Dy={Evaluator:"evaluator"};var Uy={Evaluator:"evaluator"};var Fy={Evaluator:"evaluator"};var Ny={Evaluator:"evaluator"};var My={Evaluator:"evaluator"};var Wy={None:"none",Tags:"tags",Metadata:"metadata",Name:"name",ErrorInfo:"error_info",Model:"model",Provider:"provider",Type:"type"};var By={Topic:"TOPIC",Pii:"PII"};var Vy={Topic:"TOPIC",Pii:"PII"};var Ly={Passed:"passed",Failed:"failed"};var Hy={Passed:"passed",Failed:"failed"};var Jy={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Gy={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Ky={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var $y={Trace:"trace",Span:"span"};var Qy={Pending:"PENDING",Processing:"PROCESSING",Completed:"COMPLETED",Failed:"FAILED"};var Yy={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Xy={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 Zy={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Oy={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var ks={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var qy={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var eb={Private:"private",Public:"public"};var rb={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var tb={Private:"private",Public:"public"};var ob={Trace:"trace",Span:"span"};var ib={Default:"default",Hidden:"hidden"};var ab={Default:"default",Hidden:"hidden"};var nb={Default:"default",Hidden:"hidden"};var sb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var pb={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var cb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Ps={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var lb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var mb={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ss={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var db={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ub={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var fb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var hb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var gb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var yb={Topic:"TOPIC",Pii:"PII"};var bb={Passed:"passed",Failed:"failed"};var Rb={Topic:"TOPIC",Pii:"PII"};var xb={Passed:"passed",Failed:"failed"};var wb={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var _b={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var zb={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var kb={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Pb={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Sb={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ab={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Tb={Trace:"trace",Thread:"thread",Span:"span"};var vb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var jb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Eb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Cb={Private:"private",Public:"public"};var Ib={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Db={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES",SpanFeedbackScores:"SPAN_FEEDBACK_SCORES",SpanCount:"SPAN_COUNT",SpanDuration:"SPAN_DURATION",SpanTokenUsage:"SPAN_TOKEN_USAGE"};var Ub={Private:"private",Public:"public"};var Fb={Private:"private",Public:"public"};var Nb={Text:"text",Chat:"chat"};var Mb={Text:"text",Chat:"chat"};var Wb={Text:"text",Chat:"chat"};var Bb={Mustache:"mustache",Jinja2:"jinja2"};var Vb={Text:"text",Chat:"chat"};var Lb={Mustache:"mustache",Jinja2:"jinja2"};var Hb={Text:"text",Chat:"chat"};var Jb={Mustache:"mustache",Jinja2:"jinja2"};var Gb={Text:"text",Chat:"chat"};var Kb={Mustache:"mustache",Jinja2:"jinja2"};var $b={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var Qb={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var Yb={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Xb={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Zb={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 Ob={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 qb={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 eR={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Ce={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rR={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var tR={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var oR={Function:"function"};var iR={Function:"function"};var aR={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 nR={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 sR={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 pR={Default:"default",Hidden:"hidden"};var cR={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 lR={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 mR={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 dR={Active:"active",Inactive:"inactive"};var uR={Default:"default",Hidden:"hidden"};var fR={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var hR={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var gR={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var yR={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var bR={Success:"success",Failure:"failure"};function z(...s){let o={};for(let[e,t]of s.filter(i=>i!=null).flatMap(i=>Object.entries(i))){let i=e.toLowerCase();t!=null?o[i]=t:i in o&&delete o[i];}return o}function S(...s){let o={};for(let[e,t]of s.filter(i=>i!=null).flatMap(i=>Object.entries(i))){let i=e.toLowerCase();t!=null&&(o[i]=t);}return o}var As={get:async(s,o)=>typeof s=="function"?s(o):s};var he={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},oh={[he.Debug]:1,[he.Info]:2,[he.Warn]:3,[he.Error]:4},rr=class{debug(o,...e){console.debug(o,...e);}info(o,...e){console.info(o,...e);}warn(o,...e){console.warn(o,...e);}error(o,...e){console.error(o,...e);}},Tr=class{constructor(o){this.level=oh[o.level],this.logger=o.logger,this.silent=o.silent;}shouldLog(o){return !this.silent&&this.level<=oh[o]}isDebug(){return this.shouldLog(he.Debug)}debug(o,...e){this.isDebug()&&this.logger.debug(o,...e);}isInfo(){return this.shouldLog(he.Info)}info(o,...e){this.isInfo()&&this.logger.info(o,...e);}isWarn(){return this.shouldLog(he.Warn)}warn(o,...e){this.isWarn()&&this.logger.warn(o,...e);}isError(){return this.shouldLog(he.Error)}error(o,...e){this.isError()&&this.logger.error(o,...e);}};function Ts(s){return s==null?RR:s instanceof Tr?s:(s=s!=null?s:{},(s.level)!=null||(s.level=he.Info),(s.logger)!=null||(s.logger=new rr),(s.silent)!=null||(s.silent=true),new Tr(s))}var RR=new Tr({level:he.Info,logger:new rr,silent:true});var wR={arrayFormat:"indices",encode:true};function ih(s,o){if(s===void 0||s===null)return "";let e=String(s);return o?encodeURIComponent(e):e}function vs(s,o="",e){let t=[];for(let[i,a]of Object.entries(s)){let n=o?`${o}[${i}]`:i;if(a!==void 0)if(Array.isArray(a)){if(a.length===0)continue;for(let p=0;p<a.length;p++){let l=a[p];if(l!==void 0)if(typeof l=="object"&&!Array.isArray(l)&&l!==null){let c=e.arrayFormat==="indices"?`${n}[${p}]`:n;t.push(...vs(l,c,e));}else {let c=e.arrayFormat==="indices"?`${n}[${p}]`:n,d=e.encode?encodeURIComponent(c):c;t.push(`${d}=${ih(l,e.encode)}`);}}}else if(typeof a=="object"&&a!==null){if(Object.keys(a).length===0)continue;t.push(...vs(a,n,e));}else {let p=e.encode?encodeURIComponent(n):n;t.push(`${p}=${ih(a,e.encode)}`);}}return t}function tr(s,o){return s==null||typeof s!="object"?"":vs(s,"",{...wR,...o}).join("&")}function ah(s,o){let e=tr(o,{arrayFormat:"repeat"});return e?`${s}?${e}`:s}function nh(s){let o={get bodyUsed(){return s.bodyUsed},stream:()=>s.body,arrayBuffer:s.arrayBuffer.bind(s),blob:s.blob.bind(s)};return "bytes"in s&&typeof s.bytes=="function"&&(o.bytes=s.bytes.bind(s)),o}async function Xi(s,o){switch(o){case "binary-response":return nh(s);case "blob":return await s.blob();case "arrayBuffer":return await s.arrayBuffer();case "sse":return s.body==null?{ok:false,error:{reason:"body-is-null",statusCode:s.status}}:s.body;case "streaming":return s.body==null?{ok:false,error:{reason:"body-is-null",statusCode:s.status}}:s.body;case "text":return await s.text()}let e=await s.text();if(e.length>0)try{return st(e)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:e}}}}async function sh(s){var e,t,i;let o=(e=s.headers.get("Content-Type"))==null?void 0:e.toLowerCase();if(o==null||o.length===0)return Xi(s);switch(o.indexOf(";")!==-1&&(o=(i=(t=o.split(";")[0])==null?void 0:t.trim())!=null?i:""),o){case "application/hal+json":case "application/json":case "application/ld+json":case "application/problem+json":case "application/vnd.api+json":case "text/json":{let a=await s.text();return a.length>0?st(a):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let a=await s.text();return a.length>0?st(a):void 0}return await s.text()}}async function ph(){return fetch}async function ch({body:s,type:o}){return o==="form"?tr(s,{arrayFormat:"repeat",encode:true}):o.includes("json")?Pe(s):s}var Le;typeof globalThis.Headers!="undefined"?Le=globalThis.Headers:Le=class lh{constructor(o){if(this.headers=new Map,o)if(o instanceof lh)o.forEach((e,t)=>this.append(t,e));else if(Array.isArray(o))for(let[e,t]of o)if(typeof e=="string"&&typeof t=="string")this.append(e,t);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[e,t]of Object.entries(o))if(typeof t=="string")this.append(e,t);else throw new TypeError("Header values must be strings")}append(o,e){let t=o.toLowerCase(),i=this.headers.get(t)||[];this.headers.set(t,[...i,e]);}delete(o){let e=o.toLowerCase();this.headers.delete(e);}get(o){let e=o.toLowerCase(),t=this.headers.get(e);return t?t.join(", "):null}has(o){let e=o.toLowerCase();return this.headers.has(e)}set(o,e){let t=o.toLowerCase();this.headers.set(t,[e]);}forEach(o,e){let t=e?o.bind(e):o;this.headers.forEach((i,a)=>t(i.join(", "),a,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[o,e]of this.headers.entries())yield [o,e.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let o of this.headers.values())yield o.join(", ");}[Symbol.iterator](){return this.entries()}};var _R="timeout";function mh(s){let o=new AbortController,e=setTimeout(()=>o.abort(_R),s);return {signal:o.signal,abortId:e}}function dh(...s){let o=s.length===1&&Array.isArray(s[0])?s[0]:s,e=new AbortController;for(let t of o){if(t.aborted){e.abort(t==null?void 0:t.reason);break}t.addEventListener("abort",()=>e.abort(t==null?void 0:t.reason),{signal:e.signal});}return e.signal}var uh=async(s,o,e,t,i,a,n,p,l)=>{let c=[],d;if(a!=null){let{signal:f,abortId:h}=mh(a);d=h,c.push(f);}n!=null&&c.push(n);let m=dh(c),u=await s(o,{method:e,headers:t,body:i,signal:m,credentials:p?"include":void 0,duplex:l});return d!=null&&clearTimeout(d),u};var Zi={headers:new Le,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},Oi={headers:new Le,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function qi(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function zR(s){let o=1+Math.random()*.2;return s*o}function kR(s){let o=1+(Math.random()-.5)*.2;return s*o}function PR(s,o){let e=s.headers.get("Retry-After");if(e){let i=parseInt(e,10);if(!Number.isNaN(i)&&i>0)return Math.min(i*1e3,6e4);let a=new Date(e);if(!Number.isNaN(a.getTime())){let n=a.getTime()-Date.now();if(n>0)return Math.min(Math.max(n,0),6e4)}}let t=s.headers.get("X-RateLimit-Reset");if(t){let i=parseInt(t,10);if(!Number.isNaN(i)){let a=i*1e3-Date.now();if(a>0)return zR(Math.min(a,6e4))}}return kR(Math.min(1e3*2**o,6e4))}async function fh(s,o=2){let e=await s();for(let t=0;t<o&&([408,429].includes(e.status)||e.status>=500);++t){let i=PR(e,t);await new Promise(a=>setTimeout(a,i)),e=await s();}return e}var SR=new Set(["authorization","www-authenticate","x-api-key","api-key","apikey","x-api-token","x-auth-token","auth-token","cookie","set-cookie","proxy-authorization","proxy-authenticate","x-csrf-token","x-xsrf-token","x-session-token","x-access-token"]);function js(s){let o={};for(let[e,t]of s instanceof Le?s.entries():Object.entries(s))SR.has(e.toLowerCase())?o[e]="[REDACTED]":o[e]=t;return o}var Es=new Set(["api_key","api-key","apikey","token","access_token","access-token","auth_token","auth-token","password","passwd","secret","api_secret","api-secret","apisecret","key","session","session_id","session-id"]);function AR(s){if(s==null)return s;let o={};for(let[e,t]of Object.entries(s))Es.has(e.toLowerCase())?o[e]="[REDACTED]":o[e]=t;return o}function or(s){let o=s.indexOf("://");if(o===-1)return s;let e=o+3,t=s.indexOf("/",e),i=s.indexOf("?",e),a=s.indexOf("#",e),n=Math.min(t===-1?s.length:t,i===-1?s.length:i,a===-1?s.length:a),p=-1;for(let h=e;h<n;h++)s[h]==="@"&&(p=h);if(p!==-1&&(s=`${s.slice(0,e)}[REDACTED]@${s.slice(p+1)}`),i=s.indexOf("?"),i===-1)return s;a=s.indexOf("#",i);let l=a!==-1?a:s.length,c=s.slice(i+1,l);if(c.length===0)return s;let d=c.toLowerCase();if(!(d.includes("token")||d.includes("key")||d.includes("password")||d.includes("passwd")||d.includes("secret")||d.includes("session")||d.includes("auth")))return s;let u=[],f=c.split("&");for(let h of f){let g=h.indexOf("=");if(g===-1){u.push(h);continue}let R=h.slice(0,g),T=Es.has(R.toLowerCase());if(!T&&R.includes("%"))try{let v=decodeURIComponent(R);T=Es.has(v.toLowerCase());}catch{}u.push(T?`${R}=[REDACTED]`:h);}return s.slice(0,i+1)+u.join("&")+s.slice(l)}async function TR(s){var e;let o=new Le;if(o.set("Accept",s.responseType==="json"?"application/json":s.responseType==="text"?"text/plain":"*/*"),s.body!==void 0&&s.contentType!=null&&o.set("Content-Type",s.contentType),s.headers==null)return o;for(let[t,i]of Object.entries(s.headers)){let a=await As.get(i,{endpointMetadata:(e=s.endpointMetadata)!=null?e:{}});if(typeof a=="string"){o.set(t,a);continue}a!=null&&o.set(t,`${a}`);}return o}async function vR(s){var n,p,l;let o=ah(s.url,s.queryParameters),e=await ch({body:s.body,type:(n=s.requestType)!=null?n:"other"}),t=(p=s.fetchFn)!=null?p:await ph(),i=await TR(s),a=Ts(s.logging);if(a.isDebug()){let c={method:s.method,url:or(o),headers:js(i),queryParameters:AR(s.queryParameters),hasBody:e!=null};a.debug("Making HTTP request",c);}try{let c=await fh(async()=>uh(t,o,s.method,i,e,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries);if(c.status>=200&&c.status<400){if(a.isDebug()){let m={method:s.method,url:or(o),statusCode:c.status,responseHeaders:js(c.headers)};a.debug("HTTP request succeeded",m);}return {ok:!0,body:await Xi(c,s.responseType),headers:c.headers,rawResponse:qi(c)}}else {if(a.isError()){let d={method:s.method,url:or(o),statusCode:c.status,responseHeaders:js(Object.fromEntries(c.headers.entries()))};a.error("HTTP request failed with error status",d);}return {ok:!1,error:{reason:"status-code",statusCode:c.status,body:await sh(c)},rawResponse:qi(c)}}}catch(c){if((l=s.abortSignal)!=null&&l.aborted){if(a.isError()){let d={method:s.method,url:or(o)};a.error("HTTP request was aborted",d);}return {ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Zi}}else if(c instanceof Error&&c.name==="AbortError"){if(a.isError()){let d={method:s.method,url:or(o),timeoutMs:s.timeoutMs};a.error("HTTP request timed out",d);}return {ok:false,error:{reason:"timeout"},rawResponse:Zi}}else if(c instanceof Error){if(a.isError()){let d={method:s.method,url:or(o),errorMessage:c.message};a.error("HTTP request failed with error",d);}return {ok:false,error:{reason:"unknown",errorMessage:c.message},rawResponse:Oi}}if(a.isError()){let d={method:s.method,url:or(o),error:Pe(c)};a.error("HTTP request failed with unknown error",d);}return {ok:false,error:{reason:"unknown",errorMessage:Pe(c)},rawResponse:Oi}}}var k=vR;var _=class s extends Promise{constructor(o){super(e=>{e(void 0);}),this.innerPromise=o;}static fromFunction(o,...e){return new s(o(...e))}static interceptFunction(o){return (...e)=>s.fromPromise(o(...e))}static fromPromise(o){return new s(o)}static fromExecutor(o){let e=new Promise(o);return new s(e)}static fromResult(o){let e=Promise.resolve(o);return new s(e)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:o})=>o)),this.unwrappedPromise}then(o,e){return this.unwrap().then(o,e)}catch(o){return this.unwrap().catch(o)}finally(o){return this.unwrap().finally(o)}async withRawResponse(){return await this.innerPromise}};var b={get:async s=>typeof s=="function"?s():s};var Fs={};W(Fs,{toBinaryUploadRequest:()=>jR,toMultipartDataPart:()=>Cs});async function jR(s){let{data:o,filename:e,contentLength:t,contentType:i}=await Is(s),a={body:o,headers:{}};return e&&(a.headers["Content-Disposition"]=`attachment; filename="${e}"`),i&&(a.headers["Content-Type"]=i),t!=null&&(a.headers["Content-Length"]=t.toString()),a}async function Cs(s){let{data:o,filename:e,contentType:t}=await Is(s,{noSniffFileSize:true});return {data:o,filename:e,contentType:t}}async function Is(s,{noSniffFileSize:o}={}){var e,t,i,a,n;if(ER(s))return Is({data:s},{noSniffFileSize:o});if("path"in s){let p=await import('fs');if(!p||!p.createReadStream)throw new Error("File path uploads are not supported in this environment.");let l=p.createReadStream(s.path),c=(e=s.contentLength)!=null?e:o===true?void 0:await hh(s.path),d=(t=s.filename)!=null?t:gh(s.path);return {data:l,filename:d,contentType:s.contentType,contentLength:c}}if("data"in s){let p=s.data,l=(i=s.contentLength)!=null?i:await IR(p,{noSniffFileSize:o}),c=(a=s.filename)!=null?a:CR(p);return {data:p,filename:c,contentType:(n=s.contentType)!=null?n:DR(p),contentLength:l}}throw new Error(`Invalid FileUpload of type ${typeof s}: ${JSON.stringify(s)}`)}function ER(s){return bh(s)||Rh(s)||xh(s)||MR(s)||Ds(s)||Us(s)||FR(s)||NR(s)}async function hh(s){try{let o=await import('fs');return !o||!o.promises||!o.promises.stat?void 0:(await o.promises.stat(s)).size}catch{return}}function CR(s){if(UR(s))return s.name;if(yh(s))return gh(s.path.toString())}async function IR(s,{noSniffFileSize:o}={}){if(bh(s))return s.length;if(Rh(s)||xh(s))return s.byteLength;if(Ds(s)||Us(s))return s.size;if(o!==true&&yh(s))return await hh(s.path.toString())}function DR(s){if(Ds(s)||Us(s))return s.type}function gh(s){let o=s.lastIndexOf("/"),e=s.lastIndexOf("\\"),t=Math.max(o,e);return t>=0?s.substring(t+1):s}function UR(s){return typeof s=="object"&&s!=null&&"name"in s}function yh(s){return typeof s=="object"&&s!=null&&"path"in s}function FR(s){return typeof s=="object"&&s!=null&&("read"in s||"pipe"in s)}function NR(s){return typeof s=="object"&&s!=null&&"getReader"in s}function bh(s){return typeof Buffer!="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(s)}function Rh(s){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(s)}function xh(s){return typeof ArrayBuffer!="undefined"&&s instanceof ArrayBuffer}function MR(s){return typeof Uint8Array!="undefined"&&s instanceof Uint8Array}function Ds(s){return typeof Blob!="undefined"&&s instanceof Blob}function Us(s){return typeof File!="undefined"&&s instanceof File}var vr=WR();function WR(){var l,c,d,m,u;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((l=globalThis==null?void 0:globalThis.navigator)==null?void 0:l.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((c=self.constructor)==null?void 0:c.name)==="DedicatedWorkerGlobalScope"||((d=self.constructor)==null?void 0:d.name)==="ServiceWorkerGlobalScope"||((m=self.constructor)==null?void 0:m.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 navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((u=process.versions)!=null&&u.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:{type:"unknown"}}async function wh(){return new Ns}var Ns=class{constructor(){this.fd=new FormData;}async setup(){}append(o,e){this.fd.append(o,String(e));}async appendFile(o,e){let{data:t,filename:i,contentType:a}=await Cs(e),n=await JR(t,a);i?this.fd.append(o,n,i):this.fd.append(o,n);}getRequest(){return {body:this.fd,headers:{},duplex:"half"}}};function BR(s){return typeof s=="object"&&s!=null&&("read"in s||"pipe"in s)}function _h(s){return typeof s=="object"&&s!=null&&"getReader"in s}function VR(s){return typeof Buffer!="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(s)}function LR(s){return ArrayBuffer.isView(s)}async function HR(s){if(vr.type==="node"){let{Readable:o}=await import('stream');if(s instanceof o){let e=[];for await(let t of s)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e)}}if(_h(s)){let o=s.getReader(),e=[];try{for(;;){let{done:n,value:p}=await o.read();if(n)break;e.push(p);}}finally{o.releaseLock();}let t=e.reduce((n,p)=>n+p.length,0),i=new Uint8Array(t),a=0;for(let n of e)i.set(n,a),a+=n.length;return Buffer.from(i)}throw new Error(`Unsupported stream type: ${typeof s}. Expected Node.js Readable stream or Web ReadableStream.`)}async function JR(s,o){if(BR(s)||_h(s)){let e=await HR(s);return new Blob([e],{type:o})}return s instanceof Blob?s:VR(s)?new Blob([s],{type:o}):s instanceof ArrayBuffer?new Blob([s],{type:o}):LR(s)?new Blob([s],{type:o}):typeof s=="string"?new Blob([s],{type:o}):typeof s=="object"&&s!==null?new Blob([Pe(s)],{type:o!=null?o:"application/json"}):new Blob([String(s)],{type:o})}var lt={};W(lt,{ConsoleLogger:()=>rr,LogLevel:()=>he,Logger:()=>Tr,createLogger:()=>Ts});var r={};W(r,{JsonError:()=>jr,ParseError:()=>Er,any:()=>Nh,bigint:()=>kh,boolean:()=>Mh,booleanLiteral:()=>Uh,date:()=>Ph,discriminant:()=>Qh,enum_:()=>ra,getObjectLikeUtils:()=>Se,getObjectUtils:()=>ir,getSchemaUtils:()=>J,isProperty:()=>He,lazy:()=>Sh,lazyObject:()=>Ih,list:()=>oa,never:()=>Wh,number:()=>Bh,object:()=>ta,objectWithoutOptionalProperties:()=>Ch,optional:()=>Ms,property:()=>Th,record:()=>Jh,set:()=>Gh,string:()=>Vh,stringLiteral:()=>Fh,transform:()=>Ws,undiscriminatedUnion:()=>$h,union:()=>Xh,unknown:()=>Lh,withParsedProperties:()=>Vs});var N={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function H(s,o){return `Expected ${o}. Received ${GR(s)}.`}function GR(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 te(s){return {...s,json:zh(s.json),parse:zh(s.parse)}}function zh(s){return (o,e)=>{let t=s(o,e),{skipValidation:i=false}=e!=null?e:{};return !t.ok&&i?(console.warn(["Failed to validate.",...t.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
3
|
-
`)),{ok:true,value:o}):t}}function ea(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var jr=class s extends Error{constructor(e){super(e.map(ea).join("; "));this.errors=e;Object.setPrototypeOf(this,s.prototype);}};var Er=class s extends Error{constructor(e){super(e.map(ea).join("; "));this.errors=e;Object.setPrototypeOf(this,s.prototype);}};function J(s){return {nullable:()=>KR(s),optional:()=>Ms(s),optionalNullable:()=>$R(s),transform:o=>Ws(s,o),parseOrThrow:(o,e)=>{let t=s.parse(o,e);if(t.ok)return t.value;throw new Er(t.errors)},jsonOrThrow:(o,e)=>{let t=s.json(o,e);if(t.ok)return t.value;throw new jr(t.errors)}}}function KR(s){let o={parse:(e,t)=>e==null?{ok:true,value:null}:s.parse(e,t),json:(e,t)=>e==null?{ok:true,value:null}:s.json(e,t),getType:()=>N.NULLABLE};return {...o,...J(o)}}function Ms(s){let o={parse:(e,t)=>e==null?{ok:true,value:void 0}:s.parse(e,t),json:(e,t)=>t!=null&&t.omitUndefined&&e===void 0?{ok:true,value:void 0}:e==null?{ok:true,value:null}:s.json(e,t),getType:()=>N.OPTIONAL};return {...o,...J(o)}}function $R(s){let o={parse:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:s.parse(e,t),json:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:s.json(e,t),getType:()=>N.OPTIONAL_NULLABLE};return {...o,...J(o)}}function Ws(s,o){let e={parse:(t,i)=>{let a=s.parse(t,i);return a.ok?{ok:true,value:o.transform(a.value)}:a},json:(t,i)=>{let a=o.untransform(t);return s.json(a,i)},getType:()=>s.getType()};return {...e,...J(e)}}function kh(){let s={parse:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o=="bigint"?{ok:true,value:o}:typeof o=="number"?{ok:true,value:BigInt(o)}:{ok:false,errors:[{path:e,message:H(o,"bigint | number")}]},json:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o!="bigint"?{ok:false,errors:[{path:e,message:H(o,"bigint")}]}:{ok:true,value:o},getType:()=>N.BIGINT};return {...te(s),...J(s)}}var QR=/^([+-]?\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 Ph(){let s={parse:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:e,message:H(o,"string")}]}:QR.test(o)?{ok:true,value:new Date(o)}:{ok:false,errors:[{path:e,message:H(o,"ISO 8601 date string")}]},json:(o,{breadcrumbsPrefix:e=[]}={})=>o instanceof Date?{ok:true,value:o.toISOString()}:{ok:false,errors:[{path:e,message:H(o,"Date object")}]},getType:()=>N.DATE};return {...te(s),...J(s)}}function oe(s,o){return ()=>{let e={parse:o,json:o,getType:()=>s};return {...te(e),...J(e)}}}function ra(s){let o=new Set(s);return oe(N.ENUM,(t,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:a,message:H(t,"string")}]}:!o.has(t)&&!i?{ok:false,errors:[{path:a,message:H(t,"enum")}]}:{ok:true,value:t})()}function Sh(s){let o=Bs(s);return {...o,...J(o)}}function Bs(s){return {parse:(o,e)=>Cr(s).parse(o,e),json:(o,e)=>Cr(s).json(o,e),getType:()=>Cr(s).getType()}}function Cr(s){let o=s;return o.__zurg_memoized==null&&(o.__zurg_memoized=s()),o.__zurg_memoized}function mt(s){return Object.entries(s)}function dt(s,o){let e=new Set(o);return Object.entries(s).reduce((t,[i,a])=>(e.has(i)&&(t[i]=a),t),{})}function Ie(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let o=s;for(;Object.getPrototypeOf(o)!==null;)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(s)===o}function ut(s){return Object.keys(s)}function Ah(s,o){let e=[],t=[];for(let i of s)o(i)?e.push(i):t.push(i);return [e,t]}function Se(s){return {withParsedProperties:o=>Vs(s,o)}}function Vs(s,o){let e={parse:(t,i)=>{let a=s.parse(t,i);if(!a.ok)return a;let n=Object.entries(o).reduce((p,[l,c])=>({...p,[l]:typeof c=="function"?c(a.value):c}),{});return {ok:true,value:{...a.value,...n}}},json:(t,i)=>{var p;if(!Ie(t))return {ok:false,errors:[{path:(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],message:H(t,"object")}]};let a=new Set(Object.keys(o)),n=dt(t,Object.keys(t).filter(l=>!a.has(l)));return s.json(n,i)},getType:()=>s.getType()};return {...e,...J(e),...Se(e)}}function Th(s,o){return {rawKey:s,valueSchema:o,isProperty:true}}function He(s){return s.isProperty}function ta(s){let o={_getRawProperties:()=>Object.entries(s).map(([e,t])=>He(t)?t.rawKey:e),_getParsedProperties:()=>ut(s),parse:(e,t)=>{let i={},a=[];for(let[n,p]of mt(s)){let l=He(p)?p.rawKey:n,c=He(p)?p.valueSchema:p,d={rawKey:l,parsedKey:n,valueSchema:c};i[l]=d,Eh(c)&&a.push(l);}return vh({value:e,requiredKeys:a,getProperty:n=>{let p=i[n];if(p!=null)return {transformedKey:p.parsedKey,transform:l=>{var c;return p.valueSchema.parse(l,{...t,breadcrumbsPrefix:[...(c=t==null?void 0:t.breadcrumbsPrefix)!=null?c:[],n]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},json:(e,t)=>{let i=[];for(let[a,n]of mt(s)){let p=He(n)?n.valueSchema:n;Eh(p)&&i.push(a);}return vh({value:e,requiredKeys:i,getProperty:a=>{let n=s[a];if(n!=null)return He(n)?{transformedKey:n.rawKey,transform:p=>{var l;return n.valueSchema.json(p,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],a]})}}:{transformedKey:a,transform:p=>{var l;return n.json(p,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],a]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},getType:()=>N.OBJECT};return {...te(o),...J(o),...Se(o),...ir(o)}}function vh({value:s,requiredKeys:o,getProperty:e,unrecognizedObjectKeys:t="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Ie(s))return {ok:false,errors:[{path:a,message:H(s,"object")}]};let n=new Set(o),p=[],l={};for(let[c,d]of Object.entries(s)){let m=e(c);if(m!=null){n.delete(c);let u=m.transform(d);u.ok?l[m.transformedKey]=u.value:(l[c]=d,p.push(...u.errors));}else switch(t){case "fail":p.push({path:[...a,c],message:`Unexpected key "${c}"`});break;case "strip":break;case "passthrough":l[c]=d;break}}return p.push(...o.filter(c=>n.has(c)).map(c=>({path:a,message:`Missing required key "${c}"`}))),p.length===0||i?{ok:true,value:l}:{ok:false,errors:p}}function ir(s){return {extend:o=>{let e={_getParsedProperties:()=>[...s._getParsedProperties(),...o._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...o._getRawProperties()],parse:(t,i)=>jh({extensionKeys:o._getRawProperties(),value:t,transformBase:a=>s.parse(a,i),transformExtension:a=>o.parse(a,i),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(t,i)=>jh({extensionKeys:o._getParsedProperties(),value:t,transformBase:a=>s.json(a,i),transformExtension:a=>o.json(a,i),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>N.OBJECT};return {...e,...J(e),...Se(e),...ir(e)}},passthrough:()=>{let o=new Set(s._getRawProperties()),e=new Set(s._getParsedProperties()),t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(i,a)=>{let n=s.parse(i,{...a,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let p={};if(typeof i=="object"&&i!=null)for(let[l,c]of Object.entries(i))o.has(l)||(p[l]=c);return {ok:true,value:{...p,...n.value}}},json:(i,a)=>{let n=s.json(i,{...a,unrecognizedObjectKeys:"passthrough"});if(!n.ok)return n;let p={};if(typeof i=="object"&&i!=null)for(let[l,c]of Object.entries(i))e.has(l)||(p[l]=c);return {ok:true,value:{...p,...n.value}}},getType:()=>N.OBJECT};return {...t,...J(t),...Se(t),...ir(t)}}}}function jh({extensionKeys:s,value:o,transformBase:e,transformExtension:t,breadcrumbsPrefix:i=[]}){if(!Ie(o))return {ok:false,errors:[{path:i,message:H(o,"object")}]};let a=new Set(s),[n,p]=Ah(ut(o),d=>a.has(d)),l=e(dt(o,p)),c=t(dt(o,n));return l.ok&&c.ok?{ok:true,value:{...l.value,...c.value}}:{ok:false,errors:[...l.ok?[]:l.errors,...c.ok?[]:c.errors]}}function Eh(s){return !YR(s)}function YR(s){switch(s.getType()){case N.ANY:case N.UNKNOWN:case N.OPTIONAL:case N.OPTIONAL_NULLABLE:return true;default:return false}}function Ch(s){return ta(s)}function Ih(s){let o={...Bs(s),_getRawProperties:()=>Cr(s)._getRawProperties(),_getParsedProperties:()=>Cr(s)._getParsedProperties()};return {...o,...J(o),...Se(o),...ir(o)}}function oa(s){let o={parse:(e,t)=>Dh(e,(i,a)=>{var n;return s.parse(i,{...t,breadcrumbsPrefix:[...(n=t==null?void 0:t.breadcrumbsPrefix)!=null?n:[],`[${a}]`]})}),json:(e,t)=>Dh(e,(i,a)=>{var n;return s.json(i,{...t,breadcrumbsPrefix:[...(n=t==null?void 0:t.breadcrumbsPrefix)!=null?n:[],`[${a}]`]})}),getType:()=>N.LIST};return {...te(o),...J(o)}}function Dh(s,o){return Array.isArray(s)?s.map((t,i)=>o(t,i)).reduce((t,i)=>{if(t.ok&&i.ok)return {ok:true,value:[...t.value,i.value]};let a=[];return t.ok||a.push(...t.errors),i.ok||a.push(...i.errors),{ok:false,errors:a}},{ok:true,value:[]}):{ok:false,errors:[{message:H(s,"list"),path:[]}]}}function Uh(s){return oe(N.BOOLEAN_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===s?{ok:true,value:s}:{ok:false,errors:[{path:t,message:H(e,`${s.toString()}`)}]})()}function Fh(s){return oe(N.STRING_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===s?{ok:true,value:s}:{ok:false,errors:[{path:t,message:H(e,`"${s}"`)}]})()}var Nh=oe(N.ANY,s=>({ok:true,value:s}));var Mh=oe(N.BOOLEAN,(s,{breadcrumbsPrefix:o=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:o,message:H(s,"boolean")}]});var Wh=oe(N.NEVER,(s,{breadcrumbsPrefix:o=[]}={})=>({ok:false,errors:[{path:o,message:"Expected never"}]}));var Bh=oe(N.NUMBER,(s,{breadcrumbsPrefix:o=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:o,message:H(s,"number")}]});var Vh=oe(N.STRING,(s,{breadcrumbsPrefix:o=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:o,message:H(s,"string")}]});var Lh=oe(N.UNKNOWN,s=>({ok:true,value:s}));function Jh(s,o){let e={parse:(t,i)=>Hh({value:t,isKeyNumeric:s.getType()===N.NUMBER,transformKey:a=>{var n;return s.parse(a,{...i,breadcrumbsPrefix:[...(n=i==null?void 0:i.breadcrumbsPrefix)!=null?n:[],`${a} (key)`]})},transformValue:(a,n)=>{var p;return o.parse(a,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(t,i)=>Hh({value:t,isKeyNumeric:s.getType()===N.NUMBER,transformKey:a=>{var n;return s.json(a,{...i,breadcrumbsPrefix:[...(n=i==null?void 0:i.breadcrumbsPrefix)!=null?n:[],`${a} (key)`]})},transformValue:(a,n)=>{var p;return o.json(a,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${n}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>N.RECORD};return {...te(e),...J(e)}}function Hh({value:s,isKeyNumeric:o,transformKey:e,transformValue:t,breadcrumbsPrefix:i=[]}){return Ie(s)?mt(s).reduce((a,[n,p])=>{if(p===void 0)return a;let l=a,c=n;if(o){let f=n.length>0?Number(n):NaN;Number.isNaN(f)||(c=f);}let d=e(c),m=t(p,c);if(l.ok&&d.ok&&m.ok)return {ok:true,value:{...l.value,[d.value]:m.value}};let u=[];return l.ok||u.push(...l.errors),d.ok||u.push(...d.errors),m.ok||u.push(...m.errors),{ok:false,errors:u}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:H(s,"object")}]}}function Gh(s){let o=oa(s),e={parse:(t,i)=>{let a=o.parse(t,i);return a.ok?{ok:true,value:new Set(a.value)}:a},json:(t,i)=>{var n;return t instanceof Set?o.json([...t],i):{ok:false,errors:[{path:(n=i==null?void 0:i.breadcrumbsPrefix)!=null?n:[],message:H(t,"Set")}]}},getType:()=>N.SET};return {...te(e),...J(e)}}function $h(s){let o={parse:(e,t)=>Kh((i,a)=>i.parse(e,a),s,t),json:(e,t)=>Kh((i,a)=>i.json(e,a),s,t),getType:()=>N.UNDISCRIMINATED_UNION};return {...te(o),...J(o)}}function Kh(s,o,e){let t=[];for(let[i,a]of o.entries()){let n=s(a,{...e,skipValidation:false});if(n.ok)return n;for(let p of n.errors)t.push({path:p.path,message:`[Variant ${i}] ${p.message}`});}return {ok:false,errors:t}}function Qh(s,o){return {parsedDiscriminant:s,rawDiscriminant:o}}function Xh(s,o){let e=typeof s=="string"?s:s.rawDiscriminant,t=typeof s=="string"?s:s.parsedDiscriminant,i=ra(ut(o)),a={parse:(n,p)=>Yh({value:n,discriminant:e,transformedDiscriminant:t,transformDiscriminantValue:l=>{var c;return i.parse(l,{allowUnrecognizedEnumValues:p==null?void 0:p.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(c=p==null?void 0:p.breadcrumbsPrefix)!=null?c:[],e]})},getAdditionalPropertiesSchema:l=>o[l],allowUnrecognizedUnionMembers:p==null?void 0:p.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,c)=>c.parse(l,p),breadcrumbsPrefix:p==null?void 0:p.breadcrumbsPrefix}),json:(n,p)=>Yh({value:n,discriminant:t,transformedDiscriminant:e,transformDiscriminantValue:l=>{var c;return i.json(l,{allowUnrecognizedEnumValues:p==null?void 0:p.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(c=p==null?void 0:p.breadcrumbsPrefix)!=null?c:[],t]})},getAdditionalPropertiesSchema:l=>o[l],allowUnrecognizedUnionMembers:p==null?void 0:p.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,c)=>c.json(l,p),breadcrumbsPrefix:p==null?void 0:p.breadcrumbsPrefix}),getType:()=>N.UNION};return {...te(a),...J(a),...Se(a)}}function Yh({value:s,discriminant:o,transformedDiscriminant:e,transformDiscriminantValue:t,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:n,breadcrumbsPrefix:p=[]}){if(!Ie(s))return {ok:false,errors:[{path:p,message:H(s,"object")}]};let{[o]:l,...c}=s;if(l==null)return {ok:false,errors:[{path:p,message:`Missing discriminant ("${o}")`}]};let d=t(l);if(!d.ok)return {ok:false,errors:d.errors};let m=i(d.value);if(m==null)return a?{ok:true,value:{[e]:d.value,...c}}:{ok:false,errors:[{path:[...p,o],message:"Unexpected discriminant value"}]};let u=n(c,m);return u.ok?{ok:true,value:{[e]:l,...u.value}}:u}var x={};W(x,{encodePathParam:()=>Zh,join:()=>qh,toQueryString:()=>tr});function Zh(s){if(s===null)return "null";switch(typeof s){case "undefined":return "undefined";case "string":case "number":case "boolean":break;default:s=String(s);break}return encodeURIComponent(s)}function qh(s,...o){if(!s)return "";if(o.length===0)return s;if(s.includes("://")){let e;try{e=new URL(s);}catch{return Oh(s,...o)}let t=o[o.length-1],i=t==null?void 0:t.endsWith("/");for(let a of o){let n=rg(a);n&&(e.pathname=eg(e.pathname,n));}return i&&!e.pathname.endsWith("/")&&(e.pathname+="/"),e.toString()}return Oh(s,...o)}function Oh(s,...o){if(o.length===0)return s;let e=s,t=o[o.length-1],i=t==null?void 0:t.endsWith("/");for(let a of o){let n=rg(a);n&&(e=eg(e,n));}return i&&!e.endsWith("/")&&(e+="/"),e}function eg(s,o){return s.endsWith("/")?s+o:`${s}/${o}`}function rg(s){if(!s)return s;let o=0,e=s.length;return s.startsWith("/")&&(o=1),s.endsWith("/")&&(e=s.length-1),o===0&&e===s.length?s:s.slice(o,e)}function F(s){let o=z({"X-Fern-Language":"JavaScript","X-Fern-Runtime":vr.type,"X-Fern-Runtime-Version":vr.version,"Comet-Workspace":s==null?void 0:s.workspaceName},s==null?void 0:s.headers);return {...s,logging:lt.createLogger(s==null?void 0:s.logging),headers:o}}var P={Default:"http://localhost:5173/api"};function A(s,o,e,t){switch(s.reason){case "non-json":throw new w({statusCode:s.statusCode,body:s.rawBody,rawResponse:o});case "body-is-null":throw new w({statusCode:s.statusCode,rawResponse:o});case "timeout":throw new Sr(`Timeout exceeded when calling ${e} ${t}.`);case "unknown":throw new w({message:s.errorMessage,rawResponse:o});default:throw new w({message:"Unknown error",rawResponse:o})}}var L={};W(L,{AggregationData:()=>Up,Alert:()=>ox,AlertAlertType:()=>Fp,AlertPagePublic:()=>Qp,AlertPublic:()=>vo,AlertPublicAlertType:()=>Lp,AlertTrigger:()=>Bp,AlertTriggerConfig:()=>Mp,AlertTriggerConfigPublic:()=>Jp,AlertTriggerConfigPublicType:()=>Hp,AlertTriggerConfigType:()=>Np,AlertTriggerConfigWrite:()=>Xp,AlertTriggerConfigWriteType:()=>Yp,AlertTriggerEventType:()=>Wp,AlertTriggerPublic:()=>Kp,AlertTriggerPublicEventType:()=>Gp,AlertTriggerWrite:()=>Op,AlertTriggerWriteEventType:()=>Zp,AlertWrite:()=>jo,AlertWriteAlertType:()=>qp,AnnotationQueue:()=>oc,AnnotationQueueBatch:()=>ix,AnnotationQueueBatchWrite:()=>ht,AnnotationQueueItemIds:()=>Ka,AnnotationQueuePagePublic:()=>nc,AnnotationQueuePublic:()=>Eo,AnnotationQueuePublicScope:()=>ic,AnnotationQueueReviewer:()=>rc,AnnotationQueueReviewerPublic:()=>ac,AnnotationQueueScope:()=>tc,AnnotationQueueUpdate:()=>gt,AnnotationQueueWrite:()=>ft,AnnotationQueueWriteScope:()=>Ls,AssistantMessage:()=>cc,AssistantMessageRole:()=>sc,Attachment:()=>lc,AttachmentListRequestEntityType:()=>ca,AttachmentPage:()=>mc,AudioUrl:()=>dc,AudioUrlPublic:()=>uc,AudioUrlWrite:()=>fc,AuthDetailsHolder:()=>hc,AutomationRuleEvaluator:()=>ax,AutomationRuleEvaluatorAction:()=>gc,AutomationRuleEvaluatorLlmAsJudge:()=>zc,AutomationRuleEvaluatorLlmAsJudgePublic:()=>Wo,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Jc,AutomationRuleEvaluatorObjectObjectPublic:()=>Zc,AutomationRuleEvaluatorObjectObjectPublicAction:()=>Gc,AutomationRuleEvaluatorPagePublic:()=>Oc,AutomationRuleEvaluatorPublic:()=>el,AutomationRuleEvaluatorPublicAction:()=>qc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Pc,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>Vo,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>ol,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Sc,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>Lo,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>al,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>Ac,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>Ho,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>pl,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>Tc,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>Jo,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>ll,AutomationRuleEvaluatorUpdate:()=>bl,AutomationRuleEvaluatorUpdateAction:()=>ml,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>dl,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>ul,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>fl,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>hl,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>gl,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>yl,AutomationRuleEvaluatorUserDefinedMetricPython:()=>vc,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>Go,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>xl,AutomationRuleEvaluatorWrite:()=>_l,AutomationRuleEvaluatorWriteAction:()=>wl,AvgValueStatPublic:()=>zl,BatchDelete:()=>X,BatchDeleteByProject:()=>nx,BiInformation:()=>kl,BiInformationResponse:()=>Jr,BooleanFeedbackDefinition:()=>Sl,BooleanFeedbackDefinitionCreate:()=>Tl,BooleanFeedbackDefinitionPublic:()=>Yo,BooleanFeedbackDefinitionUpdate:()=>El,BooleanFeedbackDetail:()=>Pl,BooleanFeedbackDetailCreate:()=>Al,BooleanFeedbackDetailPublic:()=>vl,BooleanFeedbackDetailUpdate:()=>jl,BreakdownConfigPublic:()=>_p,BreakdownConfigPublicField:()=>wp,CategoricalFeedbackDefinition:()=>Il,CategoricalFeedbackDefinitionCreate:()=>Ul,CategoricalFeedbackDefinitionPublic:()=>Xo,CategoricalFeedbackDefinitionUpdate:()=>Ml,CategoricalFeedbackDetail:()=>Cl,CategoricalFeedbackDetailCreate:()=>Dl,CategoricalFeedbackDetailPublic:()=>Fl,CategoricalFeedbackDetailUpdate:()=>Nl,ChatCompletionChoice:()=>Bl,ChatCompletionRequest:()=>Rt,ChatCompletionResponse:()=>Jl,Check:()=>$l,CheckName:()=>Gl,CheckPublic:()=>Xl,CheckPublicName:()=>Ql,CheckPublicResult:()=>Yl,CheckResult:()=>Kl,ChunkedOutputJsonNode:()=>sx,ChunkedOutputJsonNodePublic:()=>px,ChunkedOutputJsonNodePublicType:()=>Ol,ChunkedOutputJsonNodeType:()=>Zl,Column:()=>em,ColumnCompare:()=>tm,ColumnCompareTypesItem:()=>rm,ColumnPublic:()=>im,ColumnPublicTypesItem:()=>om,ColumnTypesItem:()=>ql,Comment:()=>O,CommentCompare:()=>am,CommentPublic:()=>yr,CompleteMultipartUploadRequest:()=>$a,CompleteMultipartUploadRequestEntityType:()=>nm,CompletionTokensDetails:()=>Vl,CountValueStatPublic:()=>pm,CreateDatasetItemsFromSpansRequest:()=>_t,CreateDatasetItemsFromTracesRequest:()=>zt,CreatePromptVersionDetail:()=>io,CreatePromptVersionDetailTemplateStructure:()=>Da,DashboardPagePublic:()=>cm,DashboardPublic:()=>br,DashboardUpdatePublic:()=>xt,DashboardWrite:()=>wt,DataPointDouble:()=>cx,DataPointNumberPublic:()=>lm,Dataset:()=>lx,DatasetExpansion:()=>mx,DatasetExpansionResponse:()=>fm,DatasetExpansionWrite:()=>kt,DatasetExportJobPublic:()=>Dr,DatasetExportJobPublicStatus:()=>rp,DatasetIdentifier:()=>Pt,DatasetIdentifierPublic:()=>St,DatasetItem:()=>Oo,DatasetItemBatch:()=>dx,DatasetItemBatchUpdate:()=>Tt,DatasetItemBatchWrite:()=>jt,DatasetItemChangesPublic:()=>hm,DatasetItemCompare:()=>zm,DatasetItemCompareSource:()=>gm,DatasetItemFilter:()=>At,DatasetItemFilterOperator:()=>Os,DatasetItemPageCompare:()=>km,DatasetItemPagePublic:()=>Am,DatasetItemPublic:()=>ei,DatasetItemPublicSource:()=>Pm,DatasetItemSource:()=>um,DatasetItemStreamRequest:()=>Et,DatasetItemUpdate:()=>qs,DatasetItemWrite:()=>vt,DatasetItemWriteSource:()=>ep,DatasetItemsDelete:()=>Ct,DatasetPagePublic:()=>jm,DatasetPublic:()=>Gr,DatasetPublicStatus:()=>Tm,DatasetPublicVisibility:()=>vm,DatasetStatus:()=>mm,DatasetUpdate:()=>It,DatasetUpdateVisibility:()=>fa,DatasetVersionDiff:()=>Cm,DatasetVersionDiffStats:()=>Em,DatasetVersionPagePublic:()=>Im,DatasetVersionPublic:()=>Je,DatasetVersionRestorePublic:()=>Dt,DatasetVersionRetrieveRequestPublic:()=>Ut,DatasetVersionSummary:()=>Zo,DatasetVersionSummaryPublic:()=>ri,DatasetVersionTag:()=>Ft,DatasetVersionUpdatePublic:()=>Nt,DatasetVisibility:()=>dm,DatasetWrite:()=>Mt,DatasetWriteVisibility:()=>ha,DeleteAttachmentsRequest:()=>ux,DeleteAttachmentsRequestEntityType:()=>Dm,DeleteFeedbackScore:()=>ti,DeleteIdsHolder:()=>Kr,DeleteThreadFeedbackScores:()=>go,DeleteTraceThreads:()=>yo,Delta:()=>Wl,DownloadAttachmentRequestEntityType:()=>la,ErrorCountWithDeviation:()=>oi,ErrorCountWithDeviationDetailed:()=>Um,ErrorInfo:()=>Ne,ErrorInfoExperimentItemBulkWriteView:()=>Lt,ErrorInfoPublic:()=>ii,ErrorInfoWrite:()=>mo,ErrorMessage:()=>ae,ErrorMessageDetail:()=>fx,ErrorMessageDetailed:()=>hx,ErrorMessagePublic:()=>gx,Experiment:()=>yx,ExperimentBatchUpdate:()=>Vt,ExperimentGroupAggregationsResponse:()=>Wm,ExperimentGroupResponse:()=>Hm,ExperimentItem:()=>Gt,ExperimentItemBulkRecord:()=>Qm,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>mp,ExperimentItemBulkUpload:()=>bx,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Ht,ExperimentItemCompare:()=>_m,ExperimentItemCompareTraceVisibilityMode:()=>ym,ExperimentItemPublic:()=>qo,ExperimentItemPublicTraceVisibilityMode:()=>Sm,ExperimentItemReference:()=>Gm,ExperimentItemReferencePublic:()=>Ym,ExperimentItemStreamRequest:()=>Jt,ExperimentItemTraceVisibilityMode:()=>dp,ExperimentItemsBatch:()=>Kt,ExperimentItemsDelete:()=>$t,ExperimentPagePublic:()=>qm,ExperimentPublic:()=>pi,ExperimentPublicStatus:()=>Xm,ExperimentPublicType:()=>Zm,ExperimentScore:()=>Wt,ExperimentScorePublic:()=>Om,ExperimentScoreWrite:()=>gp,ExperimentStatus:()=>Fm,ExperimentStreamRequestPublic:()=>Qt,ExperimentType:()=>Nm,ExperimentUpdate:()=>Bt,ExperimentUpdateStatus:()=>tp,ExperimentUpdateType:()=>op,ExperimentWrite:()=>Yt,ExperimentWriteStatus:()=>ba,ExperimentWriteType:()=>Ra,ExportTraceServiceRequest:()=>Rx,Feedback:()=>xx,FeedbackCreate:()=>nd,FeedbackDefinitionPagePublic:()=>ld,FeedbackObjectPublic:()=>cd,FeedbackPublic:()=>dd,FeedbackScore:()=>pe,FeedbackScoreAverage:()=>de,FeedbackScoreAverageDetailed:()=>ud,FeedbackScoreAveragePublic:()=>sr,FeedbackScoreBatch:()=>li,FeedbackScoreBatchItem:()=>hd,FeedbackScoreBatchItemSource:()=>fd,FeedbackScoreBatchItemThread:()=>Ip,FeedbackScoreBatchItemThreadSource:()=>Cp,FeedbackScoreBatchThread:()=>bo,FeedbackScoreCompare:()=>wm,FeedbackScoreCompareSource:()=>bm,FeedbackScoreExperimentItemBulkWriteView:()=>sp,FeedbackScoreExperimentItemBulkWriteViewSource:()=>ip,FeedbackScoreNames:()=>yd,FeedbackScorePublic:()=>$r,FeedbackScorePublicSource:()=>bd,FeedbackScoreSource:()=>up,FeedbackUpdate:()=>kd,FindFeedbackDefinitionsRequestType:()=>wa,FindFeedbackScoreNames1RequestType:()=>Ba,Function:()=>bt,FunctionCall:()=>De,GetSpanStatsRequestType:()=>Va,GetSpansByProjectRequestType:()=>La,GetWebhookExamplesRequestAlertType:()=>ia,GroupContent:()=>Bm,GroupContentWithAggregations:()=>Mm,GroupDetail:()=>Vm,GroupDetails:()=>Lm,Guardrail:()=>Ad,GuardrailBatch:()=>wx,GuardrailBatchWrite:()=>Xt,GuardrailName:()=>Pd,GuardrailResult:()=>Sd,GuardrailWrite:()=>Rp,GuardrailWriteName:()=>yp,GuardrailWriteResult:()=>bp,GuardrailsValidation:()=>Km,GuardrailsValidationPublic:()=>Td,IdsHolder:()=>_x,ImageUrl:()=>yc,ImageUrlPublic:()=>Ec,ImageUrlWrite:()=>Nc,JsonListString:()=>K,JsonListStringCompare:()=>Qa,JsonListStringExperimentItemBulkWriteView:()=>Ae,JsonListStringPublic:()=>be,JsonListStringWrite:()=>ye,JsonNode:()=>V,JsonNodeDetail:()=>Sp,JsonNodePublic:()=>ce,JsonNodeWrite:()=>ge,JsonSchema:()=>Js,LlmAsJudgeCode:()=>Io,LlmAsJudgeCodePublic:()=>Fc,LlmAsJudgeCodeWrite:()=>Lc,LlmAsJudgeMessage:()=>pr,LlmAsJudgeMessageContent:()=>Rc,LlmAsJudgeMessageContentPublic:()=>Ic,LlmAsJudgeMessageContentWrite:()=>Wc,LlmAsJudgeMessagePublic:()=>mr,LlmAsJudgeMessagePublicRole:()=>Dc,LlmAsJudgeMessageRole:()=>xc,LlmAsJudgeMessageWrite:()=>fr,LlmAsJudgeMessageWriteRole:()=>Bc,LlmAsJudgeModelParameters:()=>cr,LlmAsJudgeModelParametersPublic:()=>dr,LlmAsJudgeModelParametersWrite:()=>hr,LlmAsJudgeOutputSchema:()=>lr,LlmAsJudgeOutputSchemaPublic:()=>ur,LlmAsJudgeOutputSchemaPublicType:()=>Uc,LlmAsJudgeOutputSchemaType:()=>wc,LlmAsJudgeOutputSchemaWrite:()=>gr,LlmAsJudgeOutputSchemaWriteType:()=>Vc,LogItem:()=>jd,LogItemLevel:()=>vd,LogPage:()=>Ed,ManualEvaluationRequest:()=>mi,ManualEvaluationRequestEntityType:()=>Cd,ManualEvaluationResponse:()=>di,Message:()=>Hs,MultipartUploadPart:()=>sm,NumericalFeedbackDefinition:()=>rd,NumericalFeedbackDefinitionCreate:()=>id,NumericalFeedbackDefinitionPublic:()=>ci,NumericalFeedbackDefinitionUpdate:()=>_d,NumericalFeedbackDetail:()=>ed,NumericalFeedbackDetailCreate:()=>od,NumericalFeedbackDetailPublic:()=>sd,NumericalFeedbackDetailUpdate:()=>wd,OllamaConnectionTestResponse:()=>Za,OllamaInstanceBaseUrlRequest:()=>Oa,OllamaModel:()=>xp,Optimization:()=>zx,OptimizationPagePublic:()=>Yd,OptimizationPublic:()=>ui,OptimizationPublicStatus:()=>Vd,OptimizationStatus:()=>Id,OptimizationStudioConfig:()=>Bd,OptimizationStudioConfigPublic:()=>Qd,OptimizationStudioConfigWrite:()=>tu,OptimizationStudioLog:()=>ou,OptimizationUpdate:()=>qt,OptimizationUpdateStatus:()=>Aa,OptimizationWrite:()=>qa,OptimizationWriteStatus:()=>iu,PageColumns:()=>au,PercentageValueStatPublic:()=>nu,PercentageValues:()=>Me,PercentageValuesDetailed:()=>su,PercentageValuesPublic:()=>si,Project:()=>kx,ProjectDetailed:()=>lu,ProjectDetailedVisibility:()=>cu,ProjectMetricRequestPublic:()=>eo,ProjectMetricRequestPublicInterval:()=>va,ProjectMetricRequestPublicMetricType:()=>ja,ProjectMetricResponsePublic:()=>fu,ProjectMetricResponsePublicInterval:()=>mu,ProjectMetricResponsePublicMetricType:()=>du,ProjectPagePublic:()=>gu,ProjectPublic:()=>fi,ProjectPublicVisibility:()=>hu,ProjectReference:()=>jc,ProjectReferencePublic:()=>Ko,ProjectRetrieveDetailed:()=>ro,ProjectStatItemObjectPublic:()=>bu,ProjectStatsPublic:()=>Ge,ProjectStatsSummary:()=>xu,ProjectStatsSummaryItem:()=>Ru,ProjectUpdate:()=>to,ProjectUpdateVisibility:()=>Ea,ProjectVisibility:()=>pu,ProjectWrite:()=>oo,ProjectWriteVisibility:()=>Ca,Prompt:()=>Px,PromptDetail:()=>Au,PromptDetailTemplateStructure:()=>Su,PromptPagePublic:()=>ju,PromptPublic:()=>vu,PromptPublicTemplateStructure:()=>Tu,PromptTemplateStructure:()=>wu,PromptTokensDetails:()=>Ll,PromptType:()=>_u,PromptUpdatable:()=>ao,PromptVersion:()=>Pu,PromptVersionBatchUpdate:()=>no,PromptVersionDetail:()=>Ee,PromptVersionDetailTemplateStructure:()=>Ap,PromptVersionDetailType:()=>Tp,PromptVersionLink:()=>Ya,PromptVersionLinkPublic:()=>Xa,PromptVersionLinkWrite:()=>ya,PromptVersionPagePublic:()=>Du,PromptVersionPublic:()=>Iu,PromptVersionPublicTemplateStructure:()=>Eu,PromptVersionPublicType:()=>Cu,PromptVersionRetrieveDetail:()=>so,PromptVersionTemplateStructure:()=>zu,PromptVersionType:()=>ku,PromptVersionUpdate:()=>vp,PromptWrite:()=>po,PromptWriteTemplateStructure:()=>Ua,PromptWriteType:()=>Fa,ProviderApiKey:()=>Sx,ProviderApiKeyPagePublic:()=>Nu,ProviderApiKeyProvider:()=>Uu,ProviderApiKeyPublic:()=>hi,ProviderApiKeyPublicProvider:()=>Fu,ProviderApiKeyUpdate:()=>Zt,ProviderApiKeyWrite:()=>Ot,ProviderApiKeyWriteProvider:()=>ka,ResponseFormat:()=>Ks,ResponseFormatType:()=>Gs,Result:()=>Rr,ResultsNumberPublic:()=>uu,ScoreName:()=>gd,ServiceTogglesConfig:()=>Mu,Span:()=>ai,SpanBatch:()=>Ax,SpanBatchUpdate:()=>lo,SpanBatchWrite:()=>fo,SpanEnrichmentOptions:()=>Xs,SpanExperimentItemBulkWriteView:()=>cp,SpanExperimentItemBulkWriteViewType:()=>pp,SpanFilter:()=>Be,SpanFilterOperator:()=>kc,SpanFilterPublic:()=>Ue,SpanFilterPublicOperator:()=>zp,SpanFilterWrite:()=>$o,SpanFilterWriteOperator:()=>rl,SpanLlmAsJudgeCode:()=>Do,SpanLlmAsJudgeCodePublic:()=>Kc,SpanLlmAsJudgeCodeWrite:()=>tl,SpanPagePublic:()=>Bu,SpanPublic:()=>gi,SpanPublicType:()=>Wu,SpanSearchStreamRequestPublic:()=>ho,SpanSearchStreamRequestPublicType:()=>Ma,SpanType:()=>Jm,SpanUpdate:()=>co,SpanUpdateType:()=>jp,SpanUserDefinedMetricPythonCode:()=>Uo,SpanUserDefinedMetricPythonCodePublic:()=>$c,SpanUserDefinedMetricPythonCodeWrite:()=>il,SpanWrite:()=>uo,SpanWriteType:()=>Ep,SpansCountResponse:()=>Lu,StartMultipartUploadRequest:()=>yt,StartMultipartUploadRequestEntityType:()=>sa,StartMultipartUploadResponse:()=>Hu,StreamOptions:()=>$s,StudioEvaluation:()=>Ud,StudioEvaluationPublic:()=>Hd,StudioEvaluationWrite:()=>Zd,StudioLlmModel:()=>Fd,StudioLlmModelPublic:()=>Jd,StudioLlmModelWrite:()=>Od,StudioMessage:()=>Md,StudioMessagePublic:()=>Kd,StudioMessageWrite:()=>eu,StudioMetric:()=>Dd,StudioMetricPublic:()=>Ld,StudioMetricWrite:()=>Xd,StudioOptimizer:()=>Nd,StudioOptimizerPublic:()=>Gd,StudioOptimizerWrite:()=>qd,StudioPrompt:()=>Wd,StudioPromptPublic:()=>$d,StudioPromptWrite:()=>ru,TokenUsageNames:()=>Ju,Tool:()=>Ys,ToolCall:()=>Co,ToolCallType:()=>pc,ToolType:()=>Qs,Trace:()=>ni,TraceBatch:()=>Tx,TraceBatchUpdate:()=>xo,TraceBatchWrite:()=>_o,TraceCountResponse:()=>Ku,TraceEnrichmentOptions:()=>Zs,TraceExperimentItemBulkWriteView:()=>lp,TraceFilter:()=>We,TraceFilterOperator:()=>_c,TraceFilterPublic:()=>Fe,TraceFilterPublicOperator:()=>kp,TraceFilterWrite:()=>Bo,TraceFilterWriteOperator:()=>Hc,TracePagePublic:()=>Qu,TracePublic:()=>yi,TracePublicVisibilityMode:()=>$u,TraceSearchStreamRequestPublic:()=>zo,TraceThread:()=>bi,TraceThreadBatchIdentifier:()=>ko,TraceThreadBatchUpdate:()=>So,TraceThreadFilter:()=>Te,TraceThreadFilterOperator:()=>Dp,TraceThreadFilterPublic:()=>ar,TraceThreadFilterPublicOperator:()=>Pp,TraceThreadFilterWrite:()=>Qo,TraceThreadFilterWriteOperator:()=>nl,TraceThreadIdentifier:()=>en,TraceThreadLlmAsJudgeCode:()=>Fo,TraceThreadLlmAsJudgeCodePublic:()=>Qc,TraceThreadLlmAsJudgeCodeWrite:()=>sl,TraceThreadPage:()=>Xu,TraceThreadSearchStreamRequest:()=>Ao,TraceThreadStatus:()=>Yu,TraceThreadUpdate:()=>Po,TraceThreadUserDefinedMetricPythonCode:()=>No,TraceThreadUserDefinedMetricPythonCodePublic:()=>Yc,TraceThreadUserDefinedMetricPythonCodeWrite:()=>cl,TraceUpdate:()=>Ro,TraceVisibilityMode:()=>$m,TraceWrite:()=>wo,UploadAttachmentRequestEntityType:()=>ma,Usage:()=>Hl,UserDefinedMetricPythonCode:()=>Mo,UserDefinedMetricPythonCodePublic:()=>Xc,UserDefinedMetricPythonCodeWrite:()=>Rl,ValueEntry:()=>hp,ValueEntryCompare:()=>xm,ValueEntryCompareSource:()=>Rm,ValueEntryExperimentItemBulkWriteView:()=>np,ValueEntryExperimentItemBulkWriteViewSource:()=>ap,ValueEntryPublic:()=>xd,ValueEntryPublicSource:()=>Rd,ValueEntrySource:()=>fp,VideoUrl:()=>bc,VideoUrlPublic:()=>Cc,VideoUrlWrite:()=>Mc,Webhook:()=>Vp,WebhookExamples:()=>Zu,WebhookPublic:()=>$p,WebhookTestResult:()=>qu,WebhookTestResultStatus:()=>Ou,WebhookWrite:()=>ec,WelcomeWizardSubmission:()=>To,WelcomeWizardTracking:()=>ef,WorkspaceConfiguration:()=>Ri,WorkspaceMetricRequest:()=>vx,WorkspaceMetricResponse:()=>rn,WorkspaceMetricsSummaryRequest:()=>Qr,WorkspaceMetricsSummaryResponse:()=>rf,WorkspaceNameHolder:()=>tf,WorkspaceSpansCount:()=>Vu,WorkspaceTraceCount:()=>Gu,alerts:()=>aa,annotationQueues:()=>na,attachments:()=>Ir,chatCompletions:()=>da,dashboards:()=>ua,datasets:()=>Ur,experiments:()=>Fr,feedbackDefinitions:()=>_a,guardrails:()=>za,llmProviderKey:()=>Pa,ollama:()=>Nr,optimizations:()=>Ta,projects:()=>Ia,prompts:()=>Na,spans:()=>Mr,traces:()=>nr,welcomeWizard:()=>Ga});var aa={};W(aa,{GetWebhookExamplesRequestAlertType:()=>ia});var ia=r.enum_(["general","slack","pagerduty"]);var Ls=r.enum_(["trace","thread"]);var ft=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:Ls,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional())});var ht=r.object({annotationQueues:r.property("annotation_queues",r.list(ft))});var gt=r.object({name:r.string().optional(),description:r.string().optional(),instructions:r.string().optional(),commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional())});var na={};W(na,{AnnotationQueueBatchWrite:()=>ht,AnnotationQueueUpdate:()=>gt});var sa=r.enum_(["trace","span"]);var yt=r.object({fileName:r.property("file_name",r.string()),numOfFileParts:r.property("num_of_file_parts",r.number()),mimeType:r.property("mime_type",r.string().optional()),projectName:r.property("project_name",r.string().optional()),entityType:r.property("entity_type",sa),entityId:r.property("entity_id",r.string()),path:r.string()});var Ir={};W(Ir,{AttachmentListRequestEntityType:()=>ca,DownloadAttachmentRequestEntityType:()=>la,StartMultipartUploadRequest:()=>yt,StartMultipartUploadRequestEntityType:()=>sa,UploadAttachmentRequestEntityType:()=>ma,uploadAttachment:()=>pa});var pa={};W(pa,{Request:()=>XR});var XR=r.record(r.string(),r.unknown());var ca=r.enum_(["trace","span"]);var la=r.enum_(["trace","span"]);var ma=r.enum_(["trace","span"]);var bt=r.object({name:r.string().optional(),description:r.string().optional(),strict:r.boolean().optional(),parameters:r.record(r.string(),r.record(r.string(),r.unknown())).optional()});var De=r.object({name:r.string().optional(),arguments:r.string().optional()});var Hs=r.record(r.string(),r.unknown());var Js=r.object({name:r.string().optional(),strict:r.boolean().optional(),schema:r.record(r.string(),r.record(r.string(),r.unknown())).optional()});var Gs=r.enum_(["text","json_object","json_schema"]);var Ks=r.object({type:Gs.optional(),jsonSchema:r.property("json_schema",Js.optional())});var $s=r.object({includeUsage:r.property("include_usage",r.boolean().optional())});var Qs=r.enum_(["function"]);var Ys=r.object({type:Qs.optional(),function:bt.optional()});var Rt=r.object({model:r.string().optional(),messages:r.list(Hs).optional(),temperature:r.number().optional(),topP:r.property("top_p",r.number().optional()),n:r.number().optional(),stream:r.boolean().optional(),streamOptions:r.property("stream_options",$s.optional()),stop:r.list(r.string()).optional(),maxTokens:r.property("max_tokens",r.number().optional()),maxCompletionTokens:r.property("max_completion_tokens",r.number().optional()),presencePenalty:r.property("presence_penalty",r.number().optional()),frequencyPenalty:r.property("frequency_penalty",r.number().optional()),logitBias:r.property("logit_bias",r.record(r.string(),r.number()).optional()),user:r.string().optional(),responseFormat:r.property("response_format",Ks.optional()),seed:r.number().optional(),tools:r.list(Ys).optional(),toolChoice:r.property("tool_choice",r.record(r.string(),r.unknown()).optional()),parallelToolCalls:r.property("parallel_tool_calls",r.boolean().optional()),store:r.boolean().optional(),metadata:r.record(r.string(),r.string()).optional(),reasoningEffort:r.property("reasoning_effort",r.string().optional()),serviceTier:r.property("service_tier",r.string().optional()),functions:r.list(bt).optional(),functionCall:r.property("function_call",De.optional())});var da={};W(da,{ChatCompletionRequest:()=>Rt});var ce=r.record(r.string(),r.unknown());var xt=r.object({name:r.string().optional(),description:r.string().optional(),config:ce.optional()});var ge=r.record(r.string(),r.unknown());var wt=r.object({name:r.string(),description:r.string().optional(),config:ge});var ua={};W(ua,{DashboardUpdatePublic:()=>xt,DashboardWrite:()=>wt});var Xs=r.object({includeTags:r.boolean().optional(),includeFeedbackScores:r.boolean().optional(),includeComments:r.boolean().optional(),includeUsage:r.boolean().optional(),includeMetadata:r.boolean().optional()});var _t=r.object({spanIds:r.property("span_ids",r.list(r.string())),enrichmentOptions:r.property("enrichment_options",Xs)});var Zs=r.object({includeSpans:r.boolean().optional(),includeTags:r.boolean().optional(),includeFeedbackScores:r.boolean().optional(),includeComments:r.boolean().optional(),includeUsage:r.boolean().optional(),includeMetadata:r.boolean().optional()});var zt=r.object({traceIds:r.property("trace_ids",r.list(r.string())),enrichmentOptions:r.property("enrichment_options",Zs)});var kt=r.object({model:r.string(),sampleCount:r.property("sample_count",r.number().optional()),preserveFields:r.property("preserve_fields",r.list(r.string()).optional()),variationInstructions:r.property("variation_instructions",r.string().optional()),customPrompt:r.property("custom_prompt",r.string().optional())});var Pt=r.object({datasetName:r.property("dataset_name",r.string())});var St=r.object({datasetName:r.property("dataset_name",r.string())});var Os=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var At=r.object({field:r.string().optional(),operator:Os.optional(),key:r.string().optional(),value:r.string().optional()});var V=r.record(r.string(),r.unknown());var qs=r.object({input:r.string().optional(),expectedOutput:r.property("expected_output",r.string().optional()),metadata:V.optional(),data:V.optional(),tags:r.list(r.string()).optional()});var Tt=r.object({ids:r.list(r.string()).optional(),filters:r.list(At).optional(),datasetId:r.property("dataset_id",r.string().optional()),update:qs,mergeTags:r.property("merge_tags",r.boolean().optional())});var ep=r.enum_(["manual","trace","span","sdk"]);var vt=r.object({id:r.string().optional(),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:ep,data:V,tags:r.list(r.string()).optional()});var jt=r.object({datasetName:r.property("dataset_name",r.string().optional()),datasetId:r.property("dataset_id",r.string().optional()),items:r.list(vt),batchGroupId:r.property("batch_group_id",r.string().optional())});var Et=r.object({datasetName:r.property("dataset_name",r.string()),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),steamLimit:r.property("steam_limit",r.number().optional()),datasetVersion:r.property("dataset_version",r.string().optional()),filters:r.string().optional()});var Ct=r.object({itemIds:r.property("item_ids",r.list(r.string()).optional()),datasetId:r.property("dataset_id",r.string().optional()),filters:r.list(At).optional(),batchGroupId:r.property("batch_group_id",r.string().optional())});var fa=r.enum_(["private","public"]);var It=r.object({name:r.string(),description:r.string().optional(),visibility:fa.optional(),tags:r.list(r.string()).optional()});var Dt=r.object({versionRef:r.property("version_ref",r.string())});var Ut=r.object({versionName:r.property("version_name",r.string())});var Ft=r.object({tag:r.string()});var Nt=r.object({changeDescription:r.property("change_description",r.string().optional()),tagsToAdd:r.property("tags_to_add",r.list(r.string()).optional())});var ha=r.enum_(["private","public"]);var Mt=r.object({id:r.string().optional(),name:r.string(),visibility:ha.optional(),tags:r.list(r.string()).optional(),description:r.string().optional()});var Ur={};W(Ur,{CreateDatasetItemsFromSpansRequest:()=>_t,CreateDatasetItemsFromTracesRequest:()=>zt,DatasetExpansionWrite:()=>kt,DatasetIdentifier:()=>Pt,DatasetIdentifierPublic:()=>St,DatasetItemBatchUpdate:()=>Tt,DatasetItemBatchWrite:()=>jt,DatasetItemStreamRequest:()=>Et,DatasetItemsDelete:()=>Ct,DatasetUpdate:()=>It,DatasetUpdateVisibility:()=>fa,DatasetVersionRestorePublic:()=>Dt,DatasetVersionRetrieveRequestPublic:()=>Ut,DatasetVersionTag:()=>Ft,DatasetVersionUpdatePublic:()=>Nt,DatasetWrite:()=>Mt,DatasetWriteVisibility:()=>ha,getDatasetExportJobs:()=>ga});var ga={};W(ga,{Response:()=>ZR});var rp=r.enum_(["PENDING","PROCESSING","COMPLETED","FAILED"]);var Dr=r.object({id:r.string().optional(),datasetId:r.property("dataset_id",r.string().optional()),datasetName:r.property("dataset_name",r.string().optional()),status:rp.optional(),filePath:r.property("file_path",r.string().optional()),errorMessage:r.property("error_message",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),expiresAt:r.property("expires_at",r.date().optional()),viewedAt:r.property("viewed_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var ZR=r.list(Dr);var Wt=r.object({name:r.string(),value:r.number()});var tp=r.enum_(["running","completed","cancelled"]);var op=r.enum_(["regular","trial","mini-batch"]);var Bt=r.object({name:r.string().optional(),metadata:V.optional(),tags:r.list(r.string()).optional(),type:op.optional(),status:tp.optional(),experimentScores:r.property("experiment_scores",r.list(Wt).optional())});var Vt=r.object({ids:r.list(r.string()),update:Bt,mergeTags:r.property("merge_tags",r.boolean().optional())});var ip=r.enum_(["ui","sdk","online_scoring"]);var ap=r.enum_(["ui","sdk","online_scoring"]);var np=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:ap.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var sp=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:ip,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),np).optional())});var Ae=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var Lt=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var pp=r.enum_(["general","tool","llm","guardrail"]);var cp=r.object({id:r.string().optional(),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:pp.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:Ae.optional(),output:Ae.optional(),metadata:Ae.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",Lt.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional())});var lp=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:Ae.optional(),output:Ae.optional(),metadata:Ae.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Lt.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),threadId:r.property("thread_id",r.string().optional())});var mp=r.object({datasetItemId:r.property("dataset_item_id",r.string()),evaluateTaskResult:r.property("evaluate_task_result",Ae.optional()),trace:lp.optional(),spans:r.list(cp).optional(),feedbackScores:r.property("feedback_scores",r.list(sp).optional())});var Ht=r.object({experimentName:r.property("experiment_name",r.string()),datasetName:r.property("dataset_name",r.string()),experimentId:r.property("experiment_id",r.string().optional()),items:r.list(mp)});var Jt=r.object({experimentName:r.property("experiment_name",r.string()),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),truncate:r.boolean().optional()});var O=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var dp=r.enum_(["default","hidden"]);var up=r.enum_(["ui","sdk","online_scoring"]);var fp=r.enum_(["ui","sdk","online_scoring"]);var hp=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:fp.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var pe=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:up,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),hp).optional())});var K=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var Gt=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),input:K.optional(),output:K.optional(),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),comments:r.list(O).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),duration:r.number().optional(),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",dp.optional())});var Kt=r.object({experimentItems:r.property("experiment_items",r.list(Gt))});var $t=r.object({ids:r.list(r.string())});var Qt=r.object({name:r.string(),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional())});var gp=r.object({name:r.string(),value:r.number()});var ye=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var ya=r.object({id:r.string()});var ba=r.enum_(["running","completed","cancelled"]);var Ra=r.enum_(["regular","trial","mini-batch"]);var Yt=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),name:r.string().optional(),metadata:ye.optional(),tags:r.list(r.string()).optional(),type:Ra.optional(),optimizationId:r.property("optimization_id",r.string().optional()),status:ba.optional(),experimentScores:r.property("experiment_scores",r.list(gp).optional()),promptVersion:r.property("prompt_version",ya.optional()),promptVersions:r.property("prompt_versions",r.list(ya).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional())});var Fr={};W(Fr,{ExperimentBatchUpdate:()=>Vt,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Ht,ExperimentItemStreamRequest:()=>Jt,ExperimentItemsBatch:()=>Kt,ExperimentItemsDelete:()=>$t,ExperimentStreamRequestPublic:()=>Qt,ExperimentWrite:()=>Yt,ExperimentWriteStatus:()=>ba,ExperimentWriteType:()=>Ra,findFeedbackScoreNames:()=>xa});var xa={};W(xa,{Response:()=>OR});var OR=r.list(r.string());var _a={};W(_a,{FindFeedbackDefinitionsRequestType:()=>wa});var wa=r.enum_(["numerical","categorical","boolean"]);var yp=r.enum_(["TOPIC","PII"]);var bp=r.enum_(["passed","failed"]);var Rp=r.object({entityId:r.property("entity_id",r.string()),secondaryId:r.property("secondary_id",r.string()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:yp,result:bp,config:V,details:V});var Xt=r.object({guardrails:r.list(Rp)});var za={};W(za,{GuardrailBatchWrite:()=>Xt});var Zt=r.object({apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional())});var ka=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var Ot=r.object({provider:ka,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional())});var Pa={};W(Pa,{ProviderApiKeyUpdate:()=>Zt,ProviderApiKeyWrite:()=>Ot,ProviderApiKeyWriteProvider:()=>ka});var Nr={};W(Nr,{listModels:()=>Sa});var Sa={};W(Sa,{Response:()=>qR});var xp=r.object({name:r.string(),size:r.number().optional(),digest:r.string().optional(),modifiedAt:r.property("modified_at",r.date().optional())});var qR=r.list(xp);var Aa=r.enum_(["running","completed","cancelled","initialized","error"]);var qt=r.object({name:r.string().optional(),status:Aa.optional()});var Ta={};W(Ta,{OptimizationUpdate:()=>qt,OptimizationUpdateStatus:()=>Aa});var wp=r.enum_(["none","tags","metadata","name","error_info","model","provider","type"]);var _p=r.object({field:wp.optional(),metadataKey:r.property("metadata_key",r.string().optional()),subMetric:r.property("sub_metric",r.string().optional())});var zp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ue=r.object({field:r.string().optional(),operator:zp.optional(),key:r.string().optional(),value:r.string().optional()});var kp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Fe=r.object({field:r.string().optional(),operator:kp.optional(),key:r.string().optional(),value:r.string().optional()});var Pp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ar=r.object({field:r.string().optional(),operator:Pp.optional(),key:r.string().optional(),value:r.string().optional()});var va=r.enum_(["HOURLY","DAILY","WEEKLY"]);var ja=r.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES","SPAN_FEEDBACK_SCORES","SPAN_COUNT","SPAN_DURATION","SPAN_TOKEN_USAGE"]);var eo=r.object({metricType:r.property("metric_type",ja.optional()),interval:va.optional(),intervalStart:r.property("interval_start",r.date().optional()),intervalEnd:r.property("interval_end",r.date().optional()),spanFilters:r.property("span_filters",r.list(Ue).optional()),traceFilters:r.property("trace_filters",r.list(Fe).optional()),threadFilters:r.property("thread_filters",r.list(ar).optional()),breakdown:_p.optional()});var ro=r.object({name:r.string()});var Ea=r.enum_(["private","public"]);var to=r.object({name:r.string().optional(),description:r.string().optional(),visibility:Ea.optional()});var Ca=r.enum_(["private","public"]);var oo=r.object({name:r.string(),visibility:Ca.optional(),description:r.string().optional()});var Ia={};W(Ia,{ProjectMetricRequestPublic:()=>eo,ProjectMetricRequestPublicInterval:()=>va,ProjectMetricRequestPublicMetricType:()=>ja,ProjectRetrieveDetailed:()=>ro,ProjectUpdate:()=>to,ProjectUpdateVisibility:()=>Ea,ProjectWrite:()=>oo,ProjectWriteVisibility:()=>Ca});var Sp=r.record(r.string(),r.unknown());var Ap=r.enum_(["text","chat"]);var Tp=r.enum_(["mustache","jinja2"]);var Ee=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:Sp.optional(),type:Tp.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),variables:r.list(r.string()).optional(),templateStructure:r.property("template_structure",Ap.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Da=r.enum_(["text","chat"]);var io=r.object({name:r.string(),version:Ee,templateStructure:r.property("template_structure",Da.optional())});var ao=r.object({name:r.string(),description:r.string().optional(),tags:r.list(r.string()).optional()});var vp=r.object({tags:r.list(r.string()).optional()});var no=r.object({ids:r.list(r.string()),update:vp,mergeTags:r.property("merge_tags",r.boolean().optional())});var so=r.object({name:r.string(),commit:r.string().optional()});var Ua=r.enum_(["text","chat"]);var Fa=r.enum_(["mustache","jinja2"]);var po=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),template:r.string().optional(),metadata:ge.optional(),changeDescription:r.property("change_description",r.string().optional()),type:Fa.optional(),templateStructure:r.property("template_structure",Ua.optional()),tags:r.list(r.string()).optional()});var Na={};W(Na,{CreatePromptVersionDetail:()=>io,CreatePromptVersionDetailTemplateStructure:()=>Da,PromptUpdatable:()=>ao,PromptVersionBatchUpdate:()=>no,PromptVersionRetrieveDetail:()=>so,PromptWrite:()=>po,PromptWriteTemplateStructure:()=>Ua,PromptWriteType:()=>Fa});var Ne=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var jp=r.enum_(["general","tool","llm","guardrail"]);var co=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:jp.optional(),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),errorInfo:r.property("error_info",Ne.optional())});var lo=r.object({ids:r.list(r.string()),update:co,mergeTags:r.property("merge_tags",r.boolean().optional())});var mo=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var Ep=r.enum_(["general","tool","llm","guardrail"]);var uo=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Ep.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:ye.optional(),output:ye.optional(),metadata:ye.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",mo.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional())});var fo=r.object({spans:r.list(uo)});var Ma=r.enum_(["general","tool","llm","guardrail"]);var ho=r.object({traceId:r.property("trace_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),type:Ma.optional(),filters:r.list(Ue).optional(),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),truncate:r.boolean().optional(),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var Mr={};W(Mr,{FindFeedbackScoreNames1RequestType:()=>Ba,GetSpanStatsRequestType:()=>Va,GetSpansByProjectRequestType:()=>La,SpanBatchUpdate:()=>lo,SpanBatchWrite:()=>fo,SpanSearchStreamRequestPublic:()=>ho,SpanSearchStreamRequestPublicType:()=>Ma,findFeedbackScoreNames1:()=>Wa});var Wa={};W(Wa,{Response:()=>ex});var ex=r.list(r.string());var Ba=r.enum_(["general","tool","llm","guardrail"]);var Va=r.enum_(["general","tool","llm","guardrail"]);var La=r.enum_(["general","tool","llm","guardrail"]);var go=r.object({projectName:r.property("project_name",r.string()),threadId:r.property("thread_id",r.string()),names:r.list(r.string()),author:r.string().optional()});var yo=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadIds:r.property("thread_ids",r.list(r.string()))});var Cp=r.enum_(["ui","sdk","online_scoring"]);var Ip=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:Cp,author:r.string().optional(),threadId:r.property("thread_id",r.string())});var bo=r.object({scores:r.list(Ip)});var Ro=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Ne.optional()),threadId:r.property("thread_id",r.string().optional())});var xo=r.object({ids:r.list(r.string()),update:Ro,mergeTags:r.property("merge_tags",r.boolean().optional())});var wo=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:ye.optional(),output:ye.optional(),metadata:ye.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",mo.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),threadId:r.property("thread_id",r.string().optional())});var _o=r.object({traces:r.list(wo)});var zo=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),filters:r.list(Fe).optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),limit:r.number().optional(),truncate:r.boolean().optional(),stripAttachments:r.property("strip_attachments",r.boolean().optional()),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var ko=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadId:r.property("thread_id",r.string().optional()),threadIds:r.property("thread_ids",r.list(r.string()).optional())});var Po=r.object({tags:r.list(r.string()).optional()});var So=r.object({ids:r.list(r.string()),update:Po,mergeTags:r.property("merge_tags",r.boolean().optional())});var Dp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Te=r.object({field:r.string().optional(),operator:Dp.optional(),key:r.string().optional(),value:r.string().optional()});var Ao=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),filters:r.list(Te).optional(),lastRetrievedThreadModelId:r.property("last_retrieved_thread_model_id",r.string().optional()),limit:r.number().optional(),truncate:r.boolean().optional(),stripAttachments:r.property("strip_attachments",r.boolean().optional()),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var nr={};W(nr,{DeleteThreadFeedbackScores:()=>go,DeleteTraceThreads:()=>yo,FeedbackScoreBatchThread:()=>bo,TraceBatchUpdate:()=>xo,TraceBatchWrite:()=>_o,TraceSearchStreamRequestPublic:()=>zo,TraceThreadBatchIdentifier:()=>ko,TraceThreadBatchUpdate:()=>So,TraceThreadSearchStreamRequest:()=>Ao,findFeedbackScoreNames2:()=>Ha,findTraceThreadsFeedbackScoreNames:()=>Ja});var Ha={};W(Ha,{Response:()=>rx});var rx=r.list(r.string());var Ja={};W(Ja,{Response:()=>tx});var tx=r.list(r.string());var To=r.object({role:r.string().optional(),integrations:r.list(r.string()).optional(),email:r.string().optional(),joinBetaProgram:r.property("join_beta_program",r.boolean().optional())});var Ga={};W(Ga,{WelcomeWizardSubmission:()=>To});var de=r.object({name:r.string(),value:r.number()});var Me=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var Up=r.object({experimentCount:r.property("experiment_count",r.number().optional()),traceCount:r.property("trace_count",r.number().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),duration:Me.optional(),feedbackScores:r.property("feedback_scores",r.list(de).optional()),experimentScores:r.property("experiment_scores",r.list(de).optional())});var Fp=r.enum_(["general","slack","pagerduty"]);var Np=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Mp=r.object({id:r.string().optional(),alertTriggerId:r.property("alert_trigger_id",r.string().optional()),type:Np,configValue:r.property("config_value",r.record(r.string(),r.string()).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Wp=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Bp=r.object({id:r.string().optional(),alertId:r.property("alert_id",r.string().optional()),eventType:r.property("event_type",Wp),triggerConfigs:r.property("trigger_configs",r.list(Mp).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Vp=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var ox=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",Fp.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:Vp,triggers:r.list(Bp).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Lp=r.enum_(["general","slack","pagerduty"]);var Hp=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Jp=r.object({id:r.string().optional(),alertTriggerId:r.property("alert_trigger_id",r.string().optional()),type:Hp,configValue:r.property("config_value",r.record(r.string(),r.string()).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Gp=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Kp=r.object({id:r.string().optional(),alertId:r.property("alert_id",r.string().optional()),eventType:r.property("event_type",Gp),triggerConfigs:r.property("trigger_configs",r.list(Jp).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var $p=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var vo=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",Lp.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:$p,triggers:r.list(Kp).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Qp=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(vo).optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var Yp=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Xp=r.object({id:r.string().optional(),type:Yp,configValue:r.property("config_value",r.record(r.string(),r.string()).optional())});var Zp=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Op=r.object({id:r.string().optional(),eventType:r.property("event_type",Zp),triggerConfigs:r.property("trigger_configs",r.list(Xp).optional())});var qp=r.enum_(["general","slack","pagerduty"]);var ec=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional()});var jo=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",qp.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:ec,triggers:r.list(Op).optional()});var rc=r.object({username:r.string().optional(),status:r.number().optional()});var tc=r.enum_(["trace","thread"]);var oc=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string().optional()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:tc,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional()),reviewers:r.list(rc).optional(),feedbackScores:r.property("feedback_scores",r.list(de).optional()),itemsCount:r.property("items_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var ix=r.object({annotationQueues:r.property("annotation_queues",r.list(oc))});var Ka=r.object({ids:r.list(r.string())});var ic=r.enum_(["trace","thread"]);var ac=r.object({username:r.string().optional(),status:r.number().optional()});var sr=r.object({name:r.string(),value:r.number()});var Eo=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string().optional()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:ic,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional()),reviewers:r.list(ac).optional(),feedbackScores:r.property("feedback_scores",r.list(sr).optional()),itemsCount:r.property("items_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var nc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Eo).optional(),sortableBy:r.list(r.string()).optional()});var sc=r.enum_(["system","user","assistant","tool","function"]);var pc=r.enum_(["function"]);var Co=r.object({id:r.string().optional(),index:r.number().optional(),type:pc.optional(),function:De.optional()});var cc=r.object({role:sc.optional(),content:r.string().optional(),reasoningContent:r.property("reasoning_content",r.string().optional()),name:r.string().optional(),toolCalls:r.property("tool_calls",r.list(Co).optional()),refusal:r.string().optional(),functionCall:r.property("function_call",De.optional())});var lc=r.object({link:r.string().optional(),fileName:r.property("file_name",r.string()),fileSize:r.property("file_size",r.number()),mimeType:r.property("mime_type",r.string())});var mc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(lc).optional(),sortableBy:r.list(r.string()).optional()});var dc=r.object({url:r.string()});var uc=r.object({url:r.string()});var fc=r.object({url:r.string()});var hc=r.record(r.string(),r.unknown());var gc=r.enum_(["evaluator"]);var yc=r.object({url:r.string(),detail:r.string().optional()});var bc=r.object({url:r.string()});var Rc=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",yc.optional()),videoUrl:r.property("video_url",bc.optional()),audioUrl:r.property("audio_url",dc.optional())});var xc=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var pr=r.object({role:xc,content:r.string().optional(),contentArray:r.property("content_array",r.list(Rc).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var cr=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",V.optional())});var wc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var lr=r.object({name:r.string(),type:wc,description:r.string()});var Io=r.object({model:cr,messages:r.list(pr),variables:r.record(r.string(),r.string()),schema:r.list(lr)});var _c=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var We=r.object({field:r.string().optional(),operator:_c.optional(),key:r.string().optional(),value:r.string().optional()});var zc=r.object({filters:r.list(We).optional(),code:Io.optional()});var kc=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Be=r.object({field:r.string().optional(),operator:kc.optional(),key:r.string().optional(),value:r.string().optional()});var Do=r.object({model:cr,messages:r.list(pr),variables:r.record(r.string(),r.string()),schema:r.list(lr)});var Pc=r.object({filters:r.list(Be).optional(),code:Do.optional()});var Uo=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Sc=r.object({filters:r.list(Be).optional(),code:Uo.optional()});var Fo=r.object({model:cr,messages:r.list(pr),schema:r.list(lr)});var Ac=r.object({filters:r.list(Te).optional(),code:Fo.optional()});var No=r.object({metric:r.string()});var Tc=r.object({filters:r.list(Te).optional(),code:No.optional()});var Mo=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var vc=r.object({filters:r.list(We).optional(),code:Mo.optional()});var jc=r.object({projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string())});var Wr=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(jc).optional(),projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:gc}),ax=r.union("type",{llm_as_judge:zc.extend(Wr),user_defined_metric_python:vc.extend(Wr),trace_thread_llm_as_judge:Ac.extend(Wr),trace_thread_user_defined_metric_python:Tc.extend(Wr),span_llm_as_judge:Pc.extend(Wr),span_user_defined_metric_python:Sc.extend(Wr)}).transform({transform:s=>s,untransform:s=>s});var Ec=r.object({url:r.string(),detail:r.string().optional()});var Cc=r.object({url:r.string()});var Ic=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",Ec.optional()),videoUrl:r.property("video_url",Cc.optional()),audioUrl:r.property("audio_url",uc.optional())});var Dc=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var mr=r.object({role:Dc,content:r.string().optional(),contentArray:r.property("content_array",r.list(Ic).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var dr=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",ce.optional())});var Uc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var ur=r.object({name:r.string(),type:Uc,description:r.string()});var Fc=r.object({model:dr,messages:r.list(mr),variables:r.record(r.string(),r.string()),schema:r.list(ur)});var Wo=r.object({filters:r.list(Fe).optional(),code:Fc.optional()});var Nc=r.object({url:r.string(),detail:r.string().optional()});var Mc=r.object({url:r.string()});var Wc=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",Nc.optional()),videoUrl:r.property("video_url",Mc.optional()),audioUrl:r.property("audio_url",fc.optional())});var Bc=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var fr=r.object({role:Bc,content:r.string().optional(),contentArray:r.property("content_array",r.list(Wc).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var hr=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",ge.optional())});var Vc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var gr=r.object({name:r.string(),type:Vc,description:r.string()});var Lc=r.object({model:hr,messages:r.list(fr),variables:r.record(r.string(),r.string()),schema:r.list(gr)});var Hc=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Bo=r.object({field:r.string().optional(),operator:Hc.optional(),key:r.string().optional(),value:r.string().optional()});var Jc=r.object({filters:r.list(Bo).optional(),code:Lc.optional()});var Gc=r.enum_(["evaluator"]);var Kc=r.object({model:dr,messages:r.list(mr),variables:r.record(r.string(),r.string()),schema:r.list(ur)});var Vo=r.object({filters:r.list(Ue).optional(),code:Kc.optional()});var $c=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Lo=r.object({filters:r.list(Ue).optional(),code:$c.optional()});var Qc=r.object({model:dr,messages:r.list(mr),schema:r.list(ur)});var Ho=r.object({filters:r.list(ar).optional(),code:Qc.optional()});var Yc=r.object({metric:r.string()});var Jo=r.object({filters:r.list(ar).optional(),code:Yc.optional()});var Xc=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Go=r.object({filters:r.list(Fe).optional(),code:Xc.optional()});var Ko=r.object({projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string())});var Br=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(Ko).optional(),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:Gc}),Zc=r.union("type",{llm_as_judge:Wo.extend(Br),user_defined_metric_python:Go.extend(Br),trace_thread_llm_as_judge:Ho.extend(Br),trace_thread_user_defined_metric_python:Jo.extend(Br),span_llm_as_judge:Vo.extend(Br),span_user_defined_metric_python:Lo.extend(Br)}).transform({transform:s=>s,untransform:s=>s});var Oc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Zc).optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var qc=r.enum_(["evaluator"]);var Vr=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(Ko).optional(),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:qc}),el=r.union("type",{llm_as_judge:Wo.extend(Vr),user_defined_metric_python:Go.extend(Vr),trace_thread_llm_as_judge:Ho.extend(Vr),trace_thread_user_defined_metric_python:Jo.extend(Vr),span_llm_as_judge:Vo.extend(Vr),span_user_defined_metric_python:Lo.extend(Vr)}).transform({transform:s=>s,untransform:s=>s});var rl=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var $o=r.object({field:r.string().optional(),operator:rl.optional(),key:r.string().optional(),value:r.string().optional()});var tl=r.object({model:hr,messages:r.list(fr),variables:r.record(r.string(),r.string()),schema:r.list(gr)});var ol=r.object({filters:r.list($o).optional(),code:tl.optional()});var il=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var al=r.object({filters:r.list($o).optional(),code:il.optional()});var nl=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Qo=r.object({field:r.string().optional(),operator:nl.optional(),key:r.string().optional(),value:r.string().optional()});var sl=r.object({model:hr,messages:r.list(fr),schema:r.list(gr)});var pl=r.object({filters:r.list(Qo).optional(),code:sl.optional()});var cl=r.object({metric:r.string()});var ll=r.object({filters:r.list(Qo).optional(),code:cl.optional()});var ml=r.enum_(["evaluator"]);var dl=r.object({filters:r.list(We).optional(),code:Io.optional()});var ul=r.object({filters:r.list(Be).optional(),code:Do.optional()});var fl=r.object({filters:r.list(Be).optional(),code:Uo.optional()});var hl=r.object({filters:r.list(Te).optional(),code:Fo.optional()});var gl=r.object({filters:r.list(Te).optional(),code:No.optional()});var yl=r.object({filters:r.list(We).optional(),code:Mo.optional()});var Lr=r.object({name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),projectId:r.property("project_id",r.string().optional()),projectIds:r.property("project_ids",r.list(r.string()).optional()),action:ml}),bl=r.union("type",{llm_as_judge:dl.extend(Lr),user_defined_metric_python:yl.extend(Lr),trace_thread_llm_as_judge:hl.extend(Lr),trace_thread_user_defined_metric_python:gl.extend(Lr),span_llm_as_judge:ul.extend(Lr),span_user_defined_metric_python:fl.extend(Lr)}).transform({transform:s=>s,untransform:s=>s});var Rl=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var xl=r.object({filters:r.list(Bo).optional(),code:Rl.optional()});var wl=r.enum_(["evaluator"]);var Hr=r.object({projectId:r.property("project_id",r.string().optional()),projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),action:wl}),_l=r.union("type",{llm_as_judge:Jc.extend(Hr),user_defined_metric_python:xl.extend(Hr),trace_thread_llm_as_judge:pl.extend(Hr),trace_thread_user_defined_metric_python:ll.extend(Hr),span_llm_as_judge:ol.extend(Hr),span_user_defined_metric_python:al.extend(Hr)}).transform({transform:s=>s,untransform:s=>s});var zl=r.object({value:r.number().optional()});var X=r.object({ids:r.list(r.string())});var nx=r.object({ids:r.list(r.string()),projectId:r.property("project_id",r.string().optional())});var kl=r.object({workspaceId:r.property("workspace_id",r.string().optional()),user:r.string().optional(),count:r.number().optional()});var Jr=r.object({biInformation:r.property("bi_information",r.list(kl).optional())});var Pl=r.object({trueLabel:r.string(),falseLabel:r.string()});var Sl=r.object({details:Pl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Al=r.object({trueLabel:r.string(),falseLabel:r.string()});var Tl=r.object({details:Al.optional()});var vl=r.object({trueLabel:r.string(),falseLabel:r.string()});var Yo=r.object({details:vl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var jl=r.object({trueLabel:r.string(),falseLabel:r.string()});var El=r.object({details:jl.optional()});var Cl=r.object({categories:r.record(r.string(),r.number())});var Il=r.object({details:Cl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Dl=r.object({categories:r.record(r.string(),r.number())});var Ul=r.object({details:Dl.optional()});var Fl=r.object({categories:r.record(r.string(),r.number())});var Xo=r.object({details:Fl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Nl=r.object({categories:r.record(r.string(),r.number())});var Ml=r.object({details:Nl.optional()});var Wl=r.object({role:r.string().optional(),content:r.string().optional(),reasoningContent:r.property("reasoning_content",r.string().optional()),toolCalls:r.property("tool_calls",r.list(Co).optional()),functionCall:r.property("function_call",De.optional())});var Bl=r.object({index:r.number().optional(),message:cc.optional(),delta:Wl.optional(),finishReason:r.property("finish_reason",r.string().optional())});var Vl=r.object({reasoningTokens:r.property("reasoning_tokens",r.number().optional())});var Ll=r.object({cachedTokens:r.property("cached_tokens",r.number().optional())});var Hl=r.object({totalTokens:r.property("total_tokens",r.number().optional()),promptTokens:r.property("prompt_tokens",r.number().optional()),promptTokensDetails:r.property("prompt_tokens_details",Ll.optional()),completionTokens:r.property("completion_tokens",r.number().optional()),completionTokensDetails:r.property("completion_tokens_details",Vl.optional())});var Jl=r.object({id:r.string().optional(),created:r.number().optional(),model:r.string().optional(),choices:r.list(Bl).optional(),usage:Hl.optional(),systemFingerprint:r.property("system_fingerprint",r.string().optional()),serviceTier:r.property("service_tier",r.string().optional())});var Gl=r.enum_(["TOPIC","PII"]);var Kl=r.enum_(["passed","failed"]);var $l=r.object({name:Gl.optional(),result:Kl.optional()});var Ql=r.enum_(["TOPIC","PII"]);var Yl=r.enum_(["passed","failed"]);var Xl=r.object({name:Ql.optional(),result:Yl.optional()});var Zl=r.object({typeName:r.string().optional()});var sx=r.object({type:Zl.optional(),closed:r.boolean().optional()});var Ol=r.object({typeName:r.string().optional()});var px=r.object({type:Ol.optional(),closed:r.boolean().optional()});var ql=r.enum_(["string","number","object","boolean","array","null"]);var em=r.object({name:r.string().optional(),types:r.list(ql).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var rm=r.enum_(["string","number","object","boolean","array","null"]);var tm=r.object({name:r.string().optional(),types:r.list(rm).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var om=r.enum_(["string","number","object","boolean","array","null"]);var im=r.object({name:r.string().optional(),types:r.list(om).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var am=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var yr=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var nm=r.enum_(["trace","span"]);var sm=r.object({eTag:r.property("e_tag",r.string()),partNumber:r.property("part_number",r.number())});var $a=r.object({fileName:r.property("file_name",r.string()),projectName:r.property("project_name",r.string().optional()),entityType:r.property("entity_type",nm),entityId:r.property("entity_id",r.string()),containerId:r.property("container_id",r.string().optional()),fileSize:r.property("file_size",r.number()),mimeType:r.property("mime_type",r.string().optional()),uploadId:r.property("upload_id",r.string()),uploadedFileParts:r.property("uploaded_file_parts",r.list(sm))});var pm=r.object({value:r.number().optional()});var br=r.object({id:r.string().optional(),workspaceId:r.property("workspace_id",r.string().optional()),name:r.string(),slug:r.string().optional(),description:r.string().optional(),config:ce,createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional())});var cm=r.object({content:r.list(br).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var cx=r.object({time:r.date(),value:r.number().optional()});var lm=r.object({time:r.date(),value:r.number().optional()});var mm=r.enum_(["unknown","processing","completed","failed"]);var Zo=r.object({id:r.string().optional(),versionHash:r.property("version_hash",r.string().optional()),versionName:r.property("version_name",r.string().optional()),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional()});var dm=r.enum_(["private","public"]);var lx=r.object({id:r.string().optional(),name:r.string(),visibility:dm.optional(),tags:r.list(r.string()).optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),experimentCount:r.property("experiment_count",r.number().optional()),datasetItemsCount:r.property("dataset_items_count",r.number().optional()),optimizationCount:r.property("optimization_count",r.number().optional()),mostRecentExperimentAt:r.property("most_recent_experiment_at",r.date().optional()),lastCreatedExperimentAt:r.property("last_created_experiment_at",r.date().optional()),mostRecentOptimizationAt:r.property("most_recent_optimization_at",r.date().optional()),lastCreatedOptimizationAt:r.property("last_created_optimization_at",r.date().optional()),status:mm.optional(),latestVersion:r.property("latest_version",Zo.optional())});var mx=r.object({model:r.string(),sampleCount:r.property("sample_count",r.number().optional()),preserveFields:r.property("preserve_fields",r.list(r.string()).optional()),variationInstructions:r.property("variation_instructions",r.string().optional()),customPrompt:r.property("custom_prompt",r.string().optional())});var um=r.enum_(["manual","trace","span","sdk"]);var Oo=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:um,data:V,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(Gt).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var fm=r.object({generatedSamples:r.property("generated_samples",r.list(Oo).optional()),model:r.string().optional(),totalGenerated:r.property("total_generated",r.number().optional()),generationTime:r.property("generation_time",r.date().optional())});var dx=r.object({datasetName:r.property("dataset_name",r.string().optional()),datasetId:r.property("dataset_id",r.string().optional()),items:r.list(Oo),batchGroupId:r.property("batch_group_id",r.string().optional())});var hm=r.record(r.string(),r.unknown());var gm=r.enum_(["manual","trace","span","sdk"]);var ym=r.enum_(["default","hidden"]);var bm=r.enum_(["ui","sdk","online_scoring"]);var Rm=r.enum_(["ui","sdk","online_scoring"]);var xm=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:Rm.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var wm=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:bm,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),xm).optional())});var Qa=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var _m=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),input:Qa.optional(),output:Qa.optional(),feedbackScores:r.property("feedback_scores",r.list(wm).optional()),comments:r.list(am).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),duration:r.number().optional(),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",ym.optional())});var zm=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:gm,data:V,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(_m).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var km=r.object({content:r.list(zm).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),columns:r.list(tm).optional(),sortableBy:r.list(r.string()).optional()});var Pm=r.enum_(["manual","trace","span","sdk"]);var Sm=r.enum_(["default","hidden"]);var qo=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",Sm.optional())});var ei=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:Pm,data:V,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(qo).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Am=r.object({content:r.list(ei).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),columns:r.list(im).optional(),sortableBy:r.list(r.string()).optional()});var Tm=r.enum_(["unknown","processing","completed","failed"]);var vm=r.enum_(["private","public"]);var ri=r.object({id:r.string().optional(),versionHash:r.property("version_hash",r.string().optional()),versionName:r.property("version_name",r.string().optional()),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional()});var Gr=r.object({id:r.string().optional(),name:r.string(),visibility:vm.optional(),tags:r.list(r.string()).optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),experimentCount:r.property("experiment_count",r.number().optional()),datasetItemsCount:r.property("dataset_items_count",r.number().optional()),optimizationCount:r.property("optimization_count",r.number().optional()),mostRecentExperimentAt:r.property("most_recent_experiment_at",r.date().optional()),lastCreatedExperimentAt:r.property("last_created_experiment_at",r.date().optional()),mostRecentOptimizationAt:r.property("most_recent_optimization_at",r.date().optional()),lastCreatedOptimizationAt:r.property("last_created_optimization_at",r.date().optional()),status:Tm.optional(),latestVersion:r.property("latest_version",ri.optional())});var jm=r.object({content:r.list(Gr).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),sortableBy:r.list(r.string()).optional()});var Em=r.object({itemsAdded:r.number().optional(),itemsModified:r.number().optional(),itemsDeleted:r.number().optional(),itemsUnchanged:r.number().optional()});var Cm=r.object({fromVersion:r.property("from_version",r.string().optional()),toVersion:r.property("to_version",r.string().optional()),statistics:Em.optional()});var Je=r.object({id:r.string().optional(),datasetId:r.property("dataset_id",r.string().optional()),versionHash:r.property("version_hash",r.string().optional()),tags:r.list(r.string()).optional(),isLatest:r.property("is_latest",r.boolean().optional()),versionName:r.property("version_name",r.string().optional()),itemsTotal:r.property("items_total",r.number().optional()),itemsAdded:r.property("items_added",r.number().optional()),itemsModified:r.property("items_modified",r.number().optional()),itemsDeleted:r.property("items_deleted",r.number().optional()),changeDescription:r.property("change_description",r.string().optional()),metadata:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Im=r.object({content:r.list(Je).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional()});var Dm=r.enum_(["trace","span"]);var ux=r.object({fileNames:r.property("file_names",r.list(r.string())),entityType:r.property("entity_type",Dm),entityId:r.property("entity_id",r.string()),containerId:r.property("container_id",r.string())});var ti=r.object({name:r.string(),author:r.string().optional()});var Kr=r.object({ids:r.list(r.string())});var oi=r.object({count:r.number().optional(),deviation:r.number().optional(),deviationPercentage:r.property("deviation_percentage",r.number().optional())});var Um=r.object({count:r.number().optional(),deviation:r.number().optional(),deviationPercentage:r.property("deviation_percentage",r.number().optional())});var ii=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var ae=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var fx=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var hx=r.object({errors:r.list(r.string()).optional()});var gx=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var Fm=r.enum_(["running","completed","cancelled"]);var Nm=r.enum_(["regular","trial","mini-batch"]);var Ya=r.object({id:r.string(),commit:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),promptName:r.property("prompt_name",r.string().optional())});var yx=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),datasetId:r.property("dataset_id",r.string().optional()),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),type:Nm.optional(),optimizationId:r.property("optimization_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),comments:r.list(O).optional(),traceCount:r.property("trace_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),duration:Me.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),status:Fm.optional(),experimentScores:r.property("experiment_scores",r.list(Wt).optional()),promptVersion:r.property("prompt_version",Ya.optional()),promptVersions:r.property("prompt_versions",r.list(Ya).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional()),datasetVersionSummary:r.property("dataset_version_summary",Zo.optional())});var Mm=r.object({label:r.string().optional(),aggregations:Up.optional()});var Wm=r.object({content:r.record(r.string(),Mm).optional()});var Bm=r.object({label:r.string().optional()});var Vm=r.object({groupSorting:r.property("group_sorting",r.list(r.string()).optional())});var Lm=r.object({groupsDetails:r.property("groups_details",r.list(Vm).optional())});var Hm=r.object({content:r.record(r.string(),Bm).optional(),details:Lm.optional()});var Jm=r.enum_(["general","tool","llm","guardrail"]);var ai=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Jm.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",Ne.optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),comments:r.list(O).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional()),duration:r.number().optional()});var Gm=r.object({id:r.string(),name:r.string(),datasetId:r.property("dataset_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string())});var Km=r.object({spanId:r.property("span_id",r.string().optional()),checks:r.list($l).optional()});var $m=r.enum_(["default","hidden"]);var ni=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Ne.optional()),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),spanFeedbackScores:r.property("span_feedback_scores",r.list(pe).optional()),comments:r.list(O).optional(),guardrailsValidations:r.property("guardrails_validations",r.list(Km).optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),spanCount:r.property("span_count",r.number().optional()),duration:r.number().optional(),threadId:r.property("thread_id",r.string().optional()),visibilityMode:r.property("visibility_mode",$m.optional()),llmSpanCount:r.property("llm_span_count",r.number().optional()),hasToolSpans:r.property("has_tool_spans",r.boolean().optional()),providers:r.list(r.string()).optional(),experiment:Gm.optional()});var Qm=r.object({datasetItemId:r.property("dataset_item_id",r.string()),evaluateTaskResult:r.property("evaluate_task_result",K.optional()),trace:ni.optional(),spans:r.list(ai).optional(),feedbackScores:r.property("feedback_scores",r.list(pe).optional())});var bx=r.object({experimentName:r.property("experiment_name",r.string()),datasetName:r.property("dataset_name",r.string()),experimentId:r.property("experiment_id",r.string().optional()),items:r.list(Qm)});var Ym=r.object({id:r.string(),name:r.string(),datasetId:r.property("dataset_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string())});var Xm=r.enum_(["running","completed","cancelled"]);var Zm=r.enum_(["regular","trial","mini-batch"]);var Om=r.object({name:r.string(),value:r.number()});var be=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var si=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var Xa=r.object({id:r.string(),commit:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),promptName:r.property("prompt_name",r.string().optional())});var pi=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),datasetId:r.property("dataset_id",r.string().optional()),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),metadata:be.optional(),tags:r.list(r.string()).optional(),type:Zm.optional(),optimizationId:r.property("optimization_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(sr).optional()),comments:r.list(yr).optional(),traceCount:r.property("trace_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),duration:si.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),status:Xm.optional(),experimentScores:r.property("experiment_scores",r.list(Om).optional()),promptVersion:r.property("prompt_version",Xa.optional()),promptVersions:r.property("prompt_versions",r.list(Xa).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional()),datasetVersionSummary:r.property("dataset_version_summary",ri.optional())});var qm=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(pi).optional(),sortableBy:r.list(r.string()).optional()});var Rx=V;var ed=r.object({max:r.number(),min:r.number()});var rd=r.object({details:ed.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var td=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),xx=r.union("type",{numerical:rd.extend(td),categorical:Il.extend(td),boolean:Sl.extend(td)}).transform({transform:s=>s,untransform:s=>s});var od=r.object({max:r.number(),min:r.number()});var id=r.object({details:od.optional()});var ad=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional()}),nd=r.union("type",{numerical:id.extend(ad),categorical:Ul.extend(ad),boolean:Tl.extend(ad)}).transform({transform:s=>s,untransform:s=>s});var sd=r.object({max:r.number(),min:r.number()});var ci=r.object({details:sd.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var pd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),cd=r.union("type",{numerical:ci.extend(pd),categorical:Xo.extend(pd),boolean:Yo.extend(pd)}).transform({transform:s=>s,untransform:s=>s});var ld=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(cd).optional()});var md=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),dd=r.union("type",{numerical:ci.extend(md),categorical:Xo.extend(md),boolean:Yo.extend(md)}).transform({transform:s=>s,untransform:s=>s});var ud=r.object({name:r.string(),value:r.number()});var fd=r.enum_(["ui","sdk","online_scoring"]);var hd=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:fd,author:r.string().optional(),id:r.string()});var li=r.object({scores:r.list(hd)});var gd=r.object({name:r.string().optional(),type:r.string().optional()});var yd=r.object({scores:r.list(gd).optional()});var bd=r.enum_(["ui","sdk","online_scoring"]);var Rd=r.enum_(["ui","sdk","online_scoring"]);var xd=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:Rd.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var $r=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:bd,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),xd).optional())});var wd=r.object({max:r.number(),min:r.number()});var _d=r.object({details:wd.optional()});var zd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional()}),kd=r.union("type",{numerical:_d.extend(zd),categorical:Ml.extend(zd),boolean:El.extend(zd)}).transform({transform:s=>s,untransform:s=>s});var Pd=r.enum_(["TOPIC","PII"]);var Sd=r.enum_(["passed","failed"]);var Ad=r.object({id:r.string().optional(),entityId:r.property("entity_id",r.string()),secondaryId:r.property("secondary_id",r.string()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:Pd,result:Sd,config:V,details:V});var wx=r.object({guardrails:r.list(Ad)});var Td=r.object({spanId:r.property("span_id",r.string().optional()),checks:r.list(Xl).optional()});var _x=r.object({ids:r.list(r.string())});var vd=r.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var jd=r.object({timestamp:r.date().optional(),ruleId:r.property("rule_id",r.string().optional()),level:vd.optional(),message:r.string().optional(),markers:r.record(r.string(),r.string()).optional()});var Ed=r.object({content:r.list(jd).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional()});var Cd=r.enum_(["trace","thread","span"]);var mi=r.object({projectId:r.property("project_id",r.string()),entityIds:r.property("entity_ids",r.list(r.string())),ruleIds:r.property("rule_ids",r.list(r.string())),entityType:r.property("entity_type",Cd)});var di=r.object({entitiesQueued:r.property("entities_queued",r.number().optional()),rulesApplied:r.property("rules_applied",r.number().optional())});var Za=r.object({connected:r.boolean().optional(),version:r.string().optional(),errorMessage:r.property("error_message",r.string().optional())});var Oa=r.object({baseUrl:r.property("base_url",r.string()),apiKey:r.property("api_key",r.string().optional())});var Id=r.enum_(["running","completed","cancelled","initialized","error"]);var Dd=r.object({type:r.string(),parameters:V.optional()});var Ud=r.object({metrics:r.list(Dd)});var Fd=r.object({model:r.string(),parameters:V.optional()});var Nd=r.object({type:r.string(),parameters:V.optional()});var Md=r.object({role:r.string(),content:r.string()});var Wd=r.object({messages:r.list(Md)});var Bd=r.object({datasetName:r.property("dataset_name",r.string()),prompt:Wd,llmModel:r.property("llm_model",Fd),evaluation:Ud,optimizer:Nd});var zx=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:Id,metadata:K.optional(),studioConfig:r.property("studio_config",Bd.optional()),datasetId:r.property("dataset_id",r.string().optional()),numTrials:r.property("num_trials",r.number().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Vd=r.enum_(["running","completed","cancelled","initialized","error"]);var Ld=r.object({type:r.string(),parameters:ce.optional()});var Hd=r.object({metrics:r.list(Ld)});var Jd=r.object({model:r.string(),parameters:ce.optional()});var Gd=r.object({type:r.string(),parameters:ce.optional()});var Kd=r.object({role:r.string(),content:r.string()});var $d=r.object({messages:r.list(Kd)});var Qd=r.object({datasetName:r.property("dataset_name",r.string()),prompt:$d,llmModel:r.property("llm_model",Jd),evaluation:Hd,optimizer:Gd});var ui=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:Vd,metadata:be.optional(),studioConfig:r.property("studio_config",Qd.optional()),datasetId:r.property("dataset_id",r.string().optional()),numTrials:r.property("num_trials",r.number().optional()),feedbackScores:r.property("feedback_scores",r.list(sr).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Yd=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(ui).optional(),sortableBy:r.list(r.string()).optional()});var Xd=r.object({type:r.string(),parameters:ge.optional()});var Zd=r.object({metrics:r.list(Xd)});var Od=r.object({model:r.string(),parameters:ge.optional()});var qd=r.object({type:r.string(),parameters:ge.optional()});var eu=r.object({role:r.string(),content:r.string()});var ru=r.object({messages:r.list(eu)});var tu=r.object({datasetName:r.property("dataset_name",r.string()),prompt:ru,llmModel:r.property("llm_model",Od),evaluation:Zd,optimizer:qd});var ou=r.object({url:r.string().optional(),lastModified:r.property("last_modified",r.date().optional()),expiresAt:r.property("expires_at",r.date().optional())});var iu=r.enum_(["running","completed","cancelled","initialized","error"]);var qa=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:iu,metadata:ye.optional(),studioConfig:r.property("studio_config",tu.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional())});var au=r.object({columns:r.list(em).optional()});var nu=r.object({value:si.optional()});var su=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var pu=r.enum_(["private","public"]);var kx=r.object({id:r.string().optional(),name:r.string(),visibility:pu.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),duration:Me.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",oi.optional())});var cu=r.enum_(["private","public"]);var lu=r.object({id:r.string().optional(),name:r.string(),visibility:cu.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional()),feedbackScores:r.property("feedback_scores",r.list(ud).optional()),duration:su.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",Um.optional())});var mu=r.enum_(["HOURLY","DAILY","WEEKLY"]);var du=r.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES","SPAN_FEEDBACK_SCORES","SPAN_COUNT","SPAN_DURATION","SPAN_TOKEN_USAGE"]);var uu=r.object({name:r.string().optional(),data:r.list(lm).optional()});var fu=r.object({projectId:r.property("project_id",r.string().optional()),metricType:r.property("metric_type",du.optional()),interval:mu.optional(),results:r.list(uu).optional()});var hu=r.enum_(["private","public"]);var fi=r.object({id:r.string().optional(),name:r.string(),visibility:hu.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional())});var gu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(fi).optional(),sortableBy:r.list(r.string()).optional()});var yu=r.object({name:r.string().optional()}),bu=r.union("type",{PERCENTAGE:nu.extend(yu),COUNT:pm.extend(yu),AVG:zl.extend(yu)}).transform({transform:s=>s,untransform:s=>s});var Ge=r.object({stats:r.list(bu).optional()});var Ru=r.object({projectId:r.property("project_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),duration:Me.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",oi.optional())});var xu=r.object({content:r.list(Ru).optional()});var wu=r.enum_(["text","chat"]);var _u=r.enum_(["mustache","jinja2"]);var zu=r.enum_(["text","chat"]);var ku=r.enum_(["mustache","jinja2"]);var Pu=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:V.optional(),type:ku.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),variables:r.list(r.string()).optional(),templateStructure:r.property("template_structure",zu.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Px=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),template:r.string().optional(),metadata:V.optional(),changeDescription:r.property("change_description",r.string().optional()),type:_u.optional(),templateStructure:r.property("template_structure",wu.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional()),latestVersion:r.property("latest_version",Pu.optional())});var Su=r.enum_(["text","chat"]);var Au=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),templateStructure:r.property("template_structure",Su.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional()),latestVersion:r.property("latest_version",Ee.optional())});var Tu=r.enum_(["text","chat"]);var vu=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),templateStructure:r.property("template_structure",Tu.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional())});var ju=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(vu).optional(),sortableBy:r.list(r.string()).optional()});var Eu=r.enum_(["text","chat"]);var Cu=r.enum_(["mustache","jinja2"]);var Iu=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:ce.optional(),type:Cu.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),templateStructure:r.property("template_structure",Eu.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Du=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Iu).optional(),sortableBy:r.list(r.string()).optional()});var Uu=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var Sx=r.object({id:r.string().optional(),provider:Uu,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),readOnly:r.property("read_only",r.boolean().optional())});var Fu=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var hi=r.object({id:r.string().optional(),provider:Fu,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),readOnly:r.property("read_only",r.boolean().optional())});var Nu=r.object({size:r.number().optional(),total:r.number().optional(),content:r.list(hi).optional(),sortableBy:r.list(r.string()).optional()});var Rr=r.object({name:r.string().optional(),current:r.number().optional(),previous:r.number().optional()});var Mu=r.object({pythonEvaluatorEnabled:r.boolean(),traceThreadPythonEvaluatorEnabled:r.boolean(),spanLlmAsJudgeEnabled:r.boolean(),spanUserDefinedMetricPythonEnabled:r.boolean(),guardrailsEnabled:r.boolean(),opikAiEnabled:r.property("opikAIEnabled",r.boolean()),alertsEnabled:r.boolean(),welcomeWizardEnabled:r.boolean(),csvUploadEnabled:r.boolean(),exportEnabled:r.boolean(),optimizationStudioEnabled:r.boolean(),datasetVersioningEnabled:r.boolean(),datasetExportEnabled:r.boolean(),openaiProviderEnabled:r.boolean(),anthropicProviderEnabled:r.boolean(),geminiProviderEnabled:r.boolean(),openrouterProviderEnabled:r.boolean(),vertexaiProviderEnabled:r.boolean(),bedrockProviderEnabled:r.boolean(),customllmProviderEnabled:r.boolean(),ollamaProviderEnabled:r.boolean(),collaboratorsTabEnabled:r.boolean()});var Ax=r.object({spans:r.list(ai)});var Wu=r.enum_(["general","tool","llm","guardrail"]);var gi=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Wu.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:be.optional(),output:be.optional(),metadata:be.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",ii.optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list($r).optional()),comments:r.list(yr).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional()),duration:r.number().optional()});var Bu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(gi).optional(),sortableBy:r.list(r.string()).optional()});var Vu=r.object({workspace:r.string().optional(),spanCount:r.property("span_count",r.number().optional())});var Lu=r.object({workspacesSpansCount:r.property("workspaces_spans_count",r.list(Vu).optional())});var Hu=r.object({uploadId:r.property("upload_id",r.string()),preSignUrls:r.property("pre_sign_urls",r.list(r.string()))});var Ju=r.object({names:r.list(r.string()).optional()});var Tx=r.object({traces:r.list(ni)});var Gu=r.object({workspace:r.string().optional(),traceCount:r.property("trace_count",r.number().optional())});var Ku=r.object({workspacesTracesCount:r.property("workspaces_traces_count",r.list(Gu).optional())});var $u=r.enum_(["default","hidden"]);var yi=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:be.optional(),output:be.optional(),metadata:be.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",ii.optional()),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list($r).optional()),spanFeedbackScores:r.property("span_feedback_scores",r.list($r).optional()),comments:r.list(yr).optional(),guardrailsValidations:r.property("guardrails_validations",r.list(Td).optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),spanCount:r.property("span_count",r.number().optional()),duration:r.number().optional(),threadId:r.property("thread_id",r.string().optional()),visibilityMode:r.property("visibility_mode",$u.optional()),llmSpanCount:r.property("llm_span_count",r.number().optional()),hasToolSpans:r.property("has_tool_spans",r.boolean().optional()),providers:r.list(r.string()).optional(),experiment:Ym.optional()});var Qu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(yi).optional(),sortableBy:r.list(r.string()).optional()});var Yu=r.enum_(["active","inactive"]);var bi=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),threadModelId:r.property("thread_model_id",r.string().optional()),startTime:r.property("start_time",r.date().optional()),endTime:r.property("end_time",r.date().optional()),duration:r.number().optional(),firstMessage:r.property("first_message",K.optional()),lastMessage:r.property("last_message",K.optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),status:Yu.optional(),numberOfMessages:r.property("number_of_messages",r.number().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),comments:r.list(O).optional(),tags:r.list(r.string()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),createdBy:r.property("created_by",r.string().optional()),createdAt:r.property("created_at",r.date().optional())});var en=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadId:r.property("thread_id",r.string()),truncate:r.boolean().optional()});var Xu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(bi).optional(),sortableBy:r.list(r.string()).optional()});var Zu=r.object({responseExamples:r.property("response_examples",r.record(r.string(),r.record(r.string(),r.unknown())).optional())});var Ou=r.enum_(["success","failure"]);var qu=r.object({status:Ou.optional(),statusCode:r.property("status_code",r.number().optional()),requestBody:r.property("request_body",r.string().optional()),errorMessage:r.property("error_message",r.string().optional())});var ef=r.object({completed:r.boolean().optional()});var Ri=r.object({timeoutToMarkThreadAsInactive:r.property("timeout_to_mark_thread_as_inactive",r.string().optional()),truncationOnTables:r.property("truncation_on_tables",r.boolean().optional())});var vx=r.object({projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string().optional(),intervalStart:r.property("interval_start",r.date()),intervalEnd:r.property("interval_end",r.date()),startBeforeEnd:r.property("start_before_end",r.boolean().optional())});var rn=r.object({results:r.list(Rr).optional()});var Qr=r.object({projectIds:r.property("project_ids",r.list(r.string()).optional()),intervalStart:r.property("interval_start",r.date()),intervalEnd:r.property("interval_end",r.date()),startBeforeEnd:r.property("start_before_end",r.boolean().optional())});var rf=r.object({results:r.list(Rr).optional()});var tf=r.object({workspaceName:r.property("workspace_name",r.string().optional())});var tn=class{constructor(o={}){this._options=F(o);}findAlerts(o={},e){return _.fromPromise(this.__findAlerts(o,e))}async __findAlerts(o={},e){var d,m,u,f,h,g,R,T,v,E,C;let{page:t,size:i,sorting:a,filters:n}=o,p={page:t,size:i,sorting:a,filters:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/alerts"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:Qp.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/alerts")}createAlert(o,e){return _.fromPromise(this.__createAlert(o,e))}async __createAlert(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:jo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/alerts")}deleteAlertBatch(o,e){return _.fromPromise(this.__deleteAlertBatch(o,e))}async __deleteAlertBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/alerts/delete")}getAlertById(o,e={},t){return _.fromPromise(this.__getAlertById(o,e,t))}async __getAlertById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/alerts/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:vo.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/alerts/{id}")}updateAlert(o,e,t){return _.fromPromise(this.__updateAlert(o,e,t))}async __updateAlert(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/alerts/${x.encodePathParam(o)}`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:jo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 409:throw new $(n.error.body,n.rawResponse);case 422:throw new Q(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"PUT","/v1/private/alerts/{id}")}getWebhookExamples(o={},e){return _.fromPromise(this.__getWebhookExamples(o,e))}async __getWebhookExamples(o={},e){var p,l,c,d,m,u,f,h,g,R,T;let{alertType:t}=o,i={alert_type:t!=null?ia.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/alerts/webhooks/examples"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:Zu.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/alerts/webhooks/examples")}testWebhook(o,e){return _.fromPromise(this.__testWebhook(o,e))}async __testWebhook(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts/webhooks/tests"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:jo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:qu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===422?new Q(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/alerts/webhooks/tests")}};var on=class{constructor(o={}){this._options=F(o);}addItemsToAnnotationQueue(o,e,t){return _.fromPromise(this.__addItemsToAnnotationQueue(o,e,t))}async __addItemsToAnnotationQueue(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/annotation-queues/${x.encodePathParam(o)}/items/add`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ka.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/annotation-queues/{id}/items/add")}findAnnotationQueues(o={},e){return _.fromPromise(this.__findAnnotationQueues(o,e))}async __findAnnotationQueues(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{page:t,size:i,name:a,filters:n,sorting:p}=o,l={page:t,size:i,name:a,filters:n,sorting:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/annotation-queues"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:nc.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/annotation-queues")}createAnnotationQueue(o,e){return _.fromPromise(this.__createAnnotationQueue(o,e))}async __createAnnotationQueue(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ft.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues")}createAnnotationQueueBatch(o,e){return _.fromPromise(this.__createAnnotationQueueBatch(o,e))}async __createAnnotationQueueBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ht.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues/batch")}deleteAnnotationQueueBatch(o,e){return _.fromPromise(this.__deleteAnnotationQueueBatch(o,e))}async __deleteAnnotationQueueBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues/delete")}getAnnotationQueueById(o,e={},t){return _.fromPromise(this.__getAnnotationQueueById(o,e,t))}async __getAnnotationQueueById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/annotation-queues/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Eo.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/annotation-queues/{id}")}updateAnnotationQueue(o,e={},t){return _.fromPromise(this.__updateAnnotationQueue(o,e,t))}async __updateAnnotationQueue(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/annotation-queues/${x.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:gt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===400?new D(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PATCH","/v1/private/annotation-queues/{id}")}removeItemsFromAnnotationQueue(o,e,t){return _.fromPromise(this.__removeItemsFromAnnotationQueue(o,e,t))}async __removeItemsFromAnnotationQueue(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/annotation-queues/${x.encodePathParam(o)}/items/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ka.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/annotation-queues/{id}/items/delete")}};var an=class{constructor(o={}){this._options=F(o);}attachmentList(o,e){return _.fromPromise(this.__attachmentList(o,e))}async __attachmentList(o,e){var u,f,h,g,R,T,v,E,C,U,M;let{page:t,size:i,projectId:a,entityType:n,entityId:p,path:l}=o,c={page:t,size:i,project_id:a,entity_type:ca.jsonOrThrow(n,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:p,path:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,"v1/private/attachment/list"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(v=e==null?void 0:e.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:mc.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ae.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"GET","/v1/private/attachment/list")}completeMultiPartUpload(o,e){return _.fromPromise(this.__completeMultiPartUpload(o,e))}async __completeMultiPartUpload(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:$a.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/upload-complete")}deleteAttachments(o,e){return _.fromPromise(this.__deleteAttachments(o,e))}async __deleteAttachments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:$a.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/delete")}downloadAttachment(o,e){return _.fromPromise(this.__downloadAttachment(o,e))}async __downloadAttachment(o,e){var u,f,h,g,R,T,v,E,C,U,M;let{workspaceName:t,containerId:i,entityType:a,entityId:n,fileName:p,mimeType:l}=o,c={workspace_name:t,container_id:i,entity_type:la.jsonOrThrow(a,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:n,file_name:p,mime_type:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,"v1/private/attachment/download"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},responseType:"streaming",timeoutMs:((E=(v=e==null?void 0:e.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:m.body,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ae.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"GET","/v1/private/attachment/download")}startMultiPartUpload(o,e){return _.fromPromise(this.__startMultiPartUpload(o,e))}async __startMultiPartUpload(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/upload-start"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Hu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/upload-start")}uploadAttachment(o,e){return _.fromPromise(this.__uploadAttachment(o,e))}async __uploadAttachment(o,e){var u,f,h,g,R,T,v,E,C,U,M;let{fileName:t,projectName:i,mimeType:a,entityType:n,entityId:p,body:l}=o,c={file_name:t,project_name:i,mime_type:a,entity_type:ma.jsonOrThrow(n,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:p},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,"v1/private/attachment/upload"),method:"PUT",headers:d,contentType:"application/json",queryParameters:{...c,...e==null?void 0:e.queryParams},requestType:"json",body:Ir.uploadAttachment.Request.jsonOrThrow(l,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((E=(v=e==null?void 0:e.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:void 0,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ae.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"PUT","/v1/private/attachment/upload")}};var nn=class{constructor(o={}){this._options=F(o);}findEvaluators(o={},e){return _.fromPromise(this.__findEvaluators(o,e))}async __findEvaluators(o={},e){var f,h,g,R,T,v,E,C,U,M,Z;let{projectId:t,id:i,name:a,filters:n,sorting:p,page:l,size:c}=o,d={project_id:t,id:i,name:a,filters:n,sorting:p,page:l,size:c},m=z((f=this._options)==null?void 0:f.headers,S({"Comet-Workspace":(g=e==null?void 0:e.workspaceName)!=null?g:(h=this._options)==null?void 0:h.workspaceName}),e==null?void 0:e.headers),u=await k({url:x.join((T=(R=await b.get(this._options.baseUrl))!=null?R:await b.get(this._options.environment))!=null?T:P.Default,"v1/private/automations/evaluators"),method:"GET",headers:m,queryParameters:{...d,...e==null?void 0:e.queryParams},timeoutMs:((C=(E=e==null?void 0:e.timeoutInSeconds)!=null?E:(v=this._options)==null?void 0:v.timeoutInSeconds)!=null?C:60)*1e3,maxRetries:(M=e==null?void 0:e.maxRetries)!=null?M:(U=this._options)==null?void 0:U.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(Z=this._options)==null?void 0:Z.fetch,logging:this._options.logging});if(u.ok)return {data:Oc.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new w({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});return A(u.error,u.rawResponse,"GET","/v1/private/automations/evaluators")}createAutomationRuleEvaluator(o,e){return _.fromPromise(this.__createAutomationRuleEvaluator(o,e))}async __createAutomationRuleEvaluator(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/automations/evaluators"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:_l.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/automations/evaluators")}deleteAutomationRuleEvaluatorBatch(o,e){return _.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(o,e))}async __deleteAutomationRuleEvaluatorBatch(o,e){var l,c,d,m,u,f,h,g,R,T,v;let{projectId:t,body:i}=o,a={project_id:t},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=e==null?void 0:e.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),e==null?void 0:e.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:n,contentType:"application/json",queryParameters:{...a,...e==null?void 0:e.queryParams},requestType:"json",body:X.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((g=(h=e==null?void 0:e.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=e==null?void 0:e.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:void 0,rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"POST","/v1/private/automations/evaluators/delete")}getEvaluatorById(o,e={},t){return _.fromPromise(this.__getEvaluatorById(o,e,t))}async __getEvaluatorById(o,e={},t){var l,c,d,m,u,f,h,g,R,T,v;let{projectId:i}=e,a={project_id:i},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/automations/evaluators/${x.encodePathParam(o)}`),method:"GET",headers:n,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:el.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/automations/evaluators/{id}")}updateAutomationRuleEvaluator(o,e,t){return _.fromPromise(this.__updateAutomationRuleEvaluator(o,e,t))}async __updateAutomationRuleEvaluator(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/automations/evaluators/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:bl.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/automations/evaluators/{id}")}getEvaluatorLogsById(o,e={},t){return _.fromPromise(this.__getEvaluatorLogsById(o,e,t))}async __getEvaluatorLogsById(o,e={},t){var l,c,d,m,u,f,h,g,R,T,v;let{size:i}=e,a={size:i},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/automations/evaluators/${x.encodePathParam(o)}/logs`),method:"GET",headers:n,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:Ed.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/automations/evaluators/{id}/logs")}};var sn=class{constructor(o={}){this._options=F(o);}createChatCompletions(o={},e){return _.fromPromise(this.__createChatCompletions(o,e))}async __createChatCompletions(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/chat/completions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Rt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Jl.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/chat/completions")}};var pn=class{constructor(o={}){this._options=F(o);}access(o,e){return _.fromPromise(this.__access(o,e))}async __access(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/auth"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:hc.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/auth")}getWorkspaceName(o){return _.fromPromise(this.__getWorkspaceName(o))}async __getWorkspaceName(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/auth/workspace"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:tf.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new re(t.error.body,t.rawResponse);case 403:throw new se(ae.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),t.rawResponse);default:throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}return A(t.error,t.rawResponse,"GET","/v1/private/auth/workspace")}};var cn=class{constructor(o={}){this._options=F(o);}findDashboards(o={},e){return _.fromPromise(this.__findDashboards(o,e))}async __findDashboards(o={},e){var d,m,u,f,h,g,R,T,v,E,C;let{page:t,size:i,name:a,sorting:n}=o,p={page:t,size:i,name:a,sorting:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/dashboards"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:cm.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/dashboards")}createDashboard(o,e){return _.fromPromise(this.__createDashboard(o,e))}async __createDashboard(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/dashboards"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:wt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:br.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/dashboards")}getDashboardById(o,e={},t){return _.fromPromise(this.__getDashboardById(o,e,t))}async __getDashboardById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:br.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/dashboards/{dashboardId}")}deleteDashboard(o,e={},t){return _.fromPromise(this.__deleteDashboard(o,e,t))}async __deleteDashboard(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/dashboards/{dashboardId}")}updateDashboard(o,e={},t){return _.fromPromise(this.__updateDashboard(o,e,t))}async __updateDashboard(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${x.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:xt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:br.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 404:throw new I(a.error.body,a.rawResponse);case 409:throw new $(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/dashboards/{dashboardId}")}deleteDashboardsBatch(o,e){return _.fromPromise(this.__deleteDashboardsBatch(o,e))}async __deleteDashboardsBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/dashboards/delete-batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/dashboards/delete-batch")}};var ln=class{constructor(o={}){this._options=F(o);}applyDatasetItemChanges(o,e,t){return _.fromPromise(this.__applyDatasetItemChanges(o,e,t))}async __applyDatasetItemChanges(o,e,t){var c,d,m,u,f,h,g,R,T,v,E;let{override:i,body:a}=e,n={override:i},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:x.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/changes`),method:"POST",headers:p,contentType:"application/json",queryParameters:{...n,...t==null?void 0:t.queryParams},requestType:"json",body:hm.jsonOrThrow(a,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((R=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?R:60)*1e3,maxRetries:(v=t==null?void 0:t.maxRetries)!=null?v:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:Je.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);case 409:throw new $(l.error.body,l.rawResponse);default:throw new w({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"POST","/v1/private/datasets/{id}/items/changes")}batchUpdateDatasetItems(o,e){return _.fromPromise(this.__batchUpdateDatasetItems(o,e))}async __batchUpdateDatasetItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Tt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/datasets/items/batch")}findDatasets(o={},e){return _.fromPromise(this.__findDatasets(o,e))}async __findDatasets(o={},e){var h,g,R,T,v,E,C,U,M,Z,ie;let{page:t,size:i,withExperimentsOnly:a,withOptimizationsOnly:n,promptId:p,name:l,sorting:c,filters:d}=o,m={page:t,size:i,with_experiments_only:a,with_optimizations_only:n,prompt_id:p,name:l,sorting:c,filters:d},u=z((h=this._options)==null?void 0:h.headers,S({"Comet-Workspace":(R=e==null?void 0:e.workspaceName)!=null?R:(g=this._options)==null?void 0:g.workspaceName}),e==null?void 0:e.headers),f=await k({url:x.join((v=(T=await b.get(this._options.baseUrl))!=null?T:await b.get(this._options.environment))!=null?v:P.Default,"v1/private/datasets"),method:"GET",headers:u,queryParameters:{...m,...e==null?void 0:e.queryParams},timeoutMs:((U=(C=e==null?void 0:e.timeoutInSeconds)!=null?C:(E=this._options)==null?void 0:E.timeoutInSeconds)!=null?U:60)*1e3,maxRetries:(Z=e==null?void 0:e.maxRetries)!=null?Z:(M=this._options)==null?void 0:M.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(ie=this._options)==null?void 0:ie.fetch,logging:this._options.logging});if(f.ok)return {data:jm.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new w({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});return A(f.error,f.rawResponse,"GET","/v1/private/datasets")}createDataset(o,e){return _.fromPromise(this.__createDataset(o,e))}async __createDataset(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Mt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets")}createOrUpdateDatasetItems(o,e){return _.fromPromise(this.__createOrUpdateDatasetItems(o,e))}async __createOrUpdateDatasetItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/datasets/items")}createDatasetItemsFromCsv(o,e){return _.fromPromise(this.__createDatasetItemsFromCsv(o,e))}async __createDatasetItemsFromCsv(o,e){var p,l,c,d,m,u,f,h,g,R,T;let t=await wh();t.append("file",Pe(o.file)),t.append("dataset_id",o.datasetId);let i=await t.getRequest(),a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName,...i.headers}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/datasets/items/from-csv"),method:"POST",headers:a,queryParameters:e==null?void 0:e.queryParams,requestType:"file",duplex:i.duplex,body:i.body,timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 404:throw new I(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"POST","/v1/private/datasets/items/from-csv")}createDatasetItemsFromSpans(o,e,t){return _.fromPromise(this.__createDatasetItemsFromSpans(o,e,t))}async __createDatasetItemsFromSpans(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/from-spans`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:_t.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{dataset_id}/items/from-spans")}createDatasetItemsFromTraces(o,e,t){return _.fromPromise(this.__createDatasetItemsFromTraces(o,e,t))}async __createDatasetItemsFromTraces(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/from-traces`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:zt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{dataset_id}/items/from-traces")}getDatasetById(o,e={},t){return _.fromPromise(this.__getDatasetById(o,e,t))}async __getDatasetById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Gr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/{id}")}updateDataset(o,e,t){return _.fromPromise(this.__updateDataset(o,e,t))}async __updateDataset(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:It.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/datasets/{id}")}deleteDataset(o,e={},t){return _.fromPromise(this.__deleteDataset(o,e,t))}async __deleteDataset(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/datasets/{id}")}deleteDatasetByName(o,e){return _.fromPromise(this.__deleteDatasetByName(o,e))}async __deleteDatasetByName(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Pt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/delete")}deleteDatasetItems(o={},e){return _.fromPromise(this.__deleteDatasetItems(o,e))}async __deleteDatasetItems(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ct.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/items/delete")}deleteDatasetsBatch(o,e){return _.fromPromise(this.__deleteDatasetsBatch(o,e))}async __deleteDatasetsBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/delete-batch")}downloadDatasetExport(o,e={},t){return _.fromPromise(this.__downloadDatasetExport(o,e,t))}async __downloadDatasetExport(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${x.encodePathParam(o)}/download`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,responseType:"streaming",timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:a.body,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"GET","/v1/private/datasets/export-jobs/{jobId}/download")}expandDataset(o,e,t){return _.fromPromise(this.__expandDataset(o,e,t))}async __expandDataset(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/expansions`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:kt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:fm.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/expansions")}findDatasetItemsWithExperimentItems(o,e,t){return _.fromPromise(this.__findDatasetItemsWithExperimentItems(o,e,t))}async __findDatasetItemsWithExperimentItems(o,e,t){var h,g,R,T,v,E,C,U,M,Z,ie;let{page:i,size:a,experimentIds:n,filters:p,sorting:l,search:c,truncate:d}=e,m={page:i,size:a,experiment_ids:n,filters:p,sorting:l,search:c,truncate:d},u=z((h=this._options)==null?void 0:h.headers,S({"Comet-Workspace":(R=t==null?void 0:t.workspaceName)!=null?R:(g=this._options)==null?void 0:g.workspaceName}),t==null?void 0:t.headers),f=await k({url:x.join((v=(T=await b.get(this._options.baseUrl))!=null?T:await b.get(this._options.environment))!=null?v:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/experiments/items`),method:"GET",headers:u,queryParameters:{...m,...t==null?void 0:t.queryParams},timeoutMs:((U=(C=t==null?void 0:t.timeoutInSeconds)!=null?C:(E=this._options)==null?void 0:E.timeoutInSeconds)!=null?U:60)*1e3,maxRetries:(Z=t==null?void 0:t.maxRetries)!=null?Z:(M=this._options)==null?void 0:M.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(ie=this._options)==null?void 0:ie.fetch,logging:this._options.logging});if(f.ok)return {data:km.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new w({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});return A(f.error,f.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items")}getDatasetByIdentifier(o,e){return _.fromPromise(this.__getDatasetByIdentifier(o,e))}async __getDatasetByIdentifier(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:St.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Gr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/retrieve")}getDatasetExperimentItemsStats(o,e,t){return _.fromPromise(this.__getDatasetExperimentItemsStats(o,e,t))}async __getDatasetExperimentItemsStats(o,e,t){var c,d,m,u,f,h,g,R,T,v,E;let{experimentIds:i,filters:a}=e,n={experiment_ids:i,filters:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:x.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/experiments/items/stats`),method:"GET",headers:p,queryParameters:{...n,...t==null?void 0:t.queryParams},timeoutMs:((R=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?R:60)*1e3,maxRetries:(v=t==null?void 0:t.maxRetries)!=null?v:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:Ge.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new w({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});return A(l.error,l.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items/stats")}getDatasetExportJob(o,e={},t){return _.fromPromise(this.__getDatasetExportJob(o,e,t))}async __getDatasetExportJob(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Dr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/export-jobs/{jobId}")}getDatasetExportJobs(o){return _.fromPromise(this.__getDatasetExportJobs(o))}async __getDatasetExportJobs(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/datasets/export-jobs"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Ur.getDatasetExportJobs.Response.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/datasets/export-jobs")}getDatasetItemById(o,e={},t){return _.fromPromise(this.__getDatasetItemById(o,e,t))}async __getDatasetItemById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/items/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:ei.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/items/{itemId}")}patchDatasetItem(o,e,t){return _.fromPromise(this.__patchDatasetItem(o,e,t))}async __patchDatasetItem(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/items/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:vt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/datasets/items/{itemId}")}getDatasetItems(o,e={},t){return _.fromPromise(this.__getDatasetItems(o,e,t))}async __getDatasetItems(o,e={},t){var u,f,h,g,R,T,v,E,C,U,M;let{page:i,size:a,version:n,filters:p,truncate:l}=e,c={page:i,size:a,version:n,filters:p,truncate:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=t==null?void 0:t.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),t==null?void 0:t.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items`),method:"GET",headers:d,queryParameters:{...c,...t==null?void 0:t.queryParams},timeoutMs:((E=(v=t==null?void 0:t.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=t==null?void 0:t.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:Am.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/datasets/{id}/items")}getDatasetItemsOutputColumns(o,e={},t){return _.fromPromise(this.__getDatasetItemsOutputColumns(o,e,t))}async __getDatasetItemsOutputColumns(o,e={},t){var l,c,d,m,u,f,h,g,R,T,v;let{experimentIds:i}=e,a={experiment_ids:i},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/items/experiments/items/output/columns`),method:"GET",headers:n,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:au.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items/output/columns")}markDatasetExportJobViewed(o,e={},t){return _.fromPromise(this.__markDatasetExportJobViewed(o,e,t))}async __markDatasetExportJobViewed(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${x.encodePathParam(o)}/mark-viewed`),method:"PUT",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/datasets/export-jobs/{jobId}/mark-viewed")}startDatasetExport(o,e={},t){return _.fromPromise(this.__startDatasetExport(o,e,t))}async __startDatasetExport(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/export`),method:"POST",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Dr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/export")}streamDatasetItems(o,e){return _.fromPromise(this.__streamDatasetItems(o,e))}async __streamDatasetItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Et.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/items/stream")}compareDatasetVersions(o,e={},t){return _.fromPromise(this.__compareDatasetVersions(o,e,t))}async __compareDatasetVersions(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/diff`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Cm.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/{id}/versions/diff")}createVersionTag(o,e,t,i){return _.fromPromise(this.__createVersionTag(o,e,t,i))}async __createVersionTag(o,e,t,i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/hash/${x.encodePathParam(e)}/tags`),method:"POST",headers:a,contentType:"application/json",queryParameters:i==null?void 0:i.queryParams,requestType:"json",body:Ft.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 404:throw new I(n.error.body,n.rawResponse);case 409:throw new $(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"POST","/v1/private/datasets/{id}/versions/hash/{versionHash}/tags")}deleteVersionTag(o,e,t,i={},a){return _.fromPromise(this.__deleteVersionTag(o,e,t,i,a))}async __deleteVersionTag(o,e,t,i={},a){var l,c,d,m,u,f,h,g,R,T,v;let n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=a==null?void 0:a.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),a==null?void 0:a.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/${x.encodePathParam(e)}/tags/${x.encodePathParam(t)}`),method:"DELETE",headers:n,queryParameters:a==null?void 0:a.queryParams,timeoutMs:((g=(h=a==null?void 0:a.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=a==null?void 0:a.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:a==null?void 0:a.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:void 0,rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"DELETE","/v1/private/datasets/{id}/versions/{versionHash}/tags/{tag}")}listDatasetVersions(o,e={},t){return _.fromPromise(this.__listDatasetVersions(o,e,t))}async __listDatasetVersions(o,e={},t){var c,d,m,u,f,h,g,R,T,v,E;let{page:i,size:a}=e,n={page:i,size:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:x.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions`),method:"GET",headers:p,queryParameters:{...n,...t==null?void 0:t.queryParams},timeoutMs:((R=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?R:60)*1e3,maxRetries:(v=t==null?void 0:t.maxRetries)!=null?v:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:Im.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw l.error.statusCode===400?new D(l.error.body,l.rawResponse):new w({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});return A(l.error,l.rawResponse,"GET","/v1/private/datasets/{id}/versions")}restoreDatasetVersion(o,e,t){return _.fromPromise(this.__restoreDatasetVersion(o,e,t))}async __restoreDatasetVersion(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/restore`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Dt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Je.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/versions/restore")}retrieveDatasetVersion(o,e,t){return _.fromPromise(this.__retrieveDatasetVersion(o,e,t))}async __retrieveDatasetVersion(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/retrieve`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ut.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Je.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/versions/retrieve")}updateDatasetVersion(o,e,t={},i){return _.fromPromise(this.__updateDatasetVersion(o,e,t,i))}async __updateDatasetVersion(o,e,t={},i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/${x.encodePathParam(o)}/versions/hash/${x.encodePathParam(e)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:i==null?void 0:i.queryParams,requestType:"json",body:Nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:Je.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 404:throw new I(n.error.body,n.rawResponse);case 409:throw new $(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"PATCH","/v1/private/datasets/{id}/versions/hash/{versionHash}")}};var mn=class{constructor(o={}){this._options=F(o);}batchUpdateExperiments(o,e){return _.fromPromise(this.__batchUpdateExperiments(o,e))}async __batchUpdateExperiments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Vt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/experiments/batch")}findExperiments(o={},e){return _.fromPromise(this.__findExperiments(o,e))}async __findExperiments(o={},e){var C,U,M,Z,ie,ze,ke,Ve,ot,it,xf;let{page:t,size:i,datasetId:a,optimizationId:n,types:p,name:l,datasetDeleted:c,promptId:d,projectId:m,projectDeleted:u,sorting:f,filters:h,experimentIds:g,forceSorting:R}=o,T={page:t,size:i,datasetId:a,optimization_id:n,types:p,name:l,dataset_deleted:c,prompt_id:d,project_id:m,project_deleted:u,sorting:f,filters:h,experiment_ids:g,force_sorting:R},v=z((C=this._options)==null?void 0:C.headers,S({"Comet-Workspace":(M=e==null?void 0:e.workspaceName)!=null?M:(U=this._options)==null?void 0:U.workspaceName}),e==null?void 0:e.headers),E=await k({url:x.join((ie=(Z=await b.get(this._options.baseUrl))!=null?Z:await b.get(this._options.environment))!=null?ie:P.Default,"v1/private/experiments"),method:"GET",headers:v,queryParameters:{...T,...e==null?void 0:e.queryParams},timeoutMs:((Ve=(ke=e==null?void 0:e.timeoutInSeconds)!=null?ke:(ze=this._options)==null?void 0:ze.timeoutInSeconds)!=null?Ve:60)*1e3,maxRetries:(it=e==null?void 0:e.maxRetries)!=null?it:(ot=this._options)==null?void 0:ot.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(xf=this._options)==null?void 0:xf.fetch,logging:this._options.logging});if(E.ok)return {data:qm.parseOrThrow(E.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:E.rawResponse};if(E.error.reason==="status-code")throw E.error.statusCode===400?new D(E.error.body,E.rawResponse):new w({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse});return A(E.error,E.rawResponse,"GET","/v1/private/experiments")}createExperiment(o,e){return _.fromPromise(this.__createExperiment(o,e))}async __createExperiment(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Yt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments")}createExperimentItems(o,e){return _.fromPromise(this.__createExperimentItems(o,e))}async __createExperimentItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Kt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items")}deleteExperimentItems(o,e){return _.fromPromise(this.__deleteExperimentItems(o,e))}async __deleteExperimentItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:$t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items/delete")}deleteExperimentsById(o,e){return _.fromPromise(this.__deleteExperimentsById(o,e))}async __deleteExperimentsById(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Kr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/delete")}experimentItemsBulk(o,e){return _.fromPromise(this.__experimentItemsBulk(o,e))}async __experimentItemsBulk(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/bulk"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ht.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"PUT","/v1/private/experiments/items/bulk")}findFeedbackScoreNames(o={},e){return _.fromPromise(this.__findFeedbackScoreNames(o,e))}async __findFeedbackScoreNames(o={},e){var p,l,c,d,m,u,f,h,g,R,T;let{experimentIds:t}=o,i={experiment_ids:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:Fr.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/experiments/feedback-scores/names")}findExperimentGroups(o={},e){return _.fromPromise(this.__findExperimentGroups(o,e))}async __findExperimentGroups(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{groups:t,types:i,name:a,projectId:n,filters:p}=o,l={groups:t,types:i,name:a,project_id:n,filters:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/experiments/groups"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:Hm.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw d.error.statusCode===400?new D(d.error.body,d.rawResponse):new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/experiments/groups")}findExperimentGroupsAggregations(o={},e){return _.fromPromise(this.__findExperimentGroupsAggregations(o,e))}async __findExperimentGroupsAggregations(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{groups:t,types:i,name:a,projectId:n,filters:p}=o,l={groups:t,types:i,name:a,project_id:n,filters:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/experiments/groups/aggregations"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:Wm.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw d.error.statusCode===400?new D(d.error.body,d.rawResponse):new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/experiments/groups/aggregations")}finishExperiments(o,e){return _.fromPromise(this.__finishExperiments(o,e))}async __finishExperiments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/finish"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Kr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/finish")}getExperimentById(o,e={},t){return _.fromPromise(this.__getExperimentById(o,e,t))}async __getExperimentById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/experiments/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:pi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/experiments/{id}")}updateExperiment(o,e,t){return _.fromPromise(this.__updateExperiment(o,e,t))}async __updateExperiment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/experiments/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Bt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 404:throw new I(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"PATCH","/v1/private/experiments/{id}")}getExperimentItemById(o,e={},t){return _.fromPromise(this.__getExperimentItemById(o,e,t))}async __getExperimentItemById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/experiments/items/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:qo.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/experiments/items/{id}")}streamExperimentItems(o,e){return _.fromPromise(this.__streamExperimentItems(o,e))}async __streamExperimentItems(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items/stream")}streamExperiments(o,e){return _.fromPromise(this.__streamExperiments(o,e))}async __streamExperiments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/stream")}};var dn=class{constructor(o={}){this._options=F(o);}findFeedbackDefinitions(o={},e){return _.fromPromise(this.__findFeedbackDefinitions(o,e))}async __findFeedbackDefinitions(o={},e){var d,m,u,f,h,g,R,T,v,E,C;let{page:t,size:i,name:a,type:n}=o,p={page:t,size:i,name:a,type:n!=null?wa.jsonOrThrow(n,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/feedback-definitions"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:ld.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/feedback-definitions")}createFeedbackDefinition(o,e){return _.fromPromise(this.__createFeedbackDefinition(o,e))}async __createFeedbackDefinition(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/feedback-definitions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:nd.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/feedback-definitions")}getFeedbackDefinitionById(o,e={},t){return _.fromPromise(this.__getFeedbackDefinitionById(o,e,t))}async __getFeedbackDefinitionById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/feedback-definitions/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:dd.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/feedback-definitions/{id}")}updateFeedbackDefinition(o,e,t){return _.fromPromise(this.__updateFeedbackDefinition(o,e,t))}async __updateFeedbackDefinition(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/feedback-definitions/${x.encodePathParam(o)}`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:kd.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PUT","/v1/private/feedback-definitions/{id}")}deleteFeedbackDefinitionById(o,e={},t){return _.fromPromise(this.__deleteFeedbackDefinitionById(o,e,t))}async __deleteFeedbackDefinitionById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/feedback-definitions/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===409?new $(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/feedback-definitions/{id}")}deleteFeedbackDefinitionsBatch(o,e){return _.fromPromise(this.__deleteFeedbackDefinitionsBatch(o,e))}async __deleteFeedbackDefinitionsBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===409?new $(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/feedback-definitions/delete")}};var un=class{constructor(o={}){this._options=F(o);}createGuardrails(o,e){return _.fromPromise(this.__createGuardrails(o,e))}async __createGuardrails(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/guardrails"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Xt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/guardrails")}};var fn=class{constructor(o={}){this._options=F(o);}deleteLlmProviderApiKeysBatch(o,e){return _.fromPromise(this.__deleteLlmProviderApiKeysBatch(o,e))}async __deleteLlmProviderApiKeysBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/llm-provider-key/delete")}findLlmProviderKeys(o){return _.fromPromise(this.__findLlmProviderKeys(o))}async __findLlmProviderKeys(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/llm-provider-key"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Nu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/llm-provider-key")}storeLlmProviderApiKey(o,e){return _.fromPromise(this.__storeLlmProviderApiKey(o,e))}async __storeLlmProviderApiKey(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/llm-provider-key"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ot.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/llm-provider-key")}getLlmProviderApiKeyById(o,e={},t){return _.fromPromise(this.__getLlmProviderApiKeyById(o,e,t))}async __getLlmProviderApiKeyById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/llm-provider-key/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:hi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/llm-provider-key/{id}")}updateLlmProviderApiKey(o,e={},t){return _.fromPromise(this.__updateLlmProviderApiKey(o,e,t))}async __updateLlmProviderApiKey(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/llm-provider-key/${x.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Zt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 401:throw new re(a.error.body,a.rawResponse);case 403:throw new se(ae.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/llm-provider-key/{id}")}};var hn=class{constructor(o={}){this._options=F(o);}evaluateSpans(o,e){return _.fromPromise(this.__evaluateSpans(o,e))}async __evaluateSpans(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/spans"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:di.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/spans")}evaluateThreads(o,e){return _.fromPromise(this.__evaluateThreads(o,e))}async __evaluateThreads(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/threads"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:di.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/threads")}evaluateTraces(o,e){return _.fromPromise(this.__evaluateTraces(o,e))}async __evaluateTraces(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/traces"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:di.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/traces")}};var gn=class{constructor(o={}){this._options=F(o);}listModels(o,e){return _.fromPromise(this.__listModels(o,e))}async __listModels(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/ollama/models"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Oa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Nr.listModels.Response.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 422:throw new Q(i.error.body,i.rawResponse);case 500:throw new ct(i.error.body,i.rawResponse);case 503:throw new Ar(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/ollama/models")}testConnection(o,e){return _.fromPromise(this.__testConnection(o,e))}async __testConnection(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/ollama/test-connection"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Oa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Za.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 422:throw new Q(i.error.body,i.rawResponse);case 502:throw new pt(Za.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 503:throw new Ar(ae.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/ollama/test-connection")}};var yn=class{constructor(o={}){this._options=F(o);}receiveProtobufTraces(o){return _.fromPromise(this.__receiveProtobufTraces(o))}async __receiveProtobufTraces(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/otel/v1/traces"),method:"POST",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"POST","/v1/private/otel/v1/traces")}};var bn=class{constructor(o={}){this._options=F(o);}cancelStudioOptimizations(o,e={},t){return _.fromPromise(this.__cancelStudioOptimizations(o,e,t))}async __cancelStudioOptimizations(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/studio/${x.encodePathParam(o)}/cancel`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===501?new er(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/studio/{id}/cancel")}findOptimizations(o={},e){return _.fromPromise(this.__findOptimizations(o,e))}async __findOptimizations(o={},e){var u,f,h,g,R,T,v,E,C,U,M;let{page:t,size:i,datasetId:a,name:n,datasetDeleted:p,filters:l}=o,c={page:t,size:i,dataset_id:a,name:n,dataset_deleted:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,"v1/private/optimizations"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(v=e==null?void 0:e.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:Yd.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw m.error.statusCode===400?new D(m.error.body,m.rawResponse):new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/optimizations")}createOptimization(o,e){return _.fromPromise(this.__createOptimization(o,e))}async __createOptimization(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/optimizations")}upsertOptimization(o,e){return _.fromPromise(this.__upsertOptimization(o,e))}async __upsertOptimization(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:qa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/optimizations")}deleteOptimizationsById(o,e){return _.fromPromise(this.__deleteOptimizationsById(o,e))}async __deleteOptimizationsById(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Kr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/optimizations/delete")}getOptimizationById(o,e={},t){return _.fromPromise(this.__getOptimizationById(o,e,t))}async __getOptimizationById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:ui.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/{id}")}updateOptimizationsById(o,e={},t){return _.fromPromise(this.__updateOptimizationsById(o,e,t))}async __updateOptimizationsById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/${x.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:qt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/optimizations/{id}")}getStudioOptimizationLogs(o,e={},t){return _.fromPromise(this.__getStudioOptimizationLogs(o,e,t))}async __getStudioOptimizationLogs(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/studio/${x.encodePathParam(o)}/logs`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:ou.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/studio/{id}/logs")}};var Rn=class{constructor(o={}){this._options=F(o);}findProjects(o={},e){return _.fromPromise(this.__findProjects(o,e))}async __findProjects(o={},e){var d,m,u,f,h,g,R,T,v,E,C;let{page:t,size:i,name:a,sorting:n}=o,p={page:t,size:i,name:a,sorting:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/projects"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:gu.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/projects")}createProject(o,e){return _.fromPromise(this.__createProject(o,e))}async __createProject(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:oo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/projects")}getProjectById(o,e={},t){return _.fromPromise(this.__getProjectById(o,e,t))}async __getProjectById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:fi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/projects/{id}")}deleteProjectById(o,e={},t){return _.fromPromise(this.__deleteProjectById(o,e,t))}async __deleteProjectById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===409?new $(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/projects/{id}")}updateProject(o,e={},t){return _.fromPromise(this.__updateProject(o,e,t))}async __updateProject(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${x.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:to.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 422:throw new Q(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/projects/{id}")}deleteProjectsBatch(o,e){return _.fromPromise(this.__deleteProjectsBatch(o,e))}async __deleteProjectsBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/projects/delete")}findFeedbackScoreNamesByProjectIds(o={},e){return _.fromPromise(this.__findFeedbackScoreNamesByProjectIds(o,e))}async __findFeedbackScoreNamesByProjectIds(o={},e){var p,l,c,d,m,u,f,h,g,R,T;let{projectIds:t}=o,i={project_ids:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:yd.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/projects/feedback-scores/names")}findTokenUsageNames(o,e={},t){return _.fromPromise(this.__findTokenUsageNames(o,e,t))}async __findTokenUsageNames(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${x.encodePathParam(o)}/token-usage/names`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Ju.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/projects/{id}/token-usage/names")}getProjectMetrics(o,e={},t){return _.fromPromise(this.__getProjectMetrics(o,e,t))}async __getProjectMetrics(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${x.encodePathParam(o)}/metrics`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:eo.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:fu.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"POST","/v1/private/projects/{id}/metrics")}getProjectStats(o={},e){return _.fromPromise(this.__getProjectStats(o,e))}async __getProjectStats(o={},e){var d,m,u,f,h,g,R,T,v,E,C;let{page:t,size:i,name:a,sorting:n}=o,p={page:t,size:i,name:a,sorting:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/projects/stats"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:xu.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/projects/stats")}retrieveProject(o,e){return _.fromPromise(this.__retrieveProject(o,e))}async __retrieveProject(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ro.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:lu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/projects/retrieve")}};var xn=class{constructor(o={}){this._options=F(o);}getPrompts(o={},e){return _.fromPromise(this.__getPrompts(o,e))}async __getPrompts(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{page:t,size:i,name:a,sorting:n,filters:p}=o,l={page:t,size:i,name:a,sorting:n,filters:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/prompts"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:ju.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/prompts")}createPrompt(o,e){return _.fromPromise(this.__createPrompt(o,e))}async __createPrompt(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:po.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts")}createPromptVersion(o,e){return _.fromPromise(this.__createPromptVersion(o,e))}async __createPromptVersion(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:io.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Ee.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts/versions")}updatePromptVersions(o,e){return _.fromPromise(this.__updatePromptVersions(o,e))}async __updatePromptVersions(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:no.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/prompts/versions")}getPromptById(o,e={},t){return _.fromPromise(this.__getPromptById(o,e,t))}async __getPromptById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Au.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/prompts/{id}")}updatePrompt(o,e,t){return _.fromPromise(this.__updatePrompt(o,e,t))}async __updatePrompt(o,e,t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${x.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:ao.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);case 409:throw new $(a.error.body,a.rawResponse);case 422:throw new Q(a.error.body,a.rawResponse);default:throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PUT","/v1/private/prompts/{id}")}deletePrompt(o,e={},t){return _.fromPromise(this.__deletePrompt(o,e,t))}async __deletePrompt(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/prompts/{id}")}deletePromptsBatch(o,e){return _.fromPromise(this.__deletePromptsBatch(o,e))}async __deletePromptsBatch(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/prompts/delete")}getPromptVersionById(o,e={},t){return _.fromPromise(this.__getPromptVersionById(o,e,t))}async __getPromptVersionById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/versions/${x.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:Ee.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/prompts/versions/{versionId}")}getPromptVersions(o,e={},t){return _.fromPromise(this.__getPromptVersions(o,e,t))}async __getPromptVersions(o,e={},t){var u,f,h,g,R,T,v,E,C,U,M;let{page:i,size:a,search:n,sorting:p,filters:l}=e,c={page:i,size:a,search:n,sorting:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=t==null?void 0:t.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),t==null?void 0:t.headers),m=await k({url:x.join((R=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?R:P.Default,`v1/private/prompts/${x.encodePathParam(o)}/versions`),method:"GET",headers:d,queryParameters:{...c,...t==null?void 0:t.queryParams},timeoutMs:((E=(v=t==null?void 0:t.timeoutInSeconds)!=null?v:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=t==null?void 0:t.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(M=this._options)==null?void 0:M.fetch,logging:this._options.logging});if(m.ok)return {data:Du.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw new w({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/prompts/{id}/versions")}restorePromptVersion(o,e,t={},i){return _.fromPromise(this.__restorePromptVersion(o,e,t,i))}async __restorePromptVersion(o,e,t={},i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/prompts/${x.encodePathParam(o)}/versions/${x.encodePathParam(e)}/restore`),method:"POST",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:Ee.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new D(n.error.body,n.rawResponse);case 404:throw new I(n.error.body,n.rawResponse);default:throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}return A(n.error,n.rawResponse,"POST","/v1/private/prompts/{promptId}/versions/{versionId}/restore")}retrievePromptVersion(o,e){return _.fromPromise(this.__retrievePromptVersion(o,e))}async __retrievePromptVersion(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:so.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Ee.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts/versions/retrieve")}};var wn=class{constructor(o={}){this._options=F(o);}datasetsRedirect(o,e){return _.fromPromise(this.__datasetsRedirect(o,e))}async __datasetsRedirect(o,e){var c,d,m,u,f,h,g,R,T,v,E;let{datasetId:t,workspaceName:i,path:a}=o,n={dataset_id:t,workspace_name:i,path:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=e==null?void 0:e.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),e==null?void 0:e.headers),l=await k({url:x.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,"v1/session/redirect/datasets"),method:"GET",headers:p,queryParameters:{...n,...e==null?void 0:e.queryParams},timeoutMs:((R=(g=e==null?void 0:e.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?R:60)*1e3,maxRetries:(v=e==null?void 0:e.maxRetries)!=null?v:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);default:throw new w({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"GET","/v1/session/redirect/datasets")}experimentsRedirect(o,e){return _.fromPromise(this.__experimentsRedirect(o,e))}async __experimentsRedirect(o,e){var d,m,u,f,h,g,R,T,v,E,C;let{datasetId:t,experimentId:i,workspaceName:a,path:n}=o,p={dataset_id:t,experiment_id:i,workspace_name:a,path:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/session/redirect/experiments"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:void 0,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new D(c.error.body,c.rawResponse);case 404:throw new I(c.error.body,c.rawResponse);default:throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return A(c.error,c.rawResponse,"GET","/v1/session/redirect/experiments")}optimizationsRedirect(o,e){return _.fromPromise(this.__optimizationsRedirect(o,e))}async __optimizationsRedirect(o,e){var d,m,u,f,h,g,R,T,v,E,C;let{datasetId:t,optimizationId:i,workspaceName:a,path:n}=o,p={dataset_id:t,optimization_id:i,workspace_name:a,path:n},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:x.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/session/redirect/optimizations"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(R=e==null?void 0:e.timeoutInSeconds)!=null?R:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(v=this._options)==null?void 0:v.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:void 0,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new D(c.error.body,c.rawResponse);case 404:throw new I(c.error.body,c.rawResponse);default:throw new w({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return A(c.error,c.rawResponse,"GET","/v1/session/redirect/optimizations")}projectsRedirect(o,e){return _.fromPromise(this.__projectsRedirect(o,e))}async __projectsRedirect(o,e){var c,d,m,u,f,h,g,R,T,v,E;let{traceId:t,workspaceName:i,path:a}=o,n={trace_id:t,workspace_name:i,path:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=e==null?void 0:e.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),e==null?void 0:e.headers),l=await k({url:x.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,"v1/session/redirect/projects"),method:"GET",headers:p,queryParameters:{...n,...e==null?void 0:e.queryParams},timeoutMs:((R=(g=e==null?void 0:e.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?R:60)*1e3,maxRetries:(v=e==null?void 0:e.maxRetries)!=null?v:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);default:throw new w({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"GET","/v1/session/redirect/projects")}};var _n=class{constructor(o={}){this._options=F(o);}getServiceToggles(o){return _.fromPromise(this.__getServiceToggles(o))}async __getServiceToggles(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/toggles"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Mu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/toggles")}};var zn=class{constructor(o={}){this._options=F(o);}addSpanComment(o,e,t){return _.fromPromise(this.__addSpanComment(o,e,t))}async __addSpanComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${x.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/spans/{id}/comments")}addSpanFeedbackScore(o,e,t){return _.fromPromise(this.__addSpanFeedbackScore(o,e,t))}async __addSpanFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${x.encodePathParam(o)}/feedback-scores`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pe.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PUT","/v1/private/spans/{id}/feedback-scores")}createSpans(o,e){return _.fromPromise(this.__createSpans(o,e))}async __createSpans(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:fo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/batch")}batchUpdateSpans(o,e){return _.fromPromise(this.__batchUpdateSpans(o,e))}async __batchUpdateSpans(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:lo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/spans/batch")}getSpansByProject(o={},e){return _.fromPromise(this.__getSpansByProject(o,e))}async __getSpansByProject(o={},e){var E,C,U,M,Z,ie,ze,ke,Ve,ot,it;let{page:t,size:i,projectName:a,projectId:n,traceId:p,type:l,filters:c,truncate:d,stripAttachments:m,sorting:u,exclude:f,fromTime:h,toTime:g}=o,R={page:t,size:i,project_name:a,project_id:n,trace_id:p,type:l!=null?La.jsonOrThrow(l,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0,filters:c,truncate:d,strip_attachments:m,sorting:u,exclude:f,from_time:h==null?void 0:h.toISOString(),to_time:g==null?void 0:g.toISOString()},T=z((E=this._options)==null?void 0:E.headers,S({"Comet-Workspace":(U=e==null?void 0:e.workspaceName)!=null?U:(C=this._options)==null?void 0:C.workspaceName}),e==null?void 0:e.headers),v=await k({url:x.join((Z=(M=await b.get(this._options.baseUrl))!=null?M:await b.get(this._options.environment))!=null?Z:P.Default,"v1/private/spans"),method:"GET",headers:T,queryParameters:{...R,...e==null?void 0:e.queryParams},timeoutMs:((ke=(ze=e==null?void 0:e.timeoutInSeconds)!=null?ze:(ie=this._options)==null?void 0:ie.timeoutInSeconds)!=null?ke:60)*1e3,maxRetries:(ot=e==null?void 0:e.maxRetries)!=null?ot:(Ve=this._options)==null?void 0:Ve.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(it=this._options)==null?void 0:it.fetch,logging:this._options.logging});if(v.ok)return {data:Bu.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")throw new w({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse});return A(v.error,v.rawResponse,"GET","/v1/private/spans")}createSpan(o,e){return _.fromPromise(this.__createSpan(o,e))}async __createSpan(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:uo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===409?new $(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans")}getSpanById(o,e={},t){return _.fromPromise(this.__getSpanById(o,e,t))}async __getSpanById(o,e={},t){var l,c,d,m,u,f,h,g,R,T,v;let{stripAttachments:i}=e,a={strip_attachments:i},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/spans/${x.encodePathParam(o)}`),method:"GET",headers:n,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:gi.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw p.error.statusCode===404?new I(p.error.body,p.rawResponse):new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/spans/{id}")}deleteSpanById(o,e={},t){return _.fromPromise(this.__deleteSpanById(o,e,t))}async __deleteSpanById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/spans/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===501?new er(a.error.body,a.rawResponse):new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/spans/{id}")}updateSpan(o,e,t){return _.fromPromise(this.__updateSpan(o,e,t))}async __updateSpan(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:co.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/spans/{id}")}deleteSpanComments(o,e){return _.fromPromise(this.__deleteSpanComments(o,e))}async __deleteSpanComments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/comments/delete")}deleteSpanFeedbackScore(o,e,t){return _.fromPromise(this.__deleteSpanFeedbackScore(o,e,t))}async __deleteSpanFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${x.encodePathParam(o)}/feedback-scores/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:ti.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/spans/{id}/feedback-scores/delete")}findFeedbackScoreNames1(o={},e){return _.fromPromise(this.__findFeedbackScoreNames1(o,e))}async __findFeedbackScoreNames1(o={},e){var l,c,d,m,u,f,h,g,R,T,v;let{projectId:t,type:i}=o,a={project_id:t,type:i!=null?Ba.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=e==null?void 0:e.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),e==null?void 0:e.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:n,queryParameters:{...a,...e==null?void 0:e.queryParams},timeoutMs:((g=(h=e==null?void 0:e.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=e==null?void 0:e.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:Mr.findFeedbackScoreNames1.Response.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/spans/feedback-scores/names")}getSpanComment(o,e,t={},i){return _.fromPromise(this.__getSpanComment(o,e,t,i))}async __getSpanComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${x.encodePathParam(o)}/comments/${x.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:O.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/spans/{spanId}/comments/{commentId}")}getSpanStats(o={},e){return _.fromPromise(this.__getSpanStats(o,e))}async __getSpanStats(o={},e){var f,h,g,R,T,v,E,C,U,M,Z;let{projectId:t,projectName:i,traceId:a,type:n,filters:p,fromTime:l,toTime:c}=o,d={project_id:t,project_name:i,trace_id:a,type:n!=null?Va.jsonOrThrow(n,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0,filters:p,from_time:l==null?void 0:l.toISOString(),to_time:c==null?void 0:c.toISOString()},m=z((f=this._options)==null?void 0:f.headers,S({"Comet-Workspace":(g=e==null?void 0:e.workspaceName)!=null?g:(h=this._options)==null?void 0:h.workspaceName}),e==null?void 0:e.headers),u=await k({url:x.join((T=(R=await b.get(this._options.baseUrl))!=null?R:await b.get(this._options.environment))!=null?T:P.Default,"v1/private/spans/stats"),method:"GET",headers:m,queryParameters:{...d,...e==null?void 0:e.queryParams},timeoutMs:((C=(E=e==null?void 0:e.timeoutInSeconds)!=null?E:(v=this._options)==null?void 0:v.timeoutInSeconds)!=null?C:60)*1e3,maxRetries:(M=e==null?void 0:e.maxRetries)!=null?M:(U=this._options)==null?void 0:U.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(Z=this._options)==null?void 0:Z.fetch,logging:this._options.logging});if(u.ok)return {data:Ge.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new w({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});return A(u.error,u.rawResponse,"GET","/v1/private/spans/stats")}scoreBatchOfSpans(o,e){return _.fromPromise(this.__scoreBatchOfSpans(o,e))}async __scoreBatchOfSpans(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:li.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/spans/feedback-scores")}searchSpans(o={},e){return _.fromPromise(this.__searchSpans(o,e))}async __searchSpans(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ho.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/search")}updateSpanComment(o,e,t){return _.fromPromise(this.__updateSpanComment(o,e,t))}async __updateSpanComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/comments/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/spans/comments/{commentId}")}};var kn=class{constructor(o={}){this._options=F(o);}getDatasetBiInfo(o){return _.fromPromise(this.__getDatasetBiInfo(o))}async __getDatasetBiInfo(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Jr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-datasets")}getExperimentBiInfo(o){return _.fromPromise(this.__getExperimentBiInfo(o))}async __getExperimentBiInfo(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Jr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-experiments")}getSpansBiInfo(o){return _.fromPromise(this.__getSpansBiInfo(o))}async __getSpansBiInfo(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-spans"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Jr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-spans")}getSpansCountForWorkspaces(o){return _.fromPromise(this.__getSpansCountForWorkspaces(o))}async __getSpansCountForWorkspaces(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Lu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/workspace-span-counts")}getTracesBiInfo(o){return _.fromPromise(this.__getTracesBiInfo(o))}async __getTracesBiInfo(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Jr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-traces")}getTracesCountForWorkspaces(o){return _.fromPromise(this.__getTracesCountForWorkspaces(o))}async __getTracesCountForWorkspaces(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Ku.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/workspace-trace-counts")}};var Pn=class{constructor(o={}){this._options=F(o);}addThreadComment(o,e,t){return _.fromPromise(this.__addThreadComment(o,e,t))}async __addThreadComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${x.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/traces/threads/{id}/comments")}addTraceComment(o,e,t){return _.fromPromise(this.__addTraceComment(o,e,t))}async __addTraceComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${x.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/traces/{id}/comments")}addTraceFeedbackScore(o,e,t){return _.fromPromise(this.__addTraceFeedbackScore(o,e,t))}async __addTraceFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${x.encodePathParam(o)}/feedback-scores`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pe.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PUT","/v1/private/traces/{id}/feedback-scores")}createTraces(o,e){return _.fromPromise(this.__createTraces(o,e))}async __createTraces(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:_o.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/batch")}batchUpdateTraces(o,e){return _.fromPromise(this.__batchUpdateTraces(o,e))}async __batchUpdateTraces(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:xo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/traces/batch")}batchUpdateThreads(o,e){return _.fromPromise(this.__batchUpdateThreads(o,e))}async __batchUpdateThreads(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:So.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/traces/threads/batch")}closeTraceThread(o={},e){return _.fromPromise(this.__closeTraceThread(o,e))}async __closeTraceThread(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/close"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ko.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===404?new I(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/close")}getTracesByProject(o={},e){return _.fromPromise(this.__getTracesByProject(o,e))}async __getTracesByProject(o={},e){var T,v,E,C,U,M,Z,ie,ze,ke,Ve;let{page:t,size:i,projectName:a,projectId:n,filters:p,truncate:l,stripAttachments:c,sorting:d,exclude:m,fromTime:u,toTime:f}=o,h={page:t,size:i,project_name:a,project_id:n,filters:p,truncate:l,strip_attachments:c,sorting:d,exclude:m,from_time:u==null?void 0:u.toISOString(),to_time:f==null?void 0:f.toISOString()},g=z((T=this._options)==null?void 0:T.headers,S({"Comet-Workspace":(E=e==null?void 0:e.workspaceName)!=null?E:(v=this._options)==null?void 0:v.workspaceName}),e==null?void 0:e.headers),R=await k({url:x.join((U=(C=await b.get(this._options.baseUrl))!=null?C:await b.get(this._options.environment))!=null?U:P.Default,"v1/private/traces"),method:"GET",headers:g,queryParameters:{...h,...e==null?void 0:e.queryParams},timeoutMs:((ie=(Z=e==null?void 0:e.timeoutInSeconds)!=null?Z:(M=this._options)==null?void 0:M.timeoutInSeconds)!=null?ie:60)*1e3,maxRetries:(ke=e==null?void 0:e.maxRetries)!=null?ke:(ze=this._options)==null?void 0:ze.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(Ve=this._options)==null?void 0:Ve.fetch,logging:this._options.logging});if(R.ok)return {data:Qu.parseOrThrow(R.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:R.rawResponse};if(R.error.reason==="status-code")throw new w({statusCode:R.error.statusCode,body:R.error.body,rawResponse:R.rawResponse});return A(R.error,R.rawResponse,"GET","/v1/private/traces")}createTrace(o,e){return _.fromPromise(this.__createTrace(o,e))}async __createTrace(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:wo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces")}getTraceById(o,e={},t){return _.fromPromise(this.__getTraceById(o,e,t))}async __getTraceById(o,e={},t){var l,c,d,m,u,f,h,g,R,T,v;let{stripAttachments:i}=e,a={strip_attachments:i},n=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:x.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/traces/${x.encodePathParam(o)}`),method:"GET",headers:n,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(R=this._options)==null?void 0:R.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(v=this._options)==null?void 0:v.fetch,logging:this._options.logging});if(p.ok)return {data:yi.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new w({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/traces/{id}")}deleteTraceById(o,e={},t){return _.fromPromise(this.__deleteTraceById(o,e,t))}async __deleteTraceById(o,e={},t){var n,p,l,c,d,m,u,f,h,g,R;let i=z((n=this._options)==null?void 0:n.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:x.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/traces/${x.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(R=this._options)==null?void 0:R.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new w({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/traces/{id}")}updateTrace(o,e,t){return _.fromPromise(this.__updateTrace(o,e,t))}async __updateTrace(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ro.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/traces/{id}")}deleteThreadComments(o,e){return _.fromPromise(this.__deleteThreadComments(o,e))}async __deleteThreadComments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/comments/delete")}deleteThreadFeedbackScores(o,e){return _.fromPromise(this.__deleteThreadFeedbackScores(o,e))}async __deleteThreadFeedbackScores(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/feedback-scores/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:go.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/feedback-scores/delete")}deleteTraceComments(o,e){return _.fromPromise(this.__deleteTraceComments(o,e))}async __deleteTraceComments(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/comments/delete")}deleteTraceFeedbackScore(o,e,t){return _.fromPromise(this.__deleteTraceFeedbackScore(o,e,t))}async __deleteTraceFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${x.encodePathParam(o)}/feedback-scores/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:ti.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"POST","/v1/private/traces/{id}/feedback-scores/delete")}deleteTraceThreads(o,e){return _.fromPromise(this.__deleteTraceThreads(o,e))}async __deleteTraceThreads(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/delete")}deleteTraces(o,e){return _.fromPromise(this.__deleteTraces(o,e))}async __deleteTraces(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/delete")}findFeedbackScoreNames2(o={},e){return _.fromPromise(this.__findFeedbackScoreNames2(o,e))}async __findFeedbackScoreNames2(o={},e){var p,l,c,d,m,u,f,h,g,R,T;let{projectId:t}=o,i={project_id:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:nr.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/traces/feedback-scores/names")}findTraceThreadsFeedbackScoreNames(o={},e){return _.fromPromise(this.__findTraceThreadsFeedbackScoreNames(o,e))}async __findTraceThreadsFeedbackScoreNames(o={},e){var p,l,c,d,m,u,f,h,g,R,T;let{projectId:t}=o,i={project_id:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/traces/threads/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=e==null?void 0:e.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:nr.findTraceThreadsFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/traces/threads/feedback-scores/names")}getTraceStats(o={},e){return _.fromPromise(this.__getTraceStats(o,e))}async __getTraceStats(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{projectId:t,projectName:i,filters:a,fromTime:n,toTime:p}=o,l={project_id:t,project_name:i,filters:a,from_time:n==null?void 0:n.toISOString(),to_time:p==null?void 0:p.toISOString()},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/traces/stats"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:Ge.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/traces/stats")}getThreadComment(o,e,t={},i){return _.fromPromise(this.__getThreadComment(o,e,t,i))}async __getThreadComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${x.encodePathParam(o)}/comments/${x.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:O.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/traces/threads/{threadId}/comments/{commentId}")}getTraceThreadStats(o={},e){return _.fromPromise(this.__getTraceThreadStats(o,e))}async __getTraceThreadStats(o={},e){var m,u,f,h,g,R,T,v,E,C,U;let{projectId:t,projectName:i,filters:a,fromTime:n,toTime:p}=o,l={project_id:t,project_name:i,filters:a,from_time:n==null?void 0:n.toISOString(),to_time:p==null?void 0:p.toISOString()},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:x.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/traces/threads/stats"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((v=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(R=this._options)==null?void 0:R.timeoutInSeconds)!=null?v:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:Ge.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new w({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/traces/threads/stats")}getTraceComment(o,e,t={},i){return _.fromPromise(this.__getTraceComment(o,e,t,i))}async __getTraceComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,R,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${x.encodePathParam(o)}/comments/${x.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=i==null?void 0:i.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:O.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"GET","/v1/private/traces/{traceId}/comments/{commentId}")}getTraceThread(o,e){return _.fromPromise(this.__getTraceThread(o,e))}async __getTraceThread(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:en.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:bi.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===404?new I(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/retrieve")}getTraceThreads(o={},e){return _.fromPromise(this.__getTraceThreads(o,e))}async __getTraceThreads(o={},e){var R,T,v,E,C,U,M,Z,ie,ze,ke;let{page:t,size:i,projectName:a,projectId:n,truncate:p,stripAttachments:l,filters:c,sorting:d,fromTime:m,toTime:u}=o,f={page:t,size:i,project_name:a,project_id:n,truncate:p,strip_attachments:l,filters:c,sorting:d,from_time:m==null?void 0:m.toISOString(),to_time:u==null?void 0:u.toISOString()},h=z((R=this._options)==null?void 0:R.headers,S({"Comet-Workspace":(v=e==null?void 0:e.workspaceName)!=null?v:(T=this._options)==null?void 0:T.workspaceName}),e==null?void 0:e.headers),g=await k({url:x.join((C=(E=await b.get(this._options.baseUrl))!=null?E:await b.get(this._options.environment))!=null?C:P.Default,"v1/private/traces/threads"),method:"GET",headers:h,queryParameters:{...f,...e==null?void 0:e.queryParams},timeoutMs:((Z=(M=e==null?void 0:e.timeoutInSeconds)!=null?M:(U=this._options)==null?void 0:U.timeoutInSeconds)!=null?Z:60)*1e3,maxRetries:(ze=e==null?void 0:e.maxRetries)!=null?ze:(ie=this._options)==null?void 0:ie.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(ke=this._options)==null?void 0:ke.fetch,logging:this._options.logging});if(g.ok)return {data:Xu.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new w({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});return A(g.error,g.rawResponse,"GET","/v1/private/traces/threads")}openTraceThread(o,e){return _.fromPromise(this.__openTraceThread(o,e))}async __openTraceThread(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/open"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:en.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/open")}scoreBatchOfThreads(o,e){return _.fromPromise(this.__scoreBatchOfThreads(o,e))}async __scoreBatchOfThreads(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:bo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/feedback-scores")}scoreBatchOfTraces(o,e){return _.fromPromise(this.__scoreBatchOfTraces(o,e))}async __scoreBatchOfTraces(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:li.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/feedback-scores")}searchTraceThreads(o={},e){return _.fromPromise(this.__searchTraceThreads(o,e))}async __searchTraceThreads(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ao.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/search")}searchTraces(o={},e){return _.fromPromise(this.__searchTraces(o,e))}async __searchTraces(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:zo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 401:throw new re(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/traces/search")}updateThread(o,e,t){return _.fromPromise(this.__updateThread(o,e,t))}async __updateThread(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Po.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/traces/threads/{threadModelId}")}updateThreadComment(o,e,t){return _.fromPromise(this.__updateThreadComment(o,e,t))}async __updateThreadComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/comments/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/traces/threads/comments/{commentId}")}updateTraceComment(o,e,t){return _.fromPromise(this.__updateTraceComment(o,e,t))}async __updateTraceComment(o,e,t){var p,l,c,d,m,u,f,h,g,R,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),n=await k({url:x.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/comments/${x.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:O.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(R=t==null?void 0:t.maxRetries)!=null?R:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(n.ok)return {data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")throw n.error.statusCode===404?new I(n.error.body,n.rawResponse):new w({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse});return A(n.error,n.rawResponse,"PATCH","/v1/private/traces/comments/{commentId}")}};var Sn=class{constructor(o={}){this._options=F(o);}getWelcomeWizardStatus(o){return _.fromPromise(this.__getWelcomeWizardStatus(o))}async __getWelcomeWizardStatus(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/welcome-wizard"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:ef.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/welcome-wizard")}submitWelcomeWizard(o={},e){return _.fromPromise(this.__submitWelcomeWizard(o,e))}async __submitWelcomeWizard(o={},e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/welcome-wizard"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:To.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/welcome-wizard")}};var An=class{constructor(o={}){this._options=F(o);}costsSummary(o,e){return _.fromPromise(this.__costsSummary(o,e))}async __costsSummary(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/costs/summaries"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Qr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Rr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/costs/summaries")}getWorkspaceConfiguration(o){return _.fromPromise(this.__getWorkspaceConfiguration(o))}async __getWorkspaceConfiguration(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/workspaces/configurations"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Ri.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw t.error.statusCode===404?new I(t.error.body,t.rawResponse):new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/workspaces/configurations")}upsertWorkspaceConfiguration(o,e){return _.fromPromise(this.__upsertWorkspaceConfiguration(o,e))}async __upsertWorkspaceConfiguration(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/configurations"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ri.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Ri.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"PUT","/v1/private/workspaces/configurations")}deleteWorkspaceConfiguration(o){return _.fromPromise(this.__deleteWorkspaceConfiguration(o))}async __deleteWorkspaceConfiguration(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:void 0,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw t.error.statusCode===404?new I(t.error.body,t.rawResponse):new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"DELETE","/v1/private/workspaces/configurations")}getCost(o,e){return _.fromPromise(this.__getCost(o,e))}async __getCost(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/costs"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Qr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:rn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/costs")}getMetric(o,e){return _.fromPromise(this.__getMetric(o,e))}async __getMetric(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/metrics"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Qr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:rn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/metrics")}metricsSummary(o,e){return _.fromPromise(this.__metricsSummary(o,e))}async __metricsSummary(o,e){var a,n,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(n=this._options)==null?void 0:n.workspaceName}),e==null?void 0:e.headers),i=await k({url:x.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/metrics/summaries"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Qr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:rf.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new w({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/metrics/summaries")}};var xi=class{constructor(o={}){this._options=F(o);}get systemUsage(){var o;return (o=this._systemUsage)!=null?o:this._systemUsage=new kn(this._options)}get alerts(){var o;return (o=this._alerts)!=null?o:this._alerts=new tn(this._options)}get annotationQueues(){var o;return (o=this._annotationQueues)!=null?o:this._annotationQueues=new on(this._options)}get attachments(){var o;return (o=this._attachments)!=null?o:this._attachments=new an(this._options)}get check(){var o;return (o=this._check)!=null?o:this._check=new pn(this._options)}get automationRuleEvaluators(){var o;return (o=this._automationRuleEvaluators)!=null?o:this._automationRuleEvaluators=new nn(this._options)}get chatCompletions(){var o;return (o=this._chatCompletions)!=null?o:this._chatCompletions=new sn(this._options)}get dashboards(){var o;return (o=this._dashboards)!=null?o:this._dashboards=new cn(this._options)}get datasets(){var o;return (o=this._datasets)!=null?o:this._datasets=new ln(this._options)}get experiments(){var o;return (o=this._experiments)!=null?o:this._experiments=new mn(this._options)}get feedbackDefinitions(){var o;return (o=this._feedbackDefinitions)!=null?o:this._feedbackDefinitions=new dn(this._options)}get guardrails(){var o;return (o=this._guardrails)!=null?o:this._guardrails=new un(this._options)}get llmProviderKey(){var o;return (o=this._llmProviderKey)!=null?o:this._llmProviderKey=new fn(this._options)}get manualEvaluation(){var o;return (o=this._manualEvaluation)!=null?o:this._manualEvaluation=new hn(this._options)}get ollama(){var o;return (o=this._ollama)!=null?o:this._ollama=new gn(this._options)}get openTelemetryIngestion(){var o;return (o=this._openTelemetryIngestion)!=null?o:this._openTelemetryIngestion=new yn(this._options)}get optimizations(){var o;return (o=this._optimizations)!=null?o:this._optimizations=new bn(this._options)}get projects(){var o;return (o=this._projects)!=null?o:this._projects=new Rn(this._options)}get prompts(){var o;return (o=this._prompts)!=null?o:this._prompts=new xn(this._options)}get serviceToggles(){var o;return (o=this._serviceToggles)!=null?o:this._serviceToggles=new _n(this._options)}get spans(){var o;return (o=this._spans)!=null?o:this._spans=new zn(this._options)}get traces(){var o;return (o=this._traces)!=null?o:this._traces=new Pn(this._options)}get welcomeWizard(){var o;return (o=this._welcomeWizard)!=null?o:this._welcomeWizard=new Sn(this._options)}get workspaces(){var o;return (o=this._workspaces)!=null?o:this._workspaces=new An(this._options)}get redirect(){var o;return (o=this._redirect)!=null?o:this._redirect=new wn(this._options)}isAlive(o){return _.fromPromise(this.__isAlive(o))}async __isAlive(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"is-alive/ping"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/is-alive/ping")}version(o){return _.fromPromise(this.__version(o))}async __version(o){var i,a,n,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(n=o==null?void 0:o.workspaceName)!=null?n:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:x.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"is-alive/ver"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new w({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/is-alive/ver")}};var tg;(e=>(e.LogLevel=he,e.ConsoleLogger=rr))(tg||(tg={}));var ne=()=>uuid.v7();var Yr=class{static serializePromptToInfoDict(o){return {name:o.name,...o.id&&{id:o.id},version:{...o.versionId&&{id:o.versionId},...o.commit&&{commit:o.commit},template:o.prompt}}}static normalizeMetadata(o){if(!o)return {};if(typeof o=="object"&&!Array.isArray(o))return o;if(typeof o=="string")try{let e=JSON.parse(o);if(typeof e=="object"&&!Array.isArray(e))return e}catch{}return {}}static mergePromptsIntoMetadata(o,e,t){let i=t.map(p=>this.serializePromptToInfoDict(p)),a=this.normalizeMetadata(o),n=this.normalizeMetadata(e);return {...a,...n,opik_prompts:i}}static processTraceUpdate(o,e){let{prompts:t,...i}=o;if(!t||t.length===0)return i;let a=this.mergePromptsIntoMetadata(e,i.metadata,t);return {...i,metadata:a}}static processSpanUpdate(o,e){let{prompts:t,...i}=o;if(!t||t.length===0)return i;let a=this.mergePromptsIntoMetadata(e,i.metadata,t);return {...i,metadata:a}}};var Tn=class s{constructor(o,e){this.data=o;this.opik=e;this.childSpans=[];this.end=()=>this.update({endTime:new Date});this.score=o=>{var e;this.opik.spanFeedbackScoresBatchQueue.create({...o,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=o=>{var i;let e=Yr.processSpanUpdate(o,this.data.metadata),t={parentSpanId:this.data.parentSpanId,projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,traceId:this.data.traceId,...e};return this.opik.spanBatchQueue.update(this.data.id,t),this.data={...this.data,...o},this};this.span=o=>{var a;let e=(a=this.data.projectName)!=null?a:this.opik.config.projectName,t={id:ne(),startTime:new Date,...o,projectName:e,traceId:this.data.traceId,parentSpanId:this.data.id};this.opik.spanBatchQueue.create(t);let i=new s(t,this.opik);return this.childSpans.push(i),i};}};var vn=class{constructor(o,e){this.data=o;this.opik=e;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=o=>{var e;this.opik.traceFeedbackScoresBatchQueue.create({...o,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=o=>{var a,n;let e=(n=(a=this.data.projectName)!=null?a:o.projectName)!=null?n:this.opik.config.projectName,t={id:ne(),startTime:new Date,...o,projectName:e,traceId:this.data.id};this.opik.spanBatchQueue.create(t);let i=new Tn(t,this.opik);return this.spans.push(i),i};this.update=o=>{var i;let e=Yr.processTraceUpdate(o,this.data.metadata),t={projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,...e};return this.opik.traceBatchQueue.update(this.data.id,t),this.data={...this.data,...t},this};}};var og={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECTS:"api/v1/session/redirect/projects/"},wi={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",TRACE_ID:"trace_id",PATH:"path"},Ex=s=>Object.entries(s).map(([o,e])=>`${o}=${encodeURIComponent(e)}`).join("&").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%26/g,"&").replace(/%3F/g,"?").replace(/%3D/g,"=");var ig=s=>Buffer.from(s).toString("base64"),ag=(s,o,e)=>{let t=Ex(e),i=`${o}?${t}`;return new URL(i,s).toString()},ng=({datasetId:s,experimentId:o,baseUrl:e})=>ag(e,og.EXPERIMENTS,{[wi.EXPERIMENT_ID]:o,[wi.DATASET_ID]:s,[wi.PATH]:ig(e)}),sg=(s,o)=>ag(o,og.PROJECTS,{[wi.TRACE_ID]:s,[wi.PATH]:ig(o)});var Cx=300,jn=100,_i=class{constructor({action:o,batchSize:e=jn,delay:t,enableBatch:i,name:a="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=(o,e)=>{if(this.queue.set(o,e),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(o,e)=>{let t=this.queue.get(o);t&&(this.queue.set(o,{...t,...e}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let o=new Map(this.queue);this.queue.clear(),j.debug(`Adding ${o.size} items to ${this.name} promise:`,o),this.promise=this.promise.finally(()=>(j.debug(`Flushing ${this.name}:`,o),this.action(o))).catch(e=>{j.error(`Failed to flush ${this.name}:`,e,o);}),await this.promise;};this.action=o,this.batchSize=e,this.delay=t,this.enableBatch=i,this.name=a;}},Re=class{constructor({delay:o=Cx,enableCreateBatch:e=true,enableUpdateBatch:t=false,enableDeleteBatch:i=true,createBatchSize:a=jn,updateBatchSize:n=jn,deleteBatchSize:p=jn,name:l="BatchQueue"}={}){this.create=o=>{let e=this.getId(o);this.createQueue.add(e,o);};this.get=async o=>{let e=this.createQueue.queue.get(o);return e||this.getEntity(o)};this.update=(o,e)=>{if(this.createQueue.queue.get(o)){this.createQueue.update(o,e);return}let i=this.updateQueue.queue.get(o);this.updateQueue.add(o,{...i,...e});};this.delete=o=>{if(this.createQueue.queue.has(o)){this.createQueue.queue.delete(o);return}this.deleteQueue.add(o);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=l,this.createQueue=new _i({action:async c=>{await this.createEntities(Array.from(c.values()));},delay:o,enableBatch:e,batchSize:a,name:`${l}:createQueue`}),this.updateQueue=new _i({action:async c=>{await this.createQueue.flush();let d=Array.from(c.entries());for(let[m,u]of d)await this.updateEntity(m,u);},delay:o,enableBatch:t,batchSize:n,name:`${l}:updateQueue`}),this.deleteQueue=new _i({action:async c=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(c.keys()));},delay:o,enableBatch:i,batchSize:p,name:`${l}:deleteQueue`});}};var En=class extends Re{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.spans.createSpans({spans:e},this.api.requestOptions);}async getEntity(e){return await this.api.spans.getSpanById(e,{},this.api.requestOptions)}async updateEntity(e,t){await this.api.spans.updateSpan(e,{body:t},this.api.requestOptions);}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanById(t,this.api.requestOptions);}};var Cn=class extends Re{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.spans.scoreBatchOfSpans({scores:e},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanFeedbackScore(t.id,{body:{name:t.name}},this.api.requestOptions);}};var In=class extends Re{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.traces.createTraces({traces:e},this.api.requestOptions);}async getEntity(e){return await this.api.traces.getTraceById(e,{},this.api.requestOptions)}async updateEntity(e,t){await this.api.traces.updateTrace(e,{body:t},this.api.requestOptions);}async deleteEntities(e){await this.api.traces.deleteTraces({ids:e},this.api.requestOptions);}};var Dn=class extends Re{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.traces.scoreBatchOfTraces({scores:e},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.traces.deleteTraceFeedbackScore(t.id,{body:{name:t.name}},this.api.requestOptions);}};var Un=class extends xi{constructor(e){var i;let t={...e==null?void 0:e.headers,...(i=e==null?void 0:e.requestOptions)==null?void 0:i.headers};(e==null?void 0:e.apiKey)!==void 0&&(t.authorization=e.apiKey);super({...e,headers:t});this.setHeaders=e=>{this.requestOptions.headers=e;};this.requestOptions=(e==null?void 0:e.requestOptions)||{};}};var Fn=class extends Re{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"DatasetBatchQueue"});this.api=e;}getId(e){return e.id||""}async createEntities(e){for(let t of e)await this.api.datasets.createDataset(t,this.api.requestOptions);}async getEntity(e){try{return await this.api.datasets.getDatasetById(e,this.api.requestOptions)}catch{return}}async updateEntity(e,t){await this.api.datasets.updateDataset(e,{name:t.name||"",visibility:t.visibility,description:t.description},this.api.requestOptions);}async deleteEntities(e){await this.api.datasets.deleteDatasetsBatch({ids:e},this.api.requestOptions);}};var of=null;async function pg(){return of||(of=await Ix__default.default()),of}var Xr=class s{constructor(o){let{id:e,traceId:t,spanId:i,source:a,...n}=o;this.id=e||ne(),this.traceId=t,this.spanId=i,this.source=a||ks.Sdk,this.data={...n};}getContent(o=false){return o?{...this.data,id:this.id}:{...this.data}}async contentHash(){let o=this.getContent(),e=Dx__default.default(o);return (await pg()).h32(e,43981).toString(16)}toApiModel(){return {id:this.id,traceId:this.traceId,spanId:this.spanId,source:this.source,data:this.getContent()}}static fromApiModel(o){return new s({id:o.id,traceId:o.traceId,spanId:o.spanId,source:o.source,...o.data})}};async function Ke(s,o,e){var p;if(e===0)return [];let t=new util.TextDecoder("utf-8"),i=[],a="",n=s.getReader();try{for(;;){let{done:l,value:c}=await n.read();if(l)break;let d=c;a+=t.decode(d,{stream:!0});let m=a.split(`
|
|
4
|
-
`);a=(p=m.pop())!=null?p:"";for(let u of m)if(!(!u.trim()||u==="{}"||u==="[]"||u==="null"))try{let f=JSON.parse(u),h=o.parse(f);if(h.ok){if(i.push(h.value),e!==void 0&&i.length>=e)return n.releaseLock(),i}else j.error("Error parsing experiment item:",h.errors);}catch(f){j.error("Error parsing JSON line:",f instanceof Error?f.message:String(f));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let l=JSON.parse(a),c=o.parse(l);c.ok?i.push(c.value):j.error("Error parsing experiment item:",c.errors);}catch(l){j.error("Error parsing remaining buffer:",l instanceof Error?l.message:String(l));}}catch(l){j.error("Error processing stream:",l instanceof Error?l.message:String(l));}finally{n.releaseLock();}return i}function zi(s,o){let e=[];for(let t=0;t<s.length;t+=o.maxBatchSize)e.push(s.slice(t,t+o.maxBatchSize));return e}var cg=2e3;async function ki(s,o){let{datasetName:e,datasetVersion:t,nbSamples:i,lastRetrievedId:a}=o;if(i===0)return [];let n=[],p=i,l=a;for(;;){let c=Math.min(p!=null?p:cg,cg),d=await s.api.datasets.streamDatasetItems({datasetName:e,lastRetrievedId:l,steamLimit:c,datasetVersion:t}),m=await Ke(d,L.DatasetItemPublic,c);if(m.length===0)break;let u=m.map(f=>Xr.fromApiModel(f));if(n.push(...u),l=m[m.length-1].id,p!==void 0&&(p-=m.length,p<=0)||m.length<c)break}return n}var Pi=class{constructor(o,e,t,i){this.datasetName=o,this.datasetId=e,this.versionInfo=t,this.opik=i;}get name(){return this.datasetName}get id(){return this.datasetId}get versionId(){return this.versionInfo.id}get versionHash(){return this.versionInfo.versionHash}get versionName(){return this.versionInfo.versionName}get tags(){return this.versionInfo.tags}get isLatest(){return this.versionInfo.isLatest}get itemsTotal(){return this.versionInfo.itemsTotal}get itemsAdded(){return this.versionInfo.itemsAdded}get itemsModified(){return this.versionInfo.itemsModified}get itemsDeleted(){return this.versionInfo.itemsDeleted}get changeDescription(){return this.versionInfo.changeDescription}get createdAt(){return this.versionInfo.createdAt}get createdBy(){return this.versionInfo.createdBy}getVersionInfo(){return this.versionInfo}async getItems(o,e){return (await ki(this.opik,{datasetName:this.datasetName,datasetVersion:this.versionInfo.versionHash,nbSamples:o,lastRetrievedId:e})).map(i=>i.getContent(true))}async toJson(o={}){let t=(await this.getItems()).map(i=>{let a={...i};for(let[n,p]of Object.entries(o))if(n in a){let l=a[n];delete a[n],a[p]=l;}return a});return Dx__default.default(t)}};var ue=class extends Error{constructor(o){var e;super(o.message),this.name=this.constructor.name,this.code=o.code,this.statusCode=o.statusCode,this.details=o.details,this.originalError=o.originalError,j.error(this.message),(e=Error.captureStackTrace)==null||e.call(Error,this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,details:this.details,originalError:this.originalError,stack:this.stack}}};var af={DATASET_NOT_FOUND:s=>`Dataset with name '${s}' not found`,DATASET_ITEM_NOT_FOUND:s=>`Dataset item with id '${s}' not found`,DATASET_ITEM_MISSING_ID:s=>`Item at index ${s} is missing an ID required for update`,INVALID_JSON_FORMAT:s=>`Invalid JSON format${s?": "+s:""}`,JSON_NOT_ARRAY:"JSON input must be an array of objects",ITEM_NOT_OBJECT:(s,o)=>`Item at position ${s} is not an object (${o})`,INSERTION_FAILED:s=>`Failed to insert items from JSON: ${s}`,DATASET_JSON_PARSE_ERROR:s=>`Failed to parse JSON input: ${s}`,DATASET_VERSION_NOT_FOUND:(s,o)=>`Dataset version '${s}' not found in dataset '${o}'`};var lg={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID",DATASET_VERSION_NOT_FOUND:"DATASET_VERSION_NOT_FOUND"},Nn=class extends ue{constructor(o){super({message:af.DATASET_ITEM_MISSING_ID(o),code:lg.DATASET_ITEM_MISSING_ID});}},Si=class extends ue{constructor(o,e){super({message:af.DATASET_VERSION_NOT_FOUND(o,e),code:lg.DATASET_VERSION_NOT_FOUND});}};var Nx={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Mn=class extends ue{constructor(o){super({message:o,code:Nx.SEARCH_TIMEOUT});}};var Wn={JSON_NOT_ARRAY:s=>`JSON input must be an array of objects${s?` (${s})`:""}`,JSON_PARSE_ERROR:"Failed to parse JSON input",JSON_ITEM_NOT_OBJECT:(s,o)=>`Item at position ${s} is not an object (${o})`};var nf={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},Bn=class extends ue{constructor(o){let e=o instanceof Error?o:new Error(String(o));super({message:Wn.JSON_PARSE_ERROR,code:nf.JSON_PARSE_ERROR,originalError:e});}},Vn=class extends ue{constructor(o){super({message:Wn.JSON_NOT_ARRAY(o),code:nf.JSON_NOT_ARRAY});}},Ln=class extends ue{constructor(o,e){super({message:Wn.JSON_ITEM_NOT_OBJECT(o,e),code:nf.JSON_ITEM_NOT_OBJECT});}};var xr=class{constructor({name:o,description:e,id:t},i){this.opik=i;this.idToHash=new Map;this.hashes=new Set;this.id=t||ne(),this.name=o,this.description=e;}async insert(o){if(!o||o.length===0)return;await this.opik.datasetBatchQueue.flush(),await this.syncHashes();let e=await this.getDeduplicatedItems(o),t=zi(e,{maxBatchSize:1e3}),i=ne();try{let a=0;for(let n of t)await this.opik.api.datasets.createOrUpdateDatasetItems({datasetId:this.id,items:n,batchGroupId:i}),a+=n.length,j.info(`Inserted ${Math.min(a,e.length)} of ${e.length} items into dataset ${this.id}`);}catch(a){throw j.error(`Error inserting items into dataset: ${a instanceof Error?a.message:String(a)}`),a}}async update(o){if(!(!o||o.length===0)){for(let e=0;e<o.length;e++)if(!o[e].id)throw new Nn(e);await this.insert(o);}}async delete(o){if(!o||o.length===0){j.info("No item IDs provided for deletion");return}let e=zi(o,{maxBatchSize:100}),t=ne();for await(let i of e){j.debug("Deleting dataset items batch",{batchSize:i.length,datasetId:this.id}),await this.opik.api.datasets.deleteDatasetItems({itemIds:i,batchGroupId:t});for(let a of i)if(this.idToHash.has(a)){let n=this.idToHash.get(a);this.hashes.delete(n),this.idToHash.delete(a);}}}async clear(){let e=(await this.getItems()).map(t=>t.id).filter(Boolean);e.length!==0&&await this.delete(e);}async getItems(o,e){return (await ki(this.opik,{datasetName:this.name,nbSamples:o,lastRetrievedId:e})).map(i=>i.getContent(true))}async insertFromJson(o,e={},t=[]){let i;try{i=JSON.parse(o);}catch(n){throw new Bn(n)}if(!Array.isArray(i))throw new Vn(typeof i);if(i.length===0)return;for(let n=0;n<i.length;n++){let p=i[n];if(typeof p!="object"||p===null)throw new Ln(n,typeof p)}let a=i.map(n=>{let p=n,l={};for(let[c,d]of Object.entries(p)){if(t.includes(c))continue;let m=e[c]||c;l[m]=d;}return l});await this.insert(a);}async toJson(o={}){let t=(await this.getItems()).map(i=>{let a={...i};for(let[n,p]of Object.entries(o))if(n in a){let l=a[n];delete a[n],a[p]=l;}return a});return Dx__default.default(t)}async getDeduplicatedItems(o){let e=[];for(let t of o){let i=new Xr(t),a=await i.contentHash();if(this.hashes.has(a)){j.debug("Duplicate item found - skipping",{contentHash:a,datasetId:this.id});continue}e.push(i.toApiModel()),this.hashes.add(a),this.idToHash.set(i.id,a);}return e}clearHashState(){this.idToHash.clear(),this.hashes.clear();}async syncHashes(){j.debug("Syncing dataset hashes with backend",{datasetId:this.id});try{let o=await ki(this.opik,{datasetName:this.name});this.clearHashState();for(let e of o){let t=await e.contentHash();this.idToHash.set(e.id,t),this.hashes.add(t);}j.debug("Dataset hash sync completed",{datasetId:this.id,itemCount:o.length});}catch(o){if(o instanceof w&&o.statusCode===404){j.debug("Dataset not found - starting with empty hash state",{datasetId:this.id}),this.clearHashState();return}throw o}}async getVersionView(o){let e=await this.findVersionByName(o);if(!e)throw new Si(o,this.name);return new Pi(this.name,this.id,e,this.opik)}async getCurrentVersionName(){let o=await this.getVersionInfo();return o==null?void 0:o.versionName}async getVersionInfo(){var o;try{let t=(o=(await this.opik.api.datasets.listDatasetVersions(this.id,{page:1,size:1})).content)!=null?o:[];return t.length===0?void 0:t[0]}catch(e){if(e instanceof w&&e.statusCode===404)return;throw e}}async findVersionByName(o){try{return await this.opik.api.datasets.retrieveDatasetVersion(this.id,{versionName:o})}catch(e){if(e instanceof w&&e.statusCode===404)return;throw e}}};var sf=class extends Error{constructor(o){super(o),this.name="DatasetError";}},Ai=class extends sf{constructor(o){super(`Dataset with name '${o}' not found`),this.name="DatasetNotFoundError";}};var Hn=class{constructor(o){if(!o.datasetItemId)throw new Error("datasetItemId is required");if(!o.traceId)throw new Error("traceId is required");this.datasetItemId=o.datasetItemId,this.traceId=o.traceId;}},Jn=class s{constructor(o){this.id=o.id,this.datasetItemId=o.datasetItemId,this.traceId=o.traceId,this.datasetItemData=o.datasetItemData,this.evaluationTaskOutput=o.evaluationTaskOutput,this.feedbackScores=[...o.feedbackScores];}static fromRestExperimentItemCompare(o){var t,i;let e=(i=(t=o.feedbackScores)==null?void 0:t.map(a=>({categoryName:a.categoryName,name:a.name,reason:a.reason,value:a.value,source:a.source})))!=null?i:[];return new s({id:o.id,traceId:o.traceId,datasetItemId:o.datasetItemId,datasetItemData:o.input,evaluationTaskOutput:o.output,feedbackScores:e})}};var wr=class{constructor({id:o,name:e,datasetName:t,prompts:i},a){this.opik=a;this.id=o||ne(),this._name=e,this.datasetName=t,this.prompts=i;}get name(){return this._name}async ensureNameLoaded(){if(this._name!==void 0)return this._name;let o=await this.opik.api.experiments.getExperimentById(this.id);if(this._name=o.name,!this._name)throw new Error("Experiment name is not loaded");return this._name}async insert(o){if(o.length===0)return;let e=o.map(i=>({id:ne(),experimentId:this.id,datasetItemId:i.datasetItemId,traceId:i.traceId})),t=zi(e,{maxBatchSize:50});try{for(let i of t)await this.opik.api.experiments.createExperimentItems({experimentItems:i});j.debug(`Inserted ${o.length} items into experiment ${this.id}`);}catch(i){throw j.error(`Error inserting items into experiment: ${i instanceof Error?i.message:String(i)}`),i}}async getItems(o){let e=[],{maxResults:i,truncate:a=false}=o||{},n,p=true;try{for(;p&&!(i!==void 0&&e.length>=i);){let l=i?Math.min(i-e.length,2e3):2e3,c=await this.opik.api.experiments.streamExperimentItems({experimentName:this.name,limit:l,lastRetrievedId:n,truncate:a});try{let d=await Ke(c,L.ExperimentItemCompare,l);if(d.length===0){p=!1;break}for(let m of d){let u=Jn.fromRestExperimentItemCompare(m);if(e.push(u),i!==void 0&&e.length>=i){p=!1;break}}n=d[d.length-1].id;}catch(d){j.error("Error parsing experiment item: "+(d instanceof Error?d.message:String(d))),p=!1;break}}}catch(l){throw j.error("Error retrieving experiment items: "+(l instanceof Error?l.message:String(l))),l}return j.info(`Retrieved ${e.length} items${i?` (limited by maxResults=${i})`:""}`),e}async getUrl(){let o=await this.opik.getDataset(this.datasetName),e=this.opik.config.apiUrl||ps.apiUrl;return ng({datasetId:o.id,experimentId:this.id,baseUrl:e})}};var Gn={EXPERIMENT_NOT_FOUND:s=>`Experiment with name '${s}' not found`,INVALID_CONFIG_TYPE:s=>`experimentConfig must be a plain object, but ${s} was provided. Please provide a valid configuration object like { model: 'gpt-4', temperature: 0.7 }`,CONFIG_PROMPTS_CONFLICT:()=>`Cannot specify both 'prompts' parameter and 'experimentConfig.prompts'. Choose one approach:
|
|
1
|
+
'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),Nf=require('fs'),Mf=require('os'),_y=require('path'),zy=require('ini');require('dotenv/config');var uuid=require('uuid'),Jw=require('fast-json-stable-stringify'),Hw=require('xxhash-wasm'),util=require('util'),Yw=require('mustache'),Ow=require('nunjucks'),dateFns=require('date-fns'),jestDiff=require('jest-diff'),rR=require('fast-deep-equal'),async_hooks=require('async_hooks'),os=require('chalk'),dR=require('boxen'),uR=require('ora'),ai$1=require('ai'),openai=require('@ai-sdk/openai'),anthropic=require('@ai-sdk/anthropic'),google=require('@ai-sdk/google'),zod=require('zod');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Nf__default=/*#__PURE__*/_interopDefault(Nf);var Mf__default=/*#__PURE__*/_interopDefault(Mf);var _y__default=/*#__PURE__*/_interopDefault(_y);var zy__default=/*#__PURE__*/_interopDefault(zy);var Jw__default=/*#__PURE__*/_interopDefault(Jw);var Hw__default=/*#__PURE__*/_interopDefault(Hw);var Yw__default=/*#__PURE__*/_interopDefault(Yw);var Ow__default=/*#__PURE__*/_interopDefault(Ow);var rR__default=/*#__PURE__*/_interopDefault(rR);var os__default=/*#__PURE__*/_interopDefault(os);var dR__default=/*#__PURE__*/_interopDefault(dR);var uR__default=/*#__PURE__*/_interopDefault(uR);var dy=Object.create;var Hi=Object.defineProperty;var uy=Object.getOwnPropertyDescriptor;var Ef=(n,o)=>(o=Symbol[n])?o:Symbol.for("Symbol."+n),dt=n=>{throw TypeError(n)};var fy=(n,o,e)=>o in n?Hi(n,o,{enumerable:true,configurable:true,writable:true,value:e}):n[o]=e;var W=(n,o)=>{for(var e in o)Hi(n,e,{get:o[e],enumerable:true});};var Cf=n=>{var o;return [,,,dy((o=void 0)!=null?o:null)]},If=["class","method","getter","setter","accessor","field","value","get","set"],mt=n=>n!==void 0&&typeof n!="function"?dt("Function expected"):n,hy=(n,o,e,t,i)=>({kind:If[n],name:o,metadata:t,addInitializer:a=>e._?dt("Already initialized"):i.push(mt(a||null))}),us=(n,o)=>fy(o,Ef("metadata"),n[3]),Df=(n,o,e,t)=>{for(var i=0,a=n[o>>1],s=a&&a.length;i<s;i++)a[i].call(e);return t},Uf=(n,o,e,t,i,a)=>{var p,l,c,d,m=o&7,u=false,f=false,h=2,g=If[m+5],T=n[h]||(n[h]=[]),j=((i=i.prototype),uy(i,e));for(var E=t.length-1;E>=0;E--)c=hy(m,e,l={},n[3],T),(c.static=u,c.private=f,d=c.access={has:C=>e in C},(d.get=C=>C[e]),m>2),p=(0, t[E])(j[g],c),l._=1,mt(p)&&(j[g]=p);return j&&Hi(i,e,j),i};var wy={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Ji(n,o=n){return ansiEscapes.link(o,n)}var v=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Ff=n=>{v.settings.minLevel=wy[n];},Ry=()=>{v.settings.minLevel=100;};Ff(process.env.OPIK_LOG_LEVEL||"INFO");var ky=_y__default.default.join(Mf__default.default.homedir(),".opik.config"),hs={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function Wf(n){return Object.fromEntries(Object.entries(n).filter(([,o])=>o!==void 0))}function Py(){return Wf({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE,batchDelayMs:process.env.OPIK_BATCH_DELAY_MS?Number(process.env.OPIK_BATCH_DELAY_MS):void 0,holdUntilFlush:process.env.OPIK_HOLD_UNTIL_FLUSH===void 0?void 0:["1","true","yes"].includes(String(process.env.OPIK_HOLD_UNTIL_FLUSH).toLowerCase())})}function Sy(n){return n.replace(/^~(?=$|\/|\\)/,Mf__default.default.homedir())}function Ay(){let n=process.env.OPIK_CONFIG_PATH||ky,o=Sy(n);if(!Nf__default.default.existsSync(o)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${o}`);return {}}try{let e=zy__default.default.parse(Nf__default.default.readFileSync(o,"utf8"));return e.opik?Wf({apiKey:e.opik.api_key,apiUrl:e.opik.url_override,projectName:e.opik.project_name,workspaceName:e.opik.workspace}):{}}catch(e){return v.error(`Error loading config file ${o}: ${e}`),{}}}function Bf(n){let o=Py(),e=Ay(),{headers:t,...i}=n||{};return Ty({...hs,...e,...o,...i})}function Ty(n){if(!n.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let o=vy(n.apiUrl);if(o&&!n.apiKey)throw new Error("OPIK_API_KEY is not set");if(o&&!n.workspaceName)throw new Error("OPIK_WORKSPACE is not set");return n}function vy(n){return new URL(n).hostname.endsWith("comet.com")}var ee={};W(ee,{AlertAlertType:()=>Ey,AlertPublicAlertType:()=>Cy,AlertTriggerConfigPublicType:()=>Iy,AlertTriggerConfigType:()=>Dy,AlertTriggerConfigWriteType:()=>Uy,AlertTriggerEventType:()=>Fy,AlertTriggerPublicEventType:()=>Ny,AlertTriggerWriteEventType:()=>My,AlertWriteAlertType:()=>Wy,AnnotationQueuePublicScope:()=>By,AnnotationQueueScope:()=>Vy,AnnotationQueueWriteScope:()=>Ly,AssistantMessageRole:()=>Hy,AttachmentListRequestEntityType:()=>Lf,AutomationRuleEvaluatorAction:()=>Jy,AutomationRuleEvaluatorObjectObjectPublicAction:()=>Gy,AutomationRuleEvaluatorPublicAction:()=>Ky,AutomationRuleEvaluatorUpdateAction:()=>$y,AutomationRuleEvaluatorWriteAction:()=>Qy,BadGatewayError:()=>ft,BadRequestError:()=>D,BreakdownConfigPublicField:()=>Yy,CheckName:()=>Xy,CheckPublicName:()=>Zy,CheckPublicResult:()=>Oy,CheckResult:()=>qy,ColumnCompareTypesItem:()=>eb,ColumnPublicTypesItem:()=>rb,ColumnTypesItem:()=>tb,CompleteMultipartUploadRequestEntityType:()=>ob,ConflictError:()=>$,CreatePromptVersionDetailTemplateStructure:()=>oh,DatasetExportJobPublicStatus:()=>ib,DatasetItemCompareSource:()=>ab,DatasetItemFilterOperator:()=>nb,DatasetItemPublicSource:()=>sb,DatasetItemSource:()=>pb,DatasetItemWriteSource:()=>Es,DatasetPublicStatus:()=>cb,DatasetPublicVisibility:()=>lb,DatasetStatus:()=>mb,DatasetUpdateVisibility:()=>Kf,DatasetVisibility:()=>db,DatasetWriteVisibility:()=>$f,DeleteAttachmentsRequestEntityType:()=>ub,DownloadAttachmentRequestEntityType:()=>Hf,ExperimentItemCompareTraceVisibilityMode:()=>fb,ExperimentItemPublicTraceVisibilityMode:()=>hb,ExperimentItemTraceVisibilityMode:()=>gb,ExperimentPublicStatus:()=>yb,ExperimentPublicType:()=>bb,ExperimentStatus:()=>xb,ExperimentType:()=>Cs,ExperimentUpdateStatus:()=>wb,ExperimentUpdateType:()=>Rb,ExperimentWriteStatus:()=>Qf,ExperimentWriteType:()=>Yf,FeedbackScoreBatchItemSource:()=>Is,FeedbackScoreBatchItemThreadSource:()=>_b,FeedbackScoreCompareSource:()=>zb,FeedbackScoreExperimentItemBulkWriteViewSource:()=>kb,FeedbackScorePublicSource:()=>Pb,FeedbackScoreSource:()=>Sb,FindFeedbackDefinitionsRequestType:()=>Xf,FindFeedbackScoreNames1RequestType:()=>nh,ForbiddenError:()=>se,GetSpanStatsRequestType:()=>sh,GetSpansByProjectRequestType:()=>ph,GetWebhookExamplesRequestAlertType:()=>Vf,GuardrailName:()=>Ab,GuardrailResult:()=>Tb,GuardrailWriteName:()=>vb,GuardrailWriteResult:()=>jb,InternalServerError:()=>ht,LlmAsJudgeMessagePublicRole:()=>Eb,LlmAsJudgeMessageRole:()=>Cb,LlmAsJudgeMessageWriteRole:()=>Ib,LlmAsJudgeOutputSchemaPublicType:()=>Db,LlmAsJudgeOutputSchemaType:()=>Ub,LlmAsJudgeOutputSchemaWriteType:()=>Fb,LogItemLevel:()=>Nb,ManualEvaluationRequestEntityType:()=>Mb,NotFoundError:()=>I,NotImplementedError:()=>or,OptimizationPublicStatus:()=>Wb,OptimizationStatus:()=>Bb,OptimizationUpdateStatus:()=>Of,OptimizationWriteStatus:()=>Vb,ProjectDetailedVisibility:()=>Lb,ProjectMetricRequestPublicInterval:()=>qf,ProjectMetricRequestPublicMetricType:()=>eh,ProjectMetricResponsePublicInterval:()=>Hb,ProjectMetricResponsePublicMetricType:()=>Jb,ProjectPublicVisibility:()=>Gb,ProjectUpdateVisibility:()=>rh,ProjectVisibility:()=>Kb,ProjectWriteVisibility:()=>th,PromptDetailTemplateStructure:()=>$b,PromptPublicTemplateStructure:()=>Qb,PromptTemplateStructure:()=>Yb,PromptType:()=>Xb,PromptVersionDetailTemplateStructure:()=>Zb,PromptVersionDetailType:()=>Ob,PromptVersionPublicTemplateStructure:()=>qb,PromptVersionPublicType:()=>ex,PromptVersionTemplateStructure:()=>rx,PromptVersionType:()=>tx,PromptWriteTemplateStructure:()=>ih,PromptWriteType:()=>ah,ProviderApiKeyProvider:()=>ox,ProviderApiKeyPublicProvider:()=>ix,ProviderApiKeyWriteProvider:()=>Zf,ResponseFormatType:()=>ax,ServiceUnavailableError:()=>jr,SpanExperimentItemBulkWriteViewType:()=>nx,SpanFilterOperator:()=>sx,SpanFilterPublicOperator:()=>px,SpanFilterWriteOperator:()=>cx,SpanPublicType:()=>lx,SpanSearchStreamRequestPublicType:()=>ch,SpanType:()=>Ie,SpanUpdateType:()=>mx,SpanWriteType:()=>dx,StartMultipartUploadRequestEntityType:()=>Jf,ToolCallType:()=>ux,ToolType:()=>fx,TraceFilterOperator:()=>hx,TraceFilterPublicOperator:()=>gx,TraceFilterWriteOperator:()=>yx,TracePublicVisibilityMode:()=>bx,TraceThreadFilterOperator:()=>xx,TraceThreadFilterPublicOperator:()=>wx,TraceThreadFilterWriteOperator:()=>Rx,TraceThreadStatus:()=>_x,TraceVisibilityMode:()=>zx,UnauthorizedError:()=>re,UnprocessableEntityError:()=>Q,UploadAttachmentRequestEntityType:()=>Gf,ValueEntryCompareSource:()=>kx,ValueEntryExperimentItemBulkWriteViewSource:()=>Px,ValueEntryPublicSource:()=>Sx,ValueEntrySource:()=>Ax,WebhookTestResultStatus:()=>Tx,alerts:()=>Gi,annotationQueues:()=>gs,attachments:()=>Ki,automationRuleEvaluators:()=>ys,chatCompletions:()=>bs,check:()=>xs,dashboards:()=>ws,datasets:()=>$i,experiments:()=>Qi,feedbackDefinitions:()=>Yi,guardrails:()=>Rs,llmProviderKey:()=>Xi,manualEvaluation:()=>_s,ollama:()=>zs,openTelemetryIngestion:()=>ks,optimizations:()=>Zi,projects:()=>Oi,prompts:()=>qi,redirect:()=>Ps,serviceToggles:()=>Ss,spans:()=>ea,systemUsage:()=>As,traces:()=>Ts,welcomeWizard:()=>vs,workspaces:()=>js});var Pe=(n,o,e)=>JSON.stringify(n,o,e);function ut(n,o){return JSON.parse(n,o)}var R=class extends Error{constructor({message:o,statusCode:e,body:t,rawResponse:i}){super(jy({message:o,statusCode:e,body:t})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=e,this.body=t,this.rawResponse=i;}};function jy({message:n,statusCode:o,body:e}){let t=[];return n!=null&&t.push(n),o!=null&&t.push(`Status code: ${o.toString()}`),e!=null&&t.push(`Body: ${Pe(e,void 0,2)}`),t.join(`
|
|
2
|
+
`)}var vr=class extends Error{constructor(o){super(o),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var ft=class extends R{constructor(o,e){super({message:"BadGatewayError",statusCode:502,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var D=class extends R{constructor(o,e){super({message:"BadRequestError",statusCode:400,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var $=class extends R{constructor(o,e){super({message:"ConflictError",statusCode:409,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var se=class extends R{constructor(o,e){super({message:"ForbiddenError",statusCode:403,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var ht=class extends R{constructor(o,e){super({message:"InternalServerError",statusCode:500,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var I=class extends R{constructor(o,e){super({message:"NotFoundError",statusCode:404,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var or=class extends R{constructor(o,e){super({message:"NotImplementedError",statusCode:501,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var jr=class extends R{constructor(o,e){super({message:"ServiceUnavailableError",statusCode:503,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var re=class extends R{constructor(o,e){super({message:"UnauthorizedError",statusCode:401,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var Q=class extends R{constructor(o,e){super({message:"UnprocessableEntityError",statusCode:422,body:o,rawResponse:e}),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};var Gi={};W(Gi,{GetWebhookExamplesRequestAlertType:()=>Vf});var Vf={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var gs={};var Ki={};W(Ki,{AttachmentListRequestEntityType:()=>Lf,DownloadAttachmentRequestEntityType:()=>Hf,StartMultipartUploadRequestEntityType:()=>Jf,UploadAttachmentRequestEntityType:()=>Gf});var Lf={Trace:"trace",Span:"span"};var Hf={Trace:"trace",Span:"span"};var Jf={Trace:"trace",Span:"span"};var Gf={Trace:"trace",Span:"span"};var ys={};var bs={};var xs={};var ws={};var $i={};W($i,{DatasetUpdateVisibility:()=>Kf,DatasetWriteVisibility:()=>$f});var Kf={Private:"private",Public:"public"};var $f={Private:"private",Public:"public"};var Qi={};W(Qi,{ExperimentWriteStatus:()=>Qf,ExperimentWriteType:()=>Yf});var Qf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Yf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Yi={};W(Yi,{FindFeedbackDefinitionsRequestType:()=>Xf});var Xf={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var Rs={};var Xi={};W(Xi,{ProviderApiKeyWriteProvider:()=>Zf});var Zf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var _s={};var zs={};var ks={};var Zi={};W(Zi,{OptimizationUpdateStatus:()=>Of});var Of={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Oi={};W(Oi,{ProjectMetricRequestPublicInterval:()=>qf,ProjectMetricRequestPublicMetricType:()=>eh,ProjectUpdateVisibility:()=>rh,ProjectWriteVisibility:()=>th});var qf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var eh={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES",SpanFeedbackScores:"SPAN_FEEDBACK_SCORES",SpanCount:"SPAN_COUNT",SpanDuration:"SPAN_DURATION",SpanTokenUsage:"SPAN_TOKEN_USAGE"};var rh={Private:"private",Public:"public"};var th={Private:"private",Public:"public"};var qi={};W(qi,{CreatePromptVersionDetailTemplateStructure:()=>oh,PromptWriteTemplateStructure:()=>ih,PromptWriteType:()=>ah});var oh={Text:"text",Chat:"chat"};var ih={Text:"text",Chat:"chat"};var ah={Mustache:"mustache",Jinja2:"jinja2"};var Ps={};var Ss={};var ea={};W(ea,{FindFeedbackScoreNames1RequestType:()=>nh,GetSpanStatsRequestType:()=>sh,GetSpansByProjectRequestType:()=>ph,SpanSearchStreamRequestPublicType:()=>ch});var nh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var sh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ph={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ch={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var As={};var Ts={};var vs={};var js={};var Ey={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Cy={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Iy={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Dy={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Uy={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Fy={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Ny={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var My={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Wy={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var By={Trace:"trace",Thread:"thread"};var Vy={Trace:"trace",Thread:"thread"};var Ly={Trace:"trace",Thread:"thread"};var Hy={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Jy={Evaluator:"evaluator"};var Gy={Evaluator:"evaluator"};var Ky={Evaluator:"evaluator"};var $y={Evaluator:"evaluator"};var Qy={Evaluator:"evaluator"};var Yy={None:"none",Tags:"tags",Metadata:"metadata",Name:"name",ErrorInfo:"error_info",Model:"model",Provider:"provider",Type:"type"};var Xy={Topic:"TOPIC",Pii:"PII"};var Zy={Topic:"TOPIC",Pii:"PII"};var Oy={Passed:"passed",Failed:"failed"};var qy={Passed:"passed",Failed:"failed"};var eb={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var rb={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var tb={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var ob={Trace:"trace",Span:"span"};var ib={Pending:"PENDING",Processing:"PROCESSING",Completed:"COMPLETED",Failed:"FAILED"};var ab={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var nb={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 sb={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var pb={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Es={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var cb={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var lb={Private:"private",Public:"public"};var mb={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var db={Private:"private",Public:"public"};var ub={Trace:"trace",Span:"span"};var fb={Default:"default",Hidden:"hidden"};var hb={Default:"default",Hidden:"hidden"};var gb={Default:"default",Hidden:"hidden"};var yb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var bb={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var xb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Cs={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var wb={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Rb={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Is={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var _b={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var zb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var kb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Pb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Sb={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ab={Topic:"TOPIC",Pii:"PII"};var Tb={Passed:"passed",Failed:"failed"};var vb={Topic:"TOPIC",Pii:"PII"};var jb={Passed:"passed",Failed:"failed"};var Eb={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Cb={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Ib={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Db={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ub={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Fb={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Nb={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Mb={Trace:"trace",Thread:"thread",Span:"span"};var Wb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Bb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Vb={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Lb={Private:"private",Public:"public"};var Hb={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Jb={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES",SpanFeedbackScores:"SPAN_FEEDBACK_SCORES",SpanCount:"SPAN_COUNT",SpanDuration:"SPAN_DURATION",SpanTokenUsage:"SPAN_TOKEN_USAGE"};var Gb={Private:"private",Public:"public"};var Kb={Private:"private",Public:"public"};var $b={Text:"text",Chat:"chat"};var Qb={Text:"text",Chat:"chat"};var Yb={Text:"text",Chat:"chat"};var Xb={Mustache:"mustache",Jinja2:"jinja2"};var Zb={Text:"text",Chat:"chat"};var Ob={Mustache:"mustache",Jinja2:"jinja2"};var qb={Text:"text",Chat:"chat"};var ex={Mustache:"mustache",Jinja2:"jinja2"};var rx={Text:"text",Chat:"chat"};var tx={Mustache:"mustache",Jinja2:"jinja2"};var ox={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var ix={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",Bedrock:"bedrock",Ollama:"ollama",CustomLlm:"custom-llm",OpikFree:"opik-free"};var ax={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var nx={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var sx={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 px={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 cx={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 lx={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Ie={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var mx={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var dx={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ux={Function:"function"};var fx={Function:"function"};var hx={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 gx={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 yx={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 bx={Default:"default",Hidden:"hidden"};var xx={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 wx={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 Rx={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 _x={Active:"active",Inactive:"inactive"};var zx={Default:"default",Hidden:"hidden"};var kx={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Px={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Sx={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ax={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Tx={Success:"success",Failure:"failure"};function z(...n){let o={};for(let[e,t]of n.filter(i=>i!=null).flatMap(i=>Object.entries(i))){let i=e.toLowerCase();t!=null?o[i]=t:i in o&&delete o[i];}return o}function S(...n){let o={};for(let[e,t]of n.filter(i=>i!=null).flatMap(i=>Object.entries(i))){let i=e.toLowerCase();t!=null&&(o[i]=t);}return o}var Ds={get:async(n,o)=>typeof n=="function"?n(o):n};var he={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},lh={[he.Debug]:1,[he.Info]:2,[he.Warn]:3,[he.Error]:4},ir=class{debug(o,...e){console.debug(o,...e);}info(o,...e){console.info(o,...e);}warn(o,...e){console.warn(o,...e);}error(o,...e){console.error(o,...e);}},Er=class{constructor(o){this.level=lh[o.level],this.logger=o.logger,this.silent=o.silent;}shouldLog(o){return !this.silent&&this.level<=lh[o]}isDebug(){return this.shouldLog(he.Debug)}debug(o,...e){this.isDebug()&&this.logger.debug(o,...e);}isInfo(){return this.shouldLog(he.Info)}info(o,...e){this.isInfo()&&this.logger.info(o,...e);}isWarn(){return this.shouldLog(he.Warn)}warn(o,...e){this.isWarn()&&this.logger.warn(o,...e);}isError(){return this.shouldLog(he.Error)}error(o,...e){this.isError()&&this.logger.error(o,...e);}};function Us(n){return n==null?vx:n instanceof Er?n:(n=n!=null?n:{},(n.level)!=null||(n.level=he.Info),(n.logger)!=null||(n.logger=new ir),(n.silent)!=null||(n.silent=true),new Er(n))}var vx=new Er({level:he.Info,logger:new ir,silent:true});var Ex={arrayFormat:"indices",encode:true};function mh(n,o){if(n===void 0||n===null)return "";let e=String(n);return o?encodeURIComponent(e):e}function Fs(n,o="",e){let t=[];for(let[i,a]of Object.entries(n)){let s=o?`${o}[${i}]`:i;if(a!==void 0)if(Array.isArray(a)){if(a.length===0)continue;for(let p=0;p<a.length;p++){let l=a[p];if(l!==void 0)if(typeof l=="object"&&!Array.isArray(l)&&l!==null){let c=e.arrayFormat==="indices"?`${s}[${p}]`:s;t.push(...Fs(l,c,e));}else {let c=e.arrayFormat==="indices"?`${s}[${p}]`:s,d=e.encode?encodeURIComponent(c):c;t.push(`${d}=${mh(l,e.encode)}`);}}}else if(typeof a=="object"&&a!==null){if(Object.keys(a).length===0)continue;t.push(...Fs(a,s,e));}else {let p=e.encode?encodeURIComponent(s):s;t.push(`${p}=${mh(a,e.encode)}`);}}return t}function ar(n,o){return n==null||typeof n!="object"?"":Fs(n,"",{...Ex,...o}).join("&")}function dh(n,o){let e=ar(o,{arrayFormat:"repeat"});return e?`${n}?${e}`:n}function uh(n){let o={get bodyUsed(){return n.bodyUsed},stream:()=>n.body,arrayBuffer:n.arrayBuffer.bind(n),blob:n.blob.bind(n)};return "bytes"in n&&typeof n.bytes=="function"&&(o.bytes=n.bytes.bind(n)),o}async function ra(n,o){switch(o){case "binary-response":return uh(n);case "blob":return await n.blob();case "arrayBuffer":return await n.arrayBuffer();case "sse":return n.body==null?{ok:false,error:{reason:"body-is-null",statusCode:n.status}}:n.body;case "streaming":return n.body==null?{ok:false,error:{reason:"body-is-null",statusCode:n.status}}:n.body;case "text":return await n.text()}let e=await n.text();if(e.length>0)try{return ut(e)}catch{return {ok:false,error:{reason:"non-json",statusCode:n.status,rawBody:e}}}}async function fh(n){var e,t,i;let o=(e=n.headers.get("Content-Type"))==null?void 0:e.toLowerCase();if(o==null||o.length===0)return ra(n);switch(o.indexOf(";")!==-1&&(o=(i=(t=o.split(";")[0])==null?void 0:t.trim())!=null?i:""),o){case "application/hal+json":case "application/json":case "application/ld+json":case "application/problem+json":case "application/vnd.api+json":case "text/json":{let a=await n.text();return a.length>0?ut(a):void 0}default:if(o.startsWith("application/vnd.")&&o.endsWith("+json")){let a=await n.text();return a.length>0?ut(a):void 0}return await n.text()}}async function hh(){return fetch}async function gh({body:n,type:o}){return o==="form"?ar(n,{arrayFormat:"repeat",encode:true}):o.includes("json")?Pe(n):n}var Je;typeof globalThis.Headers!="undefined"?Je=globalThis.Headers:Je=class yh{constructor(o){if(this.headers=new Map,o)if(o instanceof yh)o.forEach((e,t)=>this.append(t,e));else if(Array.isArray(o))for(let[e,t]of o)if(typeof e=="string"&&typeof t=="string")this.append(e,t);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[e,t]of Object.entries(o))if(typeof t=="string")this.append(e,t);else throw new TypeError("Header values must be strings")}append(o,e){let t=o.toLowerCase(),i=this.headers.get(t)||[];this.headers.set(t,[...i,e]);}delete(o){let e=o.toLowerCase();this.headers.delete(e);}get(o){let e=o.toLowerCase(),t=this.headers.get(e);return t?t.join(", "):null}has(o){let e=o.toLowerCase();return this.headers.has(e)}set(o,e){let t=o.toLowerCase();this.headers.set(t,[e]);}forEach(o,e){let t=e?o.bind(e):o;this.headers.forEach((i,a)=>t(i.join(", "),a,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[o,e]of this.headers.entries())yield [o,e.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let o of this.headers.values())yield o.join(", ");}[Symbol.iterator](){return this.entries()}};var Cx="timeout";function bh(n){let o=new AbortController,e=setTimeout(()=>o.abort(Cx),n);return {signal:o.signal,abortId:e}}function xh(...n){let o=n.length===1&&Array.isArray(n[0])?n[0]:n,e=new AbortController;for(let t of o){if(t.aborted){e.abort(t==null?void 0:t.reason);break}t.addEventListener("abort",()=>e.abort(t==null?void 0:t.reason),{signal:e.signal});}return e.signal}var wh=async(n,o,e,t,i,a,s,p,l)=>{let c=[],d;if(a!=null){let{signal:f,abortId:h}=bh(a);d=h,c.push(f);}s!=null&&c.push(s);let m=xh(c),u=await n(o,{method:e,headers:t,body:i,signal:m,credentials:p?"include":void 0,duplex:l});return d!=null&&clearTimeout(d),u};var ta={headers:new Je,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},oa={headers:new Je,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function ia(n){return {headers:n.headers,redirected:n.redirected,status:n.status,statusText:n.statusText,type:n.type,url:n.url}}function Ix(n){let o=1+Math.random()*.2;return n*o}function Dx(n){let o=1+(Math.random()-.5)*.2;return n*o}function Ux(n,o){let e=n.headers.get("Retry-After");if(e){let i=parseInt(e,10);if(!Number.isNaN(i)&&i>0)return Math.min(i*1e3,6e4);let a=new Date(e);if(!Number.isNaN(a.getTime())){let s=a.getTime()-Date.now();if(s>0)return Math.min(Math.max(s,0),6e4)}}let t=n.headers.get("X-RateLimit-Reset");if(t){let i=parseInt(t,10);if(!Number.isNaN(i)){let a=i*1e3-Date.now();if(a>0)return Ix(Math.min(a,6e4))}}return Dx(Math.min(1e3*2**o,6e4))}async function Rh(n,o=2){let e=await n();for(let t=0;t<o&&([408,429].includes(e.status)||e.status>=500);++t){let i=Ux(e,t);await new Promise(a=>setTimeout(a,i)),e=await n();}return e}var Fx=new Set(["authorization","www-authenticate","x-api-key","api-key","apikey","x-api-token","x-auth-token","auth-token","cookie","set-cookie","proxy-authorization","proxy-authenticate","x-csrf-token","x-xsrf-token","x-session-token","x-access-token"]);function Ns(n){let o={};for(let[e,t]of n instanceof Je?n.entries():Object.entries(n))Fx.has(e.toLowerCase())?o[e]="[REDACTED]":o[e]=t;return o}var Ms=new Set(["api_key","api-key","apikey","token","access_token","access-token","auth_token","auth-token","password","passwd","secret","api_secret","api-secret","apisecret","key","session","session_id","session-id"]);function Nx(n){if(n==null)return n;let o={};for(let[e,t]of Object.entries(n))Ms.has(e.toLowerCase())?o[e]="[REDACTED]":o[e]=t;return o}function nr(n){let o=n.indexOf("://");if(o===-1)return n;let e=o+3,t=n.indexOf("/",e),i=n.indexOf("?",e),a=n.indexOf("#",e),s=Math.min(t===-1?n.length:t,i===-1?n.length:i,a===-1?n.length:a),p=-1;for(let h=e;h<s;h++)n[h]==="@"&&(p=h);if(p!==-1&&(n=`${n.slice(0,e)}[REDACTED]@${n.slice(p+1)}`),i=n.indexOf("?"),i===-1)return n;a=n.indexOf("#",i);let l=a!==-1?a:n.length,c=n.slice(i+1,l);if(c.length===0)return n;let d=c.toLowerCase();if(!(d.includes("token")||d.includes("key")||d.includes("password")||d.includes("passwd")||d.includes("secret")||d.includes("session")||d.includes("auth")))return n;let u=[],f=c.split("&");for(let h of f){let g=h.indexOf("=");if(g===-1){u.push(h);continue}let x=h.slice(0,g),T=Ms.has(x.toLowerCase());if(!T&&x.includes("%"))try{let j=decodeURIComponent(x);T=Ms.has(j.toLowerCase());}catch{}u.push(T?`${x}=[REDACTED]`:h);}return n.slice(0,i+1)+u.join("&")+n.slice(l)}async function Mx(n){var e;let o=new Je;if(o.set("Accept",n.responseType==="json"?"application/json":n.responseType==="text"?"text/plain":"*/*"),n.body!==void 0&&n.contentType!=null&&o.set("Content-Type",n.contentType),n.headers==null)return o;for(let[t,i]of Object.entries(n.headers)){let a=await Ds.get(i,{endpointMetadata:(e=n.endpointMetadata)!=null?e:{}});if(typeof a=="string"){o.set(t,a);continue}a!=null&&o.set(t,`${a}`);}return o}async function Wx(n){var s,p,l;let o=dh(n.url,n.queryParameters),e=await gh({body:n.body,type:(s=n.requestType)!=null?s:"other"}),t=(p=n.fetchFn)!=null?p:await hh(),i=await Mx(n),a=Us(n.logging);if(a.isDebug()){let c={method:n.method,url:nr(o),headers:Ns(i),queryParameters:Nx(n.queryParameters),hasBody:e!=null};a.debug("Making HTTP request",c);}try{let c=await Rh(async()=>wh(t,o,n.method,i,e,n.timeoutMs,n.abortSignal,n.withCredentials,n.duplex),n.maxRetries);if(c.status>=200&&c.status<400){if(a.isDebug()){let m={method:n.method,url:nr(o),statusCode:c.status,responseHeaders:Ns(c.headers)};a.debug("HTTP request succeeded",m);}return {ok:!0,body:await ra(c,n.responseType),headers:c.headers,rawResponse:ia(c)}}else {if(a.isError()){let d={method:n.method,url:nr(o),statusCode:c.status,responseHeaders:Ns(Object.fromEntries(c.headers.entries()))};a.error("HTTP request failed with error status",d);}return {ok:!1,error:{reason:"status-code",statusCode:c.status,body:await fh(c)},rawResponse:ia(c)}}}catch(c){if((l=n.abortSignal)!=null&&l.aborted){if(a.isError()){let d={method:n.method,url:nr(o)};a.error("HTTP request was aborted",d);}return {ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ta}}else if(c instanceof Error&&c.name==="AbortError"){if(a.isError()){let d={method:n.method,url:nr(o),timeoutMs:n.timeoutMs};a.error("HTTP request timed out",d);}return {ok:false,error:{reason:"timeout"},rawResponse:ta}}else if(c instanceof Error){if(a.isError()){let d={method:n.method,url:nr(o),errorMessage:c.message};a.error("HTTP request failed with error",d);}return {ok:false,error:{reason:"unknown",errorMessage:c.message},rawResponse:oa}}if(a.isError()){let d={method:n.method,url:nr(o),error:Pe(c)};a.error("HTTP request failed with unknown error",d);}return {ok:false,error:{reason:"unknown",errorMessage:Pe(c)},rawResponse:oa}}}var k=Wx;var _=class n extends Promise{constructor(o){super(e=>{e(void 0);}),this.innerPromise=o;}static fromFunction(o,...e){return new n(o(...e))}static interceptFunction(o){return (...e)=>n.fromPromise(o(...e))}static fromPromise(o){return new n(o)}static fromExecutor(o){let e=new Promise(o);return new n(e)}static fromResult(o){let e=Promise.resolve(o);return new n(e)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:o})=>o)),this.unwrappedPromise}then(o,e){return this.unwrap().then(o,e)}catch(o){return this.unwrap().catch(o)}finally(o){return this.unwrap().finally(o)}async withRawResponse(){return await this.innerPromise}};var b={get:async n=>typeof n=="function"?n():n};var Hs={};W(Hs,{toBinaryUploadRequest:()=>Bx,toMultipartDataPart:()=>Ws});async function Bx(n){let{data:o,filename:e,contentLength:t,contentType:i}=await Bs(n),a={body:o,headers:{}};return e&&(a.headers["Content-Disposition"]=`attachment; filename="${e}"`),i&&(a.headers["Content-Type"]=i),t!=null&&(a.headers["Content-Length"]=t.toString()),a}async function Ws(n){let{data:o,filename:e,contentType:t}=await Bs(n,{noSniffFileSize:true});return {data:o,filename:e,contentType:t}}async function Bs(n,{noSniffFileSize:o}={}){var e,t,i,a,s;if(Vx(n))return Bs({data:n},{noSniffFileSize:o});if("path"in n){let p=await import('fs');if(!p||!p.createReadStream)throw new Error("File path uploads are not supported in this environment.");let l=p.createReadStream(n.path),c=(e=n.contentLength)!=null?e:o===true?void 0:await _h(n.path),d=(t=n.filename)!=null?t:zh(n.path);return {data:l,filename:d,contentType:n.contentType,contentLength:c}}if("data"in n){let p=n.data,l=(i=n.contentLength)!=null?i:await Hx(p,{noSniffFileSize:o}),c=(a=n.filename)!=null?a:Lx(p);return {data:p,filename:c,contentType:(s=n.contentType)!=null?s:Jx(p),contentLength:l}}throw new Error(`Invalid FileUpload of type ${typeof n}: ${JSON.stringify(n)}`)}function Vx(n){return Ph(n)||Sh(n)||Ah(n)||Qx(n)||Vs(n)||Ls(n)||Kx(n)||$x(n)}async function _h(n){try{let o=await import('fs');return !o||!o.promises||!o.promises.stat?void 0:(await o.promises.stat(n)).size}catch{return}}function Lx(n){if(Gx(n))return n.name;if(kh(n))return zh(n.path.toString())}async function Hx(n,{noSniffFileSize:o}={}){if(Ph(n))return n.length;if(Sh(n)||Ah(n))return n.byteLength;if(Vs(n)||Ls(n))return n.size;if(o!==true&&kh(n))return await _h(n.path.toString())}function Jx(n){if(Vs(n)||Ls(n))return n.type}function zh(n){let o=n.lastIndexOf("/"),e=n.lastIndexOf("\\"),t=Math.max(o,e);return t>=0?n.substring(t+1):n}function Gx(n){return typeof n=="object"&&n!=null&&"name"in n}function kh(n){return typeof n=="object"&&n!=null&&"path"in n}function Kx(n){return typeof n=="object"&&n!=null&&("read"in n||"pipe"in n)}function $x(n){return typeof n=="object"&&n!=null&&"getReader"in n}function Ph(n){return typeof Buffer!="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(n)}function Sh(n){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(n)}function Ah(n){return typeof ArrayBuffer!="undefined"&&n instanceof ArrayBuffer}function Qx(n){return typeof Uint8Array!="undefined"&&n instanceof Uint8Array}function Vs(n){return typeof Blob!="undefined"&&n instanceof Blob}function Ls(n){return typeof File!="undefined"&&n instanceof File}var Cr=Yx();function Yx(){var l,c,d,m,u;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((l=globalThis==null?void 0:globalThis.navigator)==null?void 0:l.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((c=self.constructor)==null?void 0:c.name)==="DedicatedWorkerGlobalScope"||((d=self.constructor)==null?void 0:d.name)==="ServiceWorkerGlobalScope"||((m=self.constructor)==null?void 0:m.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 navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((u=process.versions)!=null&&u.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:{type:"unknown"}}async function Th(){return new Js}var Js=class{constructor(){this.fd=new FormData;}async setup(){}append(o,e){this.fd.append(o,String(e));}async appendFile(o,e){let{data:t,filename:i,contentType:a}=await Ws(e),s=await ew(t,a);i?this.fd.append(o,s,i):this.fd.append(o,s);}getRequest(){return {body:this.fd,headers:{},duplex:"half"}}};function Xx(n){return typeof n=="object"&&n!=null&&("read"in n||"pipe"in n)}function vh(n){return typeof n=="object"&&n!=null&&"getReader"in n}function Zx(n){return typeof Buffer!="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(n)}function Ox(n){return ArrayBuffer.isView(n)}async function qx(n){if(Cr.type==="node"){let{Readable:o}=await import('stream');if(n instanceof o){let e=[];for await(let t of n)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return Buffer.concat(e)}}if(vh(n)){let o=n.getReader(),e=[];try{for(;;){let{done:s,value:p}=await o.read();if(s)break;e.push(p);}}finally{o.releaseLock();}let t=e.reduce((s,p)=>s+p.length,0),i=new Uint8Array(t),a=0;for(let s of e)i.set(s,a),a+=s.length;return Buffer.from(i)}throw new Error(`Unsupported stream type: ${typeof n}. Expected Node.js Readable stream or Web ReadableStream.`)}async function ew(n,o){if(Xx(n)||vh(n)){let e=await qx(n);return new Blob([e],{type:o})}return n instanceof Blob?n:Zx(n)?new Blob([n],{type:o}):n instanceof ArrayBuffer?new Blob([n],{type:o}):Ox(n)?new Blob([n],{type:o}):typeof n=="string"?new Blob([n],{type:o}):typeof n=="object"&&n!==null?new Blob([Pe(n)],{type:o!=null?o:"application/json"}):new Blob([String(n)],{type:o})}var gt={};W(gt,{ConsoleLogger:()=>ir,LogLevel:()=>he,Logger:()=>Er,createLogger:()=>Us});var r={};W(r,{JsonError:()=>Ir,ParseError:()=>Dr,any:()=>Jh,bigint:()=>Eh,boolean:()=>Gh,booleanLiteral:()=>Lh,date:()=>Ch,discriminant:()=>rg,enum_:()=>na,getObjectLikeUtils:()=>Se,getObjectUtils:()=>sr,getSchemaUtils:()=>J,isProperty:()=>Ge,lazy:()=>Ih,lazyObject:()=>Bh,list:()=>pa,never:()=>Kh,number:()=>$h,object:()=>sa,objectWithoutOptionalProperties:()=>Wh,optional:()=>Gs,property:()=>Uh,record:()=>Zh,set:()=>Oh,string:()=>Qh,stringLiteral:()=>Hh,transform:()=>Ks,undiscriminatedUnion:()=>eg,union:()=>og,unknown:()=>Yh,withParsedProperties:()=>Qs});var M={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function H(n,o){return `Expected ${o}. Received ${rw(n)}.`}function rw(n){if(Array.isArray(n))return "list";if(n===null)return "null";if(n instanceof BigInt)return "BigInt";switch(typeof n){case "string":return `"${n}"`;case "bigint":case "number":case "boolean":case "undefined":return `${n}`}return typeof n}function te(n){return {...n,json:jh(n.json),parse:jh(n.parse)}}function jh(n){return (o,e)=>{let t=n(o,e),{skipValidation:i=false}=e!=null?e:{};return !t.ok&&i?(console.warn(["Failed to validate.",...t.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
3
|
+
`)),{ok:true,value:o}):t}}function aa(n){return n.path.length===0?n.message:`${n.path.join(" -> ")}: ${n.message}`}var Ir=class n extends Error{constructor(e){super(e.map(aa).join("; "));this.errors=e;Object.setPrototypeOf(this,n.prototype);}};var Dr=class n extends Error{constructor(e){super(e.map(aa).join("; "));this.errors=e;Object.setPrototypeOf(this,n.prototype);}};function J(n){return {nullable:()=>tw(n),optional:()=>Gs(n),optionalNullable:()=>ow(n),transform:o=>Ks(n,o),parseOrThrow:(o,e)=>{let t=n.parse(o,e);if(t.ok)return t.value;throw new Dr(t.errors)},jsonOrThrow:(o,e)=>{let t=n.json(o,e);if(t.ok)return t.value;throw new Ir(t.errors)}}}function tw(n){let o={parse:(e,t)=>e==null?{ok:true,value:null}:n.parse(e,t),json:(e,t)=>e==null?{ok:true,value:null}:n.json(e,t),getType:()=>M.NULLABLE};return {...o,...J(o)}}function Gs(n){let o={parse:(e,t)=>e==null?{ok:true,value:void 0}:n.parse(e,t),json:(e,t)=>t!=null&&t.omitUndefined&&e===void 0?{ok:true,value:void 0}:e==null?{ok:true,value:null}:n.json(e,t),getType:()=>M.OPTIONAL};return {...o,...J(o)}}function ow(n){let o={parse:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:n.parse(e,t),json:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:n.json(e,t),getType:()=>M.OPTIONAL_NULLABLE};return {...o,...J(o)}}function Ks(n,o){let e={parse:(t,i)=>{let a=n.parse(t,i);return a.ok?{ok:true,value:o.transform(a.value)}:a},json:(t,i)=>{let a=o.untransform(t);return n.json(a,i)},getType:()=>n.getType()};return {...e,...J(e)}}function Eh(){let n={parse:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o=="bigint"?{ok:true,value:o}:typeof o=="number"?{ok:true,value:BigInt(o)}:{ok:false,errors:[{path:e,message:H(o,"bigint | number")}]},json:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o!="bigint"?{ok:false,errors:[{path:e,message:H(o,"bigint")}]}:{ok:true,value:o},getType:()=>M.BIGINT};return {...te(n),...J(n)}}var iw=/^([+-]?\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 Ch(){let n={parse:(o,{breadcrumbsPrefix:e=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:e,message:H(o,"string")}]}:iw.test(o)?{ok:true,value:new Date(o)}:{ok:false,errors:[{path:e,message:H(o,"ISO 8601 date string")}]},json:(o,{breadcrumbsPrefix:e=[]}={})=>o instanceof Date?{ok:true,value:o.toISOString()}:{ok:false,errors:[{path:e,message:H(o,"Date object")}]},getType:()=>M.DATE};return {...te(n),...J(n)}}function oe(n,o){return ()=>{let e={parse:o,json:o,getType:()=>n};return {...te(e),...J(e)}}}function na(n){let o=new Set(n);return oe(M.ENUM,(t,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:a,message:H(t,"string")}]}:!o.has(t)&&!i?{ok:false,errors:[{path:a,message:H(t,"enum")}]}:{ok:true,value:t})()}function Ih(n){let o=$s(n);return {...o,...J(o)}}function $s(n){return {parse:(o,e)=>Ur(n).parse(o,e),json:(o,e)=>Ur(n).json(o,e),getType:()=>Ur(n).getType()}}function Ur(n){let o=n;return o.__zurg_memoized==null&&(o.__zurg_memoized=n()),o.__zurg_memoized}function yt(n){return Object.entries(n)}function bt(n,o){let e=new Set(o);return Object.entries(n).reduce((t,[i,a])=>(e.has(i)&&(t[i]=a),t),{})}function De(n){if(typeof n!="object"||n===null)return false;if(Object.getPrototypeOf(n)===null)return true;let o=n;for(;Object.getPrototypeOf(o)!==null;)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(n)===o}function xt(n){return Object.keys(n)}function Dh(n,o){let e=[],t=[];for(let i of n)o(i)?e.push(i):t.push(i);return [e,t]}function Se(n){return {withParsedProperties:o=>Qs(n,o)}}function Qs(n,o){let e={parse:(t,i)=>{let a=n.parse(t,i);if(!a.ok)return a;let s=Object.entries(o).reduce((p,[l,c])=>({...p,[l]:typeof c=="function"?c(a.value):c}),{});return {ok:true,value:{...a.value,...s}}},json:(t,i)=>{var p;if(!De(t))return {ok:false,errors:[{path:(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],message:H(t,"object")}]};let a=new Set(Object.keys(o)),s=bt(t,Object.keys(t).filter(l=>!a.has(l)));return n.json(s,i)},getType:()=>n.getType()};return {...e,...J(e),...Se(e)}}function Uh(n,o){return {rawKey:n,valueSchema:o,isProperty:true}}function Ge(n){return n.isProperty}function sa(n){let o={_getRawProperties:()=>Object.entries(n).map(([e,t])=>Ge(t)?t.rawKey:e),_getParsedProperties:()=>xt(n),parse:(e,t)=>{let i={},a=[];for(let[s,p]of yt(n)){let l=Ge(p)?p.rawKey:s,c=Ge(p)?p.valueSchema:p,d={rawKey:l,parsedKey:s,valueSchema:c};i[l]=d,Mh(c)&&a.push(l);}return Fh({value:e,requiredKeys:a,getProperty:s=>{let p=i[s];if(p!=null)return {transformedKey:p.parsedKey,transform:l=>{var c;return p.valueSchema.parse(l,{...t,breadcrumbsPrefix:[...(c=t==null?void 0:t.breadcrumbsPrefix)!=null?c:[],s]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},json:(e,t)=>{let i=[];for(let[a,s]of yt(n)){let p=Ge(s)?s.valueSchema:s;Mh(p)&&i.push(a);}return Fh({value:e,requiredKeys:i,getProperty:a=>{let s=n[a];if(s!=null)return Ge(s)?{transformedKey:s.rawKey,transform:p=>{var l;return s.valueSchema.json(p,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],a]})}}:{transformedKey:a,transform:p=>{var l;return s.json(p,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],a]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},getType:()=>M.OBJECT};return {...te(o),...J(o),...Se(o),...sr(o)}}function Fh({value:n,requiredKeys:o,getProperty:e,unrecognizedObjectKeys:t="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!De(n))return {ok:false,errors:[{path:a,message:H(n,"object")}]};let s=new Set(o),p=[],l={};for(let[c,d]of Object.entries(n)){let m=e(c);if(m!=null){s.delete(c);let u=m.transform(d);u.ok?l[m.transformedKey]=u.value:(l[c]=d,p.push(...u.errors));}else switch(t){case "fail":p.push({path:[...a,c],message:`Unexpected key "${c}"`});break;case "strip":break;case "passthrough":l[c]=d;break}}return p.push(...o.filter(c=>s.has(c)).map(c=>({path:a,message:`Missing required key "${c}"`}))),p.length===0||i?{ok:true,value:l}:{ok:false,errors:p}}function sr(n){return {extend:o=>{let e={_getParsedProperties:()=>[...n._getParsedProperties(),...o._getParsedProperties()],_getRawProperties:()=>[...n._getRawProperties(),...o._getRawProperties()],parse:(t,i)=>Nh({extensionKeys:o._getRawProperties(),value:t,transformBase:a=>n.parse(a,i),transformExtension:a=>o.parse(a,i),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(t,i)=>Nh({extensionKeys:o._getParsedProperties(),value:t,transformBase:a=>n.json(a,i),transformExtension:a=>o.json(a,i),breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>M.OBJECT};return {...e,...J(e),...Se(e),...sr(e)}},passthrough:()=>{let o=new Set(n._getRawProperties()),e=new Set(n._getParsedProperties()),t={_getParsedProperties:()=>n._getParsedProperties(),_getRawProperties:()=>n._getRawProperties(),parse:(i,a)=>{let s=n.parse(i,{...a,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let p={};if(typeof i=="object"&&i!=null)for(let[l,c]of Object.entries(i))o.has(l)||(p[l]=c);return {ok:true,value:{...p,...s.value}}},json:(i,a)=>{let s=n.json(i,{...a,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let p={};if(typeof i=="object"&&i!=null)for(let[l,c]of Object.entries(i))e.has(l)||(p[l]=c);return {ok:true,value:{...p,...s.value}}},getType:()=>M.OBJECT};return {...t,...J(t),...Se(t),...sr(t)}}}}function Nh({extensionKeys:n,value:o,transformBase:e,transformExtension:t,breadcrumbsPrefix:i=[]}){if(!De(o))return {ok:false,errors:[{path:i,message:H(o,"object")}]};let a=new Set(n),[s,p]=Dh(xt(o),d=>a.has(d)),l=e(bt(o,p)),c=t(bt(o,s));return l.ok&&c.ok?{ok:true,value:{...l.value,...c.value}}:{ok:false,errors:[...l.ok?[]:l.errors,...c.ok?[]:c.errors]}}function Mh(n){return !aw(n)}function aw(n){switch(n.getType()){case M.ANY:case M.UNKNOWN:case M.OPTIONAL:case M.OPTIONAL_NULLABLE:return true;default:return false}}function Wh(n){return sa(n)}function Bh(n){let o={...$s(n),_getRawProperties:()=>Ur(n)._getRawProperties(),_getParsedProperties:()=>Ur(n)._getParsedProperties()};return {...o,...J(o),...Se(o),...sr(o)}}function pa(n){let o={parse:(e,t)=>Vh(e,(i,a)=>{var s;return n.parse(i,{...t,breadcrumbsPrefix:[...(s=t==null?void 0:t.breadcrumbsPrefix)!=null?s:[],`[${a}]`]})}),json:(e,t)=>Vh(e,(i,a)=>{var s;return n.json(i,{...t,breadcrumbsPrefix:[...(s=t==null?void 0:t.breadcrumbsPrefix)!=null?s:[],`[${a}]`]})}),getType:()=>M.LIST};return {...te(o),...J(o)}}function Vh(n,o){return Array.isArray(n)?n.map((t,i)=>o(t,i)).reduce((t,i)=>{if(t.ok&&i.ok)return {ok:true,value:[...t.value,i.value]};let a=[];return t.ok||a.push(...t.errors),i.ok||a.push(...i.errors),{ok:false,errors:a}},{ok:true,value:[]}):{ok:false,errors:[{message:H(n,"list"),path:[]}]}}function Lh(n){return oe(M.BOOLEAN_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===n?{ok:true,value:n}:{ok:false,errors:[{path:t,message:H(e,`${n.toString()}`)}]})()}function Hh(n){return oe(M.STRING_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===n?{ok:true,value:n}:{ok:false,errors:[{path:t,message:H(e,`"${n}"`)}]})()}var Jh=oe(M.ANY,n=>({ok:true,value:n}));var Gh=oe(M.BOOLEAN,(n,{breadcrumbsPrefix:o=[]}={})=>typeof n=="boolean"?{ok:true,value:n}:{ok:false,errors:[{path:o,message:H(n,"boolean")}]});var Kh=oe(M.NEVER,(n,{breadcrumbsPrefix:o=[]}={})=>({ok:false,errors:[{path:o,message:"Expected never"}]}));var $h=oe(M.NUMBER,(n,{breadcrumbsPrefix:o=[]}={})=>typeof n=="number"?{ok:true,value:n}:{ok:false,errors:[{path:o,message:H(n,"number")}]});var Qh=oe(M.STRING,(n,{breadcrumbsPrefix:o=[]}={})=>typeof n=="string"?{ok:true,value:n}:{ok:false,errors:[{path:o,message:H(n,"string")}]});var Yh=oe(M.UNKNOWN,n=>({ok:true,value:n}));function Zh(n,o){let e={parse:(t,i)=>Xh({value:t,isKeyNumeric:n.getType()===M.NUMBER,transformKey:a=>{var s;return n.parse(a,{...i,breadcrumbsPrefix:[...(s=i==null?void 0:i.breadcrumbsPrefix)!=null?s:[],`${a} (key)`]})},transformValue:(a,s)=>{var p;return o.parse(a,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${s}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(t,i)=>Xh({value:t,isKeyNumeric:n.getType()===M.NUMBER,transformKey:a=>{var s;return n.json(a,{...i,breadcrumbsPrefix:[...(s=i==null?void 0:i.breadcrumbsPrefix)!=null?s:[],`${a} (key)`]})},transformValue:(a,s)=>{var p;return o.json(a,{...i,breadcrumbsPrefix:[...(p=i==null?void 0:i.breadcrumbsPrefix)!=null?p:[],`${s}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>M.RECORD};return {...te(e),...J(e)}}function Xh({value:n,isKeyNumeric:o,transformKey:e,transformValue:t,breadcrumbsPrefix:i=[]}){return De(n)?yt(n).reduce((a,[s,p])=>{if(p===void 0)return a;let l=a,c=s;if(o){let f=s.length>0?Number(s):NaN;Number.isNaN(f)||(c=f);}let d=e(c),m=t(p,c);if(l.ok&&d.ok&&m.ok)return {ok:true,value:{...l.value,[d.value]:m.value}};let u=[];return l.ok||u.push(...l.errors),d.ok||u.push(...d.errors),m.ok||u.push(...m.errors),{ok:false,errors:u}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:H(n,"object")}]}}function Oh(n){let o=pa(n),e={parse:(t,i)=>{let a=o.parse(t,i);return a.ok?{ok:true,value:new Set(a.value)}:a},json:(t,i)=>{var s;return t instanceof Set?o.json([...t],i):{ok:false,errors:[{path:(s=i==null?void 0:i.breadcrumbsPrefix)!=null?s:[],message:H(t,"Set")}]}},getType:()=>M.SET};return {...te(e),...J(e)}}function eg(n){let o={parse:(e,t)=>qh((i,a)=>i.parse(e,a),n,t),json:(e,t)=>qh((i,a)=>i.json(e,a),n,t),getType:()=>M.UNDISCRIMINATED_UNION};return {...te(o),...J(o)}}function qh(n,o,e){let t=[];for(let[i,a]of o.entries()){let s=n(a,{...e,skipValidation:false});if(s.ok)return s;for(let p of s.errors)t.push({path:p.path,message:`[Variant ${i}] ${p.message}`});}return {ok:false,errors:t}}function rg(n,o){return {parsedDiscriminant:n,rawDiscriminant:o}}function og(n,o){let e=typeof n=="string"?n:n.rawDiscriminant,t=typeof n=="string"?n:n.parsedDiscriminant,i=na(xt(o)),a={parse:(s,p)=>tg({value:s,discriminant:e,transformedDiscriminant:t,transformDiscriminantValue:l=>{var c;return i.parse(l,{allowUnrecognizedEnumValues:p==null?void 0:p.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(c=p==null?void 0:p.breadcrumbsPrefix)!=null?c:[],e]})},getAdditionalPropertiesSchema:l=>o[l],allowUnrecognizedUnionMembers:p==null?void 0:p.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,c)=>c.parse(l,p),breadcrumbsPrefix:p==null?void 0:p.breadcrumbsPrefix}),json:(s,p)=>tg({value:s,discriminant:t,transformedDiscriminant:e,transformDiscriminantValue:l=>{var c;return i.json(l,{allowUnrecognizedEnumValues:p==null?void 0:p.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(c=p==null?void 0:p.breadcrumbsPrefix)!=null?c:[],t]})},getAdditionalPropertiesSchema:l=>o[l],allowUnrecognizedUnionMembers:p==null?void 0:p.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,c)=>c.json(l,p),breadcrumbsPrefix:p==null?void 0:p.breadcrumbsPrefix}),getType:()=>M.UNION};return {...te(a),...J(a),...Se(a)}}function tg({value:n,discriminant:o,transformedDiscriminant:e,transformDiscriminantValue:t,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:s,breadcrumbsPrefix:p=[]}){if(!De(n))return {ok:false,errors:[{path:p,message:H(n,"object")}]};let{[o]:l,...c}=n;if(l==null)return {ok:false,errors:[{path:p,message:`Missing discriminant ("${o}")`}]};let d=t(l);if(!d.ok)return {ok:false,errors:d.errors};let m=i(d.value);if(m==null)return a?{ok:true,value:{[e]:d.value,...c}}:{ok:false,errors:[{path:[...p,o],message:"Unexpected discriminant value"}]};let u=s(c,m);return u.ok?{ok:true,value:{[e]:l,...u.value}}:u}var w={};W(w,{encodePathParam:()=>ig,join:()=>ng,toQueryString:()=>ar});function ig(n){if(n===null)return "null";switch(typeof n){case "undefined":return "undefined";case "string":case "number":case "boolean":break;default:n=String(n);break}return encodeURIComponent(n)}function ng(n,...o){if(!n)return "";if(o.length===0)return n;if(n.includes("://")){let e;try{e=new URL(n);}catch{return ag(n,...o)}let t=o[o.length-1],i=t==null?void 0:t.endsWith("/");for(let a of o){let s=pg(a);s&&(e.pathname=sg(e.pathname,s));}return i&&!e.pathname.endsWith("/")&&(e.pathname+="/"),e.toString()}return ag(n,...o)}function ag(n,...o){if(o.length===0)return n;let e=n,t=o[o.length-1],i=t==null?void 0:t.endsWith("/");for(let a of o){let s=pg(a);s&&(e=sg(e,s));}return i&&!e.endsWith("/")&&(e+="/"),e}function sg(n,o){return n.endsWith("/")?n+o:`${n}/${o}`}function pg(n){if(!n)return n;let o=0,e=n.length;return n.startsWith("/")&&(o=1),n.endsWith("/")&&(e=n.length-1),o===0&&e===n.length?n:n.slice(o,e)}function F(n){let o=z({"X-Fern-Language":"JavaScript","X-Fern-Runtime":Cr.type,"X-Fern-Runtime-Version":Cr.version,"Comet-Workspace":n==null?void 0:n.workspaceName},n==null?void 0:n.headers);return {...n,logging:gt.createLogger(n==null?void 0:n.logging),headers:o}}var P={Default:"http://localhost:5173/api"};function A(n,o,e,t){switch(n.reason){case "non-json":throw new R({statusCode:n.statusCode,body:n.rawBody,rawResponse:o});case "body-is-null":throw new R({statusCode:n.statusCode,rawResponse:o});case "timeout":throw new vr(`Timeout exceeded when calling ${e} ${t}.`);case "unknown":throw new R({message:n.errorMessage,rawResponse:o});default:throw new R({message:"Unknown error",rawResponse:o})}}var V={};W(V,{AggregationData:()=>Lp,Alert:()=>uw,AlertAlertType:()=>Hp,AlertPagePublic:()=>rc,AlertPublic:()=>Uo,AlertPublicAlertType:()=>Yp,AlertTrigger:()=>$p,AlertTriggerConfig:()=>Gp,AlertTriggerConfigPublic:()=>Zp,AlertTriggerConfigPublicType:()=>Xp,AlertTriggerConfigType:()=>Jp,AlertTriggerConfigWrite:()=>oc,AlertTriggerConfigWriteType:()=>tc,AlertTriggerEventType:()=>Kp,AlertTriggerPublic:()=>qp,AlertTriggerPublicEventType:()=>Op,AlertTriggerWrite:()=>ac,AlertTriggerWriteEventType:()=>ic,AlertWrite:()=>Fo,AlertWriteAlertType:()=>nc,AnnotationQueue:()=>lc,AnnotationQueueBatch:()=>fw,AnnotationQueueBatchWrite:()=>Rt,AnnotationQueueItemIds:()=>Za,AnnotationQueuePagePublic:()=>uc,AnnotationQueuePublic:()=>No,AnnotationQueuePublicScope:()=>mc,AnnotationQueueReviewer:()=>pc,AnnotationQueueReviewerPublic:()=>dc,AnnotationQueueScope:()=>cc,AnnotationQueueUpdate:()=>_t,AnnotationQueueWrite:()=>wt,AnnotationQueueWriteScope:()=>Ys,AssistantMessage:()=>gc,AssistantMessageRole:()=>fc,Attachment:()=>yc,AttachmentListRequestEntityType:()=>fa,AttachmentPage:()=>bc,AudioUrl:()=>xc,AudioUrlPublic:()=>wc,AudioUrlWrite:()=>Rc,AuthDetailsHolder:()=>_c,AutomationRuleEvaluator:()=>hw,AutomationRuleEvaluatorAction:()=>zc,AutomationRuleEvaluatorLlmAsJudge:()=>jc,AutomationRuleEvaluatorLlmAsJudgePublic:()=>Go,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Zc,AutomationRuleEvaluatorObjectObjectPublic:()=>il,AutomationRuleEvaluatorObjectObjectPublicAction:()=>Oc,AutomationRuleEvaluatorPagePublic:()=>al,AutomationRuleEvaluatorPublic:()=>sl,AutomationRuleEvaluatorPublicAction:()=>nl,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Cc,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>$o,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>ll,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Ic,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>Qo,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>dl,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>Dc,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>Yo,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>hl,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>Uc,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>Xo,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>yl,AutomationRuleEvaluatorUpdate:()=>Pl,AutomationRuleEvaluatorUpdateAction:()=>bl,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>xl,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>wl,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>Rl,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>_l,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>zl,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>kl,AutomationRuleEvaluatorUserDefinedMetricPython:()=>Fc,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>Zo,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Al,AutomationRuleEvaluatorWrite:()=>vl,AutomationRuleEvaluatorWriteAction:()=>Tl,AvgValueStatPublic:()=>jl,BatchDelete:()=>X,BatchDeleteByProject:()=>gw,BiInformation:()=>El,BiInformationResponse:()=>$r,BooleanFeedbackDefinition:()=>Il,BooleanFeedbackDefinitionCreate:()=>Ul,BooleanFeedbackDefinitionPublic:()=>ri,BooleanFeedbackDefinitionUpdate:()=>Ml,BooleanFeedbackDetail:()=>Cl,BooleanFeedbackDetailCreate:()=>Dl,BooleanFeedbackDetailPublic:()=>Fl,BooleanFeedbackDetailUpdate:()=>Nl,BreakdownConfigPublic:()=>vp,BreakdownConfigPublicField:()=>Tp,CategoricalFeedbackDefinition:()=>Bl,CategoricalFeedbackDefinitionCreate:()=>Ll,CategoricalFeedbackDefinitionPublic:()=>ti,CategoricalFeedbackDefinitionUpdate:()=>Gl,CategoricalFeedbackDetail:()=>Wl,CategoricalFeedbackDetailCreate:()=>Vl,CategoricalFeedbackDetailPublic:()=>Hl,CategoricalFeedbackDetailUpdate:()=>Jl,ChatCompletionChoice:()=>$l,ChatCompletionRequest:()=>Pt,ChatCompletionResponse:()=>Zl,Check:()=>em,CheckName:()=>Ol,CheckPublic:()=>om,CheckPublicName:()=>rm,CheckPublicResult:()=>tm,CheckResult:()=>ql,ChunkedOutputJsonNode:()=>yw,ChunkedOutputJsonNodePublic:()=>bw,ChunkedOutputJsonNodePublicType:()=>am,ChunkedOutputJsonNodeType:()=>im,Column:()=>sm,ColumnCompare:()=>cm,ColumnCompareTypesItem:()=>pm,ColumnPublic:()=>mm,ColumnPublicTypesItem:()=>lm,ColumnTypesItem:()=>nm,Comment:()=>q,CommentCompare:()=>dm,CommentPublic:()=>wr,CompleteMultipartUploadRequest:()=>Oa,CompleteMultipartUploadRequestEntityType:()=>um,CompletionTokensDetails:()=>Ql,CountValueStatPublic:()=>hm,CreateDatasetItemsFromSpansRequest:()=>Tt,CreateDatasetItemsFromTracesRequest:()=>vt,CreatePromptVersionDetail:()=>lo,CreatePromptVersionDetailTemplateStructure:()=>Wa,DashboardPagePublic:()=>gm,DashboardPublic:()=>Rr,DashboardUpdatePublic:()=>St,DashboardWrite:()=>At,DataPointDouble:()=>xw,DataPointNumberPublic:()=>ym,Dataset:()=>ww,DatasetExpansion:()=>Rw,DatasetExpansionResponse:()=>Rm,DatasetExpansionWrite:()=>jt,DatasetExportJobPublic:()=>Nr,DatasetExportJobPublicStatus:()=>pp,DatasetIdentifier:()=>Et,DatasetIdentifierPublic:()=>Ct,DatasetItem:()=>ii,DatasetItemBatch:()=>_w,DatasetItemBatchUpdate:()=>Dt,DatasetItemBatchWrite:()=>Ft,DatasetItemChangesPublic:()=>_m,DatasetItemCompare:()=>jm,DatasetItemCompareSource:()=>zm,DatasetItemFilter:()=>It,DatasetItemFilterOperator:()=>ap,DatasetItemPageCompare:()=>Em,DatasetItemPagePublic:()=>Dm,DatasetItemPublic:()=>ni,DatasetItemPublicSource:()=>Cm,DatasetItemSource:()=>wm,DatasetItemStreamRequest:()=>Nt,DatasetItemUpdate:()=>np,DatasetItemWrite:()=>Ut,DatasetItemWriteSource:()=>sp,DatasetItemsDelete:()=>Mt,DatasetPagePublic:()=>Nm,DatasetPublic:()=>Qr,DatasetPublicStatus:()=>Um,DatasetPublicVisibility:()=>Fm,DatasetStatus:()=>bm,DatasetUpdate:()=>Wt,DatasetUpdateVisibility:()=>xa,DatasetVersionDiff:()=>Wm,DatasetVersionDiffStats:()=>Mm,DatasetVersionPagePublic:()=>Bm,DatasetVersionPublic:()=>Ke,DatasetVersionRestorePublic:()=>Bt,DatasetVersionRetrieveRequestPublic:()=>Vt,DatasetVersionSummary:()=>oi,DatasetVersionSummaryPublic:()=>si,DatasetVersionTag:()=>Lt,DatasetVersionUpdatePublic:()=>Ht,DatasetVisibility:()=>xm,DatasetWrite:()=>Jt,DatasetWriteVisibility:()=>wa,DeleteAttachmentsRequest:()=>zw,DeleteAttachmentsRequestEntityType:()=>Vm,DeleteFeedbackScore:()=>pi,DeleteIdsHolder:()=>Yr,DeleteThreadFeedbackScores:()=>_o,DeleteTraceThreads:()=>zo,Delta:()=>Kl,DownloadAttachmentRequestEntityType:()=>ha,ErrorCountWithDeviation:()=>ci,ErrorCountWithDeviationDetailed:()=>Lm,ErrorInfo:()=>Me,ErrorInfoExperimentItemBulkWriteView:()=>Qt,ErrorInfoPublic:()=>li,ErrorInfoWrite:()=>bo,ErrorMessage:()=>ne,ErrorMessageDetail:()=>kw,ErrorMessageDetailed:()=>Pw,ErrorMessagePublic:()=>Sw,Experiment:()=>Aw,ExperimentBatchUpdate:()=>$t,ExperimentGroupAggregationsResponse:()=>Km,ExperimentGroupResponse:()=>Xm,ExperimentItem:()=>Zt,ExperimentItemBulkRecord:()=>rd,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>bp,ExperimentItemBulkUpload:()=>Tw,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Yt,ExperimentItemCompare:()=>vm,ExperimentItemCompareTraceVisibilityMode:()=>km,ExperimentItemPublic:()=>ai,ExperimentItemPublicTraceVisibilityMode:()=>Im,ExperimentItemReference:()=>Om,ExperimentItemReferencePublic:()=>td,ExperimentItemStreamRequest:()=>Xt,ExperimentItemTraceVisibilityMode:()=>xp,ExperimentItemsBatch:()=>Ot,ExperimentItemsDelete:()=>qt,ExperimentPagePublic:()=>nd,ExperimentPublic:()=>fi,ExperimentPublicStatus:()=>od,ExperimentPublicType:()=>id,ExperimentScore:()=>Gt,ExperimentScorePublic:()=>ad,ExperimentScoreWrite:()=>zp,ExperimentStatus:()=>Hm,ExperimentStreamRequestPublic:()=>eo,ExperimentType:()=>Jm,ExperimentUpdate:()=>Kt,ExperimentUpdateStatus:()=>cp,ExperimentUpdateType:()=>lp,ExperimentWrite:()=>ro,ExperimentWriteStatus:()=>za,ExperimentWriteType:()=>ka,ExportTraceServiceRequest:()=>vw,Feedback:()=>jw,FeedbackCreate:()=>ud,FeedbackDefinitionPagePublic:()=>yd,FeedbackObjectPublic:()=>gd,FeedbackPublic:()=>xd,FeedbackScore:()=>pe,FeedbackScoreAverage:()=>de,FeedbackScoreAverageDetailed:()=>wd,FeedbackScoreAveragePublic:()=>lr,FeedbackScoreBatch:()=>gi,FeedbackScoreBatchItem:()=>_d,FeedbackScoreBatchItemSource:()=>Rd,FeedbackScoreBatchItemThread:()=>Bp,FeedbackScoreBatchItemThreadSource:()=>Wp,FeedbackScoreBatchThread:()=>ko,FeedbackScoreCompare:()=>Tm,FeedbackScoreCompareSource:()=>Pm,FeedbackScoreExperimentItemBulkWriteView:()=>fp,FeedbackScoreExperimentItemBulkWriteViewSource:()=>mp,FeedbackScoreNames:()=>kd,FeedbackScorePublic:()=>Xr,FeedbackScorePublicSource:()=>Pd,FeedbackScoreSource:()=>wp,FeedbackUpdate:()=>Ed,FindFeedbackDefinitionsRequestType:()=>Sa,FindFeedbackScoreNames1RequestType:()=>Ga,Function:()=>kt,FunctionCall:()=>Ue,GetSpanStatsRequestType:()=>Ka,GetSpansByProjectRequestType:()=>$a,GetWebhookExamplesRequestAlertType:()=>ca,GroupContent:()=>$m,GroupContentWithAggregations:()=>Gm,GroupDetail:()=>Qm,GroupDetails:()=>Ym,Guardrail:()=>Dd,GuardrailBatch:()=>Ew,GuardrailBatchWrite:()=>to,GuardrailName:()=>Cd,GuardrailResult:()=>Id,GuardrailWrite:()=>Sp,GuardrailWriteName:()=>kp,GuardrailWriteResult:()=>Pp,GuardrailsValidation:()=>qm,GuardrailsValidationPublic:()=>Ud,IdsHolder:()=>Cw,ImageUrl:()=>kc,ImageUrlPublic:()=>Mc,ImageUrlWrite:()=>Jc,JsonListString:()=>K,JsonListStringCompare:()=>qa,JsonListStringExperimentItemBulkWriteView:()=>Ae,JsonListStringPublic:()=>be,JsonListStringWrite:()=>ye,JsonNode:()=>L,JsonNodeDetail:()=>Ip,JsonNodePublic:()=>ce,JsonNodeWrite:()=>ge,JsonSchema:()=>Zs,LlmAsJudgeCode:()=>Wo,LlmAsJudgeCodePublic:()=>Hc,LlmAsJudgeCodeWrite:()=>Yc,LlmAsJudgeMessage:()=>mr,LlmAsJudgeMessageContent:()=>Sc,LlmAsJudgeMessageContentPublic:()=>Bc,LlmAsJudgeMessageContentWrite:()=>Kc,LlmAsJudgeMessagePublic:()=>fr,LlmAsJudgeMessagePublicRole:()=>Vc,LlmAsJudgeMessageRole:()=>Ac,LlmAsJudgeMessageWrite:()=>yr,LlmAsJudgeMessageWriteRole:()=>$c,LlmAsJudgeModelParameters:()=>dr,LlmAsJudgeModelParametersPublic:()=>hr,LlmAsJudgeModelParametersWrite:()=>br,LlmAsJudgeOutputSchema:()=>ur,LlmAsJudgeOutputSchemaPublic:()=>gr,LlmAsJudgeOutputSchemaPublicType:()=>Lc,LlmAsJudgeOutputSchemaType:()=>Tc,LlmAsJudgeOutputSchemaWrite:()=>xr,LlmAsJudgeOutputSchemaWriteType:()=>Qc,LogItem:()=>Nd,LogItemLevel:()=>Fd,LogPage:()=>Md,ManualEvaluationRequest:()=>yi,ManualEvaluationRequestEntityType:()=>Wd,ManualEvaluationResponse:()=>bi,Message:()=>Xs,MultipartUploadPart:()=>fm,NumericalFeedbackDefinition:()=>pd,NumericalFeedbackDefinitionCreate:()=>md,NumericalFeedbackDefinitionPublic:()=>hi,NumericalFeedbackDefinitionUpdate:()=>vd,NumericalFeedbackDetail:()=>sd,NumericalFeedbackDetailCreate:()=>ld,NumericalFeedbackDetailPublic:()=>fd,NumericalFeedbackDetailUpdate:()=>Td,OllamaConnectionTestResponse:()=>tn,OllamaInstanceBaseUrlRequest:()=>on,OllamaModel:()=>Ap,Optimization:()=>Iw,OptimizationPagePublic:()=>tu,OptimizationPublic:()=>xi,OptimizationPublicStatus:()=>Qd,OptimizationStatus:()=>Bd,OptimizationStudioConfig:()=>$d,OptimizationStudioConfigPublic:()=>ru,OptimizationStudioConfigWrite:()=>cu,OptimizationStudioLog:()=>lu,OptimizationUpdate:()=>ao,OptimizationUpdateStatus:()=>Ca,OptimizationWrite:()=>an,OptimizationWriteStatus:()=>mu,PageColumns:()=>du,PercentageValueStatPublic:()=>uu,PercentageValues:()=>We,PercentageValuesDetailed:()=>fu,PercentageValuesPublic:()=>ui,Project:()=>Dw,ProjectDetailed:()=>yu,ProjectDetailedVisibility:()=>gu,ProjectMetricRequestPublic:()=>no,ProjectMetricRequestPublicInterval:()=>Da,ProjectMetricRequestPublicMetricType:()=>Ua,ProjectMetricResponsePublic:()=>Ru,ProjectMetricResponsePublicInterval:()=>bu,ProjectMetricResponsePublicMetricType:()=>xu,ProjectPagePublic:()=>zu,ProjectPublic:()=>wi,ProjectPublicVisibility:()=>_u,ProjectReference:()=>Nc,ProjectReferencePublic:()=>Oo,ProjectRetrieveDetailed:()=>so,ProjectStatItemObjectPublic:()=>Pu,ProjectStatsPublic:()=>$e,ProjectStatsSummary:()=>Au,ProjectStatsSummaryItem:()=>Su,ProjectUpdate:()=>po,ProjectUpdateVisibility:()=>Fa,ProjectVisibility:()=>hu,ProjectWrite:()=>co,ProjectWriteVisibility:()=>Na,Prompt:()=>Uw,PromptDetail:()=>Du,PromptDetailTemplateStructure:()=>Iu,PromptPagePublic:()=>Nu,PromptPublic:()=>Fu,PromptPublicTemplateStructure:()=>Uu,PromptTemplateStructure:()=>Tu,PromptTokensDetails:()=>Yl,PromptType:()=>vu,PromptUpdatable:()=>mo,PromptVersion:()=>Cu,PromptVersionBatchUpdate:()=>uo,PromptVersionDetail:()=>Ce,PromptVersionDetailTemplateStructure:()=>Dp,PromptVersionDetailType:()=>Up,PromptVersionLink:()=>en,PromptVersionLinkPublic:()=>rn,PromptVersionLinkWrite:()=>_a,PromptVersionPagePublic:()=>Vu,PromptVersionPublic:()=>Bu,PromptVersionPublicTemplateStructure:()=>Mu,PromptVersionPublicType:()=>Wu,PromptVersionRetrieveDetail:()=>fo,PromptVersionTemplateStructure:()=>ju,PromptVersionType:()=>Eu,PromptVersionUpdate:()=>Fp,PromptWrite:()=>ho,PromptWriteTemplateStructure:()=>Ba,PromptWriteType:()=>Va,ProviderApiKey:()=>Fw,ProviderApiKeyPagePublic:()=>Ju,ProviderApiKeyProvider:()=>Lu,ProviderApiKeyPublic:()=>Ri,ProviderApiKeyPublicProvider:()=>Hu,ProviderApiKeyUpdate:()=>oo,ProviderApiKeyWrite:()=>io,ProviderApiKeyWriteProvider:()=>va,ResponseFormat:()=>qs,ResponseFormatType:()=>Os,Result:()=>_r,ResultsNumberPublic:()=>wu,ScoreName:()=>zd,ServiceTogglesConfig:()=>Gu,Span:()=>mi,SpanBatch:()=>Nw,SpanBatchUpdate:()=>yo,SpanBatchWrite:()=>wo,SpanEnrichmentOptions:()=>op,SpanExperimentItemBulkWriteView:()=>gp,SpanExperimentItemBulkWriteViewType:()=>hp,SpanFilter:()=>Ve,SpanFilterOperator:()=>Ec,SpanFilterPublic:()=>Fe,SpanFilterPublicOperator:()=>jp,SpanFilterWrite:()=>qo,SpanFilterWriteOperator:()=>pl,SpanLlmAsJudgeCode:()=>Bo,SpanLlmAsJudgeCodePublic:()=>qc,SpanLlmAsJudgeCodeWrite:()=>cl,SpanPagePublic:()=>$u,SpanPublic:()=>_i,SpanPublicType:()=>Ku,SpanSearchStreamRequestPublic:()=>Ro,SpanSearchStreamRequestPublicType:()=>Ha,SpanType:()=>Zm,SpanUpdate:()=>go,SpanUpdateType:()=>Np,SpanUserDefinedMetricPythonCode:()=>Vo,SpanUserDefinedMetricPythonCodePublic:()=>el,SpanUserDefinedMetricPythonCodeWrite:()=>ml,SpanWrite:()=>xo,SpanWriteType:()=>Mp,SpansCountResponse:()=>Yu,StartMultipartUploadRequest:()=>zt,StartMultipartUploadRequestEntityType:()=>da,StartMultipartUploadResponse:()=>Xu,StreamOptions:()=>ep,StudioEvaluation:()=>Ld,StudioEvaluationPublic:()=>Xd,StudioEvaluationWrite:()=>iu,StudioLlmModel:()=>Hd,StudioLlmModelPublic:()=>Zd,StudioLlmModelWrite:()=>au,StudioMessage:()=>Gd,StudioMessagePublic:()=>qd,StudioMessageWrite:()=>su,StudioMetric:()=>Vd,StudioMetricPublic:()=>Yd,StudioMetricWrite:()=>ou,StudioOptimizer:()=>Jd,StudioOptimizerPublic:()=>Od,StudioOptimizerWrite:()=>nu,StudioPrompt:()=>Kd,StudioPromptPublic:()=>eu,StudioPromptWrite:()=>pu,TokenUsageNames:()=>Zu,Tool:()=>tp,ToolCall:()=>Mo,ToolCallType:()=>hc,ToolType:()=>rp,Trace:()=>di,TraceBatch:()=>Mw,TraceBatchUpdate:()=>So,TraceBatchWrite:()=>To,TraceCountResponse:()=>qu,TraceEnrichmentOptions:()=>ip,TraceExperimentItemBulkWriteView:()=>yp,TraceFilter:()=>Be,TraceFilterOperator:()=>vc,TraceFilterPublic:()=>Ne,TraceFilterPublicOperator:()=>Ep,TraceFilterWrite:()=>Ko,TraceFilterWriteOperator:()=>Xc,TracePagePublic:()=>rf,TracePublic:()=>zi,TracePublicVisibilityMode:()=>ef,TraceSearchStreamRequestPublic:()=>vo,TraceThread:()=>ki,TraceThreadBatchIdentifier:()=>jo,TraceThreadBatchUpdate:()=>Co,TraceThreadFilter:()=>Te,TraceThreadFilterOperator:()=>Vp,TraceThreadFilterPublic:()=>pr,TraceThreadFilterPublicOperator:()=>Cp,TraceThreadFilterWrite:()=>ei,TraceThreadFilterWriteOperator:()=>ul,TraceThreadIdentifier:()=>nn,TraceThreadLlmAsJudgeCode:()=>Lo,TraceThreadLlmAsJudgeCodePublic:()=>rl,TraceThreadLlmAsJudgeCodeWrite:()=>fl,TraceThreadPage:()=>of,TraceThreadSearchStreamRequest:()=>Io,TraceThreadStatus:()=>tf,TraceThreadUpdate:()=>Eo,TraceThreadUserDefinedMetricPythonCode:()=>Ho,TraceThreadUserDefinedMetricPythonCodePublic:()=>tl,TraceThreadUserDefinedMetricPythonCodeWrite:()=>gl,TraceUpdate:()=>Po,TraceVisibilityMode:()=>ed,TraceWrite:()=>Ao,UploadAttachmentRequestEntityType:()=>ga,Usage:()=>Xl,UserDefinedMetricPythonCode:()=>Jo,UserDefinedMetricPythonCodePublic:()=>ol,UserDefinedMetricPythonCodeWrite:()=>Sl,ValueEntry:()=>_p,ValueEntryCompare:()=>Am,ValueEntryCompareSource:()=>Sm,ValueEntryExperimentItemBulkWriteView:()=>up,ValueEntryExperimentItemBulkWriteViewSource:()=>dp,ValueEntryPublic:()=>Ad,ValueEntryPublicSource:()=>Sd,ValueEntrySource:()=>Rp,VideoUrl:()=>Pc,VideoUrlPublic:()=>Wc,VideoUrlWrite:()=>Gc,Webhook:()=>Qp,WebhookExamples:()=>af,WebhookPublic:()=>ec,WebhookTestResult:()=>sf,WebhookTestResultStatus:()=>nf,WebhookWrite:()=>sc,WelcomeWizardSubmission:()=>Do,WelcomeWizardTracking:()=>pf,WorkspaceConfiguration:()=>Pi,WorkspaceMetricRequest:()=>Ww,WorkspaceMetricResponse:()=>sn,WorkspaceMetricsSummaryRequest:()=>Zr,WorkspaceMetricsSummaryResponse:()=>cf,WorkspaceNameHolder:()=>lf,WorkspaceSpansCount:()=>Qu,WorkspaceTraceCount:()=>Ou,alerts:()=>la,annotationQueues:()=>ma,attachments:()=>Fr,chatCompletions:()=>ya,dashboards:()=>ba,datasets:()=>Mr,experiments:()=>Wr,feedbackDefinitions:()=>Aa,guardrails:()=>Ta,llmProviderKey:()=>ja,ollama:()=>Br,optimizations:()=>Ia,projects:()=>Ma,prompts:()=>La,spans:()=>Vr,traces:()=>cr,welcomeWizard:()=>Xa});var la={};W(la,{GetWebhookExamplesRequestAlertType:()=>ca});var ca=r.enum_(["general","slack","pagerduty"]);var Ys=r.enum_(["trace","thread"]);var wt=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:Ys,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional())});var Rt=r.object({annotationQueues:r.property("annotation_queues",r.list(wt))});var _t=r.object({name:r.string().optional(),description:r.string().optional(),instructions:r.string().optional(),commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional())});var ma={};W(ma,{AnnotationQueueBatchWrite:()=>Rt,AnnotationQueueUpdate:()=>_t});var da=r.enum_(["trace","span"]);var zt=r.object({fileName:r.property("file_name",r.string()),numOfFileParts:r.property("num_of_file_parts",r.number()),mimeType:r.property("mime_type",r.string().optional()),projectName:r.property("project_name",r.string().optional()),entityType:r.property("entity_type",da),entityId:r.property("entity_id",r.string()),path:r.string()});var Fr={};W(Fr,{AttachmentListRequestEntityType:()=>fa,DownloadAttachmentRequestEntityType:()=>ha,StartMultipartUploadRequest:()=>zt,StartMultipartUploadRequestEntityType:()=>da,UploadAttachmentRequestEntityType:()=>ga,uploadAttachment:()=>ua});var ua={};W(ua,{Request:()=>nw});var nw=r.record(r.string(),r.unknown());var fa=r.enum_(["trace","span"]);var ha=r.enum_(["trace","span"]);var ga=r.enum_(["trace","span"]);var kt=r.object({name:r.string().optional(),description:r.string().optional(),strict:r.boolean().optional(),parameters:r.record(r.string(),r.record(r.string(),r.unknown())).optional()});var Ue=r.object({name:r.string().optional(),arguments:r.string().optional()});var Xs=r.record(r.string(),r.unknown());var Zs=r.object({name:r.string().optional(),strict:r.boolean().optional(),schema:r.record(r.string(),r.record(r.string(),r.unknown())).optional()});var Os=r.enum_(["text","json_object","json_schema"]);var qs=r.object({type:Os.optional(),jsonSchema:r.property("json_schema",Zs.optional())});var ep=r.object({includeUsage:r.property("include_usage",r.boolean().optional())});var rp=r.enum_(["function"]);var tp=r.object({type:rp.optional(),function:kt.optional()});var Pt=r.object({model:r.string().optional(),messages:r.list(Xs).optional(),temperature:r.number().optional(),topP:r.property("top_p",r.number().optional()),n:r.number().optional(),stream:r.boolean().optional(),streamOptions:r.property("stream_options",ep.optional()),stop:r.list(r.string()).optional(),maxTokens:r.property("max_tokens",r.number().optional()),maxCompletionTokens:r.property("max_completion_tokens",r.number().optional()),presencePenalty:r.property("presence_penalty",r.number().optional()),frequencyPenalty:r.property("frequency_penalty",r.number().optional()),logitBias:r.property("logit_bias",r.record(r.string(),r.number()).optional()),user:r.string().optional(),responseFormat:r.property("response_format",qs.optional()),seed:r.number().optional(),tools:r.list(tp).optional(),toolChoice:r.property("tool_choice",r.record(r.string(),r.unknown()).optional()),parallelToolCalls:r.property("parallel_tool_calls",r.boolean().optional()),store:r.boolean().optional(),metadata:r.record(r.string(),r.string()).optional(),reasoningEffort:r.property("reasoning_effort",r.string().optional()),serviceTier:r.property("service_tier",r.string().optional()),functions:r.list(kt).optional(),functionCall:r.property("function_call",Ue.optional())});var ya={};W(ya,{ChatCompletionRequest:()=>Pt});var ce=r.record(r.string(),r.unknown());var St=r.object({name:r.string().optional(),description:r.string().optional(),config:ce.optional()});var ge=r.record(r.string(),r.unknown());var At=r.object({name:r.string(),description:r.string().optional(),config:ge});var ba={};W(ba,{DashboardUpdatePublic:()=>St,DashboardWrite:()=>At});var op=r.object({includeTags:r.boolean().optional(),includeFeedbackScores:r.boolean().optional(),includeComments:r.boolean().optional(),includeUsage:r.boolean().optional(),includeMetadata:r.boolean().optional()});var Tt=r.object({spanIds:r.property("span_ids",r.list(r.string())),enrichmentOptions:r.property("enrichment_options",op)});var ip=r.object({includeSpans:r.boolean().optional(),includeTags:r.boolean().optional(),includeFeedbackScores:r.boolean().optional(),includeComments:r.boolean().optional(),includeUsage:r.boolean().optional(),includeMetadata:r.boolean().optional()});var vt=r.object({traceIds:r.property("trace_ids",r.list(r.string())),enrichmentOptions:r.property("enrichment_options",ip)});var jt=r.object({model:r.string(),sampleCount:r.property("sample_count",r.number().optional()),preserveFields:r.property("preserve_fields",r.list(r.string()).optional()),variationInstructions:r.property("variation_instructions",r.string().optional()),customPrompt:r.property("custom_prompt",r.string().optional())});var Et=r.object({datasetName:r.property("dataset_name",r.string())});var Ct=r.object({datasetName:r.property("dataset_name",r.string())});var ap=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var It=r.object({field:r.string().optional(),operator:ap.optional(),key:r.string().optional(),value:r.string().optional()});var L=r.record(r.string(),r.unknown());var np=r.object({input:r.string().optional(),expectedOutput:r.property("expected_output",r.string().optional()),metadata:L.optional(),data:L.optional(),tags:r.list(r.string()).optional()});var Dt=r.object({ids:r.list(r.string()).optional(),filters:r.list(It).optional(),datasetId:r.property("dataset_id",r.string().optional()),update:np,mergeTags:r.property("merge_tags",r.boolean().optional())});var sp=r.enum_(["manual","trace","span","sdk"]);var Ut=r.object({id:r.string().optional(),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:sp,data:L,tags:r.list(r.string()).optional()});var Ft=r.object({datasetName:r.property("dataset_name",r.string().optional()),datasetId:r.property("dataset_id",r.string().optional()),items:r.list(Ut),batchGroupId:r.property("batch_group_id",r.string().optional())});var Nt=r.object({datasetName:r.property("dataset_name",r.string()),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),steamLimit:r.property("steam_limit",r.number().optional()),datasetVersion:r.property("dataset_version",r.string().optional()),filters:r.string().optional()});var Mt=r.object({itemIds:r.property("item_ids",r.list(r.string()).optional()),datasetId:r.property("dataset_id",r.string().optional()),filters:r.list(It).optional(),batchGroupId:r.property("batch_group_id",r.string().optional())});var xa=r.enum_(["private","public"]);var Wt=r.object({name:r.string(),description:r.string().optional(),visibility:xa.optional(),tags:r.list(r.string()).optional()});var Bt=r.object({versionRef:r.property("version_ref",r.string())});var Vt=r.object({versionName:r.property("version_name",r.string())});var Lt=r.object({tag:r.string()});var Ht=r.object({changeDescription:r.property("change_description",r.string().optional()),tagsToAdd:r.property("tags_to_add",r.list(r.string()).optional())});var wa=r.enum_(["private","public"]);var Jt=r.object({id:r.string().optional(),name:r.string(),visibility:wa.optional(),tags:r.list(r.string()).optional(),description:r.string().optional()});var Mr={};W(Mr,{CreateDatasetItemsFromSpansRequest:()=>Tt,CreateDatasetItemsFromTracesRequest:()=>vt,DatasetExpansionWrite:()=>jt,DatasetIdentifier:()=>Et,DatasetIdentifierPublic:()=>Ct,DatasetItemBatchUpdate:()=>Dt,DatasetItemBatchWrite:()=>Ft,DatasetItemStreamRequest:()=>Nt,DatasetItemsDelete:()=>Mt,DatasetUpdate:()=>Wt,DatasetUpdateVisibility:()=>xa,DatasetVersionRestorePublic:()=>Bt,DatasetVersionRetrieveRequestPublic:()=>Vt,DatasetVersionTag:()=>Lt,DatasetVersionUpdatePublic:()=>Ht,DatasetWrite:()=>Jt,DatasetWriteVisibility:()=>wa,getDatasetExportJobs:()=>Ra});var Ra={};W(Ra,{Response:()=>sw});var pp=r.enum_(["PENDING","PROCESSING","COMPLETED","FAILED"]);var Nr=r.object({id:r.string().optional(),datasetId:r.property("dataset_id",r.string().optional()),datasetName:r.property("dataset_name",r.string().optional()),status:pp.optional(),filePath:r.property("file_path",r.string().optional()),errorMessage:r.property("error_message",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),expiresAt:r.property("expires_at",r.date().optional()),viewedAt:r.property("viewed_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var sw=r.list(Nr);var Gt=r.object({name:r.string(),value:r.number()});var cp=r.enum_(["running","completed","cancelled"]);var lp=r.enum_(["regular","trial","mini-batch"]);var Kt=r.object({name:r.string().optional(),metadata:L.optional(),tags:r.list(r.string()).optional(),type:lp.optional(),status:cp.optional(),experimentScores:r.property("experiment_scores",r.list(Gt).optional())});var $t=r.object({ids:r.list(r.string()),update:Kt,mergeTags:r.property("merge_tags",r.boolean().optional())});var mp=r.enum_(["ui","sdk","online_scoring"]);var dp=r.enum_(["ui","sdk","online_scoring"]);var up=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:dp.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var fp=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:mp,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),up).optional())});var Ae=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var Qt=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var hp=r.enum_(["general","tool","llm","guardrail"]);var gp=r.object({id:r.string().optional(),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:hp.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:Ae.optional(),output:Ae.optional(),metadata:Ae.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",Qt.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional())});var yp=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:Ae.optional(),output:Ae.optional(),metadata:Ae.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Qt.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),threadId:r.property("thread_id",r.string().optional())});var bp=r.object({datasetItemId:r.property("dataset_item_id",r.string()),evaluateTaskResult:r.property("evaluate_task_result",Ae.optional()),trace:yp.optional(),spans:r.list(gp).optional(),feedbackScores:r.property("feedback_scores",r.list(fp).optional())});var Yt=r.object({experimentName:r.property("experiment_name",r.string()),datasetName:r.property("dataset_name",r.string()),experimentId:r.property("experiment_id",r.string().optional()),items:r.list(bp)});var Xt=r.object({experimentName:r.property("experiment_name",r.string()),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),truncate:r.boolean().optional()});var q=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var xp=r.enum_(["default","hidden"]);var wp=r.enum_(["ui","sdk","online_scoring"]);var Rp=r.enum_(["ui","sdk","online_scoring"]);var _p=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:Rp.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var pe=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:wp,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),_p).optional())});var K=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var Zt=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),input:K.optional(),output:K.optional(),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),comments:r.list(q).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),duration:r.number().optional(),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",xp.optional())});var Ot=r.object({experimentItems:r.property("experiment_items",r.list(Zt))});var qt=r.object({ids:r.list(r.string())});var eo=r.object({name:r.string(),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional())});var zp=r.object({name:r.string(),value:r.number()});var ye=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var _a=r.object({id:r.string()});var za=r.enum_(["running","completed","cancelled"]);var ka=r.enum_(["regular","trial","mini-batch"]);var ro=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),name:r.string().optional(),metadata:ye.optional(),tags:r.list(r.string()).optional(),type:ka.optional(),optimizationId:r.property("optimization_id",r.string().optional()),status:za.optional(),experimentScores:r.property("experiment_scores",r.list(zp).optional()),promptVersion:r.property("prompt_version",_a.optional()),promptVersions:r.property("prompt_versions",r.list(_a).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional())});var Wr={};W(Wr,{ExperimentBatchUpdate:()=>$t,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Yt,ExperimentItemStreamRequest:()=>Xt,ExperimentItemsBatch:()=>Ot,ExperimentItemsDelete:()=>qt,ExperimentStreamRequestPublic:()=>eo,ExperimentWrite:()=>ro,ExperimentWriteStatus:()=>za,ExperimentWriteType:()=>ka,findFeedbackScoreNames:()=>Pa});var Pa={};W(Pa,{Response:()=>pw});var pw=r.list(r.string());var Aa={};W(Aa,{FindFeedbackDefinitionsRequestType:()=>Sa});var Sa=r.enum_(["numerical","categorical","boolean"]);var kp=r.enum_(["TOPIC","PII"]);var Pp=r.enum_(["passed","failed"]);var Sp=r.object({entityId:r.property("entity_id",r.string()),secondaryId:r.property("secondary_id",r.string()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:kp,result:Pp,config:L,details:L});var to=r.object({guardrails:r.list(Sp)});var Ta={};W(Ta,{GuardrailBatchWrite:()=>to});var oo=r.object({apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional())});var va=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var io=r.object({provider:va,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional())});var ja={};W(ja,{ProviderApiKeyUpdate:()=>oo,ProviderApiKeyWrite:()=>io,ProviderApiKeyWriteProvider:()=>va});var Br={};W(Br,{listModels:()=>Ea});var Ea={};W(Ea,{Response:()=>cw});var Ap=r.object({name:r.string(),size:r.number().optional(),digest:r.string().optional(),modifiedAt:r.property("modified_at",r.date().optional())});var cw=r.list(Ap);var Ca=r.enum_(["running","completed","cancelled","initialized","error"]);var ao=r.object({name:r.string().optional(),status:Ca.optional()});var Ia={};W(Ia,{OptimizationUpdate:()=>ao,OptimizationUpdateStatus:()=>Ca});var Tp=r.enum_(["none","tags","metadata","name","error_info","model","provider","type"]);var vp=r.object({field:Tp.optional(),metadataKey:r.property("metadata_key",r.string().optional()),subMetric:r.property("sub_metric",r.string().optional())});var jp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Fe=r.object({field:r.string().optional(),operator:jp.optional(),key:r.string().optional(),value:r.string().optional()});var Ep=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ne=r.object({field:r.string().optional(),operator:Ep.optional(),key:r.string().optional(),value:r.string().optional()});var Cp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var pr=r.object({field:r.string().optional(),operator:Cp.optional(),key:r.string().optional(),value:r.string().optional()});var Da=r.enum_(["HOURLY","DAILY","WEEKLY"]);var Ua=r.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES","SPAN_FEEDBACK_SCORES","SPAN_COUNT","SPAN_DURATION","SPAN_TOKEN_USAGE"]);var no=r.object({metricType:r.property("metric_type",Ua.optional()),interval:Da.optional(),intervalStart:r.property("interval_start",r.date().optional()),intervalEnd:r.property("interval_end",r.date().optional()),spanFilters:r.property("span_filters",r.list(Fe).optional()),traceFilters:r.property("trace_filters",r.list(Ne).optional()),threadFilters:r.property("thread_filters",r.list(pr).optional()),breakdown:vp.optional()});var so=r.object({name:r.string()});var Fa=r.enum_(["private","public"]);var po=r.object({name:r.string().optional(),description:r.string().optional(),visibility:Fa.optional()});var Na=r.enum_(["private","public"]);var co=r.object({name:r.string(),visibility:Na.optional(),description:r.string().optional()});var Ma={};W(Ma,{ProjectMetricRequestPublic:()=>no,ProjectMetricRequestPublicInterval:()=>Da,ProjectMetricRequestPublicMetricType:()=>Ua,ProjectRetrieveDetailed:()=>so,ProjectUpdate:()=>po,ProjectUpdateVisibility:()=>Fa,ProjectWrite:()=>co,ProjectWriteVisibility:()=>Na});var Ip=r.record(r.string(),r.unknown());var Dp=r.enum_(["text","chat"]);var Up=r.enum_(["mustache","jinja2"]);var Ce=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:Ip.optional(),type:Up.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),variables:r.list(r.string()).optional(),templateStructure:r.property("template_structure",Dp.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Wa=r.enum_(["text","chat"]);var lo=r.object({name:r.string(),version:Ce,templateStructure:r.property("template_structure",Wa.optional())});var mo=r.object({name:r.string(),description:r.string().optional(),tags:r.list(r.string()).optional()});var Fp=r.object({tags:r.list(r.string()).optional()});var uo=r.object({ids:r.list(r.string()),update:Fp,mergeTags:r.property("merge_tags",r.boolean().optional())});var fo=r.object({name:r.string(),commit:r.string().optional()});var Ba=r.enum_(["text","chat"]);var Va=r.enum_(["mustache","jinja2"]);var ho=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),template:r.string().optional(),metadata:ge.optional(),changeDescription:r.property("change_description",r.string().optional()),type:Va.optional(),templateStructure:r.property("template_structure",Ba.optional()),tags:r.list(r.string()).optional()});var La={};W(La,{CreatePromptVersionDetail:()=>lo,CreatePromptVersionDetailTemplateStructure:()=>Wa,PromptUpdatable:()=>mo,PromptVersionBatchUpdate:()=>uo,PromptVersionRetrieveDetail:()=>fo,PromptWrite:()=>ho,PromptWriteTemplateStructure:()=>Ba,PromptWriteType:()=>Va});var Me=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var Np=r.enum_(["general","tool","llm","guardrail"]);var go=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Np.optional(),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),errorInfo:r.property("error_info",Me.optional())});var yo=r.object({ids:r.list(r.string()),update:go,mergeTags:r.property("merge_tags",r.boolean().optional())});var bo=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var Mp=r.enum_(["general","tool","llm","guardrail"]);var xo=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Mp.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:ye.optional(),output:ye.optional(),metadata:ye.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",bo.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional())});var wo=r.object({spans:r.list(xo)});var Ha=r.enum_(["general","tool","llm","guardrail"]);var Ro=r.object({traceId:r.property("trace_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),type:Ha.optional(),filters:r.list(Fe).optional(),limit:r.number().optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),truncate:r.boolean().optional(),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var Vr={};W(Vr,{FindFeedbackScoreNames1RequestType:()=>Ga,GetSpanStatsRequestType:()=>Ka,GetSpansByProjectRequestType:()=>$a,SpanBatchUpdate:()=>yo,SpanBatchWrite:()=>wo,SpanSearchStreamRequestPublic:()=>Ro,SpanSearchStreamRequestPublicType:()=>Ha,findFeedbackScoreNames1:()=>Ja});var Ja={};W(Ja,{Response:()=>lw});var lw=r.list(r.string());var Ga=r.enum_(["general","tool","llm","guardrail"]);var Ka=r.enum_(["general","tool","llm","guardrail"]);var $a=r.enum_(["general","tool","llm","guardrail"]);var _o=r.object({projectName:r.property("project_name",r.string()),threadId:r.property("thread_id",r.string()),names:r.list(r.string()),author:r.string().optional()});var zo=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadIds:r.property("thread_ids",r.list(r.string()))});var Wp=r.enum_(["ui","sdk","online_scoring"]);var Bp=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:Wp,author:r.string().optional(),threadId:r.property("thread_id",r.string())});var ko=r.object({scores:r.list(Bp)});var Po=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Me.optional()),threadId:r.property("thread_id",r.string().optional())});var So=r.object({ids:r.list(r.string()),update:Po,mergeTags:r.property("merge_tags",r.boolean().optional())});var Ao=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:ye.optional(),output:ye.optional(),metadata:ye.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",bo.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),threadId:r.property("thread_id",r.string().optional())});var To=r.object({traces:r.list(Ao)});var vo=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),filters:r.list(Ne).optional(),lastRetrievedId:r.property("last_retrieved_id",r.string().optional()),limit:r.number().optional(),truncate:r.boolean().optional(),stripAttachments:r.property("strip_attachments",r.boolean().optional()),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var jo=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadId:r.property("thread_id",r.string().optional()),threadIds:r.property("thread_ids",r.list(r.string()).optional())});var Eo=r.object({tags:r.list(r.string()).optional()});var Co=r.object({ids:r.list(r.string()),update:Eo,mergeTags:r.property("merge_tags",r.boolean().optional())});var Vp=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Te=r.object({field:r.string().optional(),operator:Vp.optional(),key:r.string().optional(),value:r.string().optional()});var Io=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),filters:r.list(Te).optional(),lastRetrievedThreadModelId:r.property("last_retrieved_thread_model_id",r.string().optional()),limit:r.number().optional(),truncate:r.boolean().optional(),stripAttachments:r.property("strip_attachments",r.boolean().optional()),fromTime:r.property("from_time",r.date().optional()),toTime:r.property("to_time",r.date().optional())});var cr={};W(cr,{DeleteThreadFeedbackScores:()=>_o,DeleteTraceThreads:()=>zo,FeedbackScoreBatchThread:()=>ko,TraceBatchUpdate:()=>So,TraceBatchWrite:()=>To,TraceSearchStreamRequestPublic:()=>vo,TraceThreadBatchIdentifier:()=>jo,TraceThreadBatchUpdate:()=>Co,TraceThreadSearchStreamRequest:()=>Io,findFeedbackScoreNames2:()=>Qa,findTraceThreadsFeedbackScoreNames:()=>Ya});var Qa={};W(Qa,{Response:()=>mw});var mw=r.list(r.string());var Ya={};W(Ya,{Response:()=>dw});var dw=r.list(r.string());var Do=r.object({role:r.string().optional(),integrations:r.list(r.string()).optional(),email:r.string().optional(),joinBetaProgram:r.property("join_beta_program",r.boolean().optional())});var Xa={};W(Xa,{WelcomeWizardSubmission:()=>Do});var de=r.object({name:r.string(),value:r.number()});var We=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var Lp=r.object({experimentCount:r.property("experiment_count",r.number().optional()),traceCount:r.property("trace_count",r.number().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),duration:We.optional(),feedbackScores:r.property("feedback_scores",r.list(de).optional()),experimentScores:r.property("experiment_scores",r.list(de).optional())});var Hp=r.enum_(["general","slack","pagerduty"]);var Jp=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Gp=r.object({id:r.string().optional(),alertTriggerId:r.property("alert_trigger_id",r.string().optional()),type:Jp,configValue:r.property("config_value",r.record(r.string(),r.string()).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Kp=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var $p=r.object({id:r.string().optional(),alertId:r.property("alert_id",r.string().optional()),eventType:r.property("event_type",Kp),triggerConfigs:r.property("trigger_configs",r.list(Gp).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Qp=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var uw=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",Hp.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:Qp,triggers:r.list($p).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Yp=r.enum_(["general","slack","pagerduty"]);var Xp=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Zp=r.object({id:r.string().optional(),alertTriggerId:r.property("alert_trigger_id",r.string().optional()),type:Xp,configValue:r.property("config_value",r.record(r.string(),r.string()).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Op=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var qp=r.object({id:r.string().optional(),alertId:r.property("alert_id",r.string().optional()),eventType:r.property("event_type",Op),triggerConfigs:r.property("trigger_configs",r.list(Zp).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var ec=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Uo=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",Yp.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:ec,triggers:r.list(qp).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var rc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Uo).optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var tc=r.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var oc=r.object({id:r.string().optional(),type:tc,configValue:r.property("config_value",r.record(r.string(),r.string()).optional())});var ic=r.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var ac=r.object({id:r.string().optional(),eventType:r.property("event_type",ic),triggerConfigs:r.property("trigger_configs",r.list(oc).optional())});var nc=r.enum_(["general","slack","pagerduty"]);var sc=r.object({id:r.string().optional(),name:r.string().optional(),url:r.string(),secretToken:r.property("secret_token",r.string().optional()),headers:r.record(r.string(),r.string()).optional()});var Fo=r.object({id:r.string().optional(),name:r.string().optional(),enabled:r.boolean().optional(),alertType:r.property("alert_type",nc.optional()),metadata:r.record(r.string(),r.string()).optional(),webhook:sc,triggers:r.list(ac).optional()});var pc=r.object({username:r.string().optional(),status:r.number().optional()});var cc=r.enum_(["trace","thread"]);var lc=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string().optional()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:cc,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional()),reviewers:r.list(pc).optional(),feedbackScores:r.property("feedback_scores",r.list(de).optional()),itemsCount:r.property("items_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var fw=r.object({annotationQueues:r.property("annotation_queues",r.list(lc))});var Za=r.object({ids:r.list(r.string())});var mc=r.enum_(["trace","thread"]);var dc=r.object({username:r.string().optional(),status:r.number().optional()});var lr=r.object({name:r.string(),value:r.number()});var No=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string().optional()),name:r.string(),description:r.string().optional(),instructions:r.string().optional(),scope:mc,commentsEnabled:r.property("comments_enabled",r.boolean().optional()),feedbackDefinitionNames:r.property("feedback_definition_names",r.list(r.string()).optional()),reviewers:r.list(dc).optional(),feedbackScores:r.property("feedback_scores",r.list(lr).optional()),itemsCount:r.property("items_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var uc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(No).optional(),sortableBy:r.list(r.string()).optional()});var fc=r.enum_(["system","user","assistant","tool","function"]);var hc=r.enum_(["function"]);var Mo=r.object({id:r.string().optional(),index:r.number().optional(),type:hc.optional(),function:Ue.optional()});var gc=r.object({role:fc.optional(),content:r.string().optional(),reasoningContent:r.property("reasoning_content",r.string().optional()),name:r.string().optional(),toolCalls:r.property("tool_calls",r.list(Mo).optional()),refusal:r.string().optional(),functionCall:r.property("function_call",Ue.optional())});var yc=r.object({link:r.string().optional(),fileName:r.property("file_name",r.string()),fileSize:r.property("file_size",r.number()),mimeType:r.property("mime_type",r.string())});var bc=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(yc).optional(),sortableBy:r.list(r.string()).optional()});var xc=r.object({url:r.string()});var wc=r.object({url:r.string()});var Rc=r.object({url:r.string()});var _c=r.record(r.string(),r.unknown());var zc=r.enum_(["evaluator"]);var kc=r.object({url:r.string(),detail:r.string().optional()});var Pc=r.object({url:r.string()});var Sc=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",kc.optional()),videoUrl:r.property("video_url",Pc.optional()),audioUrl:r.property("audio_url",xc.optional())});var Ac=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var mr=r.object({role:Ac,content:r.string().optional(),contentArray:r.property("content_array",r.list(Sc).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var dr=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",L.optional())});var Tc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var ur=r.object({name:r.string(),type:Tc,description:r.string()});var Wo=r.object({model:dr,messages:r.list(mr),variables:r.record(r.string(),r.string()),schema:r.list(ur)});var vc=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Be=r.object({field:r.string().optional(),operator:vc.optional(),key:r.string().optional(),value:r.string().optional()});var jc=r.object({filters:r.list(Be).optional(),code:Wo.optional()});var Ec=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ve=r.object({field:r.string().optional(),operator:Ec.optional(),key:r.string().optional(),value:r.string().optional()});var Bo=r.object({model:dr,messages:r.list(mr),variables:r.record(r.string(),r.string()),schema:r.list(ur)});var Cc=r.object({filters:r.list(Ve).optional(),code:Bo.optional()});var Vo=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Ic=r.object({filters:r.list(Ve).optional(),code:Vo.optional()});var Lo=r.object({model:dr,messages:r.list(mr),schema:r.list(ur)});var Dc=r.object({filters:r.list(Te).optional(),code:Lo.optional()});var Ho=r.object({metric:r.string()});var Uc=r.object({filters:r.list(Te).optional(),code:Ho.optional()});var Jo=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Fc=r.object({filters:r.list(Be).optional(),code:Jo.optional()});var Nc=r.object({projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string())});var Lr=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(Nc).optional(),projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:zc}),hw=r.union("type",{llm_as_judge:jc.extend(Lr),user_defined_metric_python:Fc.extend(Lr),trace_thread_llm_as_judge:Dc.extend(Lr),trace_thread_user_defined_metric_python:Uc.extend(Lr),span_llm_as_judge:Cc.extend(Lr),span_user_defined_metric_python:Ic.extend(Lr)}).transform({transform:n=>n,untransform:n=>n});var Mc=r.object({url:r.string(),detail:r.string().optional()});var Wc=r.object({url:r.string()});var Bc=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",Mc.optional()),videoUrl:r.property("video_url",Wc.optional()),audioUrl:r.property("audio_url",wc.optional())});var Vc=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var fr=r.object({role:Vc,content:r.string().optional(),contentArray:r.property("content_array",r.list(Bc).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var hr=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",ce.optional())});var Lc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var gr=r.object({name:r.string(),type:Lc,description:r.string()});var Hc=r.object({model:hr,messages:r.list(fr),variables:r.record(r.string(),r.string()),schema:r.list(gr)});var Go=r.object({filters:r.list(Ne).optional(),code:Hc.optional()});var Jc=r.object({url:r.string(),detail:r.string().optional()});var Gc=r.object({url:r.string()});var Kc=r.object({type:r.string(),text:r.string().optional(),imageUrl:r.property("image_url",Jc.optional()),videoUrl:r.property("video_url",Gc.optional()),audioUrl:r.property("audio_url",Rc.optional())});var $c=r.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var yr=r.object({role:$c,content:r.string().optional(),contentArray:r.property("content_array",r.list(Kc).optional()),stringContent:r.property("string_content",r.boolean().optional()),structuredContent:r.property("structured_content",r.boolean().optional())});var br=r.object({name:r.string(),temperature:r.number(),seed:r.number().optional(),customParameters:r.property("custom_parameters",ge.optional())});var Qc=r.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var xr=r.object({name:r.string(),type:Qc,description:r.string()});var Yc=r.object({model:br,messages:r.list(yr),variables:r.record(r.string(),r.string()),schema:r.list(xr)});var Xc=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ko=r.object({field:r.string().optional(),operator:Xc.optional(),key:r.string().optional(),value:r.string().optional()});var Zc=r.object({filters:r.list(Ko).optional(),code:Yc.optional()});var Oc=r.enum_(["evaluator"]);var qc=r.object({model:hr,messages:r.list(fr),variables:r.record(r.string(),r.string()),schema:r.list(gr)});var $o=r.object({filters:r.list(Fe).optional(),code:qc.optional()});var el=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Qo=r.object({filters:r.list(Fe).optional(),code:el.optional()});var rl=r.object({model:hr,messages:r.list(fr),schema:r.list(gr)});var Yo=r.object({filters:r.list(pr).optional(),code:rl.optional()});var tl=r.object({metric:r.string()});var Xo=r.object({filters:r.list(pr).optional(),code:tl.optional()});var ol=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Zo=r.object({filters:r.list(Ne).optional(),code:ol.optional()});var Oo=r.object({projectId:r.property("project_id",r.string()),projectName:r.property("project_name",r.string())});var Hr=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(Oo).optional(),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:Oc}),il=r.union("type",{llm_as_judge:Go.extend(Hr),user_defined_metric_python:Zo.extend(Hr),trace_thread_llm_as_judge:Yo.extend(Hr),trace_thread_user_defined_metric_python:Xo.extend(Hr),span_llm_as_judge:$o.extend(Hr),span_user_defined_metric_python:Qo.extend(Hr)}).transform({transform:n=>n,untransform:n=>n});var al=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(il).optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var nl=r.enum_(["evaluator"]);var Jr=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),projects:r.list(Oo).optional(),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),action:nl}),sl=r.union("type",{llm_as_judge:Go.extend(Jr),user_defined_metric_python:Zo.extend(Jr),trace_thread_llm_as_judge:Yo.extend(Jr),trace_thread_user_defined_metric_python:Xo.extend(Jr),span_llm_as_judge:$o.extend(Jr),span_user_defined_metric_python:Qo.extend(Jr)}).transform({transform:n=>n,untransform:n=>n});var pl=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var qo=r.object({field:r.string().optional(),operator:pl.optional(),key:r.string().optional(),value:r.string().optional()});var cl=r.object({model:br,messages:r.list(yr),variables:r.record(r.string(),r.string()),schema:r.list(xr)});var ll=r.object({filters:r.list(qo).optional(),code:cl.optional()});var ml=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var dl=r.object({filters:r.list(qo).optional(),code:ml.optional()});var ul=r.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ei=r.object({field:r.string().optional(),operator:ul.optional(),key:r.string().optional(),value:r.string().optional()});var fl=r.object({model:br,messages:r.list(yr),schema:r.list(xr)});var hl=r.object({filters:r.list(ei).optional(),code:fl.optional()});var gl=r.object({metric:r.string()});var yl=r.object({filters:r.list(ei).optional(),code:gl.optional()});var bl=r.enum_(["evaluator"]);var xl=r.object({filters:r.list(Be).optional(),code:Wo.optional()});var wl=r.object({filters:r.list(Ve).optional(),code:Bo.optional()});var Rl=r.object({filters:r.list(Ve).optional(),code:Vo.optional()});var _l=r.object({filters:r.list(Te).optional(),code:Lo.optional()});var zl=r.object({filters:r.list(Te).optional(),code:Ho.optional()});var kl=r.object({filters:r.list(Be).optional(),code:Jo.optional()});var Gr=r.object({name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),projectId:r.property("project_id",r.string().optional()),projectIds:r.property("project_ids",r.list(r.string()).optional()),action:bl}),Pl=r.union("type",{llm_as_judge:xl.extend(Gr),user_defined_metric_python:kl.extend(Gr),trace_thread_llm_as_judge:_l.extend(Gr),trace_thread_user_defined_metric_python:zl.extend(Gr),span_llm_as_judge:wl.extend(Gr),span_user_defined_metric_python:Rl.extend(Gr)}).transform({transform:n=>n,untransform:n=>n});var Sl=r.object({metric:r.string(),arguments:r.record(r.string(),r.string())});var Al=r.object({filters:r.list(Ko).optional(),code:Sl.optional()});var Tl=r.enum_(["evaluator"]);var Kr=r.object({projectId:r.property("project_id",r.string().optional()),projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string(),samplingRate:r.property("sampling_rate",r.number().optional()),enabled:r.boolean().optional(),action:Tl}),vl=r.union("type",{llm_as_judge:Zc.extend(Kr),user_defined_metric_python:Al.extend(Kr),trace_thread_llm_as_judge:hl.extend(Kr),trace_thread_user_defined_metric_python:yl.extend(Kr),span_llm_as_judge:ll.extend(Kr),span_user_defined_metric_python:dl.extend(Kr)}).transform({transform:n=>n,untransform:n=>n});var jl=r.object({value:r.number().optional()});var X=r.object({ids:r.list(r.string())});var gw=r.object({ids:r.list(r.string()),projectId:r.property("project_id",r.string().optional())});var El=r.object({workspaceId:r.property("workspace_id",r.string().optional()),user:r.string().optional(),count:r.number().optional()});var $r=r.object({biInformation:r.property("bi_information",r.list(El).optional())});var Cl=r.object({trueLabel:r.string(),falseLabel:r.string()});var Il=r.object({details:Cl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Dl=r.object({trueLabel:r.string(),falseLabel:r.string()});var Ul=r.object({details:Dl.optional()});var Fl=r.object({trueLabel:r.string(),falseLabel:r.string()});var ri=r.object({details:Fl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Nl=r.object({trueLabel:r.string(),falseLabel:r.string()});var Ml=r.object({details:Nl.optional()});var Wl=r.object({categories:r.record(r.string(),r.number())});var Bl=r.object({details:Wl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Vl=r.object({categories:r.record(r.string(),r.number())});var Ll=r.object({details:Vl.optional()});var Hl=r.object({categories:r.record(r.string(),r.number())});var ti=r.object({details:Hl.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Jl=r.object({categories:r.record(r.string(),r.number())});var Gl=r.object({details:Jl.optional()});var Kl=r.object({role:r.string().optional(),content:r.string().optional(),reasoningContent:r.property("reasoning_content",r.string().optional()),toolCalls:r.property("tool_calls",r.list(Mo).optional()),functionCall:r.property("function_call",Ue.optional())});var $l=r.object({index:r.number().optional(),message:gc.optional(),delta:Kl.optional(),finishReason:r.property("finish_reason",r.string().optional())});var Ql=r.object({reasoningTokens:r.property("reasoning_tokens",r.number().optional())});var Yl=r.object({cachedTokens:r.property("cached_tokens",r.number().optional())});var Xl=r.object({totalTokens:r.property("total_tokens",r.number().optional()),promptTokens:r.property("prompt_tokens",r.number().optional()),promptTokensDetails:r.property("prompt_tokens_details",Yl.optional()),completionTokens:r.property("completion_tokens",r.number().optional()),completionTokensDetails:r.property("completion_tokens_details",Ql.optional())});var Zl=r.object({id:r.string().optional(),created:r.number().optional(),model:r.string().optional(),choices:r.list($l).optional(),usage:Xl.optional(),systemFingerprint:r.property("system_fingerprint",r.string().optional()),serviceTier:r.property("service_tier",r.string().optional())});var Ol=r.enum_(["TOPIC","PII"]);var ql=r.enum_(["passed","failed"]);var em=r.object({name:Ol.optional(),result:ql.optional()});var rm=r.enum_(["TOPIC","PII"]);var tm=r.enum_(["passed","failed"]);var om=r.object({name:rm.optional(),result:tm.optional()});var im=r.object({typeName:r.string().optional()});var yw=r.object({type:im.optional(),closed:r.boolean().optional()});var am=r.object({typeName:r.string().optional()});var bw=r.object({type:am.optional(),closed:r.boolean().optional()});var nm=r.enum_(["string","number","object","boolean","array","null"]);var sm=r.object({name:r.string().optional(),types:r.list(nm).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var pm=r.enum_(["string","number","object","boolean","array","null"]);var cm=r.object({name:r.string().optional(),types:r.list(pm).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var lm=r.enum_(["string","number","object","boolean","array","null"]);var mm=r.object({name:r.string().optional(),types:r.list(lm).optional(),filterFieldPrefix:r.property("filter_field_prefix",r.string().optional()),filterField:r.string().optional()});var dm=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var wr=r.object({id:r.string().optional(),text:r.string(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var um=r.enum_(["trace","span"]);var fm=r.object({eTag:r.property("e_tag",r.string()),partNumber:r.property("part_number",r.number())});var Oa=r.object({fileName:r.property("file_name",r.string()),projectName:r.property("project_name",r.string().optional()),entityType:r.property("entity_type",um),entityId:r.property("entity_id",r.string()),containerId:r.property("container_id",r.string().optional()),fileSize:r.property("file_size",r.number()),mimeType:r.property("mime_type",r.string().optional()),uploadId:r.property("upload_id",r.string()),uploadedFileParts:r.property("uploaded_file_parts",r.list(fm))});var hm=r.object({value:r.number().optional()});var Rr=r.object({id:r.string().optional(),workspaceId:r.property("workspace_id",r.string().optional()),name:r.string(),slug:r.string().optional(),description:r.string().optional(),config:ce,createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional())});var gm=r.object({content:r.list(Rr).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),sortableBy:r.property("sortable_by",r.list(r.string()).optional())});var xw=r.object({time:r.date(),value:r.number().optional()});var ym=r.object({time:r.date(),value:r.number().optional()});var bm=r.enum_(["unknown","processing","completed","failed"]);var oi=r.object({id:r.string().optional(),versionHash:r.property("version_hash",r.string().optional()),versionName:r.property("version_name",r.string().optional()),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional()});var xm=r.enum_(["private","public"]);var ww=r.object({id:r.string().optional(),name:r.string(),visibility:xm.optional(),tags:r.list(r.string()).optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),experimentCount:r.property("experiment_count",r.number().optional()),datasetItemsCount:r.property("dataset_items_count",r.number().optional()),optimizationCount:r.property("optimization_count",r.number().optional()),mostRecentExperimentAt:r.property("most_recent_experiment_at",r.date().optional()),lastCreatedExperimentAt:r.property("last_created_experiment_at",r.date().optional()),mostRecentOptimizationAt:r.property("most_recent_optimization_at",r.date().optional()),lastCreatedOptimizationAt:r.property("last_created_optimization_at",r.date().optional()),status:bm.optional(),latestVersion:r.property("latest_version",oi.optional())});var Rw=r.object({model:r.string(),sampleCount:r.property("sample_count",r.number().optional()),preserveFields:r.property("preserve_fields",r.list(r.string()).optional()),variationInstructions:r.property("variation_instructions",r.string().optional()),customPrompt:r.property("custom_prompt",r.string().optional())});var wm=r.enum_(["manual","trace","span","sdk"]);var ii=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:wm,data:L,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(Zt).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Rm=r.object({generatedSamples:r.property("generated_samples",r.list(ii).optional()),model:r.string().optional(),totalGenerated:r.property("total_generated",r.number().optional()),generationTime:r.property("generation_time",r.date().optional())});var _w=r.object({datasetName:r.property("dataset_name",r.string().optional()),datasetId:r.property("dataset_id",r.string().optional()),items:r.list(ii),batchGroupId:r.property("batch_group_id",r.string().optional())});var _m=r.record(r.string(),r.unknown());var zm=r.enum_(["manual","trace","span","sdk"]);var km=r.enum_(["default","hidden"]);var Pm=r.enum_(["ui","sdk","online_scoring"]);var Sm=r.enum_(["ui","sdk","online_scoring"]);var Am=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:Sm.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var Tm=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:Pm,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),Am).optional())});var qa=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var vm=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),input:qa.optional(),output:qa.optional(),feedbackScores:r.property("feedback_scores",r.list(Tm).optional()),comments:r.list(dm).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),duration:r.number().optional(),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",km.optional())});var jm=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:zm,data:L,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(vm).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Em=r.object({content:r.list(jm).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),columns:r.list(cm).optional(),sortableBy:r.list(r.string()).optional()});var Cm=r.enum_(["manual","trace","span","sdk"]);var Im=r.enum_(["default","hidden"]);var ai=r.object({id:r.string().optional(),experimentId:r.property("experiment_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string()),traceId:r.property("trace_id",r.string()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),traceVisibilityMode:r.property("trace_visibility_mode",Im.optional())});var ni=r.object({id:r.string().optional(),datasetItemId:r.property("dataset_item_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),spanId:r.property("span_id",r.string().optional()),source:Cm,data:L,tags:r.list(r.string()).optional(),experimentItems:r.property("experiment_items",r.list(ai).optional()),datasetId:r.property("dataset_id",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Dm=r.object({content:r.list(ni).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),columns:r.list(mm).optional(),sortableBy:r.list(r.string()).optional()});var Um=r.enum_(["unknown","processing","completed","failed"]);var Fm=r.enum_(["private","public"]);var si=r.object({id:r.string().optional(),versionHash:r.property("version_hash",r.string().optional()),versionName:r.property("version_name",r.string().optional()),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional()});var Qr=r.object({id:r.string().optional(),name:r.string(),visibility:Fm.optional(),tags:r.list(r.string()).optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),experimentCount:r.property("experiment_count",r.number().optional()),datasetItemsCount:r.property("dataset_items_count",r.number().optional()),optimizationCount:r.property("optimization_count",r.number().optional()),mostRecentExperimentAt:r.property("most_recent_experiment_at",r.date().optional()),lastCreatedExperimentAt:r.property("last_created_experiment_at",r.date().optional()),mostRecentOptimizationAt:r.property("most_recent_optimization_at",r.date().optional()),lastCreatedOptimizationAt:r.property("last_created_optimization_at",r.date().optional()),status:Um.optional(),latestVersion:r.property("latest_version",si.optional())});var Nm=r.object({content:r.list(Qr).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),sortableBy:r.list(r.string()).optional()});var Mm=r.object({itemsAdded:r.number().optional(),itemsModified:r.number().optional(),itemsDeleted:r.number().optional(),itemsUnchanged:r.number().optional()});var Wm=r.object({fromVersion:r.property("from_version",r.string().optional()),toVersion:r.property("to_version",r.string().optional()),statistics:Mm.optional()});var Ke=r.object({id:r.string().optional(),datasetId:r.property("dataset_id",r.string().optional()),versionHash:r.property("version_hash",r.string().optional()),tags:r.list(r.string()).optional(),isLatest:r.property("is_latest",r.boolean().optional()),versionName:r.property("version_name",r.string().optional()),itemsTotal:r.property("items_total",r.number().optional()),itemsAdded:r.property("items_added",r.number().optional()),itemsModified:r.property("items_modified",r.number().optional()),itemsDeleted:r.property("items_deleted",r.number().optional()),changeDescription:r.property("change_description",r.string().optional()),metadata:r.record(r.string(),r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Bm=r.object({content:r.list(Ke).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional()});var Vm=r.enum_(["trace","span"]);var zw=r.object({fileNames:r.property("file_names",r.list(r.string())),entityType:r.property("entity_type",Vm),entityId:r.property("entity_id",r.string()),containerId:r.property("container_id",r.string())});var pi=r.object({name:r.string(),author:r.string().optional()});var Yr=r.object({ids:r.list(r.string())});var ci=r.object({count:r.number().optional(),deviation:r.number().optional(),deviationPercentage:r.property("deviation_percentage",r.number().optional())});var Lm=r.object({count:r.number().optional(),deviation:r.number().optional(),deviationPercentage:r.property("deviation_percentage",r.number().optional())});var li=r.object({exceptionType:r.property("exception_type",r.string()),message:r.string().optional(),traceback:r.string()});var ne=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var kw=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var Pw=r.object({errors:r.list(r.string()).optional()});var Sw=r.object({code:r.number().optional(),message:r.string().optional(),details:r.string().optional()});var Hm=r.enum_(["running","completed","cancelled"]);var Jm=r.enum_(["regular","trial","mini-batch"]);var en=r.object({id:r.string(),commit:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),promptName:r.property("prompt_name",r.string().optional())});var Aw=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),datasetId:r.property("dataset_id",r.string().optional()),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),type:Jm.optional(),optimizationId:r.property("optimization_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),comments:r.list(q).optional(),traceCount:r.property("trace_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),duration:We.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),status:Hm.optional(),experimentScores:r.property("experiment_scores",r.list(Gt).optional()),promptVersion:r.property("prompt_version",en.optional()),promptVersions:r.property("prompt_versions",r.list(en).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional()),datasetVersionSummary:r.property("dataset_version_summary",oi.optional())});var Gm=r.object({label:r.string().optional(),aggregations:Lp.optional()});var Km=r.object({content:r.record(r.string(),Gm).optional()});var $m=r.object({label:r.string().optional()});var Qm=r.object({groupSorting:r.property("group_sorting",r.list(r.string()).optional())});var Ym=r.object({groupsDetails:r.property("groups_details",r.list(Qm).optional())});var Xm=r.object({content:r.record(r.string(),$m).optional(),details:Ym.optional()});var Zm=r.enum_(["general","tool","llm","guardrail"]);var mi=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Zm.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",Me.optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),comments:r.list(q).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional()),duration:r.number().optional()});var Om=r.object({id:r.string(),name:r.string(),datasetId:r.property("dataset_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string())});var qm=r.object({spanId:r.property("span_id",r.string().optional()),checks:r.list(em).optional()});var ed=r.enum_(["default","hidden"]);var di=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:K.optional(),output:K.optional(),metadata:K.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",Me.optional()),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),spanFeedbackScores:r.property("span_feedback_scores",r.list(pe).optional()),comments:r.list(q).optional(),guardrailsValidations:r.property("guardrails_validations",r.list(qm).optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),spanCount:r.property("span_count",r.number().optional()),duration:r.number().optional(),threadId:r.property("thread_id",r.string().optional()),visibilityMode:r.property("visibility_mode",ed.optional()),llmSpanCount:r.property("llm_span_count",r.number().optional()),hasToolSpans:r.property("has_tool_spans",r.boolean().optional()),providers:r.list(r.string()).optional(),experiment:Om.optional()});var rd=r.object({datasetItemId:r.property("dataset_item_id",r.string()),evaluateTaskResult:r.property("evaluate_task_result",K.optional()),trace:di.optional(),spans:r.list(mi).optional(),feedbackScores:r.property("feedback_scores",r.list(pe).optional())});var Tw=r.object({experimentName:r.property("experiment_name",r.string()),datasetName:r.property("dataset_name",r.string()),experimentId:r.property("experiment_id",r.string().optional()),items:r.list(rd)});var td=r.object({id:r.string(),name:r.string(),datasetId:r.property("dataset_id",r.string()),datasetItemId:r.property("dataset_item_id",r.string())});var od=r.enum_(["running","completed","cancelled"]);var id=r.enum_(["regular","trial","mini-batch"]);var ad=r.object({name:r.string(),value:r.number()});var be=r.undiscriminatedUnion([r.record(r.string(),r.unknown()),r.list(r.record(r.string(),r.unknown())),r.string()]);var ui=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var rn=r.object({id:r.string(),commit:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),promptName:r.property("prompt_name",r.string().optional())});var fi=r.object({id:r.string().optional(),datasetName:r.property("dataset_name",r.string()),datasetId:r.property("dataset_id",r.string().optional()),projectId:r.property("project_id",r.string().optional()),projectName:r.property("project_name",r.string().optional()),name:r.string().optional(),metadata:be.optional(),tags:r.list(r.string()).optional(),type:id.optional(),optimizationId:r.property("optimization_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(lr).optional()),comments:r.list(wr).optional(),traceCount:r.property("trace_count",r.number().optional()),createdAt:r.property("created_at",r.date().optional()),duration:ui.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostAvg:r.property("total_estimated_cost_avg",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),status:od.optional(),experimentScores:r.property("experiment_scores",r.list(ad).optional()),promptVersion:r.property("prompt_version",rn.optional()),promptVersions:r.property("prompt_versions",r.list(rn).optional()),datasetVersionId:r.property("dataset_version_id",r.string().optional()),datasetVersionSummary:r.property("dataset_version_summary",si.optional())});var nd=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(fi).optional(),sortableBy:r.list(r.string()).optional()});var vw=L;var sd=r.object({max:r.number(),min:r.number()});var pd=r.object({details:sd.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var cd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),jw=r.union("type",{numerical:pd.extend(cd),categorical:Bl.extend(cd),boolean:Il.extend(cd)}).transform({transform:n=>n,untransform:n=>n});var ld=r.object({max:r.number(),min:r.number()});var md=r.object({details:ld.optional()});var dd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional()}),ud=r.union("type",{numerical:md.extend(dd),categorical:Ll.extend(dd),boolean:Ul.extend(dd)}).transform({transform:n=>n,untransform:n=>n});var fd=r.object({max:r.number(),min:r.number()});var hi=r.object({details:fd.optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var hd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),gd=r.union("type",{numerical:hi.extend(hd),categorical:ti.extend(hd),boolean:ri.extend(hd)}).transform({transform:n=>n,untransform:n=>n});var yd=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(gd).optional()});var bd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),createdAt:r.date().optional(),createdBy:r.string().optional(),lastUpdatedAt:r.date().optional(),lastUpdatedBy:r.string().optional()}),xd=r.union("type",{numerical:hi.extend(bd),categorical:ti.extend(bd),boolean:ri.extend(bd)}).transform({transform:n=>n,untransform:n=>n});var wd=r.object({name:r.string(),value:r.number()});var Rd=r.enum_(["ui","sdk","online_scoring"]);var _d=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:Rd,author:r.string().optional(),id:r.string()});var gi=r.object({scores:r.list(_d)});var zd=r.object({name:r.string().optional(),type:r.string().optional()});var kd=r.object({scores:r.list(zd).optional()});var Pd=r.enum_(["ui","sdk","online_scoring"]);var Sd=r.enum_(["ui","sdk","online_scoring"]);var Ad=r.object({value:r.number().optional(),reason:r.string().optional(),categoryName:r.property("category_name",r.string().optional()),source:Sd.optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),spanType:r.property("span_type",r.string().optional()),spanId:r.property("span_id",r.string().optional())});var Xr=r.object({name:r.string(),categoryName:r.property("category_name",r.string().optional()),value:r.number(),reason:r.string().optional(),source:Pd,createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),valueByAuthor:r.property("value_by_author",r.record(r.string(),Ad).optional())});var Td=r.object({max:r.number(),min:r.number()});var vd=r.object({details:Td.optional()});var jd=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional()}),Ed=r.union("type",{numerical:vd.extend(jd),categorical:Gl.extend(jd),boolean:Ml.extend(jd)}).transform({transform:n=>n,untransform:n=>n});var Cd=r.enum_(["TOPIC","PII"]);var Id=r.enum_(["passed","failed"]);var Dd=r.object({id:r.string().optional(),entityId:r.property("entity_id",r.string()),secondaryId:r.property("secondary_id",r.string()),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),name:Cd,result:Id,config:L,details:L});var Ew=r.object({guardrails:r.list(Dd)});var Ud=r.object({spanId:r.property("span_id",r.string().optional()),checks:r.list(om).optional()});var Cw=r.object({ids:r.list(r.string())});var Fd=r.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var Nd=r.object({timestamp:r.date().optional(),ruleId:r.property("rule_id",r.string().optional()),level:Fd.optional(),message:r.string().optional(),markers:r.record(r.string(),r.string()).optional()});var Md=r.object({content:r.list(Nd).optional(),page:r.number().optional(),size:r.number().optional(),total:r.number().optional()});var Wd=r.enum_(["trace","thread","span"]);var yi=r.object({projectId:r.property("project_id",r.string()),entityIds:r.property("entity_ids",r.list(r.string())),ruleIds:r.property("rule_ids",r.list(r.string())),entityType:r.property("entity_type",Wd)});var bi=r.object({entitiesQueued:r.property("entities_queued",r.number().optional()),rulesApplied:r.property("rules_applied",r.number().optional())});var tn=r.object({connected:r.boolean().optional(),version:r.string().optional(),errorMessage:r.property("error_message",r.string().optional())});var on=r.object({baseUrl:r.property("base_url",r.string()),apiKey:r.property("api_key",r.string().optional())});var Bd=r.enum_(["running","completed","cancelled","initialized","error"]);var Vd=r.object({type:r.string(),parameters:L.optional()});var Ld=r.object({metrics:r.list(Vd)});var Hd=r.object({model:r.string(),parameters:L.optional()});var Jd=r.object({type:r.string(),parameters:L.optional()});var Gd=r.object({role:r.string(),content:r.string()});var Kd=r.object({messages:r.list(Gd)});var $d=r.object({datasetName:r.property("dataset_name",r.string()),prompt:Kd,llmModel:r.property("llm_model",Hd),evaluation:Ld,optimizer:Jd});var Iw=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:Bd,metadata:K.optional(),studioConfig:r.property("studio_config",$d.optional()),datasetId:r.property("dataset_id",r.string().optional()),numTrials:r.property("num_trials",r.number().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var Qd=r.enum_(["running","completed","cancelled","initialized","error"]);var Yd=r.object({type:r.string(),parameters:ce.optional()});var Xd=r.object({metrics:r.list(Yd)});var Zd=r.object({model:r.string(),parameters:ce.optional()});var Od=r.object({type:r.string(),parameters:ce.optional()});var qd=r.object({role:r.string(),content:r.string()});var eu=r.object({messages:r.list(qd)});var ru=r.object({datasetName:r.property("dataset_name",r.string()),prompt:eu,llmModel:r.property("llm_model",Zd),evaluation:Xd,optimizer:Od});var xi=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:Qd,metadata:be.optional(),studioConfig:r.property("studio_config",ru.optional()),datasetId:r.property("dataset_id",r.string().optional()),numTrials:r.property("num_trials",r.number().optional()),feedbackScores:r.property("feedback_scores",r.list(lr).optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional())});var tu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(xi).optional(),sortableBy:r.list(r.string()).optional()});var ou=r.object({type:r.string(),parameters:ge.optional()});var iu=r.object({metrics:r.list(ou)});var au=r.object({model:r.string(),parameters:ge.optional()});var nu=r.object({type:r.string(),parameters:ge.optional()});var su=r.object({role:r.string(),content:r.string()});var pu=r.object({messages:r.list(su)});var cu=r.object({datasetName:r.property("dataset_name",r.string()),prompt:pu,llmModel:r.property("llm_model",au),evaluation:iu,optimizer:nu});var lu=r.object({url:r.string().optional(),lastModified:r.property("last_modified",r.date().optional()),expiresAt:r.property("expires_at",r.date().optional())});var mu=r.enum_(["running","completed","cancelled","initialized","error"]);var an=r.object({id:r.string().optional(),name:r.string().optional(),datasetName:r.property("dataset_name",r.string()),objectiveName:r.property("objective_name",r.string()),status:mu,metadata:ye.optional(),studioConfig:r.property("studio_config",cu.optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional())});var du=r.object({columns:r.list(sm).optional()});var uu=r.object({value:ui.optional()});var fu=r.object({p50:r.number().optional(),p90:r.number().optional(),p99:r.number().optional()});var hu=r.enum_(["private","public"]);var Dw=r.object({id:r.string().optional(),name:r.string(),visibility:hu.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),duration:We.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",ci.optional())});var gu=r.enum_(["private","public"]);var yu=r.object({id:r.string().optional(),name:r.string(),visibility:gu.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional()),feedbackScores:r.property("feedback_scores",r.list(wd).optional()),duration:fu.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",Lm.optional())});var bu=r.enum_(["HOURLY","DAILY","WEEKLY"]);var xu=r.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES","SPAN_FEEDBACK_SCORES","SPAN_COUNT","SPAN_DURATION","SPAN_TOKEN_USAGE"]);var wu=r.object({name:r.string().optional(),data:r.list(ym).optional()});var Ru=r.object({projectId:r.property("project_id",r.string().optional()),metricType:r.property("metric_type",xu.optional()),interval:bu.optional(),results:r.list(wu).optional()});var _u=r.enum_(["private","public"]);var wi=r.object({id:r.string().optional(),name:r.string(),visibility:_u.optional(),description:r.string().optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),lastUpdatedTraceAt:r.property("last_updated_trace_at",r.date().optional())});var zu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(wi).optional(),sortableBy:r.list(r.string()).optional()});var ku=r.object({name:r.string().optional()}),Pu=r.union("type",{PERCENTAGE:uu.extend(ku),COUNT:hm.extend(ku),AVG:jl.extend(ku)}).transform({transform:n=>n,untransform:n=>n});var $e=r.object({stats:r.list(Pu).optional()});var Su=r.object({projectId:r.property("project_id",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(de).optional()),duration:We.optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostSum:r.property("total_estimated_cost_sum",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),traceCount:r.property("trace_count",r.number().optional()),threadCount:r.property("thread_count",r.number().optional()),guardrailsFailedCount:r.property("guardrails_failed_count",r.number().optional()),errorCount:r.property("error_count",ci.optional())});var Au=r.object({content:r.list(Su).optional()});var Tu=r.enum_(["text","chat"]);var vu=r.enum_(["mustache","jinja2"]);var ju=r.enum_(["text","chat"]);var Eu=r.enum_(["mustache","jinja2"]);var Cu=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:L.optional(),type:Eu.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),variables:r.list(r.string()).optional(),templateStructure:r.property("template_structure",ju.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Uw=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),template:r.string().optional(),metadata:L.optional(),changeDescription:r.property("change_description",r.string().optional()),type:vu.optional(),templateStructure:r.property("template_structure",Tu.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional()),latestVersion:r.property("latest_version",Cu.optional())});var Iu=r.enum_(["text","chat"]);var Du=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),templateStructure:r.property("template_structure",Iu.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional()),latestVersion:r.property("latest_version",Ce.optional())});var Uu=r.enum_(["text","chat"]);var Fu=r.object({id:r.string().optional(),name:r.string(),description:r.string().optional(),templateStructure:r.property("template_structure",Uu.optional()),tags:r.list(r.string()).optional(),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),versionCount:r.property("version_count",r.number().optional())});var Nu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Fu).optional(),sortableBy:r.list(r.string()).optional()});var Mu=r.enum_(["text","chat"]);var Wu=r.enum_(["mustache","jinja2"]);var Bu=r.object({id:r.string().optional(),promptId:r.property("prompt_id",r.string().optional()),commit:r.string().optional(),template:r.string(),metadata:ce.optional(),type:Wu.optional(),changeDescription:r.property("change_description",r.string().optional()),tags:r.list(r.string()).optional(),templateStructure:r.property("template_structure",Mu.optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional())});var Vu=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(Bu).optional(),sortableBy:r.list(r.string()).optional()});var Lu=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var Fw=r.object({id:r.string().optional(),provider:Lu,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),readOnly:r.property("read_only",r.boolean().optional())});var Hu=r.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","bedrock","ollama","custom-llm","opik-free"]);var Ri=r.object({id:r.string().optional(),provider:Hu,apiKey:r.property("api_key",r.string().optional()),name:r.string().optional(),providerName:r.property("provider_name",r.string().optional()),headers:r.record(r.string(),r.string()).optional(),configuration:r.record(r.string(),r.string()).optional(),baseUrl:r.property("base_url",r.string().optional()),createdAt:r.property("created_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),readOnly:r.property("read_only",r.boolean().optional())});var Ju=r.object({size:r.number().optional(),total:r.number().optional(),content:r.list(Ri).optional(),sortableBy:r.list(r.string()).optional()});var _r=r.object({name:r.string().optional(),current:r.number().optional(),previous:r.number().optional()});var Gu=r.object({pythonEvaluatorEnabled:r.boolean(),traceThreadPythonEvaluatorEnabled:r.boolean(),spanLlmAsJudgeEnabled:r.boolean(),spanUserDefinedMetricPythonEnabled:r.boolean(),guardrailsEnabled:r.boolean(),opikAiEnabled:r.property("opikAIEnabled",r.boolean()),alertsEnabled:r.boolean(),welcomeWizardEnabled:r.boolean(),csvUploadEnabled:r.boolean(),exportEnabled:r.boolean(),optimizationStudioEnabled:r.boolean(),datasetVersioningEnabled:r.boolean(),datasetExportEnabled:r.boolean(),openaiProviderEnabled:r.boolean(),anthropicProviderEnabled:r.boolean(),geminiProviderEnabled:r.boolean(),openrouterProviderEnabled:r.boolean(),vertexaiProviderEnabled:r.boolean(),bedrockProviderEnabled:r.boolean(),customllmProviderEnabled:r.boolean(),ollamaProviderEnabled:r.boolean(),collaboratorsTabEnabled:r.boolean()});var Nw=r.object({spans:r.list(mi)});var Ku=r.enum_(["general","tool","llm","guardrail"]);var _i=r.object({id:r.string().optional(),projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),traceId:r.property("trace_id",r.string().optional()),parentSpanId:r.property("parent_span_id",r.string().optional()),name:r.string().optional(),type:Ku.optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:be.optional(),output:be.optional(),metadata:be.optional(),model:r.string().optional(),provider:r.string().optional(),tags:r.list(r.string()).optional(),usage:r.record(r.string(),r.number()).optional(),errorInfo:r.property("error_info",li.optional()),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(Xr).optional()),comments:r.list(wr).optional(),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),totalEstimatedCostVersion:r.property("total_estimated_cost_version",r.string().optional()),duration:r.number().optional()});var $u=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(_i).optional(),sortableBy:r.list(r.string()).optional()});var Qu=r.object({workspace:r.string().optional(),spanCount:r.property("span_count",r.number().optional())});var Yu=r.object({workspacesSpansCount:r.property("workspaces_spans_count",r.list(Qu).optional())});var Xu=r.object({uploadId:r.property("upload_id",r.string()),preSignUrls:r.property("pre_sign_urls",r.list(r.string()))});var Zu=r.object({names:r.list(r.string()).optional()});var Mw=r.object({traces:r.list(di)});var Ou=r.object({workspace:r.string().optional(),traceCount:r.property("trace_count",r.number().optional())});var qu=r.object({workspacesTracesCount:r.property("workspaces_traces_count",r.list(Ou).optional())});var ef=r.enum_(["default","hidden"]);var zi=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),name:r.string().optional(),startTime:r.property("start_time",r.date()),endTime:r.property("end_time",r.date().optional()),input:be.optional(),output:be.optional(),metadata:be.optional(),tags:r.list(r.string()).optional(),errorInfo:r.property("error_info",li.optional()),usage:r.record(r.string(),r.number()).optional(),createdAt:r.property("created_at",r.date().optional()),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),createdBy:r.property("created_by",r.string().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),feedbackScores:r.property("feedback_scores",r.list(Xr).optional()),spanFeedbackScores:r.property("span_feedback_scores",r.list(Xr).optional()),comments:r.list(wr).optional(),guardrailsValidations:r.property("guardrails_validations",r.list(Ud).optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),spanCount:r.property("span_count",r.number().optional()),duration:r.number().optional(),threadId:r.property("thread_id",r.string().optional()),visibilityMode:r.property("visibility_mode",ef.optional()),llmSpanCount:r.property("llm_span_count",r.number().optional()),hasToolSpans:r.property("has_tool_spans",r.boolean().optional()),providers:r.list(r.string()).optional(),experiment:td.optional()});var rf=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(zi).optional(),sortableBy:r.list(r.string()).optional()});var tf=r.enum_(["active","inactive"]);var ki=r.object({id:r.string().optional(),projectId:r.property("project_id",r.string().optional()),threadModelId:r.property("thread_model_id",r.string().optional()),startTime:r.property("start_time",r.date().optional()),endTime:r.property("end_time",r.date().optional()),duration:r.number().optional(),firstMessage:r.property("first_message",K.optional()),lastMessage:r.property("last_message",K.optional()),feedbackScores:r.property("feedback_scores",r.list(pe).optional()),status:tf.optional(),numberOfMessages:r.property("number_of_messages",r.number().optional()),totalEstimatedCost:r.property("total_estimated_cost",r.number().optional()),usage:r.record(r.string(),r.number()).optional(),comments:r.list(q).optional(),tags:r.list(r.string()).optional(),lastUpdatedAt:r.property("last_updated_at",r.date().optional()),lastUpdatedBy:r.property("last_updated_by",r.string().optional()),createdBy:r.property("created_by",r.string().optional()),createdAt:r.property("created_at",r.date().optional())});var nn=r.object({projectName:r.property("project_name",r.string().optional()),projectId:r.property("project_id",r.string().optional()),threadId:r.property("thread_id",r.string()),truncate:r.boolean().optional()});var of=r.object({page:r.number().optional(),size:r.number().optional(),total:r.number().optional(),content:r.list(ki).optional(),sortableBy:r.list(r.string()).optional()});var af=r.object({responseExamples:r.property("response_examples",r.record(r.string(),r.record(r.string(),r.unknown())).optional())});var nf=r.enum_(["success","failure"]);var sf=r.object({status:nf.optional(),statusCode:r.property("status_code",r.number().optional()),requestBody:r.property("request_body",r.string().optional()),errorMessage:r.property("error_message",r.string().optional())});var pf=r.object({completed:r.boolean().optional()});var Pi=r.object({timeoutToMarkThreadAsInactive:r.property("timeout_to_mark_thread_as_inactive",r.string().optional()),truncationOnTables:r.property("truncation_on_tables",r.boolean().optional()),colorMap:r.property("color_map",r.record(r.string(),r.string()).optional())});var Ww=r.object({projectIds:r.property("project_ids",r.list(r.string()).optional()),name:r.string().optional(),intervalStart:r.property("interval_start",r.date()),intervalEnd:r.property("interval_end",r.date()),startBeforeEnd:r.property("start_before_end",r.boolean().optional())});var sn=r.object({results:r.list(_r).optional()});var Zr=r.object({projectIds:r.property("project_ids",r.list(r.string()).optional()),intervalStart:r.property("interval_start",r.date()),intervalEnd:r.property("interval_end",r.date()),startBeforeEnd:r.property("start_before_end",r.boolean().optional())});var cf=r.object({results:r.list(_r).optional()});var lf=r.object({workspaceName:r.property("workspace_name",r.string().optional())});var pn=class{constructor(o={}){this._options=F(o);}findAlerts(o={},e){return _.fromPromise(this.__findAlerts(o,e))}async __findAlerts(o={},e){var d,m,u,f,h,g,x,T,j,E,C;let{page:t,size:i,sorting:a,filters:s}=o,p={page:t,size:i,sorting:a,filters:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/alerts"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:rc.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/alerts")}createAlert(o,e){return _.fromPromise(this.__createAlert(o,e))}async __createAlert(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Fo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/alerts")}deleteAlertBatch(o,e){return _.fromPromise(this.__deleteAlertBatch(o,e))}async __deleteAlertBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/alerts/delete")}getAlertById(o,e={},t){return _.fromPromise(this.__getAlertById(o,e,t))}async __getAlertById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/alerts/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Uo.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/alerts/{id}")}updateAlert(o,e,t){return _.fromPromise(this.__updateAlert(o,e,t))}async __updateAlert(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/alerts/${w.encodePathParam(o)}`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Fo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 409:throw new $(s.error.body,s.rawResponse);case 422:throw new Q(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"PUT","/v1/private/alerts/{id}")}getWebhookExamples(o={},e){return _.fromPromise(this.__getWebhookExamples(o,e))}async __getWebhookExamples(o={},e){var p,l,c,d,m,u,f,h,g,x,T;let{alertType:t}=o,i={alert_type:t!=null?ca.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/alerts/webhooks/examples"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:af.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/alerts/webhooks/examples")}testWebhook(o,e){return _.fromPromise(this.__testWebhook(o,e))}async __testWebhook(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/alerts/webhooks/tests"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Fo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:sf.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===422?new Q(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/alerts/webhooks/tests")}};var cn=class{constructor(o={}){this._options=F(o);}addItemsToAnnotationQueue(o,e,t){return _.fromPromise(this.__addItemsToAnnotationQueue(o,e,t))}async __addItemsToAnnotationQueue(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/annotation-queues/${w.encodePathParam(o)}/items/add`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Za.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/annotation-queues/{id}/items/add")}findAnnotationQueues(o={},e){return _.fromPromise(this.__findAnnotationQueues(o,e))}async __findAnnotationQueues(o={},e){var m,u,f,h,g,x,T,j,E,C,U;let{page:t,size:i,name:a,filters:s,sorting:p}=o,l={page:t,size:i,name:a,filters:s,sorting:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:w.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/annotation-queues"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((j=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(x=this._options)==null?void 0:x.timeoutInSeconds)!=null?j:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:uc.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new R({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/annotation-queues")}createAnnotationQueue(o,e){return _.fromPromise(this.__createAnnotationQueue(o,e))}async __createAnnotationQueue(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:wt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues")}createAnnotationQueueBatch(o,e){return _.fromPromise(this.__createAnnotationQueueBatch(o,e))}async __createAnnotationQueueBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Rt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues/batch")}deleteAnnotationQueueBatch(o,e){return _.fromPromise(this.__deleteAnnotationQueueBatch(o,e))}async __deleteAnnotationQueueBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/annotation-queues/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/annotation-queues/delete")}getAnnotationQueueById(o,e={},t){return _.fromPromise(this.__getAnnotationQueueById(o,e,t))}async __getAnnotationQueueById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/annotation-queues/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:No.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/annotation-queues/{id}")}updateAnnotationQueue(o,e={},t){return _.fromPromise(this.__updateAnnotationQueue(o,e,t))}async __updateAnnotationQueue(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/annotation-queues/${w.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:_t.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===400?new D(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PATCH","/v1/private/annotation-queues/{id}")}removeItemsFromAnnotationQueue(o,e,t){return _.fromPromise(this.__removeItemsFromAnnotationQueue(o,e,t))}async __removeItemsFromAnnotationQueue(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/annotation-queues/${w.encodePathParam(o)}/items/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Za.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/annotation-queues/{id}/items/delete")}};var ln=class{constructor(o={}){this._options=F(o);}attachmentList(o,e){return _.fromPromise(this.__attachmentList(o,e))}async __attachmentList(o,e){var u,f,h,g,x,T,j,E,C,U,N;let{page:t,size:i,projectId:a,entityType:s,entityId:p,path:l}=o,c={page:t,size:i,project_id:a,entity_type:fa.jsonOrThrow(s,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:p,path:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/attachment/list"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:bc.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ne.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"GET","/v1/private/attachment/list")}completeMultiPartUpload(o,e){return _.fromPromise(this.__completeMultiPartUpload(o,e))}async __completeMultiPartUpload(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Oa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/upload-complete")}deleteAttachments(o,e){return _.fromPromise(this.__deleteAttachments(o,e))}async __deleteAttachments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Oa.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/delete")}downloadAttachment(o,e){return _.fromPromise(this.__downloadAttachment(o,e))}async __downloadAttachment(o,e){var u,f,h,g,x,T,j,E,C,U,N;let{workspaceName:t,containerId:i,entityType:a,entityId:s,fileName:p,mimeType:l}=o,c={workspace_name:t,container_id:i,entity_type:ha.jsonOrThrow(a,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:s,file_name:p,mime_type:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/attachment/download"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},responseType:"streaming",timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:m.body,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ne.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"GET","/v1/private/attachment/download")}startMultiPartUpload(o,e){return _.fromPromise(this.__startMultiPartUpload(o,e))}async __startMultiPartUpload(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/attachment/upload-start"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:zt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Xu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/attachment/upload-start")}uploadAttachment(o,e){return _.fromPromise(this.__uploadAttachment(o,e))}async __uploadAttachment(o,e){var u,f,h,g,x,T,j,E,C,U,N;let{fileName:t,projectName:i,mimeType:a,entityType:s,entityId:p,body:l}=o,c={file_name:t,project_name:i,mime_type:a,entity_type:ga.jsonOrThrow(s,{unrecognizedObjectKeys:"strip",omitUndefined:true}),entity_id:p},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/attachment/upload"),method:"PUT",headers:d,contentType:"application/json",queryParameters:{...c,...e==null?void 0:e.queryParams},requestType:"json",body:Fr.uploadAttachment.Request.jsonOrThrow(l,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:void 0,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new re(m.error.body,m.rawResponse);case 403:throw new se(ne.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}return A(m.error,m.rawResponse,"PUT","/v1/private/attachment/upload")}};var mn=class{constructor(o={}){this._options=F(o);}findEvaluators(o={},e){return _.fromPromise(this.__findEvaluators(o,e))}async __findEvaluators(o={},e){var f,h,g,x,T,j,E,C,U,N,O;let{projectId:t,id:i,name:a,filters:s,sorting:p,page:l,size:c}=o,d={project_id:t,id:i,name:a,filters:s,sorting:p,page:l,size:c},m=z((f=this._options)==null?void 0:f.headers,S({"Comet-Workspace":(g=e==null?void 0:e.workspaceName)!=null?g:(h=this._options)==null?void 0:h.workspaceName}),e==null?void 0:e.headers),u=await k({url:w.join((T=(x=await b.get(this._options.baseUrl))!=null?x:await b.get(this._options.environment))!=null?T:P.Default,"v1/private/automations/evaluators"),method:"GET",headers:m,queryParameters:{...d,...e==null?void 0:e.queryParams},timeoutMs:((C=(E=e==null?void 0:e.timeoutInSeconds)!=null?E:(j=this._options)==null?void 0:j.timeoutInSeconds)!=null?C:60)*1e3,maxRetries:(N=e==null?void 0:e.maxRetries)!=null?N:(U=this._options)==null?void 0:U.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(O=this._options)==null?void 0:O.fetch,logging:this._options.logging});if(u.ok)return {data:al.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new R({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});return A(u.error,u.rawResponse,"GET","/v1/private/automations/evaluators")}createAutomationRuleEvaluator(o,e){return _.fromPromise(this.__createAutomationRuleEvaluator(o,e))}async __createAutomationRuleEvaluator(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/automations/evaluators"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:vl.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/automations/evaluators")}deleteAutomationRuleEvaluatorBatch(o,e){return _.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(o,e))}async __deleteAutomationRuleEvaluatorBatch(o,e){var l,c,d,m,u,f,h,g,x,T,j;let{projectId:t,body:i}=o,a={project_id:t},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=e==null?void 0:e.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),e==null?void 0:e.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:s,contentType:"application/json",queryParameters:{...a,...e==null?void 0:e.queryParams},requestType:"json",body:X.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((g=(h=e==null?void 0:e.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=e==null?void 0:e.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:void 0,rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"POST","/v1/private/automations/evaluators/delete")}getEvaluatorById(o,e={},t){return _.fromPromise(this.__getEvaluatorById(o,e,t))}async __getEvaluatorById(o,e={},t){var l,c,d,m,u,f,h,g,x,T,j;let{projectId:i}=e,a={project_id:i},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/automations/evaluators/${w.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:sl.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/automations/evaluators/{id}")}updateAutomationRuleEvaluator(o,e,t){return _.fromPromise(this.__updateAutomationRuleEvaluator(o,e,t))}async __updateAutomationRuleEvaluator(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/automations/evaluators/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Pl.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/automations/evaluators/{id}")}getEvaluatorLogsById(o,e={},t){return _.fromPromise(this.__getEvaluatorLogsById(o,e,t))}async __getEvaluatorLogsById(o,e={},t){var l,c,d,m,u,f,h,g,x,T,j;let{size:i}=e,a={size:i},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/automations/evaluators/${w.encodePathParam(o)}/logs`),method:"GET",headers:s,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:Md.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/automations/evaluators/{id}/logs")}};var dn=class{constructor(o={}){this._options=F(o);}createChatCompletions(o={},e){return _.fromPromise(this.__createChatCompletions(o,e))}async __createChatCompletions(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/chat/completions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Pt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Zl.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/chat/completions")}};var un=class{constructor(o={}){this._options=F(o);}access(o,e){return _.fromPromise(this.__access(o,e))}async __access(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/auth"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:_c.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/auth")}getWorkspaceName(o){return _.fromPromise(this.__getWorkspaceName(o))}async __getWorkspaceName(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/auth/workspace"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:lf.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new re(t.error.body,t.rawResponse);case 403:throw new se(ne.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),t.rawResponse);default:throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}return A(t.error,t.rawResponse,"GET","/v1/private/auth/workspace")}};var fn=class{constructor(o={}){this._options=F(o);}findDashboards(o={},e){return _.fromPromise(this.__findDashboards(o,e))}async __findDashboards(o={},e){var d,m,u,f,h,g,x,T,j,E,C;let{page:t,size:i,name:a,sorting:s}=o,p={page:t,size:i,name:a,sorting:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/dashboards"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:gm.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/dashboards")}createDashboard(o,e){return _.fromPromise(this.__createDashboard(o,e))}async __createDashboard(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/dashboards"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:At.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Rr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/dashboards")}getDashboardById(o,e={},t){return _.fromPromise(this.__getDashboardById(o,e,t))}async __getDashboardById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Rr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/dashboards/{dashboardId}")}deleteDashboard(o,e={},t){return _.fromPromise(this.__deleteDashboard(o,e,t))}async __deleteDashboard(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/dashboards/{dashboardId}")}updateDashboard(o,e={},t){return _.fromPromise(this.__updateDashboard(o,e,t))}async __updateDashboard(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/dashboards/${w.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:St.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Rr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 404:throw new I(a.error.body,a.rawResponse);case 409:throw new $(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/dashboards/{dashboardId}")}deleteDashboardsBatch(o,e){return _.fromPromise(this.__deleteDashboardsBatch(o,e))}async __deleteDashboardsBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/dashboards/delete-batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/dashboards/delete-batch")}};var hn=class{constructor(o={}){this._options=F(o);}applyDatasetItemChanges(o,e,t){return _.fromPromise(this.__applyDatasetItemChanges(o,e,t))}async __applyDatasetItemChanges(o,e,t){var c,d,m,u,f,h,g,x,T,j,E;let{override:i,body:a}=e,s={override:i},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:w.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/changes`),method:"POST",headers:p,contentType:"application/json",queryParameters:{...s,...t==null?void 0:t.queryParams},requestType:"json",body:_m.jsonOrThrow(a,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((x=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?x:60)*1e3,maxRetries:(j=t==null?void 0:t.maxRetries)!=null?j:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:Ke.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);case 409:throw new $(l.error.body,l.rawResponse);default:throw new R({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"POST","/v1/private/datasets/{id}/items/changes")}batchUpdateDatasetItems(o,e){return _.fromPromise(this.__batchUpdateDatasetItems(o,e))}async __batchUpdateDatasetItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Dt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/datasets/items/batch")}findDatasets(o={},e){return _.fromPromise(this.__findDatasets(o,e))}async __findDatasets(o={},e){var h,g,x,T,j,E,C,U,N,O,ae;let{page:t,size:i,withExperimentsOnly:a,withOptimizationsOnly:s,promptId:p,name:l,sorting:c,filters:d}=o,m={page:t,size:i,with_experiments_only:a,with_optimizations_only:s,prompt_id:p,name:l,sorting:c,filters:d},u=z((h=this._options)==null?void 0:h.headers,S({"Comet-Workspace":(x=e==null?void 0:e.workspaceName)!=null?x:(g=this._options)==null?void 0:g.workspaceName}),e==null?void 0:e.headers),f=await k({url:w.join((j=(T=await b.get(this._options.baseUrl))!=null?T:await b.get(this._options.environment))!=null?j:P.Default,"v1/private/datasets"),method:"GET",headers:u,queryParameters:{...m,...e==null?void 0:e.queryParams},timeoutMs:((U=(C=e==null?void 0:e.timeoutInSeconds)!=null?C:(E=this._options)==null?void 0:E.timeoutInSeconds)!=null?U:60)*1e3,maxRetries:(O=e==null?void 0:e.maxRetries)!=null?O:(N=this._options)==null?void 0:N.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(ae=this._options)==null?void 0:ae.fetch,logging:this._options.logging});if(f.ok)return {data:Nm.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new R({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});return A(f.error,f.rawResponse,"GET","/v1/private/datasets")}createDataset(o,e){return _.fromPromise(this.__createDataset(o,e))}async __createDataset(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets")}createOrUpdateDatasetItems(o,e){return _.fromPromise(this.__createOrUpdateDatasetItems(o,e))}async __createOrUpdateDatasetItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ft.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/datasets/items")}createDatasetItemsFromCsv(o,e){return _.fromPromise(this.__createDatasetItemsFromCsv(o,e))}async __createDatasetItemsFromCsv(o,e){var p,l,c,d,m,u,f,h,g,x,T;let t=await Th();t.append("file",Pe(o.file)),t.append("dataset_id",o.datasetId);let i=await t.getRequest(),a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName,...i.headers}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/datasets/items/from-csv"),method:"POST",headers:a,queryParameters:e==null?void 0:e.queryParams,requestType:"file",duplex:i.duplex,body:i.body,timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 404:throw new I(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"POST","/v1/private/datasets/items/from-csv")}createDatasetItemsFromSpans(o,e,t){return _.fromPromise(this.__createDatasetItemsFromSpans(o,e,t))}async __createDatasetItemsFromSpans(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/from-spans`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Tt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{dataset_id}/items/from-spans")}createDatasetItemsFromTraces(o,e,t){return _.fromPromise(this.__createDatasetItemsFromTraces(o,e,t))}async __createDatasetItemsFromTraces(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/from-traces`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:vt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{dataset_id}/items/from-traces")}getDatasetById(o,e={},t){return _.fromPromise(this.__getDatasetById(o,e,t))}async __getDatasetById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Qr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/{id}")}updateDataset(o,e,t){return _.fromPromise(this.__updateDataset(o,e,t))}async __updateDataset(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Wt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/datasets/{id}")}deleteDataset(o,e={},t){return _.fromPromise(this.__deleteDataset(o,e,t))}async __deleteDataset(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/datasets/{id}")}deleteDatasetByName(o,e){return _.fromPromise(this.__deleteDatasetByName(o,e))}async __deleteDatasetByName(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Et.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/delete")}deleteDatasetItems(o={},e){return _.fromPromise(this.__deleteDatasetItems(o,e))}async __deleteDatasetItems(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Mt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/items/delete")}deleteDatasetsBatch(o,e){return _.fromPromise(this.__deleteDatasetsBatch(o,e))}async __deleteDatasetsBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/delete-batch")}downloadDatasetExport(o,e={},t){return _.fromPromise(this.__downloadDatasetExport(o,e,t))}async __downloadDatasetExport(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${w.encodePathParam(o)}/download`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,responseType:"streaming",timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:a.body,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"GET","/v1/private/datasets/export-jobs/{jobId}/download")}expandDataset(o,e,t){return _.fromPromise(this.__expandDataset(o,e,t))}async __expandDataset(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/expansions`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:jt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Rm.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/expansions")}findDatasetItemsWithExperimentItems(o,e,t){return _.fromPromise(this.__findDatasetItemsWithExperimentItems(o,e,t))}async __findDatasetItemsWithExperimentItems(o,e,t){var h,g,x,T,j,E,C,U,N,O,ae;let{page:i,size:a,experimentIds:s,filters:p,sorting:l,search:c,truncate:d}=e,m={page:i,size:a,experiment_ids:s,filters:p,sorting:l,search:c,truncate:d},u=z((h=this._options)==null?void 0:h.headers,S({"Comet-Workspace":(x=t==null?void 0:t.workspaceName)!=null?x:(g=this._options)==null?void 0:g.workspaceName}),t==null?void 0:t.headers),f=await k({url:w.join((j=(T=await b.get(this._options.baseUrl))!=null?T:await b.get(this._options.environment))!=null?j:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/experiments/items`),method:"GET",headers:u,queryParameters:{...m,...t==null?void 0:t.queryParams},timeoutMs:((U=(C=t==null?void 0:t.timeoutInSeconds)!=null?C:(E=this._options)==null?void 0:E.timeoutInSeconds)!=null?U:60)*1e3,maxRetries:(O=t==null?void 0:t.maxRetries)!=null?O:(N=this._options)==null?void 0:N.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(ae=this._options)==null?void 0:ae.fetch,logging:this._options.logging});if(f.ok)return {data:Em.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")throw new R({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse});return A(f.error,f.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items")}getDatasetByIdentifier(o,e){return _.fromPromise(this.__getDatasetByIdentifier(o,e))}async __getDatasetByIdentifier(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ct.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Qr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/retrieve")}getDatasetExperimentItemsStats(o,e,t){return _.fromPromise(this.__getDatasetExperimentItemsStats(o,e,t))}async __getDatasetExperimentItemsStats(o,e,t){var c,d,m,u,f,h,g,x,T,j,E;let{experimentIds:i,filters:a}=e,s={experiment_ids:i,filters:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:w.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/experiments/items/stats`),method:"GET",headers:p,queryParameters:{...s,...t==null?void 0:t.queryParams},timeoutMs:((x=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?x:60)*1e3,maxRetries:(j=t==null?void 0:t.maxRetries)!=null?j:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:$e.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new R({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});return A(l.error,l.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items/stats")}getDatasetExportJob(o,e={},t){return _.fromPromise(this.__getDatasetExportJob(o,e,t))}async __getDatasetExportJob(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Nr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/export-jobs/{jobId}")}getDatasetExportJobs(o){return _.fromPromise(this.__getDatasetExportJobs(o))}async __getDatasetExportJobs(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/datasets/export-jobs"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Mr.getDatasetExportJobs.Response.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/datasets/export-jobs")}getDatasetItemById(o,e={},t){return _.fromPromise(this.__getDatasetItemById(o,e,t))}async __getDatasetItemById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/items/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:ni.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/items/{itemId}")}patchDatasetItem(o,e,t){return _.fromPromise(this.__patchDatasetItem(o,e,t))}async __patchDatasetItem(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/items/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ut.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/datasets/items/{itemId}")}getDatasetItems(o,e={},t){return _.fromPromise(this.__getDatasetItems(o,e,t))}async __getDatasetItems(o,e={},t){var u,f,h,g,x,T,j,E,C,U,N;let{page:i,size:a,version:s,filters:p,truncate:l}=e,c={page:i,size:a,version:s,filters:p,truncate:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=t==null?void 0:t.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),t==null?void 0:t.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items`),method:"GET",headers:d,queryParameters:{...c,...t==null?void 0:t.queryParams},timeoutMs:((E=(j=t==null?void 0:t.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=t==null?void 0:t.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:Dm.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/datasets/{id}/items")}getDatasetItemsOutputColumns(o,e={},t){return _.fromPromise(this.__getDatasetItemsOutputColumns(o,e,t))}async __getDatasetItemsOutputColumns(o,e={},t){var l,c,d,m,u,f,h,g,x,T,j;let{experimentIds:i}=e,a={experiment_ids:i},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/items/experiments/items/output/columns`),method:"GET",headers:s,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:du.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/datasets/{id}/items/experiments/items/output/columns")}markDatasetExportJobViewed(o,e={},t){return _.fromPromise(this.__markDatasetExportJobViewed(o,e,t))}async __markDatasetExportJobViewed(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/export-jobs/${w.encodePathParam(o)}/mark-viewed`),method:"PUT",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/datasets/export-jobs/{jobId}/mark-viewed")}startDatasetExport(o,e={},t){return _.fromPromise(this.__startDatasetExport(o,e,t))}async __startDatasetExport(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/export`),method:"POST",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Nr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/export")}streamDatasetItems(o,e){return _.fromPromise(this.__streamDatasetItems(o,e))}async __streamDatasetItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/datasets/items/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Nt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/datasets/items/stream")}compareDatasetVersions(o,e={},t){return _.fromPromise(this.__compareDatasetVersions(o,e,t))}async __compareDatasetVersions(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/diff`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Wm.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/datasets/{id}/versions/diff")}createVersionTag(o,e,t,i){return _.fromPromise(this.__createVersionTag(o,e,t,i))}async __createVersionTag(o,e,t,i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/hash/${w.encodePathParam(e)}/tags`),method:"POST",headers:a,contentType:"application/json",queryParameters:i==null?void 0:i.queryParams,requestType:"json",body:Lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 404:throw new I(s.error.body,s.rawResponse);case 409:throw new $(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"POST","/v1/private/datasets/{id}/versions/hash/{versionHash}/tags")}deleteVersionTag(o,e,t,i={},a){return _.fromPromise(this.__deleteVersionTag(o,e,t,i,a))}async __deleteVersionTag(o,e,t,i={},a){var l,c,d,m,u,f,h,g,x,T,j;let s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=a==null?void 0:a.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),a==null?void 0:a.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/${w.encodePathParam(e)}/tags/${w.encodePathParam(t)}`),method:"DELETE",headers:s,queryParameters:a==null?void 0:a.queryParams,timeoutMs:((g=(h=a==null?void 0:a.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=a==null?void 0:a.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:a==null?void 0:a.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:void 0,rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"DELETE","/v1/private/datasets/{id}/versions/{versionHash}/tags/{tag}")}listDatasetVersions(o,e={},t){return _.fromPromise(this.__listDatasetVersions(o,e,t))}async __listDatasetVersions(o,e={},t){var c,d,m,u,f,h,g,x,T,j,E;let{page:i,size:a}=e,s={page:i,size:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=t==null?void 0:t.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),t==null?void 0:t.headers),l=await k({url:w.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions`),method:"GET",headers:p,queryParameters:{...s,...t==null?void 0:t.queryParams},timeoutMs:((x=(g=t==null?void 0:t.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?x:60)*1e3,maxRetries:(j=t==null?void 0:t.maxRetries)!=null?j:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:Bm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw l.error.statusCode===400?new D(l.error.body,l.rawResponse):new R({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});return A(l.error,l.rawResponse,"GET","/v1/private/datasets/{id}/versions")}restoreDatasetVersion(o,e,t){return _.fromPromise(this.__restoreDatasetVersion(o,e,t))}async __restoreDatasetVersion(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/restore`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Bt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Ke.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/versions/restore")}retrieveDatasetVersion(o,e,t){return _.fromPromise(this.__retrieveDatasetVersion(o,e,t))}async __retrieveDatasetVersion(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/retrieve`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Vt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Ke.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"POST","/v1/private/datasets/{id}/versions/retrieve")}updateDatasetVersion(o,e,t={},i){return _.fromPromise(this.__updateDatasetVersion(o,e,t,i))}async __updateDatasetVersion(o,e,t={},i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/datasets/${w.encodePathParam(o)}/versions/hash/${w.encodePathParam(e)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:i==null?void 0:i.queryParams,requestType:"json",body:Ht.jsonOrThrow(t,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:Ke.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 404:throw new I(s.error.body,s.rawResponse);case 409:throw new $(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"PATCH","/v1/private/datasets/{id}/versions/hash/{versionHash}")}};var gn=class{constructor(o={}){this._options=F(o);}batchUpdateExperiments(o,e){return _.fromPromise(this.__batchUpdateExperiments(o,e))}async __batchUpdateExperiments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:$t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/experiments/batch")}findExperiments(o={},e){return _.fromPromise(this.__findExperiments(o,e))}async __findExperiments(o={},e){var C,U,N,O,ae,ze,ke,He,ct,lt,Af;let{page:t,size:i,datasetId:a,optimizationId:s,types:p,name:l,datasetDeleted:c,promptId:d,projectId:m,projectDeleted:u,sorting:f,filters:h,experimentIds:g,forceSorting:x}=o,T={page:t,size:i,datasetId:a,optimization_id:s,types:p,name:l,dataset_deleted:c,prompt_id:d,project_id:m,project_deleted:u,sorting:f,filters:h,experiment_ids:g,force_sorting:x},j=z((C=this._options)==null?void 0:C.headers,S({"Comet-Workspace":(N=e==null?void 0:e.workspaceName)!=null?N:(U=this._options)==null?void 0:U.workspaceName}),e==null?void 0:e.headers),E=await k({url:w.join((ae=(O=await b.get(this._options.baseUrl))!=null?O:await b.get(this._options.environment))!=null?ae:P.Default,"v1/private/experiments"),method:"GET",headers:j,queryParameters:{...T,...e==null?void 0:e.queryParams},timeoutMs:((He=(ke=e==null?void 0:e.timeoutInSeconds)!=null?ke:(ze=this._options)==null?void 0:ze.timeoutInSeconds)!=null?He:60)*1e3,maxRetries:(lt=e==null?void 0:e.maxRetries)!=null?lt:(ct=this._options)==null?void 0:ct.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(Af=this._options)==null?void 0:Af.fetch,logging:this._options.logging});if(E.ok)return {data:nd.parseOrThrow(E.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:E.rawResponse};if(E.error.reason==="status-code")throw E.error.statusCode===400?new D(E.error.body,E.rawResponse):new R({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse});return A(E.error,E.rawResponse,"GET","/v1/private/experiments")}createExperiment(o,e){return _.fromPromise(this.__createExperiment(o,e))}async __createExperiment(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ro.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments")}createExperimentItems(o,e){return _.fromPromise(this.__createExperimentItems(o,e))}async __createExperimentItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ot.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items")}deleteExperimentItems(o,e){return _.fromPromise(this.__deleteExperimentItems(o,e))}async __deleteExperimentItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items/delete")}deleteExperimentsById(o,e){return _.fromPromise(this.__deleteExperimentsById(o,e))}async __deleteExperimentsById(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Yr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/delete")}experimentItemsBulk(o,e){return _.fromPromise(this.__experimentItemsBulk(o,e))}async __experimentItemsBulk(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/bulk"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Yt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"PUT","/v1/private/experiments/items/bulk")}findFeedbackScoreNames(o={},e){return _.fromPromise(this.__findFeedbackScoreNames(o,e))}async __findFeedbackScoreNames(o={},e){var p,l,c,d,m,u,f,h,g,x,T;let{experimentIds:t}=o,i={experiment_ids:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:Wr.findFeedbackScoreNames.Response.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/experiments/feedback-scores/names")}findExperimentGroups(o={},e){return _.fromPromise(this.__findExperimentGroups(o,e))}async __findExperimentGroups(o={},e){var u,f,h,g,x,T,j,E,C,U,N;let{groups:t,types:i,name:a,projectId:s,projectDeleted:p,filters:l}=o,c={groups:t,types:i,name:a,project_id:s,project_deleted:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/experiments/groups"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:Xm.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw m.error.statusCode===400?new D(m.error.body,m.rawResponse):new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/experiments/groups")}findExperimentGroupsAggregations(o={},e){return _.fromPromise(this.__findExperimentGroupsAggregations(o,e))}async __findExperimentGroupsAggregations(o={},e){var u,f,h,g,x,T,j,E,C,U,N;let{groups:t,types:i,name:a,projectId:s,projectDeleted:p,filters:l}=o,c={groups:t,types:i,name:a,project_id:s,project_deleted:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/experiments/groups/aggregations"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:Km.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw m.error.statusCode===400?new D(m.error.body,m.rawResponse):new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/experiments/groups/aggregations")}finishExperiments(o,e){return _.fromPromise(this.__finishExperiments(o,e))}async __finishExperiments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/finish"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Yr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/finish")}getExperimentById(o,e={},t){return _.fromPromise(this.__getExperimentById(o,e,t))}async __getExperimentById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/experiments/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:fi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/experiments/{id}")}updateExperiment(o,e,t){return _.fromPromise(this.__updateExperiment(o,e,t))}async __updateExperiment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/experiments/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Kt.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 404:throw new I(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"PATCH","/v1/private/experiments/{id}")}getExperimentItemById(o,e={},t){return _.fromPromise(this.__getExperimentItemById(o,e,t))}async __getExperimentItemById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/experiments/items/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:ai.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/experiments/items/{id}")}streamExperimentItems(o,e){return _.fromPromise(this.__streamExperimentItems(o,e))}async __streamExperimentItems(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/items/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Xt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/items/stream")}streamExperiments(o,e){return _.fromPromise(this.__streamExperiments(o,e))}async __streamExperiments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/experiments/stream"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:eo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/experiments/stream")}};var yn=class{constructor(o={}){this._options=F(o);}findFeedbackDefinitions(o={},e){return _.fromPromise(this.__findFeedbackDefinitions(o,e))}async __findFeedbackDefinitions(o={},e){var d,m,u,f,h,g,x,T,j,E,C;let{page:t,size:i,name:a,type:s}=o,p={page:t,size:i,name:a,type:s!=null?Sa.jsonOrThrow(s,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/feedback-definitions"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:yd.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/feedback-definitions")}createFeedbackDefinition(o,e){return _.fromPromise(this.__createFeedbackDefinition(o,e))}async __createFeedbackDefinition(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/feedback-definitions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ud.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/feedback-definitions")}getFeedbackDefinitionById(o,e={},t){return _.fromPromise(this.__getFeedbackDefinitionById(o,e,t))}async __getFeedbackDefinitionById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/feedback-definitions/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:xd.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/feedback-definitions/{id}")}updateFeedbackDefinition(o,e,t){return _.fromPromise(this.__updateFeedbackDefinition(o,e,t))}async __updateFeedbackDefinition(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/feedback-definitions/${w.encodePathParam(o)}`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Ed.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PUT","/v1/private/feedback-definitions/{id}")}deleteFeedbackDefinitionById(o,e={},t){return _.fromPromise(this.__deleteFeedbackDefinitionById(o,e,t))}async __deleteFeedbackDefinitionById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/feedback-definitions/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===409?new $(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/feedback-definitions/{id}")}deleteFeedbackDefinitionsBatch(o,e){return _.fromPromise(this.__deleteFeedbackDefinitionsBatch(o,e))}async __deleteFeedbackDefinitionsBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===409?new $(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/feedback-definitions/delete")}};var bn=class{constructor(o={}){this._options=F(o);}createGuardrails(o,e){return _.fromPromise(this.__createGuardrails(o,e))}async __createGuardrails(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/guardrails"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:to.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/guardrails")}};var xn=class{constructor(o={}){this._options=F(o);}deleteLlmProviderApiKeysBatch(o,e){return _.fromPromise(this.__deleteLlmProviderApiKeysBatch(o,e))}async __deleteLlmProviderApiKeysBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/llm-provider-key/delete")}findLlmProviderKeys(o){return _.fromPromise(this.__findLlmProviderKeys(o))}async __findLlmProviderKeys(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/llm-provider-key"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Ju.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/llm-provider-key")}storeLlmProviderApiKey(o,e){return _.fromPromise(this.__storeLlmProviderApiKey(o,e))}async __storeLlmProviderApiKey(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/llm-provider-key"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:io.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new re(i.error.body,i.rawResponse);case 403:throw new se(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/llm-provider-key")}getLlmProviderApiKeyById(o,e={},t){return _.fromPromise(this.__getLlmProviderApiKeyById(o,e,t))}async __getLlmProviderApiKeyById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/llm-provider-key/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Ri.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/llm-provider-key/{id}")}updateLlmProviderApiKey(o,e={},t){return _.fromPromise(this.__updateLlmProviderApiKey(o,e,t))}async __updateLlmProviderApiKey(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/llm-provider-key/${w.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:oo.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 401:throw new re(a.error.body,a.rawResponse);case 403:throw new se(ne.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/llm-provider-key/{id}")}};var wn=class{constructor(o={}){this._options=F(o);}evaluateSpans(o,e){return _.fromPromise(this.__evaluateSpans(o,e))}async __evaluateSpans(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/spans"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:bi.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/spans")}evaluateThreads(o,e){return _.fromPromise(this.__evaluateThreads(o,e))}async __evaluateThreads(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/threads"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:bi.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/threads")}evaluateTraces(o,e){return _.fromPromise(this.__evaluateTraces(o,e))}async __evaluateTraces(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/manual-evaluation/traces"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:bi.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/manual-evaluation/traces")}};var Rn=class{constructor(o={}){this._options=F(o);}listModels(o,e){return _.fromPromise(this.__listModels(o,e))}async __listModels(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/ollama/models"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:on.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Br.listModels.Response.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 422:throw new Q(i.error.body,i.rawResponse);case 500:throw new ht(i.error.body,i.rawResponse);case 503:throw new jr(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/ollama/models")}testConnection(o,e){return _.fromPromise(this.__testConnection(o,e))}async __testConnection(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/ollama/test-connection"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:on.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:tn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 422:throw new Q(i.error.body,i.rawResponse);case 502:throw new ft(tn.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 503:throw new jr(ne.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/ollama/test-connection")}};var _n=class{constructor(o={}){this._options=F(o);}receiveProtobufTraces(o){return _.fromPromise(this.__receiveProtobufTraces(o))}async __receiveProtobufTraces(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/otel/v1/traces"),method:"POST",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"POST","/v1/private/otel/v1/traces")}};var zn=class{constructor(o={}){this._options=F(o);}cancelStudioOptimizations(o,e={},t){return _.fromPromise(this.__cancelStudioOptimizations(o,e,t))}async __cancelStudioOptimizations(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/studio/${w.encodePathParam(o)}/cancel`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===501?new or(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/studio/{id}/cancel")}findOptimizations(o={},e){return _.fromPromise(this.__findOptimizations(o,e))}async __findOptimizations(o={},e){var u,f,h,g,x,T,j,E,C,U,N;let{page:t,size:i,datasetId:a,name:s,datasetDeleted:p,filters:l}=o,c={page:t,size:i,dataset_id:a,name:s,dataset_deleted:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=e==null?void 0:e.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),e==null?void 0:e.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,"v1/private/optimizations"),method:"GET",headers:d,queryParameters:{...c,...e==null?void 0:e.queryParams},timeoutMs:((E=(j=e==null?void 0:e.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=e==null?void 0:e.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:tu.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw m.error.statusCode===400?new D(m.error.body,m.rawResponse):new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/optimizations")}createOptimization(o,e){return _.fromPromise(this.__createOptimization(o,e))}async __createOptimization(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:an.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/optimizations")}upsertOptimization(o,e){return _.fromPromise(this.__upsertOptimization(o,e))}async __upsertOptimization(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:an.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/optimizations")}deleteOptimizationsById(o,e){return _.fromPromise(this.__deleteOptimizationsById(o,e))}async __deleteOptimizationsById(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/optimizations/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Yr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/optimizations/delete")}getOptimizationById(o,e={},t){return _.fromPromise(this.__getOptimizationById(o,e,t))}async __getOptimizationById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:xi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/{id}")}updateOptimizationsById(o,e={},t){return _.fromPromise(this.__updateOptimizationsById(o,e,t))}async __updateOptimizationsById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/${w.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:ao.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"PUT","/v1/private/optimizations/{id}")}getStudioOptimizationLogs(o,e={},t){return _.fromPromise(this.__getStudioOptimizationLogs(o,e,t))}async __getStudioOptimizationLogs(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/optimizations/studio/${w.encodePathParam(o)}/logs`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:lu.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/optimizations/studio/{id}/logs")}};var kn=class{constructor(o={}){this._options=F(o);}findProjects(o={},e){return _.fromPromise(this.__findProjects(o,e))}async __findProjects(o={},e){var d,m,u,f,h,g,x,T,j,E,C;let{page:t,size:i,name:a,sorting:s}=o,p={page:t,size:i,name:a,sorting:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/projects"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:zu.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/projects")}createProject(o,e){return _.fromPromise(this.__createProject(o,e))}async __createProject(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:co.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/projects")}getProjectById(o,e={},t){return _.fromPromise(this.__getProjectById(o,e,t))}async __getProjectById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:wi.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/projects/{id}")}deleteProjectById(o,e={},t){return _.fromPromise(this.__deleteProjectById(o,e,t))}async __deleteProjectById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===409?new $(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/projects/{id}")}updateProject(o,e={},t){return _.fromPromise(this.__updateProject(o,e,t))}async __updateProject(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${w.encodePathParam(o)}`),method:"PATCH",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:po.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 422:throw new Q(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PATCH","/v1/private/projects/{id}")}deleteProjectsBatch(o,e){return _.fromPromise(this.__deleteProjectsBatch(o,e))}async __deleteProjectsBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/projects/delete")}findFeedbackScoreNamesByProjectIds(o={},e){return _.fromPromise(this.__findFeedbackScoreNamesByProjectIds(o,e))}async __findFeedbackScoreNamesByProjectIds(o={},e){var p,l,c,d,m,u,f,h,g,x,T;let{projectIds:t}=o,i={project_ids:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:kd.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/projects/feedback-scores/names")}findTokenUsageNames(o,e={},t){return _.fromPromise(this.__findTokenUsageNames(o,e,t))}async __findTokenUsageNames(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${w.encodePathParam(o)}/token-usage/names`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Zu.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/projects/{id}/token-usage/names")}getProjectMetrics(o,e={},t){return _.fromPromise(this.__getProjectMetrics(o,e,t))}async __getProjectMetrics(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/projects/${w.encodePathParam(o)}/metrics`),method:"POST",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:no.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Ru.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"POST","/v1/private/projects/{id}/metrics")}getProjectStats(o={},e){return _.fromPromise(this.__getProjectStats(o,e))}async __getProjectStats(o={},e){var d,m,u,f,h,g,x,T,j,E,C;let{page:t,size:i,name:a,sorting:s}=o,p={page:t,size:i,name:a,sorting:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/private/projects/stats"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:Au.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse});return A(c.error,c.rawResponse,"GET","/v1/private/projects/stats")}retrieveProject(o,e){return _.fromPromise(this.__retrieveProject(o,e))}async __retrieveProject(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/projects/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:so.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:yu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/projects/retrieve")}};var Pn=class{constructor(o={}){this._options=F(o);}getPrompts(o={},e){return _.fromPromise(this.__getPrompts(o,e))}async __getPrompts(o={},e){var m,u,f,h,g,x,T,j,E,C,U;let{page:t,size:i,name:a,sorting:s,filters:p}=o,l={page:t,size:i,name:a,sorting:s,filters:p},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:w.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/prompts"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((j=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(x=this._options)==null?void 0:x.timeoutInSeconds)!=null?j:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:Nu.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new R({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/prompts")}createPrompt(o,e){return _.fromPromise(this.__createPrompt(o,e))}async __createPrompt(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ho.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts")}createPromptVersion(o,e){return _.fromPromise(this.__createPromptVersion(o,e))}async __createPromptVersion(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:lo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Ce.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 409:throw new $(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts/versions")}updatePromptVersions(o,e){return _.fromPromise(this.__updatePromptVersions(o,e))}async __updatePromptVersions(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:uo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/prompts/versions")}getPromptById(o,e={},t){return _.fromPromise(this.__getPromptById(o,e,t))}async __getPromptById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Du.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/prompts/{id}")}updatePrompt(o,e,t){return _.fromPromise(this.__updatePrompt(o,e,t))}async __updatePrompt(o,e,t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${w.encodePathParam(o)}`),method:"PUT",headers:i,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:mo.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new D(a.error.body,a.rawResponse);case 404:throw new I(a.error.body,a.rawResponse);case 409:throw new $(a.error.body,a.rawResponse);case 422:throw new Q(a.error.body,a.rawResponse);default:throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}return A(a.error,a.rawResponse,"PUT","/v1/private/prompts/{id}")}deletePrompt(o,e={},t){return _.fromPromise(this.__deletePrompt(o,e,t))}async __deletePrompt(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/prompts/{id}")}deletePromptsBatch(o,e){return _.fromPromise(this.__deletePromptsBatch(o,e))}async __deletePromptsBatch(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/prompts/delete")}getPromptVersionById(o,e={},t){return _.fromPromise(this.__getPromptVersionById(o,e,t))}async __getPromptVersionById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/prompts/versions/${w.encodePathParam(o)}`),method:"GET",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:Ce.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===404?new I(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"GET","/v1/private/prompts/versions/{versionId}")}getPromptVersions(o,e={},t){return _.fromPromise(this.__getPromptVersions(o,e,t))}async __getPromptVersions(o,e={},t){var u,f,h,g,x,T,j,E,C,U,N;let{page:i,size:a,search:s,sorting:p,filters:l}=e,c={page:i,size:a,search:s,sorting:p,filters:l},d=z((u=this._options)==null?void 0:u.headers,S({"Comet-Workspace":(h=t==null?void 0:t.workspaceName)!=null?h:(f=this._options)==null?void 0:f.workspaceName}),t==null?void 0:t.headers),m=await k({url:w.join((x=(g=await b.get(this._options.baseUrl))!=null?g:await b.get(this._options.environment))!=null?x:P.Default,`v1/private/prompts/${w.encodePathParam(o)}/versions`),method:"GET",headers:d,queryParameters:{...c,...t==null?void 0:t.queryParams},timeoutMs:((E=(j=t==null?void 0:t.timeoutInSeconds)!=null?j:(T=this._options)==null?void 0:T.timeoutInSeconds)!=null?E:60)*1e3,maxRetries:(U=t==null?void 0:t.maxRetries)!=null?U:(C=this._options)==null?void 0:C.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(N=this._options)==null?void 0:N.fetch,logging:this._options.logging});if(m.ok)return {data:Vu.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")throw new R({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse});return A(m.error,m.rawResponse,"GET","/v1/private/prompts/{id}/versions")}restorePromptVersion(o,e,t={},i){return _.fromPromise(this.__restorePromptVersion(o,e,t,i))}async __restorePromptVersion(o,e,t={},i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/prompts/${w.encodePathParam(o)}/versions/${w.encodePathParam(e)}/restore`),method:"POST",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:Ce.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new D(s.error.body,s.rawResponse);case 404:throw new I(s.error.body,s.rawResponse);default:throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}return A(s.error,s.rawResponse,"POST","/v1/private/prompts/{promptId}/versions/{versionId}/restore")}retrievePromptVersion(o,e){return _.fromPromise(this.__retrievePromptVersion(o,e))}async __retrievePromptVersion(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:fo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Ce.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 404:throw new I(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/prompts/versions/retrieve")}};var Sn=class{constructor(o={}){this._options=F(o);}datasetsRedirect(o,e){return _.fromPromise(this.__datasetsRedirect(o,e))}async __datasetsRedirect(o,e){var c,d,m,u,f,h,g,x,T,j,E;let{datasetId:t,workspaceName:i,path:a}=o,s={dataset_id:t,workspace_name:i,path:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=e==null?void 0:e.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),e==null?void 0:e.headers),l=await k({url:w.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,"v1/session/redirect/datasets"),method:"GET",headers:p,queryParameters:{...s,...e==null?void 0:e.queryParams},timeoutMs:((x=(g=e==null?void 0:e.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?x:60)*1e3,maxRetries:(j=e==null?void 0:e.maxRetries)!=null?j:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);default:throw new R({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"GET","/v1/session/redirect/datasets")}experimentsRedirect(o,e){return _.fromPromise(this.__experimentsRedirect(o,e))}async __experimentsRedirect(o,e){var d,m,u,f,h,g,x,T,j,E,C;let{datasetId:t,experimentId:i,workspaceName:a,path:s}=o,p={dataset_id:t,experiment_id:i,workspace_name:a,path:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/session/redirect/experiments"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:void 0,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new D(c.error.body,c.rawResponse);case 404:throw new I(c.error.body,c.rawResponse);default:throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return A(c.error,c.rawResponse,"GET","/v1/session/redirect/experiments")}optimizationsRedirect(o,e){return _.fromPromise(this.__optimizationsRedirect(o,e))}async __optimizationsRedirect(o,e){var d,m,u,f,h,g,x,T,j,E,C;let{datasetId:t,optimizationId:i,workspaceName:a,path:s}=o,p={dataset_id:t,optimization_id:i,workspace_name:a,path:s},l=z((d=this._options)==null?void 0:d.headers,S({"Comet-Workspace":(u=e==null?void 0:e.workspaceName)!=null?u:(m=this._options)==null?void 0:m.workspaceName}),e==null?void 0:e.headers),c=await k({url:w.join((h=(f=await b.get(this._options.baseUrl))!=null?f:await b.get(this._options.environment))!=null?h:P.Default,"v1/session/redirect/optimizations"),method:"GET",headers:l,queryParameters:{...p,...e==null?void 0:e.queryParams},timeoutMs:((T=(x=e==null?void 0:e.timeoutInSeconds)!=null?x:(g=this._options)==null?void 0:g.timeoutInSeconds)!=null?T:60)*1e3,maxRetries:(E=e==null?void 0:e.maxRetries)!=null?E:(j=this._options)==null?void 0:j.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(C=this._options)==null?void 0:C.fetch,logging:this._options.logging});if(c.ok)return {data:void 0,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new D(c.error.body,c.rawResponse);case 404:throw new I(c.error.body,c.rawResponse);default:throw new R({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}return A(c.error,c.rawResponse,"GET","/v1/session/redirect/optimizations")}projectsRedirect(o,e){return _.fromPromise(this.__projectsRedirect(o,e))}async __projectsRedirect(o,e){var c,d,m,u,f,h,g,x,T,j,E;let{traceId:t,workspaceName:i,path:a}=o,s={trace_id:t,workspace_name:i,path:a},p=z((c=this._options)==null?void 0:c.headers,S({"Comet-Workspace":(m=e==null?void 0:e.workspaceName)!=null?m:(d=this._options)==null?void 0:d.workspaceName}),e==null?void 0:e.headers),l=await k({url:w.join((f=(u=await b.get(this._options.baseUrl))!=null?u:await b.get(this._options.environment))!=null?f:P.Default,"v1/session/redirect/projects"),method:"GET",headers:p,queryParameters:{...s,...e==null?void 0:e.queryParams},timeoutMs:((x=(g=e==null?void 0:e.timeoutInSeconds)!=null?g:(h=this._options)==null?void 0:h.timeoutInSeconds)!=null?x:60)*1e3,maxRetries:(j=e==null?void 0:e.maxRetries)!=null?j:(T=this._options)==null?void 0:T.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(E=this._options)==null?void 0:E.fetch,logging:this._options.logging});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new D(l.error.body,l.rawResponse);case 404:throw new I(l.error.body,l.rawResponse);default:throw new R({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}return A(l.error,l.rawResponse,"GET","/v1/session/redirect/projects")}};var An=class{constructor(o={}){this._options=F(o);}getServiceToggles(o){return _.fromPromise(this.__getServiceToggles(o))}async __getServiceToggles(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/toggles"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Gu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/toggles")}};var Tn=class{constructor(o={}){this._options=F(o);}addSpanComment(o,e,t){return _.fromPromise(this.__addSpanComment(o,e,t))}async __addSpanComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${w.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/spans/{id}/comments")}addSpanFeedbackScore(o,e,t){return _.fromPromise(this.__addSpanFeedbackScore(o,e,t))}async __addSpanFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${w.encodePathParam(o)}/feedback-scores`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pe.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PUT","/v1/private/spans/{id}/feedback-scores")}createSpans(o,e){return _.fromPromise(this.__createSpans(o,e))}async __createSpans(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:wo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/batch")}batchUpdateSpans(o,e){return _.fromPromise(this.__batchUpdateSpans(o,e))}async __batchUpdateSpans(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:yo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/spans/batch")}getSpansByProject(o={},e){return _.fromPromise(this.__getSpansByProject(o,e))}async __getSpansByProject(o={},e){var E,C,U,N,O,ae,ze,ke,He,ct,lt;let{page:t,size:i,projectName:a,projectId:s,traceId:p,type:l,filters:c,truncate:d,stripAttachments:m,sorting:u,exclude:f,fromTime:h,toTime:g}=o,x={page:t,size:i,project_name:a,project_id:s,trace_id:p,type:l!=null?$a.jsonOrThrow(l,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0,filters:c,truncate:d,strip_attachments:m,sorting:u,exclude:f,from_time:h==null?void 0:h.toISOString(),to_time:g==null?void 0:g.toISOString()},T=z((E=this._options)==null?void 0:E.headers,S({"Comet-Workspace":(U=e==null?void 0:e.workspaceName)!=null?U:(C=this._options)==null?void 0:C.workspaceName}),e==null?void 0:e.headers),j=await k({url:w.join((O=(N=await b.get(this._options.baseUrl))!=null?N:await b.get(this._options.environment))!=null?O:P.Default,"v1/private/spans"),method:"GET",headers:T,queryParameters:{...x,...e==null?void 0:e.queryParams},timeoutMs:((ke=(ze=e==null?void 0:e.timeoutInSeconds)!=null?ze:(ae=this._options)==null?void 0:ae.timeoutInSeconds)!=null?ke:60)*1e3,maxRetries:(ct=e==null?void 0:e.maxRetries)!=null?ct:(He=this._options)==null?void 0:He.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(lt=this._options)==null?void 0:lt.fetch,logging:this._options.logging});if(j.ok)return {data:$u.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")throw new R({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse});return A(j.error,j.rawResponse,"GET","/v1/private/spans")}createSpan(o,e){return _.fromPromise(this.__createSpan(o,e))}async __createSpan(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:xo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===409?new $(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans")}getSpanById(o,e={},t){return _.fromPromise(this.__getSpanById(o,e,t))}async __getSpanById(o,e={},t){var l,c,d,m,u,f,h,g,x,T,j;let{stripAttachments:i}=e,a={strip_attachments:i},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/spans/${w.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:_i.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw p.error.statusCode===404?new I(p.error.body,p.rawResponse):new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/spans/{id}")}deleteSpanById(o,e={},t){return _.fromPromise(this.__deleteSpanById(o,e,t))}async __deleteSpanById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/spans/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw a.error.statusCode===501?new or(a.error.body,a.rawResponse):new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/spans/{id}")}updateSpan(o,e,t){return _.fromPromise(this.__updateSpan(o,e,t))}async __updateSpan(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:go.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/spans/{id}")}deleteSpanComments(o,e){return _.fromPromise(this.__deleteSpanComments(o,e))}async __deleteSpanComments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/comments/delete")}deleteSpanFeedbackScore(o,e,t){return _.fromPromise(this.__deleteSpanFeedbackScore(o,e,t))}async __deleteSpanFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${w.encodePathParam(o)}/feedback-scores/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/spans/{id}/feedback-scores/delete")}findFeedbackScoreNames1(o={},e){return _.fromPromise(this.__findFeedbackScoreNames1(o,e))}async __findFeedbackScoreNames1(o={},e){var l,c,d,m,u,f,h,g,x,T,j;let{projectId:t,type:i}=o,a={project_id:t,type:i!=null?Ga.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=e==null?void 0:e.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),e==null?void 0:e.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:s,queryParameters:{...a,...e==null?void 0:e.queryParams},timeoutMs:((g=(h=e==null?void 0:e.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=e==null?void 0:e.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:Vr.findFeedbackScoreNames1.Response.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/spans/feedback-scores/names")}getSpanComment(o,e,t={},i){return _.fromPromise(this.__getSpanComment(o,e,t,i))}async __getSpanComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/${w.encodePathParam(o)}/comments/${w.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:q.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/spans/{spanId}/comments/{commentId}")}getSpanStats(o={},e){return _.fromPromise(this.__getSpanStats(o,e))}async __getSpanStats(o={},e){var f,h,g,x,T,j,E,C,U,N,O;let{projectId:t,projectName:i,traceId:a,type:s,filters:p,fromTime:l,toTime:c}=o,d={project_id:t,project_name:i,trace_id:a,type:s!=null?Ka.jsonOrThrow(s,{unrecognizedObjectKeys:"strip",omitUndefined:true}):void 0,filters:p,from_time:l==null?void 0:l.toISOString(),to_time:c==null?void 0:c.toISOString()},m=z((f=this._options)==null?void 0:f.headers,S({"Comet-Workspace":(g=e==null?void 0:e.workspaceName)!=null?g:(h=this._options)==null?void 0:h.workspaceName}),e==null?void 0:e.headers),u=await k({url:w.join((T=(x=await b.get(this._options.baseUrl))!=null?x:await b.get(this._options.environment))!=null?T:P.Default,"v1/private/spans/stats"),method:"GET",headers:m,queryParameters:{...d,...e==null?void 0:e.queryParams},timeoutMs:((C=(E=e==null?void 0:e.timeoutInSeconds)!=null?E:(j=this._options)==null?void 0:j.timeoutInSeconds)!=null?C:60)*1e3,maxRetries:(N=e==null?void 0:e.maxRetries)!=null?N:(U=this._options)==null?void 0:U.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(O=this._options)==null?void 0:O.fetch,logging:this._options.logging});if(u.ok)return {data:$e.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new R({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});return A(u.error,u.rawResponse,"GET","/v1/private/spans/stats")}scoreBatchOfSpans(o,e){return _.fromPromise(this.__scoreBatchOfSpans(o,e))}async __scoreBatchOfSpans(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:gi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/spans/feedback-scores")}searchSpans(o={},e){return _.fromPromise(this.__searchSpans(o,e))}async __searchSpans(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/spans/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ro.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/spans/search")}updateSpanComment(o,e,t){return _.fromPromise(this.__updateSpanComment(o,e,t))}async __updateSpanComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/spans/comments/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/spans/comments/{commentId}")}};var vn=class{constructor(o={}){this._options=F(o);}getDatasetBiInfo(o){return _.fromPromise(this.__getDatasetBiInfo(o))}async __getDatasetBiInfo(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:$r.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-datasets")}getExperimentBiInfo(o){return _.fromPromise(this.__getExperimentBiInfo(o))}async __getExperimentBiInfo(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:$r.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-experiments")}getSpansBiInfo(o){return _.fromPromise(this.__getSpansBiInfo(o))}async __getSpansBiInfo(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-spans"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:$r.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-spans")}getSpansCountForWorkspaces(o){return _.fromPromise(this.__getSpansCountForWorkspaces(o))}async __getSpansCountForWorkspaces(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Yu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/workspace-span-counts")}getTracesBiInfo(o){return _.fromPromise(this.__getTracesBiInfo(o))}async __getTracesBiInfo(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:$r.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/bi-traces")}getTracesCountForWorkspaces(o){return _.fromPromise(this.__getTracesCountForWorkspaces(o))}async __getTracesCountForWorkspaces(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:qu.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/internal/usage/workspace-trace-counts")}};var jn=class{constructor(o={}){this._options=F(o);}addThreadComment(o,e,t){return _.fromPromise(this.__addThreadComment(o,e,t))}async __addThreadComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${w.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/traces/threads/{id}/comments")}addTraceComment(o,e,t){return _.fromPromise(this.__addTraceComment(o,e,t))}async __addTraceComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${w.encodePathParam(o)}/comments`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/traces/{id}/comments")}addTraceFeedbackScore(o,e,t){return _.fromPromise(this.__addTraceFeedbackScore(o,e,t))}async __addTraceFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${w.encodePathParam(o)}/feedback-scores`),method:"PUT",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pe.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PUT","/v1/private/traces/{id}/feedback-scores")}createTraces(o,e){return _.fromPromise(this.__createTraces(o,e))}async __createTraces(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/batch"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:To.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/batch")}batchUpdateTraces(o,e){return _.fromPromise(this.__batchUpdateTraces(o,e))}async __batchUpdateTraces(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:So.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/traces/batch")}batchUpdateThreads(o,e){return _.fromPromise(this.__batchUpdateThreads(o,e))}async __batchUpdateThreads(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/batch"),method:"PATCH",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Co.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PATCH","/v1/private/traces/threads/batch")}closeTraceThread(o={},e){return _.fromPromise(this.__closeTraceThread(o,e))}async __closeTraceThread(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/close"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:jo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===404?new I(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/close")}getTracesByProject(o={},e){return _.fromPromise(this.__getTracesByProject(o,e))}async __getTracesByProject(o={},e){var T,j,E,C,U,N,O,ae,ze,ke,He;let{page:t,size:i,projectName:a,projectId:s,filters:p,truncate:l,stripAttachments:c,sorting:d,exclude:m,fromTime:u,toTime:f}=o,h={page:t,size:i,project_name:a,project_id:s,filters:p,truncate:l,strip_attachments:c,sorting:d,exclude:m,from_time:u==null?void 0:u.toISOString(),to_time:f==null?void 0:f.toISOString()},g=z((T=this._options)==null?void 0:T.headers,S({"Comet-Workspace":(E=e==null?void 0:e.workspaceName)!=null?E:(j=this._options)==null?void 0:j.workspaceName}),e==null?void 0:e.headers),x=await k({url:w.join((U=(C=await b.get(this._options.baseUrl))!=null?C:await b.get(this._options.environment))!=null?U:P.Default,"v1/private/traces"),method:"GET",headers:g,queryParameters:{...h,...e==null?void 0:e.queryParams},timeoutMs:((ae=(O=e==null?void 0:e.timeoutInSeconds)!=null?O:(N=this._options)==null?void 0:N.timeoutInSeconds)!=null?ae:60)*1e3,maxRetries:(ke=e==null?void 0:e.maxRetries)!=null?ke:(ze=this._options)==null?void 0:ze.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(He=this._options)==null?void 0:He.fetch,logging:this._options.logging});if(x.ok)return {data:rf.parseOrThrow(x.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:x.rawResponse};if(x.error.reason==="status-code")throw new R({statusCode:x.error.statusCode,body:x.error.body,rawResponse:x.rawResponse});return A(x.error,x.rawResponse,"GET","/v1/private/traces")}createTrace(o,e){return _.fromPromise(this.__createTrace(o,e))}async __createTrace(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Ao.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces")}getTraceById(o,e={},t){return _.fromPromise(this.__getTraceById(o,e,t))}async __getTraceById(o,e={},t){var l,c,d,m,u,f,h,g,x,T,j;let{stripAttachments:i}=e,a={strip_attachments:i},s=z((l=this._options)==null?void 0:l.headers,S({"Comet-Workspace":(d=t==null?void 0:t.workspaceName)!=null?d:(c=this._options)==null?void 0:c.workspaceName}),t==null?void 0:t.headers),p=await k({url:w.join((u=(m=await b.get(this._options.baseUrl))!=null?m:await b.get(this._options.environment))!=null?u:P.Default,`v1/private/traces/${w.encodePathParam(o)}`),method:"GET",headers:s,queryParameters:{...a,...t==null?void 0:t.queryParams},timeoutMs:((g=(h=t==null?void 0:t.timeoutInSeconds)!=null?h:(f=this._options)==null?void 0:f.timeoutInSeconds)!=null?g:60)*1e3,maxRetries:(T=t==null?void 0:t.maxRetries)!=null?T:(x=this._options)==null?void 0:x.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(j=this._options)==null?void 0:j.fetch,logging:this._options.logging});if(p.ok)return {data:zi.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")throw new R({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse});return A(p.error,p.rawResponse,"GET","/v1/private/traces/{id}")}deleteTraceById(o,e={},t){return _.fromPromise(this.__deleteTraceById(o,e,t))}async __deleteTraceById(o,e={},t){var s,p,l,c,d,m,u,f,h,g,x;let i=z((s=this._options)==null?void 0:s.headers,S({"Comet-Workspace":(l=t==null?void 0:t.workspaceName)!=null?l:(p=this._options)==null?void 0:p.workspaceName}),t==null?void 0:t.headers),a=await k({url:w.join((d=(c=await b.get(this._options.baseUrl))!=null?c:await b.get(this._options.environment))!=null?d:P.Default,`v1/private/traces/${w.encodePathParam(o)}`),method:"DELETE",headers:i,queryParameters:t==null?void 0:t.queryParams,timeoutMs:((f=(u=t==null?void 0:t.timeoutInSeconds)!=null?u:(m=this._options)==null?void 0:m.timeoutInSeconds)!=null?f:60)*1e3,maxRetries:(g=t==null?void 0:t.maxRetries)!=null?g:(h=this._options)==null?void 0:h.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(x=this._options)==null?void 0:x.fetch,logging:this._options.logging});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new R({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});return A(a.error,a.rawResponse,"DELETE","/v1/private/traces/{id}")}updateTrace(o,e,t){return _.fromPromise(this.__updateTrace(o,e,t))}async __updateTrace(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Po.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/traces/{id}")}deleteThreadComments(o,e){return _.fromPromise(this.__deleteThreadComments(o,e))}async __deleteThreadComments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/comments/delete")}deleteThreadFeedbackScores(o,e){return _.fromPromise(this.__deleteThreadFeedbackScores(o,e))}async __deleteThreadFeedbackScores(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/feedback-scores/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:_o.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/feedback-scores/delete")}deleteTraceComments(o,e){return _.fromPromise(this.__deleteTraceComments(o,e))}async __deleteTraceComments(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/comments/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/comments/delete")}deleteTraceFeedbackScore(o,e,t){return _.fromPromise(this.__deleteTraceFeedbackScore(o,e,t))}async __deleteTraceFeedbackScore(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${w.encodePathParam(o)}/feedback-scores/delete`),method:"POST",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:pi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"POST","/v1/private/traces/{id}/feedback-scores/delete")}deleteTraceThreads(o,e){return _.fromPromise(this.__deleteTraceThreads(o,e))}async __deleteTraceThreads(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:zo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/delete")}deleteTraces(o,e){return _.fromPromise(this.__deleteTraces(o,e))}async __deleteTraces(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/delete"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:X.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/delete")}findFeedbackScoreNames2(o={},e){return _.fromPromise(this.__findFeedbackScoreNames2(o,e))}async __findFeedbackScoreNames2(o={},e){var p,l,c,d,m,u,f,h,g,x,T;let{projectId:t}=o,i={project_id:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:cr.findFeedbackScoreNames2.Response.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/traces/feedback-scores/names")}findTraceThreadsFeedbackScoreNames(o={},e){return _.fromPromise(this.__findTraceThreadsFeedbackScoreNames(o,e))}async __findTraceThreadsFeedbackScoreNames(o={},e){var p,l,c,d,m,u,f,h,g,x,T;let{projectId:t}=o,i={project_id:t},a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=e==null?void 0:e.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),e==null?void 0:e.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,"v1/private/traces/threads/feedback-scores/names"),method:"GET",headers:a,queryParameters:{...i,...e==null?void 0:e.queryParams},timeoutMs:((h=(f=e==null?void 0:e.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=e==null?void 0:e.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:cr.findTraceThreadsFeedbackScoreNames.Response.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/traces/threads/feedback-scores/names")}getTraceStats(o={},e){return _.fromPromise(this.__getTraceStats(o,e))}async __getTraceStats(o={},e){var m,u,f,h,g,x,T,j,E,C,U;let{projectId:t,projectName:i,filters:a,fromTime:s,toTime:p}=o,l={project_id:t,project_name:i,filters:a,from_time:s==null?void 0:s.toISOString(),to_time:p==null?void 0:p.toISOString()},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:w.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/traces/stats"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((j=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(x=this._options)==null?void 0:x.timeoutInSeconds)!=null?j:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:$e.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new R({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/traces/stats")}getThreadComment(o,e,t={},i){return _.fromPromise(this.__getThreadComment(o,e,t,i))}async __getThreadComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${w.encodePathParam(o)}/comments/${w.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:q.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/traces/threads/{threadId}/comments/{commentId}")}getTraceThreadStats(o={},e){return _.fromPromise(this.__getTraceThreadStats(o,e))}async __getTraceThreadStats(o={},e){var m,u,f,h,g,x,T,j,E,C,U;let{projectId:t,projectName:i,filters:a,fromTime:s,toTime:p}=o,l={project_id:t,project_name:i,filters:a,from_time:s==null?void 0:s.toISOString(),to_time:p==null?void 0:p.toISOString()},c=z((m=this._options)==null?void 0:m.headers,S({"Comet-Workspace":(f=e==null?void 0:e.workspaceName)!=null?f:(u=this._options)==null?void 0:u.workspaceName}),e==null?void 0:e.headers),d=await k({url:w.join((g=(h=await b.get(this._options.baseUrl))!=null?h:await b.get(this._options.environment))!=null?g:P.Default,"v1/private/traces/threads/stats"),method:"GET",headers:c,queryParameters:{...l,...e==null?void 0:e.queryParams},timeoutMs:((j=(T=e==null?void 0:e.timeoutInSeconds)!=null?T:(x=this._options)==null?void 0:x.timeoutInSeconds)!=null?j:60)*1e3,maxRetries:(C=e==null?void 0:e.maxRetries)!=null?C:(E=this._options)==null?void 0:E.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(U=this._options)==null?void 0:U.fetch,logging:this._options.logging});if(d.ok)return {data:$e.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new R({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});return A(d.error,d.rawResponse,"GET","/v1/private/traces/threads/stats")}getTraceComment(o,e,t={},i){return _.fromPromise(this.__getTraceComment(o,e,t,i))}async __getTraceComment(o,e,t={},i){var p,l,c,d,m,u,f,h,g,x,T;let a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=i==null?void 0:i.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),i==null?void 0:i.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/${w.encodePathParam(o)}/comments/${w.encodePathParam(e)}`),method:"GET",headers:a,queryParameters:i==null?void 0:i.queryParams,timeoutMs:((h=(f=i==null?void 0:i.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=i==null?void 0:i.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:q.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"GET","/v1/private/traces/{traceId}/comments/{commentId}")}getTraceThread(o,e){return _.fromPromise(this.__getTraceThread(o,e))}async __getTraceThread(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:nn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:ki.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===404?new I(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/retrieve")}getTraceThreads(o={},e){return _.fromPromise(this.__getTraceThreads(o,e))}async __getTraceThreads(o={},e){var x,T,j,E,C,U,N,O,ae,ze,ke;let{page:t,size:i,projectName:a,projectId:s,truncate:p,stripAttachments:l,filters:c,sorting:d,fromTime:m,toTime:u}=o,f={page:t,size:i,project_name:a,project_id:s,truncate:p,strip_attachments:l,filters:c,sorting:d,from_time:m==null?void 0:m.toISOString(),to_time:u==null?void 0:u.toISOString()},h=z((x=this._options)==null?void 0:x.headers,S({"Comet-Workspace":(j=e==null?void 0:e.workspaceName)!=null?j:(T=this._options)==null?void 0:T.workspaceName}),e==null?void 0:e.headers),g=await k({url:w.join((C=(E=await b.get(this._options.baseUrl))!=null?E:await b.get(this._options.environment))!=null?C:P.Default,"v1/private/traces/threads"),method:"GET",headers:h,queryParameters:{...f,...e==null?void 0:e.queryParams},timeoutMs:((O=(N=e==null?void 0:e.timeoutInSeconds)!=null?N:(U=this._options)==null?void 0:U.timeoutInSeconds)!=null?O:60)*1e3,maxRetries:(ze=e==null?void 0:e.maxRetries)!=null?ze:(ae=this._options)==null?void 0:ae.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(ke=this._options)==null?void 0:ke.fetch,logging:this._options.logging});if(g.ok)return {data:of.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new R({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});return A(g.error,g.rawResponse,"GET","/v1/private/traces/threads")}openTraceThread(o,e){return _.fromPromise(this.__openTraceThread(o,e))}async __openTraceThread(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/open"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:nn.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/open")}scoreBatchOfThreads(o,e){return _.fromPromise(this.__scoreBatchOfThreads(o,e))}async __scoreBatchOfThreads(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:ko.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/threads/feedback-scores")}scoreBatchOfTraces(o,e){return _.fromPromise(this.__scoreBatchOfTraces(o,e))}async __scoreBatchOfTraces(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:gi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"PUT","/v1/private/traces/feedback-scores")}searchTraceThreads(o={},e){return _.fromPromise(this.__searchTraceThreads(o,e))}async __searchTraceThreads(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/threads/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Io.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/traces/threads/search")}searchTraces(o={},e){return _.fromPromise(this.__searchTraces(o,e))}async __searchTraces(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/traces/search"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:vo.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),responseType:"streaming",timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:i.body,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 401:throw new re(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"POST","/v1/private/traces/search")}updateThread(o,e,t){return _.fromPromise(this.__updateThread(o,e,t))}async __updateThread(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:Eo.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/traces/threads/{threadModelId}")}updateThreadComment(o,e,t){return _.fromPromise(this.__updateThreadComment(o,e,t))}async __updateThreadComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/threads/comments/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/traces/threads/comments/{commentId}")}updateTraceComment(o,e,t){return _.fromPromise(this.__updateTraceComment(o,e,t))}async __updateTraceComment(o,e,t){var p,l,c,d,m,u,f,h,g,x,T;let{body:i}=e,a=z((p=this._options)==null?void 0:p.headers,S({"Comet-Workspace":(c=t==null?void 0:t.workspaceName)!=null?c:(l=this._options)==null?void 0:l.workspaceName}),t==null?void 0:t.headers),s=await k({url:w.join((m=(d=await b.get(this._options.baseUrl))!=null?d:await b.get(this._options.environment))!=null?m:P.Default,`v1/private/traces/comments/${w.encodePathParam(o)}`),method:"PATCH",headers:a,contentType:"application/json",queryParameters:t==null?void 0:t.queryParams,requestType:"json",body:q.jsonOrThrow(i,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((h=(f=t==null?void 0:t.timeoutInSeconds)!=null?f:(u=this._options)==null?void 0:u.timeoutInSeconds)!=null?h:60)*1e3,maxRetries:(x=t==null?void 0:t.maxRetries)!=null?x:(g=this._options)==null?void 0:g.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal,fetchFn:(T=this._options)==null?void 0:T.fetch,logging:this._options.logging});if(s.ok)return {data:void 0,rawResponse:s.rawResponse};if(s.error.reason==="status-code")throw s.error.statusCode===404?new I(s.error.body,s.rawResponse):new R({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse});return A(s.error,s.rawResponse,"PATCH","/v1/private/traces/comments/{commentId}")}};var En=class{constructor(o={}){this._options=F(o);}getWelcomeWizardStatus(o){return _.fromPromise(this.__getWelcomeWizardStatus(o))}async __getWelcomeWizardStatus(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/welcome-wizard"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:pf.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/welcome-wizard")}submitWelcomeWizard(o={},e){return _.fromPromise(this.__submitWelcomeWizard(o,e))}async __submitWelcomeWizard(o={},e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/welcome-wizard"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Do.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/welcome-wizard")}};var Cn=class{constructor(o={}){this._options=F(o);}costsSummary(o,e){return _.fromPromise(this.__costsSummary(o,e))}async __costsSummary(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/costs/summaries"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Zr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:_r.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/costs/summaries")}getWorkspaceConfiguration(o){return _.fromPromise(this.__getWorkspaceConfiguration(o))}async __getWorkspaceConfiguration(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/workspaces/configurations"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:Pi.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw t.error.statusCode===404?new I(t.error.body,t.rawResponse):new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/v1/private/workspaces/configurations")}upsertWorkspaceConfiguration(o,e){return _.fromPromise(this.__upsertWorkspaceConfiguration(o,e))}async __upsertWorkspaceConfiguration(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/configurations"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Pi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:Pi.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new D(i.error.body,i.rawResponse);case 422:throw new Q(i.error.body,i.rawResponse);default:throw new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}return A(i.error,i.rawResponse,"PUT","/v1/private/workspaces/configurations")}deleteWorkspaceConfiguration(o){return _.fromPromise(this.__deleteWorkspaceConfiguration(o))}async __deleteWorkspaceConfiguration(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:void 0,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw t.error.statusCode===404?new I(t.error.body,t.rawResponse):new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"DELETE","/v1/private/workspaces/configurations")}getCost(o,e){return _.fromPromise(this.__getCost(o,e))}async __getCost(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/costs"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Zr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:sn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/costs")}getMetric(o,e){return _.fromPromise(this.__getMetric(o,e))}async __getMetric(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/metrics"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Zr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:sn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/metrics")}metricsSummary(o,e){return _.fromPromise(this.__metricsSummary(o,e))}async __metricsSummary(o,e){var a,s,p,l,c,d,m,u,f,h,g;let t=z((a=this._options)==null?void 0:a.headers,S({"Comet-Workspace":(p=e==null?void 0:e.workspaceName)!=null?p:(s=this._options)==null?void 0:s.workspaceName}),e==null?void 0:e.headers),i=await k({url:w.join((c=(l=await b.get(this._options.baseUrl))!=null?l:await b.get(this._options.environment))!=null?c:P.Default,"v1/private/workspaces/metrics/summaries"),method:"POST",headers:t,contentType:"application/json",queryParameters:e==null?void 0:e.queryParams,requestType:"json",body:Zr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip",omitUndefined:true}),timeoutMs:((u=(m=e==null?void 0:e.timeoutInSeconds)!=null?m:(d=this._options)==null?void 0:d.timeoutInSeconds)!=null?u:60)*1e3,maxRetries:(h=e==null?void 0:e.maxRetries)!=null?h:(f=this._options)==null?void 0:f.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal,fetchFn:(g=this._options)==null?void 0:g.fetch,logging:this._options.logging});if(i.ok)return {data:cf.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,skipValidation:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw i.error.statusCode===400?new D(i.error.body,i.rawResponse):new R({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});return A(i.error,i.rawResponse,"POST","/v1/private/workspaces/metrics/summaries")}};var Si=class{constructor(o={}){this._options=F(o);}get systemUsage(){var o;return (o=this._systemUsage)!=null?o:this._systemUsage=new vn(this._options)}get alerts(){var o;return (o=this._alerts)!=null?o:this._alerts=new pn(this._options)}get annotationQueues(){var o;return (o=this._annotationQueues)!=null?o:this._annotationQueues=new cn(this._options)}get attachments(){var o;return (o=this._attachments)!=null?o:this._attachments=new ln(this._options)}get check(){var o;return (o=this._check)!=null?o:this._check=new un(this._options)}get automationRuleEvaluators(){var o;return (o=this._automationRuleEvaluators)!=null?o:this._automationRuleEvaluators=new mn(this._options)}get chatCompletions(){var o;return (o=this._chatCompletions)!=null?o:this._chatCompletions=new dn(this._options)}get dashboards(){var o;return (o=this._dashboards)!=null?o:this._dashboards=new fn(this._options)}get datasets(){var o;return (o=this._datasets)!=null?o:this._datasets=new hn(this._options)}get experiments(){var o;return (o=this._experiments)!=null?o:this._experiments=new gn(this._options)}get feedbackDefinitions(){var o;return (o=this._feedbackDefinitions)!=null?o:this._feedbackDefinitions=new yn(this._options)}get guardrails(){var o;return (o=this._guardrails)!=null?o:this._guardrails=new bn(this._options)}get llmProviderKey(){var o;return (o=this._llmProviderKey)!=null?o:this._llmProviderKey=new xn(this._options)}get manualEvaluation(){var o;return (o=this._manualEvaluation)!=null?o:this._manualEvaluation=new wn(this._options)}get ollama(){var o;return (o=this._ollama)!=null?o:this._ollama=new Rn(this._options)}get openTelemetryIngestion(){var o;return (o=this._openTelemetryIngestion)!=null?o:this._openTelemetryIngestion=new _n(this._options)}get optimizations(){var o;return (o=this._optimizations)!=null?o:this._optimizations=new zn(this._options)}get projects(){var o;return (o=this._projects)!=null?o:this._projects=new kn(this._options)}get prompts(){var o;return (o=this._prompts)!=null?o:this._prompts=new Pn(this._options)}get serviceToggles(){var o;return (o=this._serviceToggles)!=null?o:this._serviceToggles=new An(this._options)}get spans(){var o;return (o=this._spans)!=null?o:this._spans=new Tn(this._options)}get traces(){var o;return (o=this._traces)!=null?o:this._traces=new jn(this._options)}get welcomeWizard(){var o;return (o=this._welcomeWizard)!=null?o:this._welcomeWizard=new En(this._options)}get workspaces(){var o;return (o=this._workspaces)!=null?o:this._workspaces=new Cn(this._options)}get redirect(){var o;return (o=this._redirect)!=null?o:this._redirect=new Sn(this._options)}isAlive(o){return _.fromPromise(this.__isAlive(o))}async __isAlive(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"is-alive/ping"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/is-alive/ping")}version(o){return _.fromPromise(this.__version(o))}async __version(o){var i,a,s,p,l,c,d,m,u,f,h;let e=z((i=this._options)==null?void 0:i.headers,S({"Comet-Workspace":(s=o==null?void 0:o.workspaceName)!=null?s:(a=this._options)==null?void 0:a.workspaceName}),o==null?void 0:o.headers),t=await k({url:w.join((l=(p=await b.get(this._options.baseUrl))!=null?p:await b.get(this._options.environment))!=null?l:P.Default,"is-alive/ver"),method:"GET",headers:e,queryParameters:o==null?void 0:o.queryParams,timeoutMs:((m=(d=o==null?void 0:o.timeoutInSeconds)!=null?d:(c=this._options)==null?void 0:c.timeoutInSeconds)!=null?m:60)*1e3,maxRetries:(f=o==null?void 0:o.maxRetries)!=null?f:(u=this._options)==null?void 0:u.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal,fetchFn:(h=this._options)==null?void 0:h.fetch,logging:this._options.logging});if(t.ok)return {data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")throw new R({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse});return A(t.error,t.rawResponse,"GET","/is-alive/ver")}};var cg;(e=>(e.LogLevel=he,e.ConsoleLogger=ir))(cg||(cg={}));var ie=()=>uuid.v7();var Or=class{static serializePromptToInfoDict(o){return {name:o.name,...o.id&&{id:o.id},version:{...o.versionId&&{id:o.versionId},...o.commit&&{commit:o.commit},template:o.prompt}}}static normalizeMetadata(o){if(!o)return {};if(typeof o=="object"&&!Array.isArray(o))return o;if(typeof o=="string")try{let e=JSON.parse(o);if(typeof e=="object"&&!Array.isArray(e))return e}catch{}return {}}static mergePromptsIntoMetadata(o,e,t){let i=t.map(p=>this.serializePromptToInfoDict(p)),a=this.normalizeMetadata(o),s=this.normalizeMetadata(e);return {...a,...s,opik_prompts:i}}static processTraceUpdate(o,e){let{prompts:t,...i}=o;if(!t||t.length===0)return i;let a=this.mergePromptsIntoMetadata(e,i.metadata,t);return {...i,metadata:a}}static processSpanUpdate(o,e){let{prompts:t,...i}=o;if(!t||t.length===0)return i;let a=this.mergePromptsIntoMetadata(e,i.metadata,t);return {...i,metadata:a}}};var In=class n{constructor(o,e){this.data=o;this.opik=e;this.childSpans=[];this.end=()=>this.update({endTime:new Date});this.score=o=>{var e;this.opik.spanFeedbackScoresBatchQueue.create({...o,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=o=>{var i;let e=Or.processSpanUpdate(o,this.data.metadata),t={parentSpanId:this.data.parentSpanId,projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,traceId:this.data.traceId,...e};return this.opik.spanBatchQueue.update(this.data.id,t),this.data={...this.data,...o},this};this.span=o=>{var a;let e=(a=this.data.projectName)!=null?a:this.opik.config.projectName,t={id:ie(),startTime:new Date,...o,projectName:e,traceId:this.data.traceId,parentSpanId:this.data.id};this.opik.spanBatchQueue.create(t);let i=new n(t,this.opik);return this.childSpans.push(i),i};}};var Dn=class{constructor(o,e){this.data=o;this.opik=e;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=o=>{var e;this.opik.traceFeedbackScoresBatchQueue.create({...o,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=o=>{var a,s;let e=(s=(a=this.data.projectName)!=null?a:o.projectName)!=null?s:this.opik.config.projectName,t={id:ie(),startTime:new Date,...o,projectName:e,traceId:this.data.id};this.opik.spanBatchQueue.create(t);let i=new In(t,this.opik);return this.spans.push(i),i};this.update=o=>{var i;let e=Or.processTraceUpdate(o,this.data.metadata),t={projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,...e};return this.opik.traceBatchQueue.update(this.data.id,t),this.data={...this.data,...t},this};}};var lg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECTS:"api/v1/session/redirect/projects/"},Ai={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",TRACE_ID:"trace_id",PATH:"path"},Vw=n=>Object.entries(n).map(([o,e])=>`${o}=${encodeURIComponent(e)}`).join("&").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%26/g,"&").replace(/%3F/g,"?").replace(/%3D/g,"=");var mg=n=>Buffer.from(n).toString("base64"),dg=(n,o,e)=>{let t=Vw(e),i=`${o}?${t}`;return new URL(i,n).toString()},ug=({datasetId:n,experimentId:o,baseUrl:e})=>dg(e,lg.EXPERIMENTS,{[Ai.EXPERIMENT_ID]:o,[Ai.DATASET_ID]:n,[Ai.PATH]:mg(e)}),fg=(n,o)=>dg(o,lg.PROJECTS,{[Ai.TRACE_ID]:n,[Ai.PATH]:mg(o)});var Lw=300,Un=100,Ti=class{constructor({action:o,batchSize:e=Un,delay:t,enableBatch:i,name:a="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=(o,e)=>{if(this.queue.set(o,e),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(o,e)=>{let t=this.queue.get(o);t&&(this.queue.set(o,{...t,...e}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let o=new Map(this.queue);this.queue.clear(),v.debug(`Adding ${o.size} items to ${this.name} promise:`,o),this.promise=this.promise.finally(()=>(v.debug(`Flushing ${this.name}:`,o),this.action(o))).catch(e=>{v.error(`Failed to flush ${this.name}:`,e,o);}),await this.promise;};this.action=o,this.batchSize=e,this.delay=t,this.enableBatch=i,this.name=a;}},xe=class{constructor({delay:o=Lw,enableCreateBatch:e=true,enableUpdateBatch:t=false,enableDeleteBatch:i=true,createBatchSize:a=Un,updateBatchSize:s=Un,deleteBatchSize:p=Un,name:l="BatchQueue"}={}){this.create=o=>{let e=this.getId(o);this.createQueue.add(e,o);};this.get=async o=>{let e=this.createQueue.queue.get(o);return e||this.getEntity(o)};this.update=(o,e)=>{if(this.createQueue.queue.get(o)){this.createQueue.update(o,e);return}let i=this.updateQueue.queue.get(o);this.updateQueue.add(o,{...i,...e});};this.delete=o=>{if(this.createQueue.queue.has(o)){this.createQueue.queue.delete(o);return}this.deleteQueue.add(o);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=l,this.createQueue=new Ti({action:async c=>{await this.createEntities(Array.from(c.values()));},delay:o,enableBatch:e,batchSize:a,name:`${l}:createQueue`}),this.updateQueue=new Ti({action:async c=>{await this.createQueue.flush();let d=Array.from(c.entries());for(let[m,u]of d)await this.updateEntity(m,u);},delay:o,enableBatch:t,batchSize:s,name:`${l}:updateQueue`}),this.deleteQueue=new Ti({action:async c=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(c.keys()));},delay:o,enableBatch:i,batchSize:p,name:`${l}:deleteQueue`});}};var Fn=class extends xe{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.spans.createSpans({spans:e},this.api.requestOptions);}async getEntity(e){return await this.api.spans.getSpanById(e,{},this.api.requestOptions)}async updateEntity(e,t){await this.api.spans.updateSpan(e,{body:t},this.api.requestOptions);}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanById(t,this.api.requestOptions);}};var Nn=class extends xe{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.spans.scoreBatchOfSpans({scores:e},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanFeedbackScore(t.id,{body:{name:t.name}},this.api.requestOptions);}};var Mn=class extends xe{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.traces.createTraces({traces:e},this.api.requestOptions);}async getEntity(e){return await this.api.traces.getTraceById(e,{},this.api.requestOptions)}async updateEntity(e,t){await this.api.traces.updateTrace(e,{body:t},this.api.requestOptions);}async deleteEntities(e){await this.api.traces.deleteTraces({ids:e},this.api.requestOptions);}};var Wn=class extends xe{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.traces.scoreBatchOfTraces({scores:e},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.traces.deleteTraceFeedbackScore(t.id,{body:{name:t.name}},this.api.requestOptions);}};var Bn=class extends Si{constructor(e){var i;let t={...e==null?void 0:e.headers,...(i=e==null?void 0:e.requestOptions)==null?void 0:i.headers};(e==null?void 0:e.apiKey)!==void 0&&(t.authorization=e.apiKey);super({...e,headers:t});this.setHeaders=e=>{this.requestOptions.headers=e;};this.requestOptions=(e==null?void 0:e.requestOptions)||{};}};var Vn=class extends xe{constructor(e,t){super({delay:t,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"DatasetBatchQueue"});this.api=e;}getId(e){return e.id||""}async createEntities(e){for(let t of e)await this.api.datasets.createDataset(t,this.api.requestOptions);}async getEntity(e){try{return await this.api.datasets.getDatasetById(e,this.api.requestOptions)}catch{return}}async updateEntity(e,t){await this.api.datasets.updateDataset(e,{name:t.name||"",visibility:t.visibility,description:t.description},this.api.requestOptions);}async deleteEntities(e){await this.api.datasets.deleteDatasetsBatch({ids:e},this.api.requestOptions);}};var mf=null;async function hg(){return mf||(mf=await Hw__default.default()),mf}var qr=class n{constructor(o){let{id:e,traceId:t,spanId:i,source:a,...s}=o;this.id=e||ie(),this.traceId=t,this.spanId=i,this.source=a||Es.Sdk,this.data={...s};}getContent(o=false){return o?{...this.data,id:this.id}:{...this.data}}async contentHash(){let o=this.getContent(),e=Jw__default.default(o);return (await hg()).h32(e,43981).toString(16)}toApiModel(){return {id:this.id,traceId:this.traceId,spanId:this.spanId,source:this.source,data:this.getContent()}}static fromApiModel(o){return new n({id:o.id,traceId:o.traceId,spanId:o.spanId,source:o.source,...o.data})}};async function Le(n,o,e){var p;if(e===0)return [];let t=new util.TextDecoder("utf-8"),i=[],a="",s=n.getReader();try{for(;;){let{done:l,value:c}=await s.read();if(l)break;let d=c;a+=t.decode(d,{stream:!0});let m=a.split(`
|
|
4
|
+
`);a=(p=m.pop())!=null?p:"";for(let u of m)if(!(!u.trim()||u==="{}"||u==="[]"||u==="null"))try{let f=JSON.parse(u),h=o.parse(f);if(h.ok){if(i.push(h.value),e!==void 0&&i.length>=e)return s.releaseLock(),i}else v.error("Error parsing experiment item:",h.errors);}catch(f){v.error("Error parsing JSON line:",f instanceof Error?f.message:String(f));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let l=JSON.parse(a),c=o.parse(l);c.ok?i.push(c.value):v.error("Error parsing experiment item:",c.errors);}catch(l){v.error("Error parsing remaining buffer:",l instanceof Error?l.message:String(l));}}catch(l){v.error("Error processing stream:",l instanceof Error?l.message:String(l));}finally{s.releaseLock();}return i}function ve(n,o){let e=[];for(let t=0;t<n.length;t+=o.maxBatchSize)e.push(n.slice(t,t+o.maxBatchSize));return e}var gg=2e3;async function vi(n,o){let{datasetName:e,datasetVersion:t,nbSamples:i,lastRetrievedId:a}=o;if(i===0)return [];let s=[],p=i,l=a;for(;;){let c=Math.min(p!=null?p:gg,gg),d=await n.api.datasets.streamDatasetItems({datasetName:e,lastRetrievedId:l,steamLimit:c,datasetVersion:t}),m=await Le(d,V.DatasetItemPublic,c);if(m.length===0)break;let u=m.map(f=>qr.fromApiModel(f));if(s.push(...u),l=m[m.length-1].id,p!==void 0&&(p-=m.length,p<=0)||m.length<c)break}return s}var ji=class{constructor(o,e,t,i){this.datasetName=o,this.datasetId=e,this.versionInfo=t,this.opik=i;}get name(){return this.datasetName}get id(){return this.datasetId}get versionId(){return this.versionInfo.id}get versionHash(){return this.versionInfo.versionHash}get versionName(){return this.versionInfo.versionName}get tags(){return this.versionInfo.tags}get isLatest(){return this.versionInfo.isLatest}get itemsTotal(){return this.versionInfo.itemsTotal}get itemsAdded(){return this.versionInfo.itemsAdded}get itemsModified(){return this.versionInfo.itemsModified}get itemsDeleted(){return this.versionInfo.itemsDeleted}get changeDescription(){return this.versionInfo.changeDescription}get createdAt(){return this.versionInfo.createdAt}get createdBy(){return this.versionInfo.createdBy}getVersionInfo(){return this.versionInfo}async getItems(o,e){return (await vi(this.opik,{datasetName:this.datasetName,datasetVersion:this.versionInfo.versionHash,nbSamples:o,lastRetrievedId:e})).map(i=>i.getContent(true))}async toJson(o={}){let t=(await this.getItems()).map(i=>{let a={...i};for(let[s,p]of Object.entries(o))if(s in a){let l=a[s];delete a[s],a[p]=l;}return a});return Jw__default.default(t)}};var ue=class extends Error{constructor(o){var e;super(o.message),this.name=this.constructor.name,this.code=o.code,this.statusCode=o.statusCode,this.details=o.details,this.originalError=o.originalError,v.error(this.message),(e=Error.captureStackTrace)==null||e.call(Error,this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,details:this.details,originalError:this.originalError,stack:this.stack}}};var df={DATASET_NOT_FOUND:n=>`Dataset with name '${n}' not found`,DATASET_ITEM_NOT_FOUND:n=>`Dataset item with id '${n}' not found`,DATASET_ITEM_MISSING_ID:n=>`Item at index ${n} is missing an ID required for update`,INVALID_JSON_FORMAT:n=>`Invalid JSON format${n?": "+n:""}`,JSON_NOT_ARRAY:"JSON input must be an array of objects",ITEM_NOT_OBJECT:(n,o)=>`Item at position ${n} is not an object (${o})`,INSERTION_FAILED:n=>`Failed to insert items from JSON: ${n}`,DATASET_JSON_PARSE_ERROR:n=>`Failed to parse JSON input: ${n}`,DATASET_VERSION_NOT_FOUND:(n,o)=>`Dataset version '${n}' not found in dataset '${o}'`};var yg={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID",DATASET_VERSION_NOT_FOUND:"DATASET_VERSION_NOT_FOUND"},Ln=class extends ue{constructor(o){super({message:df.DATASET_ITEM_MISSING_ID(o),code:yg.DATASET_ITEM_MISSING_ID});}},Ei=class extends ue{constructor(o,e){super({message:df.DATASET_VERSION_NOT_FOUND(o,e),code:yg.DATASET_VERSION_NOT_FOUND});}};var $w={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Hn=class extends ue{constructor(o){super({message:o,code:$w.SEARCH_TIMEOUT});}};var Jn=class extends Error{constructor(o){super(o),this.name="AnnotationQueueError";}},Gn=class extends Jn{constructor(o){super(`Annotation queue with ID '${o}' not found`),this.name="AnnotationQueueNotFoundError";}};var et=class extends Jn{constructor(o,e){let t=e!==void 0?` at index ${e}`:"";super(`${o} object${t} has no ID`),this.name="AnnotationQueueItemMissingIdError";}};var Kn={JSON_NOT_ARRAY:n=>`JSON input must be an array of objects${n?` (${n})`:""}`,JSON_PARSE_ERROR:"Failed to parse JSON input",JSON_ITEM_NOT_OBJECT:(n,o)=>`Item at position ${n} is not an object (${o})`};var uf={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},$n=class extends ue{constructor(o){let e=o instanceof Error?o:new Error(String(o));super({message:Kn.JSON_PARSE_ERROR,code:uf.JSON_PARSE_ERROR,originalError:e});}},Qn=class extends ue{constructor(o){super({message:Kn.JSON_NOT_ARRAY(o),code:uf.JSON_NOT_ARRAY});}},Yn=class extends ue{constructor(o,e){super({message:Kn.JSON_ITEM_NOT_OBJECT(o,e),code:uf.JSON_ITEM_NOT_OBJECT});}};var zr=class{constructor({name:o,description:e,id:t},i){this.opik=i;this.idToHash=new Map;this.hashes=new Set;this.id=t||ie(),this.name=o,this.description=e;}async insert(o){if(!o||o.length===0)return;await this.opik.datasetBatchQueue.flush(),await this.syncHashes();let e=await this.getDeduplicatedItems(o),t=ve(e,{maxBatchSize:1e3}),i=ie();try{let a=0;for(let s of t)await this.opik.api.datasets.createOrUpdateDatasetItems({datasetId:this.id,items:s,batchGroupId:i}),a+=s.length,v.info(`Inserted ${Math.min(a,e.length)} of ${e.length} items into dataset ${this.id}`);}catch(a){throw v.error(`Error inserting items into dataset: ${a instanceof Error?a.message:String(a)}`),a}}async update(o){if(!(!o||o.length===0)){for(let e=0;e<o.length;e++)if(!o[e].id)throw new Ln(e);await this.insert(o);}}async delete(o){if(!o||o.length===0){v.info("No item IDs provided for deletion");return}let e=ve(o,{maxBatchSize:100}),t=ie();for await(let i of e){v.debug("Deleting dataset items batch",{batchSize:i.length,datasetId:this.id}),await this.opik.api.datasets.deleteDatasetItems({itemIds:i,batchGroupId:t});for(let a of i)if(this.idToHash.has(a)){let s=this.idToHash.get(a);this.hashes.delete(s),this.idToHash.delete(a);}}}async clear(){let e=(await this.getItems()).map(t=>t.id).filter(Boolean);e.length!==0&&await this.delete(e);}async getItems(o,e){return (await vi(this.opik,{datasetName:this.name,nbSamples:o,lastRetrievedId:e})).map(i=>i.getContent(true))}async insertFromJson(o,e={},t=[]){let i;try{i=JSON.parse(o);}catch(s){throw new $n(s)}if(!Array.isArray(i))throw new Qn(typeof i);if(i.length===0)return;for(let s=0;s<i.length;s++){let p=i[s];if(typeof p!="object"||p===null)throw new Yn(s,typeof p)}let a=i.map(s=>{let p=s,l={};for(let[c,d]of Object.entries(p)){if(t.includes(c))continue;let m=e[c]||c;l[m]=d;}return l});await this.insert(a);}async toJson(o={}){let t=(await this.getItems()).map(i=>{let a={...i};for(let[s,p]of Object.entries(o))if(s in a){let l=a[s];delete a[s],a[p]=l;}return a});return Jw__default.default(t)}async getDeduplicatedItems(o){let e=[];for(let t of o){let i=new qr(t),a=await i.contentHash();if(this.hashes.has(a)){v.debug("Duplicate item found - skipping",{contentHash:a,datasetId:this.id});continue}e.push(i.toApiModel()),this.hashes.add(a),this.idToHash.set(i.id,a);}return e}clearHashState(){this.idToHash.clear(),this.hashes.clear();}async syncHashes(){v.debug("Syncing dataset hashes with backend",{datasetId:this.id});try{let o=await vi(this.opik,{datasetName:this.name});this.clearHashState();for(let e of o){let t=await e.contentHash();this.idToHash.set(e.id,t),this.hashes.add(t);}v.debug("Dataset hash sync completed",{datasetId:this.id,itemCount:o.length});}catch(o){if(o instanceof R&&o.statusCode===404){v.debug("Dataset not found - starting with empty hash state",{datasetId:this.id}),this.clearHashState();return}throw o}}async getVersionView(o){let e=await this.findVersionByName(o);if(!e)throw new Ei(o,this.name);return new ji(this.name,this.id,e,this.opik)}async getCurrentVersionName(){let o=await this.getVersionInfo();return o==null?void 0:o.versionName}async getVersionInfo(){var o;try{let t=(o=(await this.opik.api.datasets.listDatasetVersions(this.id,{page:1,size:1})).content)!=null?o:[];return t.length===0?void 0:t[0]}catch(e){if(e instanceof R&&e.statusCode===404)return;throw e}}async findVersionByName(o){try{return await this.opik.api.datasets.retrieveDatasetVersion(this.id,{versionName:o})}catch(e){if(e instanceof R&&e.statusCode===404)return;throw e}}};var ff=class extends Error{constructor(o){super(o),this.name="DatasetError";}},Ci=class extends ff{constructor(o){super(`Dataset with name '${o}' not found`),this.name="DatasetNotFoundError";}};var Xn=class{constructor(o){if(!o.datasetItemId)throw new Error("datasetItemId is required");if(!o.traceId)throw new Error("traceId is required");this.datasetItemId=o.datasetItemId,this.traceId=o.traceId;}},Zn=class n{constructor(o){this.id=o.id,this.datasetItemId=o.datasetItemId,this.traceId=o.traceId,this.datasetItemData=o.datasetItemData,this.evaluationTaskOutput=o.evaluationTaskOutput,this.feedbackScores=[...o.feedbackScores];}static fromRestExperimentItemCompare(o){var t,i;let e=(i=(t=o.feedbackScores)==null?void 0:t.map(a=>({categoryName:a.categoryName,name:a.name,reason:a.reason,value:a.value,source:a.source})))!=null?i:[];return new n({id:o.id,traceId:o.traceId,datasetItemId:o.datasetItemId,datasetItemData:o.input,evaluationTaskOutput:o.output,feedbackScores:e})}};var kr=class{constructor({id:o,name:e,datasetName:t,prompts:i},a){this.opik=a;this.id=o||ie(),this._name=e,this.datasetName=t,this.prompts=i;}get name(){return this._name}async ensureNameLoaded(){if(this._name!==void 0)return this._name;let o=await this.opik.api.experiments.getExperimentById(this.id);if(this._name=o.name,!this._name)throw new Error("Experiment name is not loaded");return this._name}async insert(o){if(o.length===0)return;let e=o.map(i=>({id:ie(),experimentId:this.id,datasetItemId:i.datasetItemId,traceId:i.traceId})),t=ve(e,{maxBatchSize:50});try{for(let i of t)await this.opik.api.experiments.createExperimentItems({experimentItems:i});v.debug(`Inserted ${o.length} items into experiment ${this.id}`);}catch(i){throw v.error(`Error inserting items into experiment: ${i instanceof Error?i.message:String(i)}`),i}}async getItems(o){let e=[],{maxResults:i,truncate:a=false}=o||{},s,p=true;try{for(;p&&!(i!==void 0&&e.length>=i);){let l=i?Math.min(i-e.length,2e3):2e3,c=await this.opik.api.experiments.streamExperimentItems({experimentName:this.name,limit:l,lastRetrievedId:s,truncate:a});try{let d=await Le(c,V.ExperimentItemCompare,l);if(d.length===0){p=!1;break}for(let m of d){let u=Zn.fromRestExperimentItemCompare(m);if(e.push(u),i!==void 0&&e.length>=i){p=!1;break}}s=d[d.length-1].id;}catch(d){v.error("Error parsing experiment item: "+(d instanceof Error?d.message:String(d))),p=!1;break}}}catch(l){throw v.error("Error retrieving experiment items: "+(l instanceof Error?l.message:String(l))),l}return v.info(`Retrieved ${e.length} items${i?` (limited by maxResults=${i})`:""}`),e}async getUrl(){let o=await this.opik.getDataset(this.datasetName),e=this.opik.config.apiUrl||hs.apiUrl;return ug({datasetId:o.id,experimentId:this.id,baseUrl:e})}};var On={EXPERIMENT_NOT_FOUND:n=>`Experiment with name '${n}' not found`,INVALID_CONFIG_TYPE:n=>`experimentConfig must be a plain object, but ${n} was provided. Please provide a valid configuration object like { model: 'gpt-4', temperature: 0.7 }`,CONFIG_PROMPTS_CONFLICT:()=>`Cannot specify both 'prompts' parameter and 'experimentConfig.prompts'. Choose one approach:
|
|
5
5
|
1. Use prompts parameter: buildMetadataAndPromptVersions(config, [prompt1, prompt2])
|
|
6
6
|
2. Use config only: buildMetadataAndPromptVersions({ ...config, prompts: {...} })
|
|
7
7
|
|
|
8
|
-
The prompts parameter is recommended for prompt version tracking.`};var
|
|
9
|
-
${
|
|
10
|
-
`)}`)}}function me(
|
|
11
|
-
`)}function
|
|
8
|
+
The prompts parameter is recommended for prompt version tracking.`};var hf={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Ii=class extends ue{constructor(o){super({message:On.EXPERIMENT_NOT_FOUND(o),code:hf.EXPERIMENT_NOT_FOUND});}},Di=class n extends ue{constructor(o,e){super({message:o,code:e});}static invalidConfigType(o){return new n(On.INVALID_CONFIG_TYPE(o),hf.INVALID_CONFIG_TYPE)}static promptsConflict(){return new n(On.CONFIG_PROMPTS_CONFLICT(),hf.CONFIG_PROMPTS_CONFLICT)}};function bg(n,o){if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw Di.invalidConfigType(typeof n);if(o&&o.length>0&&(n!=null&&n.prompts))throw Di.promptsConflict();if(!n&&(!o||o.length===0))return [void 0,void 0];let e=n?structuredClone(n):{},t;if(o&&o.length>0){t=[];let i={};for(let a of o)t.push({id:a.versionId}),i[a.name]=a.prompt;e.prompts=i;}return Object.keys(e).length===0?[void 0,void 0]:[e,t]}var we={MUSTACHE:"mustache",JINJA2:"jinja2"},le={Text:"text",Chat:"chat"};var G=class n extends Error{constructor(o){super(o),this.name="PromptValidationError",Object.setPrototypeOf(this,n.prototype);}},Pr=class n extends Error{constructor(o,e,t){let i=`Prompt '${o}' has template_structure='${e}' but attempted to access as '${t}'. Template structure is immutable after creation.`;super(i),this.name="PromptTemplateStructureMismatch",this.promptName=o,this.existingStructure=e,this.attemptedStructure=t,Object.setPrototypeOf(this,n.prototype);}};function Xw(n){try{let e=Yw__default.default.parse(n).filter(t=>{let i=t[0];return i==="name"||i==="#"||i==="&"||i==="^"}).map(t=>t[1].split(".")[0]);return new Set(e)}catch(o){throw new G(`Invalid Mustache template syntax: ${o instanceof Error?o.message:String(o)}`)}}function xg(n,o,e){if(e!=="mustache")return;let t=Xw(n),i=new Set(Object.keys(o)),a=new Set([...t].filter(s=>!i.has(s)));if(a.size>0){let s=[];throw s.push(`Missing required variables: ${[...a].join(", ")}`),s.push(`Template placeholders: {${[...t].join(", ")}}`),s.push(`Provided variables: {${[...i].join(", ")}}`),new G(`Template variables validation failed:
|
|
9
|
+
${s.join(`
|
|
10
|
+
`)}`)}}function me(n,o,e){try{switch(xg(n,o,e),e){case "mustache":return Yw__default.default.render(n,o,{},{escape:t=>t});case "jinja2":return Ow__default.default.renderString(n,o);default:return n}}catch(t){if(t instanceof G)throw t;let i=t instanceof Error?t.message:String(t);throw new G(`Failed to format prompt template: ${i}`)}}function _g(n){let o=[];for(let e=0;e<n.length;e++){let t=n[e];if(o.push(`Message ${e+1} [${t.role}]:`),typeof t.content=="string")o.push(Rg(t.content));else if(Array.isArray(t.content))for(let i=0;i<t.content.length;i++){let a=t.content[i];if(o.push(` Part ${i+1}:`),o.push(` Type: ${a.type}`),a.type==="text"&&"text"in a){let s=a;o.push(Rg(String(s.text),4)),gf(s,["type","text"],o,4);}else if(a.type==="image_url"&&"image_url"in a){let s=a,p=s.image_url;o.push(` URL: ${p.url}`),wg(p,["url"],o,4),gf(s,["type","image_url"],o,4);}else if(a.type==="video_url"&&"video_url"in a){let s=a,p=s.video_url;o.push(` URL: ${p.url}`),wg(p,["url"],o,4),gf(s,["type","video_url"],o,4);}else o.push(" [Difference found in unrecognized content type]");}e<n.length-1&&o.push("");}return o.join(`
|
|
11
|
+
`)}function gf(n,o,e,t=4){let i=Object.keys(n).filter(a=>!o.includes(a));if(i.length>0)for(let a of i.sort()){let s=n[a];e.push(`${" ".repeat(t)}${a}: ${zg(s)}`);}}function wg(n,o,e,t=4){let i=Object.keys(n).filter(a=>!o.includes(a));if(i.length>0)for(let a of i.sort()){let s=n[a];e.push(`${" ".repeat(t)}${a}: ${zg(s)}`);}}function zg(n){return n===null?"null":n===void 0?"undefined":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):Array.isArray(n)||typeof n=="object"?JSON.stringify(n):String(n)}function Rg(n,o=2){let e=" ".repeat(o);return n.split(`
|
|
12
12
|
`).map(t=>`${e}${t}`).join(`
|
|
13
|
-
`)}var
|
|
13
|
+
`)}var Ui=class n{constructor(o){this.id=o.versionId,this.name=o.name,this.prompt=o.prompt,this.commit=o.commit,this.type=o.type,this.metadata=o.metadata,this.changeDescription=o.changeDescription,this.tags=o.tags,this.createdAt=o.createdAt,this.createdBy=o.createdBy;}format(o){return me(this.prompt,o,this.type)}getVersionAge(){return this.createdAt?dateFns.formatDistanceToNow(new Date(this.createdAt),{addSuffix:true}):"Unknown"}getVersionInfo(){let o=[`[${this.commit}]`];if(this.createdAt){let e=new Date(this.createdAt);o.push(e.toISOString().split("T")[0]);}return this.createdBy&&o.push(`by ${this.createdBy}`),this.changeDescription&&o.push(`- ${this.changeDescription}`),o.join(" ")}compareTo(o){let e=`Current version [${this.commit}]`,t=`Other version [${o.commit}]`,i=this.prompt,a=o.prompt;this.isChatPrompt(this.prompt)&&(i=this.formatChatPromptString(this.prompt)),this.isChatPrompt(o.prompt)&&(a=this.formatChatPromptString(o.prompt));let s=jestDiff.diffStringsUnified(a,i,{aAnnotation:t,bAnnotation:e,includeChangeCounts:true,contextLines:3,expand:false});return v.info(`
|
|
14
14
|
Prompt version comparison:
|
|
15
|
-
${
|
|
15
|
+
${s}`),s}isChatPrompt(o){try{let e=JSON.parse(o);return Array.isArray(e)&&e.length>0&&typeof e[0]=="object"&&"role"in e[0]&&"content"in e[0]}catch{return false}}formatChatPromptString(o){try{let e=JSON.parse(o);return _g(e)}catch{return o}}static fromApiResponse(o,e){var t;if(!e.template)throw new G("Invalid API response: missing required field 'template'");if(!e.commit)throw new G("Invalid API response: missing required field 'commit'");if(!e.promptId)throw new G("Invalid API response: missing required field 'promptId'");if(!e.id)throw new G("Invalid API response: missing required field 'id'");return new n({name:o,prompt:e.template,commit:e.commit,promptId:e.promptId,versionId:e.id,type:(t=e.type)!=null?t:we.MUSTACHE,metadata:e.metadata,changeDescription:e.changeDescription,tags:e.tags,createdAt:e.createdAt?new Date(e.createdAt):void 0,createdBy:e.createdBy})}};var rt=class{constructor(o,e){var t,i;this.id=o.promptId,this.versionId=o.versionId,this.commit=o.commit,this.type=(t=o.type)!=null?t:"mustache",this.changeDescription=o.changeDescription,this.templateStructure=(i=o.templateStructure)!=null?i:"text",this._name=o.name,this._description=o.description,this._tags=o.tags?[...o.tags]:[],this._metadata=o.metadata,this.opik=e;}get name(){return this._name}get description(){return this._description}get tags(){return Object.freeze([...this._tags])}get metadata(){if(this._metadata)return structuredClone(this._metadata)}async updateProperties(o){var e,t,i,a;return await this.opik.api.prompts.updatePrompt(this.id,{name:(e=o.name)!=null?e:this._name,description:o.description,tags:o.tags},this.opik.api.requestOptions),this._name=(t=o.name)!=null?t:this._name,this._description=(i=o.description)!=null?i:this._description,this._tags=(a=o.tags)!=null?a:this._tags,this}async delete(){await this.opik.deletePrompts([this.id]);}async getVersions(o){var e;v.debug("Getting versions for prompt",{promptId:this.id,name:this.name});try{let t=[],i=1,a=100;for(;;){let p=(e=(await this.opik.api.prompts.getPromptVersions(this.id,{page:i,size:a,search:o==null?void 0:o.search,sorting:o==null?void 0:o.sorting,filters:o==null?void 0:o.filters},this.opik.api.requestOptions)).content)!=null?e:[];if(t.push(...p),p.length<a)break;i++;}return v.debug("Successfully retrieved prompt versions",{promptId:this.id,name:this.name,totalVersions:t.length}),t.map(s=>Ui.fromApiResponse(this.name,s))}catch(t){throw v.error("Failed to get prompt versions",{promptId:this.id,name:this.name,error:t}),t}}async restoreVersion(o){v.debug("Restoring prompt version",{promptId:this.id,name:this.name,versionId:o.id,versionCommit:o.commit});try{let e=await this.opik.api.prompts.restorePromptVersion(this.id,o.id,this.opik.api.requestOptions);return v.debug("Successfully restored prompt version",{promptId:this.id,name:this.name,restoredVersionId:e.id,restoredCommit:e.commit}),e}catch(e){throw v.error("Failed to restore prompt version",{promptId:this.id,name:this.name,versionId:o.id,versionCommit:o.commit,error:e}),e}}async retrieveVersionByCommit(o){try{return await this.opik.api.prompts.retrievePromptVersion({name:this.name,commit:o},this.opik.api.requestOptions)}catch(e){if(e&&typeof e=="object"&&"statusCode"in e&&e.statusCode===404)return null;throw v.error("Failed to retrieve prompt version",{promptName:this.name,commit:o,error:e}),e}}};var Qe=class n extends rt{constructor(o,e){super({...o,templateStructure:le.Text},e),this.prompt=o.prompt;}get template(){return this.prompt}format(o){return me(this.prompt,o,this.type)}static fromApiResponse(o,e,t){var a;if(!e.template)throw new G("Invalid API response: missing required field 'template'");if(!e.commit)throw new G("Invalid API response: missing required field 'commit'");if(!e.promptId)throw new G("Invalid API response: missing required field 'promptId'");if(!e.id)throw new G("Invalid API response: missing required field 'id' (version ID)");let i=(a=e.type)!=null?a:we.MUSTACHE;if(i!=="mustache"&&i!=="jinja2")throw new G(`Invalid API response: unknown prompt type '${i}'`);return new n({promptId:e.promptId,versionId:e.id,name:o.name,prompt:e.template,commit:e.commit,metadata:e.metadata,type:i,changeDescription:e.changeDescription,description:o.description,tags:o.tags},t)}async useVersion(o){var t;let e=await this.restoreVersion(o);return n.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik)}async getVersion(o){var t;let e=await this.retrieveVersionByCommit(o);return e?n.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik):null}};var qn=class{constructor(o,e="mustache",t=false){this.messages=o,this.templateType=e,this.validatePlaceholders=t;}format(o,e){let t={vision:true,video:true,...e},i=[];for(let a of this.messages){let s=a.role;if(!s)continue;let p=a.content,l;if(typeof p=="string")l=me(p,o,this.templateType);else if(Array.isArray(p))l=this.renderContentParts(p,o,t);else throw new G(`Invalid message content type. Expected string or array of content parts, got: ${typeof p}`);i.push({role:s,content:l});}return i}renderContentParts(o,e,t){var s,p,l,c,d,m,u;let i=[],a=false;for(let f of o){if(!f||typeof f!="object")continue;switch(f.type){case "text":{let x=me(f.text||"",e,this.templateType);i.push({type:"text",text:x});break}case "image_url":{if(t.vision===false)a=true,i.push({type:"text",text:"<<<image>>><<</image>>>"});else {let g=f,x=((s=g.image_url)==null?void 0:s.url)||"",T=me(x,e,this.templateType);if(T){let j={type:"image_url",image_url:{url:T}};(p=g.image_url)!=null&&p.detail&&(j.image_url.detail=g.image_url.detail),i.push(j);}}break}case "video_url":{if(t.video===false)a=true,i.push({type:"text",text:"<<<video>>><<</video>>>"});else {let g=f,x=((l=g.video_url)==null?void 0:l.url)||"",T=me(x,e,this.templateType);if(T){let j={type:"video_url",video_url:{url:T}};(c=g.video_url)!=null&&c.mime_type&&(j.video_url.mime_type=g.video_url.mime_type),(d=g.video_url)!=null&&d.duration&&(j.video_url.duration=g.video_url.duration),(m=g.video_url)!=null&&m.format&&(j.video_url.format=g.video_url.format),(u=g.video_url)!=null&&u.detail&&(j.video_url.detail=g.video_url.detail),i.push(j);}}break}default:i.push(f);}}if(a){let f=[];for(let h of i)if(h.type==="text"){let g=h.text;g&&f.push(g);}else f.push(JSON.stringify(h));return f.join(`
|
|
16
16
|
|
|
17
|
-
`)}return i.length===1&&i[0].type==="text"?i[0].text:i}};var zr=class s extends Zr{constructor(o,e){super({...o,templateStructure:le.Chat},e),this.messages=o.messages,this.chatTemplate=new Kn(o.messages,this.type);}get template(){return structuredClone(this.messages)}format(o,e){return this.chatTemplate.format(o,e)}static fromApiResponse(o,e,t){var n;if(!e.template)throw new G("Invalid API response: missing required field 'template'");if(!e.commit)throw new G("Invalid API response: missing required field 'commit'");if(!e.promptId)throw new G("Invalid API response: missing required field 'promptId'");if(!e.id)throw new G("Invalid API response: missing required field 'id' (version ID)");let i;try{if(i=JSON.parse(e.template),!Array.isArray(i))throw new G("Invalid chat prompt template: expected array of messages")}catch(p){throw p instanceof G?p:new G(`Failed to parse chat prompt template: ${p instanceof Error?p.message:String(p)}`)}let a=(n=e.type)!=null?n:xe.MUSTACHE;if(a!=="mustache"&&a!=="jinja2")throw new G(`Invalid API response: unknown prompt type '${a}'`);return new s({promptId:e.promptId,versionId:e.id,name:o.name,messages:i,commit:e.commit,metadata:e.metadata,type:a,changeDescription:e.changeDescription,description:o.description,tags:o.tags},t)}async useVersion(o){var t;let e=await this.restoreVersion(o);return s.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik)}async getVersion(o){var t;let e=await this.retrieveVersionByCommit(o);return e?s.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik):null}};async function yg(s,o,e){try{return await s.retrievePromptVersion({name:o},e)}catch(t){if($x(t))return null;throw t}}function bg(s,o,e){return o?o.template!==s.prompt||!Kx(o.metadata,s.metadata)||o.type!==e:true}function Kx(s,o){let e=s!=null?s:{},t=o!=null?o:{};return Gx__default.default(e,t)}function $x(s){return typeof s=="object"&&s!==null&&"statusCode"in s&&s.statusCode===404}var fe=class{constructor(o){this.input=o;this.cursor=0;}getPosition(){return this.cursor}getRemainingInput(){return this.input.slice(this.cursor)}getFullInput(){return this.input}isAtEnd(){return this.cursor>=this.input.length}peekChar(){return this.input[this.cursor]}peekCharAt(o){return this.input[this.cursor+o]}consumeChar(){return this.input[this.cursor++]}advance(o=1){this.cursor+=o;}skipWhitespace(){for(;this.cursor<this.input.length&&/\s/.test(this.input[this.cursor]);)this.cursor++;}consumeWhile(o){let e=this.cursor;for(;this.cursor<this.input.length&&o(this.input[this.cursor]);)this.cursor++;return this.input.slice(e,this.cursor)}sliceFrom(o){return this.input.slice(o,this.cursor)}static isFieldChar(o){return /[a-zA-Z0-9_]/.test(o)}static isLetterChar(o){return /[a-zA-Z]/.test(o)}static isDigitChar(o){return /\d/.test(o)}static isWhitespaceChar(o){return /\s/.test(o)}static isQuoteChar(o){return o==='"'||o==="'"}};var ee={STRING_OPS:["=","contains","not_contains","starts_with","ends_with","!=",">","<"],NUMERIC_OPS:["=","!=",">","<",">=","<="],DATETIME_OPS:["=",">","<",">=","<="],LIST_OPS:["contains"],DICT_OPS:["=","contains",">","<"],LIMITED_STRING_OPS:["=","contains","not_contains"]},Qe={id:"string",name:"string",status:"string",start_time:"date_time",end_time:"date_time",input:"string",output:"string",metadata:"dictionary",feedback_scores:"feedback_scores_number",tags:"list","usage.total_tokens":"number","usage.prompt_tokens":"number","usage.completion_tokens":"number",duration:"number",number_of_messages:"number",created_by:"string",thread_id:"string",total_estimated_cost:"number",type:"string",model:"string",provider:"string"},Rg={id:ee.STRING_OPS,name:ee.STRING_OPS,status:ee.LIMITED_STRING_OPS,start_time:ee.DATETIME_OPS,end_time:ee.DATETIME_OPS,input:ee.LIMITED_STRING_OPS,output:ee.LIMITED_STRING_OPS,metadata:ee.DICT_OPS,feedback_scores:ee.NUMERIC_OPS,tags:ee.LIST_OPS,"usage.total_tokens":ee.NUMERIC_OPS,"usage.prompt_tokens":ee.NUMERIC_OPS,"usage.completion_tokens":ee.NUMERIC_OPS,duration:ee.NUMERIC_OPS,number_of_messages:ee.NUMERIC_OPS,created_by:ee.STRING_OPS,thread_id:ee.STRING_OPS,total_estimated_cost:ee.NUMERIC_OPS,type:ee.STRING_OPS,model:ee.STRING_OPS,provider:ee.STRING_OPS},$n={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function xg(s){let o=$n.SPECIAL_FIELDS.includes(s),e=Object.keys(Qe).includes(s);if(!o&&!e){let t=Object.keys(Qe).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${t} are supported.`)}}function wg(s,o){if(!$n.SPECIAL_FIELDS.includes(s)){let e=Object.keys(Qe).join(", ");throw new Error(`Field ${s}.${o} is not supported, only the fields ${e} are supported.`)}if(s==="usage"&&!$n.USAGE_KEYS.includes(o))throw new Error(`When querying usage, ${o} is not supported, only usage.total_tokens, usage.prompt_tokens and usage.completion_tokens are supported.`)}function lf(s,o){let e=Rg[s];if(!(e!=null&&e.includes(o))){let t=(e==null?void 0:e.join(", "))||"none";throw new Error(`Operator ${o} is not supported for field ${s}, only the operators ${t} are supported.`)}}function _g(s){let o=s.toLowerCase();if(o==="and")return true;throw o==="or"?new Error("Invalid filter string, OR is not currently supported"):new Error(`Invalid filter string, trailing characters ${s}`)}function Qn(s,o,e){if(!s)throw new Error(`Missing closing quote for: ${e}`)}var Ei=class{static parse(o){o.skipWhitespace();let e=this.parseFieldName(o);return xg(e),o.peekChar()==="."?this.parseFieldWithKey(o,e):{type:"simple",field:e,columnType:Qe[e]}}static parseFieldName(o){return o.consumeWhile(e=>fe.isFieldChar(e))}static parseFieldWithKey(o,e){o.advance();let t=this.parseKey(o);if(wg(e,t),e==="usage"){let i=`usage.${t}`;return {type:"simple",field:i,columnType:Qe[i]}}return {type:"nested",field:e,key:t,columnType:Qe[e]}}static parseKey(o){let e=o.peekChar();return fe.isQuoteChar(e)?this.parseQuotedKey(o,e):this.parseUnquotedKey(o)}static parseUnquotedKey(o){return o.consumeWhile(e=>fe.isFieldChar(e))}static parseQuotedKey(o,e){let t=o.getPosition();o.advance();let i="",a=false;for(;!o.isAtEnd();){let p=o.peekChar();if(p===e){if(o.peekCharAt(1)===e){i+=e,o.advance(2);continue}a=true,o.advance();break}i+=p,o.advance();}let n=o.getFullInput().slice(t);return Qn(a,t,n),i}};var Ci=class{static parse(o,e){o.skipWhitespace();let t=o.peekChar(),i=this.tryParseSymbolicOperator(o,t);if(i)return lf(e,i),{operator:i};let a=this.parseWordOperator(o);return lf(e,a),{operator:a}}static tryParseSymbolicOperator(o,e){if(e==="=")return o.advance(),"=";if(e==="<"||e===">"){let t=e;return o.advance(),o.peekChar()==="="?(o.advance(),t+"="):t}return e==="!"&&o.peekCharAt(1)==="="?(o.advance(2),"!="):null}static parseWordOperator(o){return o.consumeWhile(e=>!fe.isWhitespaceChar(e))}};var Ii=class{static parse(o){o.skipWhitespace();let e=o.getPosition(),t=o.peekChar();if(t==='"')return this.parseQuotedString(o,e);if(fe.isDigitChar(t)||t==="-")return this.parseNumber(o);let i=o.getRemainingInput();throw new Error(`Invalid value ${i.slice(0,20)}, expected a string in double quotes("value") or a number`)}static parseQuotedString(o,e){o.advance();let t=o.getPosition(),i=false;for(;!o.isAtEnd();){if(o.peekChar()==='"'){i=true;break}o.advance();}Qn(i,e,`value starting at position ${e}`);let a=o.sliceFrom(t);return o.advance(),{value:a}}static parseNumber(o){let e="";return o.peekChar()==="-"&&(e+=o.consumeChar()),e+=this.parseDigits(o),o.peekChar()==="."&&(e+=o.consumeChar(),e+=this.parseDigits(o)),{value:e}}static parseDigits(o){return o.consumeWhile(e=>fe.isDigitChar(e))}};var Ye=class{constructor(o){let e=o||"";this.filterExpressions=e?this.parse(e):null,this.parsedFilters=this.filterExpressions?JSON.stringify(this.filterExpressions):null;}getFilterExpressions(){return this.filterExpressions}parse(o){let e=new fe(o),t=[];for(;!e.isAtEnd();){let i=this.parseExpression(e);if(t.push(i),e.skipWhitespace(),!e.isAtEnd()&&!this.parseConnector(e))break}return t}parseExpression(o){let e=Ei.parse(o),t=Ci.parse(o,this.getFieldName(e)),i=Ii.parse(o);return this.buildExpression(e,t,i)}getFieldName(o){return o.field}buildExpression(o,e,t){let i={field:o.field,operator:e.operator,value:t.value,type:o.columnType};return o.type==="nested"&&(i.key=o.key),i}parseConnector(o){let e=o.getPosition(),t=o.consumeWhile(i=>fe.isLetterChar(i));try{return _g(t)}catch(i){if(i instanceof Error&&i.message.includes("trailing characters")){let a=o.getFullInput().slice(e);throw new Error(`Invalid filter string, trailing characters ${a}`)}throw i}}};async function zg(s,o,e,t,i){let a=await s.traces.searchTraces({projectName:o,filters:e!=null?e:void 0,limit:t,truncate:i});return await Ke(a,L.TracePublic,t)}async function kg(s,o,e,t){let i=Date.now(),a=[];for(;;){if(a=await s(),a.length>=o||Date.now()-i>=e)return a;await new Promise(p=>setTimeout(p,t));}}function Pg(s){if(!s)return null;let e=new Ye(s).getFilterExpressions();return e?e.map(t=>{let i={field:t.field,operator:t.operator,value:t.value};return t.key&&(i.key=t.key),i}):null}var mf=[],kr=class{constructor(o){this.displayTraceLog=(o,e)=>{if(e===this.lastProjectNameLogged||!this.config.apiUrl)return;let t=sg(o,this.config.apiUrl);j.info(`Started logging traces to the "${e}" project at ${Wi(t)}`),this.lastProjectNameLogged=e;};this.trace=o=>{var i;j.debug("Creating new trace with data:",o);let e=(i=o.projectName)!=null?i:this.config.projectName,t=new vn({id:ne(),startTime:new Date,...o,projectName:e},this);return this.traceBatchQueue.create(t.data),j.debug("Trace added to the queue with ID:",t.data.id),this.displayTraceLog(t.data.id,e),t};this.getDataset=async o=>{j.debug(`Getting dataset with name "${o}"`);try{await this.datasetBatchQueue.flush();let e=await this.api.datasets.getDatasetByIdentifier({datasetName:o});return new xr(e,this)}catch(e){throw e instanceof w&&e.statusCode===404?new Ai(o):e}};this.createDataset=async(o,e)=>{j.debug(`Creating dataset with name "${o}"`);let t=new xr({name:o,description:e},this);try{return this.datasetBatchQueue.create({name:t.name,description:t.description,id:t.id}),j.debug("Dataset added to the queue with name:",t.name),t}catch(i){throw j.error(`Failed to create dataset "${o}"`,{error:i}),new Error(`Error creating dataset "${o}": ${i}`)}};this.getOrCreateDataset=async(o,e)=>{j.debug(`Attempting to retrieve or create dataset with name: "${o}"`);try{return await this.getDataset(o)}catch(t){if(t instanceof Ai)return j.info(`Dataset "${o}" not found. Proceeding to create a new one.`),this.createDataset(o,e);throw j.error(`Error retrieving dataset "${o}":`,t),t}};this.getDatasets=async(o=100)=>{j.debug(`Getting all datasets (limit: ${o})`);try{await this.datasetBatchQueue.flush();let e=await this.api.datasets.findDatasets({size:o}),t=[];for(let i of e.content||[])t.push(new xr(i,this));return j.info(`Retrieved ${t.length} datasets`),t}catch(e){throw j.error("Failed to retrieve datasets",{error:e}),new Error("Failed to retrieve datasets")}};this.deleteDataset=async o=>{j.debug(`Deleting dataset with name "${o}"`);try{let e=await this.getDataset(o);if(!e.id)throw new Error(`Cannot delete dataset "${o}": ID not available`);this.datasetBatchQueue.delete(e.id);}catch(e){throw j.error(`Failed to delete dataset "${o}"`,{error:e}),new Error(`Failed to delete dataset "${o}": ${e}`)}};this.createExperiment=async({datasetName:o,name:e,experimentConfig:t,prompts:i,type:a=Ps.Regular,optimizationId:n,datasetVersionId:p})=>{if(j.debug(`Creating experiment for dataset "${o}"`),!o)throw new Error("Dataset name is required to create an experiment");let[l,c]=mg(t,i),d=ne(),m=new wr({id:d,name:e,datasetName:o,prompts:i},this);try{return await this.api.experiments.createExperiment({id:d,datasetName:o,name:e,metadata:l,promptVersions:c,type:a,optimizationId:n,datasetVersionId:p}),j.debug("Experiment created with id:",d),m}catch(u){throw j.error(`Failed to create experiment for dataset "${o}"`,{error:u}),new Error(`Error creating experiment: ${u}`)}};this.updateExperiment=async(o,e)=>{if(!o)throw new Error("id is required to update an experiment");let{name:t,experimentConfig:i}=e;if(!t&&!i)throw new Error("At least one of 'name' or 'experimentConfig' must be provided to update an experiment");j.debug(`Updating experiment with ID "${o}"`);let a={};t!==void 0&&(a.name=t),i!==void 0&&(a.metadata=i);try{await this.api.experiments.updateExperiment(o,{body:a});}catch(n){throw j.error(`Failed to update experiment with ID "${o}"`,{error:n}),n}};this.getExperimentById=async o=>{j.debug(`Getting experiment with ID "${o}"`);try{let e=await this.api.experiments.getExperimentById(o);return new wr({id:e.id,name:e.name,datasetName:e.datasetName},this)}catch(e){throw e instanceof w&&e.statusCode===404?new Ti(`No experiment found with ID '${o}'`):(j.error(`Failed to get experiment with ID "${o}"`,{error:e}),e)}};this.getExperimentsByName=async o=>{j.debug(`Getting experiments with name "${o}"`);try{let e=await this.api.experiments.streamExperiments({name:o});return (await Ke(e,L.ExperimentPublic)).map(i=>new wr({id:i.id,name:i.name,datasetName:i.datasetName},this))}catch(e){throw j.error(`Failed to get experiments with name "${o}"`,{error:e}),e}};this.getExperiment=async o=>{j.debug(`Getting experiment with name "${o}"`);let e=await this.getExperimentsByName(o);if(e.length===0)throw new Ti(o);return e[0]};this.getDatasetExperiments=async(o,e=100)=>{var n;j.debug(`Getting experiments for dataset "${o}"`);let t=await this.getDataset(o),i=Math.min(100,e),a=[];try{let p=1;for(;a.length<e;){let l=await this.api.experiments.findExperiments({page:p,size:i,datasetId:t.id}),c=(n=l==null?void 0:l.content)!=null?n:[];if(c.length===0)break;let d=e-a.length,m=Math.min(c.length,d);for(let u=0;u<m;u++){let f=c[u];a.push(new wr({id:f.id,name:f.name,datasetName:f.datasetName},this));}if(m<c.length)break;p+=1;}return a}catch(p){throw j.error(`Failed to get experiments for dataset "${o}"`,{error:p}),p}};this.deleteExperiment=async o=>{j.debug(`Deleting experiment with ID "${o}"`);try{await this.api.experiments.deleteExperimentsById({ids:[o]});}catch(e){throw j.error(`Failed to delete experiment with ID "${o}"`,{error:e}),e}};this.createPromptInternal=async(o,e,t,i,a,n,p)=>{var l;j.debug(`Creating ${p}`,{name:o});try{let c=await yg(this.api.prompts,o,this.api.requestOptions);a(c);let d=(l=i.type)!=null?l:xe.MUSTACHE,m=bg({prompt:e,metadata:i.metadata},c,d),u;if(m?(j.debug(`Creating new ${p} version`,{name:o}),u=await this.api.prompts.createPromptVersion({name:o,version:{template:e,metadata:i.metadata,type:d},templateStructure:t},this.api.requestOptions)):(j.debug(`Returning existing ${p} version`,{name:o}),u=c),!u.promptId)throw new Error("Invalid API response: missing promptId");let f=await this.api.prompts.getPromptById(u.promptId,this.api.requestOptions),h=n(f,u);return j.debug(`${p} created`,{name:o}),i.description||i.tags?await h.updateProperties({description:i.description,tags:i.tags}):h}catch(c){throw j.error(`Failed to create ${p}`,{name:o,error:c}),c}};this.createPrompt=async o=>this.createPromptInternal(o.name,o.prompt,le.Text,o,()=>{},(e,t)=>$e.fromApiResponse(e,t,this),"prompt");this.createChatPrompt=async o=>{let e=JSON.stringify(o.messages);return this.createPromptInternal(o.name,e,le.Chat,o,t=>{if(t&&t.templateStructure&&t.templateStructure!==le.Chat)throw new _r(o.name,t.templateStructure,le.Chat)},(t,i)=>zr.fromApiResponse(t,i,this),"chat prompt")};this.getPrompt=async o=>{var e;j.debug("Getting prompt",o);try{let i=(e=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:o.name}]),size:1},this.api.requestOptions)).content)==null?void 0:e[0];if(!i)return j.debug("Prompt not found",{name:o.name}),null;let a=await this.api.prompts.retrievePromptVersion(o,this.api.requestOptions),n=a.templateStructure;if(n&&n!==le.Text)throw new _r(o.name,n,le.Text);return $e.fromApiResponse(i,a,this)}catch(t){if(t instanceof w&&t.statusCode===404)return null;throw j.error("Failed to get prompt",{name:o.name,error:t}),t}};this.getChatPrompt=async o=>{var e;j.debug("Getting chat prompt",o);try{let i=(e=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:o.name}]),size:1},this.api.requestOptions)).content)==null?void 0:e[0];if(!i)return j.debug("Chat prompt not found",{name:o.name}),null;let a=await this.api.prompts.retrievePromptVersion(o,this.api.requestOptions),n=a.templateStructure;if(!n||n!==le.Chat)throw new _r(o.name,n!=null?n:"undefined",le.Chat);return zr.fromApiResponse(i,a,this)}catch(t){if(t instanceof w&&t.statusCode===404)return null;throw j.error("Failed to get chat prompt",{name:o.name,error:t}),t}};this.searchPrompts=async o=>{var e;j.debug("Searching prompts",{filterString:o});try{let t;if(o){let l=new Ye(o).getFilterExpressions();t=l?JSON.stringify(l):void 0;}let a=(e=(await this.api.prompts.getPrompts({filters:t,size:1e3},this.api.requestOptions)).content)!=null?e:[];return (await Promise.all(a.map(async p=>{if(!p.name)return null;try{let l=await this.api.prompts.retrievePromptVersion({name:p.name},this.api.requestOptions),c=l.templateStructure;return !c||c===le.Text?$e.fromApiResponse(p,l,this):c===le.Chat?zr.fromApiResponse(p,l,this):null}catch(l){return j.debug("Failed to get version for prompt",{name:p.name,error:l}),null}}))).filter(p=>p!==null)}catch(t){throw j.error("Failed to search prompts",{error:t}),t}};this.deletePrompts=async o=>{j.debug("Deleting prompts in batch",{count:o.length});try{await this.api.prompts.deletePromptsBatch({ids:o},this.api.requestOptions),j.info("Successfully deleted prompts",{count:o.length});}catch(e){throw j.error("Failed to delete prompts",{count:o.length,error:e}),e}};this.searchTraces=async o=>{let{projectName:e,filterString:t,maxResults:i=1e3,truncate:a=true,waitForAtLeast:n,waitForTimeout:p=60}=o!=null?o:{};j.debug("Searching traces",{projectName:e,filterString:t,maxResults:i,truncate:a,waitForAtLeast:n,waitForTimeout:p});let l=Pg(t),c=e!=null?e:this.config.projectName,d=()=>zg(this.api,c,l,i,a);if(n===void 0)return await d();let m=await kg(d,n,p*1e3,5e3);if(m.length<n)throw new Mn(`Timeout after ${p} seconds: expected ${n} traces, but only ${m.length} were found.`);return m};this.flush=async()=>{j.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),await this.datasetBatchQueue.flush(),j.info("Successfully flushed all data to Opik");}catch(o){j.error("Error during flush operation:",{error:o instanceof Error?o.message:o});}};this.updatePromptVersionTags=async(o,e)=>{var t;j.debug("Updating prompt version tags",{count:o.length,options:e});try{await this.api.prompts.updatePromptVersions({ids:o,update:{tags:(t=e==null?void 0:e.tags)!=null?t:void 0},mergeTags:e==null?void 0:e.mergeTags},this.api.requestOptions),j.debug("Successfully updated prompt version tags",{count:o.length});}catch(i){throw j.error("Failed to update prompt version tags",{count:o.length,error:i}),i}};j.debug("Initializing OpikClient with config:",o),this.config=If(o);let e={apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName};o!=null&&o.headers&&(j.debug("Initializing OpikClient with additional headers:",o==null?void 0:o.headers),e.requestOptions={headers:o==null?void 0:o.headers}),this.api=new Un(e);let t=this.config.holdUntilFlush?1440*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new En(this.api,t),this.traceBatchQueue=new In(this.api,t),this.spanFeedbackScoresBatchQueue=new Cn(this.api,t),this.traceFeedbackScoresBatchQueue=new Dn(this.api,t),this.datasetBatchQueue=new Fn(this.api,t),mf.push(this);}logFeedbackScores(o,e){var t;for(let i of o)e.create({...i,projectName:(t=i.projectName)!=null?t:this.config.projectName,source:Ss.Sdk});}logTracesFeedbackScores(o){this.logFeedbackScores(o,this.traceFeedbackScoresBatchQueue);}logSpansFeedbackScores(o){this.logFeedbackScores(o,this.spanFeedbackScoresBatchQueue);}};var Yx="track.decorator",Di=new async_hooks.AsyncLocalStorage,Xx=()=>{let{span:s,trace:o}=Di.getStore()||{};if(!(!s||!o))return {span:s,trace:o}};function Zx(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function Ox({name:s,parentSpan:o,projectName:e,trace:t,type:i="llm"}){j.debug("Creating new span:",{name:s,parentSpan:o==null?void 0:o.data.id,projectName:e,type:i});let a=t;a||(a=uf().trace({name:s,projectName:e}));let n=a.span({name:s,parentSpanId:o==null?void 0:o.data.id,projectName:e,type:i});return j.debug("Span created with ID:",n.data.id),{span:n,trace:a}}function qx({args:s,span:o,trace:e}){if(j.debug("Starting span execution:",{spanId:o.data.id,traceId:e==null?void 0:e.data.id}),s.length===0)return;let t={arguments:s};j.debug("Recording span input"),o.update({input:t}),e&&(j.debug("Recording trace input"),e.update({input:t}));}function Sg({result:s,span:o,trace:e,enrichSpan:t}){j.debug("Recording successful execution:",{spanId:o.data.id,traceId:e==null?void 0:e.data.id});let i=typeof s=="object"?s:{result:s},a=new Date,n={endTime:a,output:i};if(t){let p=t(s);Object.assign(n,p);}o.update(n),e&&e.update({endTime:a,output:i});}function Ag({span:s,error:o,trace:e}){var t,i;j.error("Recording execution error:",{spanId:s.data.id,traceId:e==null?void 0:e.data.id,error:o instanceof Error?{name:o.name,message:o.message,stack:o.stack}:o}),o instanceof Error&&s.update({errorInfo:{message:o.message,exceptionType:o.name,traceback:(t=o.stack)!=null?t:""}}),s.end(),e&&(e.update({errorInfo:{message:o.message,exceptionType:o.name,traceback:(i=o.stack)!=null?i:""}}),e.end());}function Yn({name:s,projectName:o,type:e,enrichSpan:t}={},i){return function(...n){let p=Di.getStore(),{span:l,trace:c}=Ox({name:s!=null?s:i.name||Yx,parentSpan:p==null?void 0:p.span,projectName:o,trace:p==null?void 0:p.trace,type:e}),d=!p,m=this;return Di.run({span:l,trace:c},()=>{let u=d?c:void 0;try{qx({args:n,span:l,trace:u});let f=i.apply(m,n);return Zx(f)?f.then(h=>(Sg({span:l,result:h,trace:u,enrichSpan:t}),h),h=>{throw Ag({span:l,error:h,trace:u}),h}):(Sg({span:l,result:f,trace:u,enrichSpan:t}),f)}catch(f){throw Ag({span:l,error:f,trace:u}),f}})}}function Xe(s,o){if(typeof s=="function")return Yn({},s);let e=s;return o?Yn(e,o):function(...t){if(t.length===2&&typeof t[1]=="object"&&t[1]!==null&&"kind"in t[1]){let[n,p]=t;if(p.kind!=="method")throw new Error("track decorator is only applicable to methods");return Yn(e,n)}let[,,i]=t;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=Yn(e,a),i}}var df=null;function uf(){return df===null&&(df=new kr),df}var ew=async()=>{j.debug("Starting flushAll operation");try{await Promise.all([uf().flush(),...mf.map(s=>s.flush())]),j.debug("flushAll operation completed successfully");}catch(s){throw j.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};function Tg(s,o){if(!o||typeof o!="object")throw new Error("Arguments must be an object");let e=s.validationSchema,i=e.extend(Object.fromEntries(Object.entries(e.shape).map(([a,n])=>[a,n.refine(p=>p!==void 0,{message:`${a} cannot be undefined`,path:[a]})]))).safeParse(o);if(!i.success){let a=i.error.issues.map(p=>p.path[0]).filter(Boolean),n=[...new Set(a)];throw new Error(rw(s,o,n))}}function rw(s,o,e){let t=Object.keys(o),i=e.filter(a=>!(a in o));return `Metric '${s.name}' is skipped, missing required arguments: ${i.join(", ")}. Available arguments: ${t.join(", ")}.`}var Zn=class{static calculateAverageScores(o){if(!o||o.length===0)return new Map;let e=new Map;for(let i of o)if(!(!i||!i.scoreResults||i.scoreResults.length===0))for(let a of i.scoreResults){if(!a||a.scoringFailed||typeof a.value!="number")continue;let n=e.get(a.name)||{sum:0,count:0};n.sum+=a.value,n.count+=1,e.set(a.name,n);}let t=new Map;return e.forEach((i,a)=>{t.set(a,i.count>0?i.sum/i.count:0);}),t}static formatScore(o){return o.toFixed(4)}static formatTime(o){let e=Math.floor(o/3600),t=Math.floor(o%3600/60),i=Math.floor(o%60);return `${e.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}static async generateResultTable(o,e,t,i){if(o.length===0){j.info(`
|
|
18
|
-
No test results available to display.`);return}if(t.size===0){
|
|
19
|
-
No metrics available to display.`);return}let a=[...t.keys()].sort(),
|
|
20
|
-
`),l=await e.ensureNameLoaded(),c=
|
|
17
|
+
`)}return i.length===1&&i[0].type==="text"?i[0].text:i}};var Sr=class n extends rt{constructor(o,e){super({...o,templateStructure:le.Chat},e),this.messages=o.messages,this.chatTemplate=new qn(o.messages,this.type);}get template(){return structuredClone(this.messages)}format(o,e){return this.chatTemplate.format(o,e)}static fromApiResponse(o,e,t){var s;if(!e.template)throw new G("Invalid API response: missing required field 'template'");if(!e.commit)throw new G("Invalid API response: missing required field 'commit'");if(!e.promptId)throw new G("Invalid API response: missing required field 'promptId'");if(!e.id)throw new G("Invalid API response: missing required field 'id' (version ID)");let i;try{if(i=JSON.parse(e.template),!Array.isArray(i))throw new G("Invalid chat prompt template: expected array of messages")}catch(p){throw p instanceof G?p:new G(`Failed to parse chat prompt template: ${p instanceof Error?p.message:String(p)}`)}let a=(s=e.type)!=null?s:we.MUSTACHE;if(a!=="mustache"&&a!=="jinja2")throw new G(`Invalid API response: unknown prompt type '${a}'`);return new n({promptId:e.promptId,versionId:e.id,name:o.name,messages:i,commit:e.commit,metadata:e.metadata,type:a,changeDescription:e.changeDescription,description:o.description,tags:o.tags},t)}async useVersion(o){var t;let e=await this.restoreVersion(o);return n.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik)}async getVersion(o){var t;let e=await this.retrieveVersionByCommit(o);return e?n.fromApiResponse({name:this.name,description:this.description,tags:Array.from((t=this.tags)!=null?t:[])},e,this.opik):null}};async function kg(n,o,e){try{return await n.retrievePromptVersion({name:o},e)}catch(t){if(oR(t))return null;throw t}}function Pg(n,o,e){return o?o.template!==n.prompt||!tR(o.metadata,n.metadata)||o.type!==e:true}function tR(n,o){let e=n!=null?n:{},t=o!=null?o:{};return rR__default.default(e,t)}function oR(n){return typeof n=="object"&&n!==null&&"statusCode"in n&&n.statusCode===404}var fe=class{constructor(o){this.input=o;this.cursor=0;}getPosition(){return this.cursor}getRemainingInput(){return this.input.slice(this.cursor)}getFullInput(){return this.input}isAtEnd(){return this.cursor>=this.input.length}peekChar(){return this.input[this.cursor]}peekCharAt(o){return this.input[this.cursor+o]}consumeChar(){return this.input[this.cursor++]}advance(o=1){this.cursor+=o;}skipWhitespace(){for(;this.cursor<this.input.length&&/\s/.test(this.input[this.cursor]);)this.cursor++;}consumeWhile(o){let e=this.cursor;for(;this.cursor<this.input.length&&o(this.input[this.cursor]);)this.cursor++;return this.input.slice(e,this.cursor)}sliceFrom(o){return this.input.slice(o,this.cursor)}static isFieldChar(o){return /[a-zA-Z0-9_]/.test(o)}static isLetterChar(o){return /[a-zA-Z]/.test(o)}static isDigitChar(o){return /\d/.test(o)}static isWhitespaceChar(o){return /\s/.test(o)}static isQuoteChar(o){return o==='"'||o==="'"}};var Z={STRING_OPS:["=","contains","not_contains","starts_with","ends_with","!=",">","<"],NUMERIC_OPS:["=","!=",">","<",">=","<="],DATETIME_OPS:["=",">","<",">=","<="],LIST_OPS:["contains"],DICT_OPS:["=","contains",">","<"],LIMITED_STRING_OPS:["=","contains","not_contains"]},Ye={id:"string",name:"string",status:"string",start_time:"date_time",end_time:"date_time",input:"string",output:"string",metadata:"dictionary",feedback_scores:"feedback_scores_number",tags:"list","usage.total_tokens":"number","usage.prompt_tokens":"number","usage.completion_tokens":"number",duration:"number",number_of_messages:"number",created_by:"string",thread_id:"string",total_estimated_cost:"number",type:"string",model:"string",provider:"string",first_message:"string",last_message:"string",template_structure:"string"},Sg={id:Z.STRING_OPS,name:Z.STRING_OPS,status:Z.LIMITED_STRING_OPS,start_time:Z.DATETIME_OPS,end_time:Z.DATETIME_OPS,input:Z.LIMITED_STRING_OPS,output:Z.LIMITED_STRING_OPS,metadata:Z.DICT_OPS,feedback_scores:Z.NUMERIC_OPS,tags:Z.LIST_OPS,"usage.total_tokens":Z.NUMERIC_OPS,"usage.prompt_tokens":Z.NUMERIC_OPS,"usage.completion_tokens":Z.NUMERIC_OPS,duration:Z.NUMERIC_OPS,number_of_messages:Z.NUMERIC_OPS,created_by:Z.STRING_OPS,thread_id:Z.STRING_OPS,total_estimated_cost:Z.NUMERIC_OPS,type:Z.STRING_OPS,model:Z.STRING_OPS,provider:Z.STRING_OPS,first_message:Z.LIMITED_STRING_OPS,last_message:Z.LIMITED_STRING_OPS,template_structure:Z.STRING_OPS},es={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function Ag(n){let o=es.SPECIAL_FIELDS.includes(n),e=Object.keys(Ye).includes(n);if(!o&&!e){let t=Object.keys(Ye).join(", ");throw new Error(`Field ${n} is not supported, only the fields ${t} are supported.`)}}function Tg(n,o){if(!es.SPECIAL_FIELDS.includes(n)){let e=Object.keys(Ye).join(", ");throw new Error(`Field ${n}.${o} is not supported, only the fields ${e} are supported.`)}if(n==="usage"&&!es.USAGE_KEYS.includes(o))throw new Error(`When querying usage, ${o} is not supported, only usage.total_tokens, usage.prompt_tokens and usage.completion_tokens are supported.`)}function yf(n,o){let e=Sg[n];if(!(e!=null&&e.includes(o))){let t=(e==null?void 0:e.join(", "))||"none";throw new Error(`Operator ${o} is not supported for field ${n}, only the operators ${t} are supported.`)}}function vg(n){let o=n.toLowerCase();if(o==="and")return true;throw o==="or"?new Error("Invalid filter string, OR is not currently supported"):new Error(`Invalid filter string, trailing characters ${n}`)}function rs(n,o,e){if(!n)throw new Error(`Missing closing quote for: ${e}`)}var Fi=class{static parse(o){o.skipWhitespace();let e=this.parseFieldName(o);return Ag(e),o.peekChar()==="."?this.parseFieldWithKey(o,e):{type:"simple",field:e,columnType:Ye[e]}}static parseFieldName(o){return o.consumeWhile(e=>fe.isFieldChar(e))}static parseFieldWithKey(o,e){o.advance();let t=this.parseKey(o);if(Tg(e,t),e==="usage"){let i=`usage.${t}`;return {type:"simple",field:i,columnType:Ye[i]}}return {type:"nested",field:e,key:t,columnType:Ye[e]}}static parseKey(o){let e=o.peekChar();return fe.isQuoteChar(e)?this.parseQuotedKey(o,e):this.parseUnquotedKey(o)}static parseUnquotedKey(o){return o.consumeWhile(e=>fe.isFieldChar(e))}static parseQuotedKey(o,e){let t=o.getPosition();o.advance();let i="",a=false;for(;!o.isAtEnd();){let p=o.peekChar();if(p===e){if(o.peekCharAt(1)===e){i+=e,o.advance(2);continue}a=true,o.advance();break}i+=p,o.advance();}let s=o.getFullInput().slice(t);return rs(a,t,s),i}};var Ni=class{static parse(o,e){o.skipWhitespace();let t=o.peekChar(),i=this.tryParseSymbolicOperator(o,t);if(i)return yf(e,i),{operator:i};let a=this.parseWordOperator(o);return yf(e,a),{operator:a}}static tryParseSymbolicOperator(o,e){if(e==="=")return o.advance(),"=";if(e==="<"||e===">"){let t=e;return o.advance(),o.peekChar()==="="?(o.advance(),t+"="):t}return e==="!"&&o.peekCharAt(1)==="="?(o.advance(2),"!="):null}static parseWordOperator(o){return o.consumeWhile(e=>!fe.isWhitespaceChar(e))}};var Mi=class{static parse(o){o.skipWhitespace();let e=o.getPosition(),t=o.peekChar();if(t==='"')return this.parseQuotedString(o,e);if(fe.isDigitChar(t)||t==="-")return this.parseNumber(o);let i=o.getRemainingInput();throw new Error(`Invalid value ${i.slice(0,20)}, expected a string in double quotes("value") or a number`)}static parseQuotedString(o,e){o.advance();let t=o.getPosition(),i=false;for(;!o.isAtEnd();){if(o.peekChar()==='"'){i=true;break}o.advance();}rs(i,e,`value starting at position ${e}`);let a=o.sliceFrom(t);return o.advance(),{value:a}}static parseNumber(o){let e="";return o.peekChar()==="-"&&(e+=o.consumeChar()),e+=this.parseDigits(o),o.peekChar()==="."&&(e+=o.consumeChar(),e+=this.parseDigits(o)),{value:e}}static parseDigits(o){return o.consumeWhile(e=>fe.isDigitChar(e))}};var Xe=class{constructor(o){let e=o||"";this.filterExpressions=e?this.parse(e):null,this.parsedFilters=this.filterExpressions?JSON.stringify(this.filterExpressions):null;}getFilterExpressions(){return this.filterExpressions}parse(o){let e=new fe(o),t=[];for(;!e.isAtEnd();){let i=this.parseExpression(e);if(t.push(i),e.skipWhitespace(),!e.isAtEnd()&&!this.parseConnector(e))break}return t}parseExpression(o){let e=Fi.parse(o),t=Ni.parse(o,this.getFieldName(e)),i=Mi.parse(o);return this.buildExpression(e,t,i)}getFieldName(o){return o.field}buildExpression(o,e,t){let i={field:o.field,operator:e.operator,value:t.value,type:o.columnType};return o.type==="nested"&&(i.key=o.key),i}parseConnector(o){let e=o.getPosition(),t=o.consumeWhile(i=>fe.isLetterChar(i));try{return vg(t)}catch(i){if(i instanceof Error&&i.message.includes("trailing characters")){let a=o.getFullInput().slice(e);throw new Error(`Invalid filter string, trailing characters ${a}`)}throw i}}};async function jg(n,o,e,t,i){let a=await n.traces.searchTraces({projectName:o,filters:e!=null?e:void 0,limit:t,truncate:i});return await Le(a,V.TracePublic,t)}async function Eg(n,o,e,t){let i=Date.now(),a=[];for(;;){if(a=await n(),a.length>=o||Date.now()-i>=e)return a;await new Promise(p=>setTimeout(p,t));}}async function Cg(n,o,e,t,i){let a=await n.traces.searchTraceThreads({projectName:o,filters:e!=null?e:void 0,limit:t,truncate:i});return await Le(a,V.TraceThread,t)}function Ig(n,o){if(!n)return null;let t=new Xe(n).getFilterExpressions();return t?t.map(i=>{let a={field:i.field,operator:o(i.operator),value:i.value};return i.key&&(a.key=i.key),a}):null}function Dg(n){return Ig(n,o=>o)}function Ug(n){return Ig(n,o=>o)}var ot=1e3,tt=class{constructor(o,e){this.opik=e;var t;this.id=o.id,this.name=o.name,this.projectId=o.projectId,this.scope=(t=o.scope)!=null?t:this.constructor.SCOPE,this.description=o.description,this.instructions=o.instructions,this.commentsEnabled=o.commentsEnabled,this.feedbackDefinitionNames=o.feedbackDefinitionNames;}async getItemsCount(){return (await this.opik.api.annotationQueues.getAnnotationQueueById(this.id)).itemsCount}async update(o){v.debug(`Updating annotation queue "${this.name}"`,o),await this.opik.api.annotationQueues.updateAnnotationQueue(this.id,o),v.debug(`Successfully updated annotation queue "${this.name}"`);}async delete(){v.debug(`Deleting annotation queue "${this.name}"`),await this.opik.api.annotationQueues.deleteAnnotationQueueBatch({ids:[this.id]}),v.debug(`Successfully deleted annotation queue "${this.name}"`);}async addItemsBatch(o){await this.opik.api.annotationQueues.addItemsToAnnotationQueue(this.id,{body:{ids:o}}),v.debug(`Successfully added ${o.length} items to annotation queue`);}async removeItemsBatch(o){await this.opik.api.annotationQueues.removeItemsFromAnnotationQueue(this.id,{body:{ids:o}}),v.debug(`Successfully removed ${o.length} items from annotation queue`);}};var Ze=class extends tt{constructor(o,e){super(o,e);}extractTraceIds(o){return o.map((e,t)=>{if(!e.id)throw new et("trace",t);return e.id})}async addTraces(o){if(!o||o.length===0)return;let e=this.extractTraceIds(o),t=ve(e,{maxBatchSize:ot});for(let i of t)v.debug(`Adding ${i.length} traces to annotation queue`),await this.addItemsBatch(i);}async removeTraces(o){if(!o||o.length===0)return;let e=this.extractTraceIds(o),t=ve(e,{maxBatchSize:ot});for(let i of t)v.debug(`Removing ${i.length} traces from annotation queue`),await this.removeItemsBatch(i);}};Ze.SCOPE="trace";var Oe=class extends tt{constructor(o,e){super(o,e);}extractThreadIds(o){return o.map((e,t)=>{if(!e.threadModelId)throw new et("thread",t);return e.threadModelId})}async addThreads(o){if(!o||o.length===0)return;let e=this.extractThreadIds(o),t=ve(e,{maxBatchSize:ot});for(let i of t)v.debug(`Adding ${i.length} threads to annotation queue`),await this.addItemsBatch(i);}async removeThreads(o){if(!o||o.length===0)return;let e=this.extractThreadIds(o),t=ve(e,{maxBatchSize:ot});for(let i of t)v.debug(`Removing ${i.length} threads from annotation queue`),await this.removeItemsBatch(i);}};Oe.SCOPE="thread";var bf=[],Ar=class{constructor(o){this.displayTraceLog=(o,e)=>{if(e===this.lastProjectNameLogged||!this.config.apiUrl)return;let t=fg(o,this.config.apiUrl);v.info(`Started logging traces to the "${e}" project at ${Ji(t)}`),this.lastProjectNameLogged=e;};this.trace=o=>{var i;v.debug("Creating new trace with data:",o);let e=(i=o.projectName)!=null?i:this.config.projectName,t=new Dn({id:ie(),startTime:new Date,...o,projectName:e},this);return this.traceBatchQueue.create(t.data),v.debug("Trace added to the queue with ID:",t.data.id),this.displayTraceLog(t.data.id,e),t};this.getDataset=async o=>{v.debug(`Getting dataset with name "${o}"`);try{await this.datasetBatchQueue.flush();let e=await this.api.datasets.getDatasetByIdentifier({datasetName:o});return new zr(e,this)}catch(e){throw e instanceof R&&e.statusCode===404?new Ci(o):e}};this.createDataset=async(o,e)=>{v.debug(`Creating dataset with name "${o}"`);let t=new zr({name:o,description:e},this);try{return this.datasetBatchQueue.create({name:t.name,description:t.description,id:t.id}),v.debug("Dataset added to the queue with name:",t.name),t}catch(i){throw v.error(`Failed to create dataset "${o}"`,{error:i}),new Error(`Error creating dataset "${o}": ${i}`)}};this.getOrCreateDataset=async(o,e)=>{v.debug(`Attempting to retrieve or create dataset with name: "${o}"`);try{return await this.getDataset(o)}catch(t){if(t instanceof Ci)return v.info(`Dataset "${o}" not found. Proceeding to create a new one.`),this.createDataset(o,e);throw v.error(`Error retrieving dataset "${o}":`,t),t}};this.getDatasets=async(o=100)=>{v.debug(`Getting all datasets (limit: ${o})`);try{await this.datasetBatchQueue.flush();let e=await this.api.datasets.findDatasets({size:o}),t=[];for(let i of e.content||[])t.push(new zr(i,this));return v.info(`Retrieved ${t.length} datasets`),t}catch(e){throw v.error("Failed to retrieve datasets",{error:e}),new Error("Failed to retrieve datasets")}};this.deleteDataset=async o=>{v.debug(`Deleting dataset with name "${o}"`);try{let e=await this.getDataset(o);if(!e.id)throw new Error(`Cannot delete dataset "${o}": ID not available`);this.datasetBatchQueue.delete(e.id);}catch(e){throw v.error(`Failed to delete dataset "${o}"`,{error:e}),new Error(`Failed to delete dataset "${o}": ${e}`)}};this.createTracesAnnotationQueue=async o=>this.createAnnotationQueueInternal(o,Ze);this.createThreadsAnnotationQueue=async o=>this.createAnnotationQueueInternal(o,Oe);this.getTracesAnnotationQueue=async o=>this.fetchAnnotationQueueById(o,"trace",Ze);this.getThreadsAnnotationQueue=async o=>this.fetchAnnotationQueueById(o,"thread",Oe);this.getTracesAnnotationQueues=async o=>(await this.getAnnotationQueuesByScope("trace",o)).map(t=>new Ze(t,this));this.getThreadsAnnotationQueues=async o=>(await this.getAnnotationQueuesByScope("thread",o)).map(t=>new Oe(t,this));this.deleteTracesAnnotationQueue=async o=>this.deleteAnnotationQueueById(o,"traces");this.deleteThreadsAnnotationQueue=async o=>this.deleteAnnotationQueueById(o,"threads");this.createExperiment=async({datasetName:o,name:e,experimentConfig:t,prompts:i,type:a=Cs.Regular,optimizationId:s,datasetVersionId:p})=>{if(v.debug(`Creating experiment for dataset "${o}"`),!o)throw new Error("Dataset name is required to create an experiment");let[l,c]=bg(t,i),d=ie(),m=new kr({id:d,name:e,datasetName:o,prompts:i},this);try{return await this.api.experiments.createExperiment({id:d,datasetName:o,name:e,metadata:l,promptVersions:c,type:a,optimizationId:s,datasetVersionId:p}),v.debug("Experiment created with id:",d),m}catch(u){throw v.error(`Failed to create experiment for dataset "${o}"`,{error:u}),new Error(`Error creating experiment: ${u}`)}};this.updateExperiment=async(o,e)=>{if(!o)throw new Error("id is required to update an experiment");let{name:t,experimentConfig:i}=e;if(!t&&!i)throw new Error("At least one of 'name' or 'experimentConfig' must be provided to update an experiment");v.debug(`Updating experiment with ID "${o}"`);let a={};t!==void 0&&(a.name=t),i!==void 0&&(a.metadata=i);try{await this.api.experiments.updateExperiment(o,{body:a});}catch(s){throw v.error(`Failed to update experiment with ID "${o}"`,{error:s}),s}};this.getExperimentById=async o=>{v.debug(`Getting experiment with ID "${o}"`);try{let e=await this.api.experiments.getExperimentById(o);return new kr({id:e.id,name:e.name,datasetName:e.datasetName},this)}catch(e){throw e instanceof R&&e.statusCode===404?new Ii(`No experiment found with ID '${o}'`):(v.error(`Failed to get experiment with ID "${o}"`,{error:e}),e)}};this.getExperimentsByName=async o=>{v.debug(`Getting experiments with name "${o}"`);try{let e=await this.api.experiments.streamExperiments({name:o});return (await Le(e,V.ExperimentPublic)).map(i=>new kr({id:i.id,name:i.name,datasetName:i.datasetName},this))}catch(e){throw v.error(`Failed to get experiments with name "${o}"`,{error:e}),e}};this.getExperiment=async o=>{v.debug(`Getting experiment with name "${o}"`);let e=await this.getExperimentsByName(o);if(e.length===0)throw new Ii(o);return e[0]};this.getDatasetExperiments=async(o,e=100)=>{var s;v.debug(`Getting experiments for dataset "${o}"`);let t=await this.getDataset(o),i=Math.min(100,e),a=[];try{let p=1;for(;a.length<e;){let l=await this.api.experiments.findExperiments({page:p,size:i,datasetId:t.id}),c=(s=l==null?void 0:l.content)!=null?s:[];if(c.length===0)break;let d=e-a.length,m=Math.min(c.length,d);for(let u=0;u<m;u++){let f=c[u];a.push(new kr({id:f.id,name:f.name,datasetName:f.datasetName},this));}if(m<c.length)break;p+=1;}return a}catch(p){throw v.error(`Failed to get experiments for dataset "${o}"`,{error:p}),p}};this.deleteExperiment=async o=>{v.debug(`Deleting experiment with ID "${o}"`);try{await this.api.experiments.deleteExperimentsById({ids:[o]});}catch(e){throw v.error(`Failed to delete experiment with ID "${o}"`,{error:e}),e}};this.createPromptInternal=async(o,e,t,i,a,s,p)=>{var l;v.debug(`Creating ${p}`,{name:o});try{let c=await kg(this.api.prompts,o,this.api.requestOptions);a(c);let d=(l=i.type)!=null?l:we.MUSTACHE,m=Pg({prompt:e,metadata:i.metadata},c,d),u;if(m?(v.debug(`Creating new ${p} version`,{name:o}),u=await this.api.prompts.createPromptVersion({name:o,version:{template:e,metadata:i.metadata,type:d},templateStructure:t},this.api.requestOptions)):(v.debug(`Returning existing ${p} version`,{name:o}),u=c),!u.promptId)throw new Error("Invalid API response: missing promptId");let f=await this.api.prompts.getPromptById(u.promptId,this.api.requestOptions),h=s(f,u);return v.debug(`${p} created`,{name:o}),i.description||i.tags?await h.updateProperties({description:i.description,tags:i.tags}):h}catch(c){throw v.error(`Failed to create ${p}`,{name:o,error:c}),c}};this.createPrompt=async o=>this.createPromptInternal(o.name,o.prompt,le.Text,o,()=>{},(e,t)=>Qe.fromApiResponse(e,t,this),"prompt");this.createChatPrompt=async o=>{let e=JSON.stringify(o.messages);return this.createPromptInternal(o.name,e,le.Chat,o,t=>{if(t&&t.templateStructure&&t.templateStructure!==le.Chat)throw new Pr(o.name,t.templateStructure,le.Chat)},(t,i)=>Sr.fromApiResponse(t,i,this),"chat prompt")};this.getPrompt=async o=>{var e;v.debug("Getting prompt",o);try{let i=(e=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:o.name}]),size:1},this.api.requestOptions)).content)==null?void 0:e[0];if(!i)return v.debug("Prompt not found",{name:o.name}),null;let a=await this.api.prompts.retrievePromptVersion(o,this.api.requestOptions),s=a.templateStructure;if(s&&s!==le.Text)throw new Pr(o.name,s,le.Text);return Qe.fromApiResponse(i,a,this)}catch(t){if(t instanceof R&&t.statusCode===404)return null;throw v.error("Failed to get prompt",{name:o.name,error:t}),t}};this.getChatPrompt=async o=>{var e;v.debug("Getting chat prompt",o);try{let i=(e=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:o.name}]),size:1},this.api.requestOptions)).content)==null?void 0:e[0];if(!i)return v.debug("Chat prompt not found",{name:o.name}),null;let a=await this.api.prompts.retrievePromptVersion(o,this.api.requestOptions),s=a.templateStructure;if(!s||s!==le.Chat)throw new Pr(o.name,s!=null?s:"undefined",le.Chat);return Sr.fromApiResponse(i,a,this)}catch(t){if(t instanceof R&&t.statusCode===404)return null;throw v.error("Failed to get chat prompt",{name:o.name,error:t}),t}};this.searchPrompts=async o=>{var e;v.debug("Searching prompts",{filterString:o});try{let t;if(o){let l=new Xe(o).getFilterExpressions();t=l?JSON.stringify(l):void 0;}let a=(e=(await this.api.prompts.getPrompts({filters:t,size:1e3},this.api.requestOptions)).content)!=null?e:[];return (await Promise.all(a.map(async p=>{if(!p.name)return null;try{let l=await this.api.prompts.retrievePromptVersion({name:p.name},this.api.requestOptions),c=l.templateStructure;return !c||c===le.Text?Qe.fromApiResponse(p,l,this):c===le.Chat?Sr.fromApiResponse(p,l,this):null}catch(l){return v.debug("Failed to get version for prompt",{name:p.name,error:l}),null}}))).filter(p=>p!==null)}catch(t){throw v.error("Failed to search prompts",{error:t}),t}};this.deletePrompts=async o=>{v.debug("Deleting prompts in batch",{count:o.length});try{await this.api.prompts.deletePromptsBatch({ids:o},this.api.requestOptions),v.info("Successfully deleted prompts",{count:o.length});}catch(e){throw v.error("Failed to delete prompts",{count:o.length,error:e}),e}};this.searchTraces=async o=>this.executeSearch("traces",o!=null?o:{},Dg,jg);this.searchThreads=async o=>this.executeSearch("threads",o!=null?o:{},Ug,Cg);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(),await this.datasetBatchQueue.flush(),v.info("Successfully flushed all data to Opik");}catch(o){v.error("Error during flush operation:",{error:o instanceof Error?o.message:o});}};this.updatePromptVersionTags=async(o,e)=>{var t;v.debug("Updating prompt version tags",{count:o.length,options:e});try{await this.api.prompts.updatePromptVersions({ids:o,update:{tags:(t=e==null?void 0:e.tags)!=null?t:void 0},mergeTags:e==null?void 0:e.mergeTags},this.api.requestOptions),v.debug("Successfully updated prompt version tags",{count:o.length});}catch(i){throw v.error("Failed to update prompt version tags",{count:o.length,error:i}),i}};v.debug("Initializing OpikClient with config:",o),this.config=Bf(o);let e={apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName};o!=null&&o.headers&&(v.debug("Initializing OpikClient with additional headers:",o==null?void 0:o.headers),e.requestOptions={headers:o==null?void 0:o.headers}),this.api=new Bn(e);let t=this.config.holdUntilFlush?1440*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Fn(this.api,t),this.traceBatchQueue=new Mn(this.api,t),this.spanFeedbackScoresBatchQueue=new Nn(this.api,t),this.traceFeedbackScoresBatchQueue=new Wn(this.api,t),this.datasetBatchQueue=new Vn(this.api,t),bf.push(this);}async getProjectIdByName(o){let e=await this.api.projects.retrieveProject({name:o});if(!(e!=null&&e.id))throw new Error(`Project "${o}" not found`);return e.id}async createAnnotationQueueInternal(o,e){let{name:t,projectName:i,description:a,instructions:s,commentsEnabled:p,feedbackDefinitionNames:l}=o,c=e.SCOPE;v.debug(`Creating ${c} annotation queue "${t}"`);let d=i!=null?i:this.config.projectName;try{let m=await this.getProjectIdByName(d),u=ie();return await this.api.annotationQueues.createAnnotationQueue({id:u,projectId:m,name:t,scope:c,description:a,instructions:s,commentsEnabled:p,feedbackDefinitionNames:l}),v.debug(`Created ${c} annotation queue "${t}" with ID "${u}"`),new e({id:u,name:t,projectId:m,scope:c,description:a,instructions:s,commentsEnabled:p,feedbackDefinitionNames:l},this)}catch(m){throw v.error(`Failed to create ${c} annotation queue "${t}"`,{error:m}),m}}async fetchAnnotationQueueById(o,e,t){v.debug(`Getting ${e} annotation queue with ID "${o}"`);try{let i=await this.api.annotationQueues.getAnnotationQueueById(o);if(i.scope!==e)throw new Error(`Annotation queue "${o}" is not a ${e} queue (scope: ${i.scope})`);return new t(i,this)}catch(i){if(i instanceof R){if(i.statusCode===404)throw new Gn(o);v.error(`Failed to get ${e} annotation queue with ID "${o}"`,{error:i});}throw i}}async getAnnotationQueuesByScope(o,e){let{projectName:t,maxResults:i=1e3}=e!=null?e:{};v.debug(`Getting ${o} annotation queues (project: ${t!=null?t:"all"}, limit: ${i})`);try{let a;if(t){let l=await this.getProjectIdByName(t);a=JSON.stringify([{field:"project_id",operator:"=",value:l},{field:"scope",operator:"=",value:o}]);}else a=JSON.stringify([{field:"scope",operator:"=",value:o}]);let p=(await this.api.annotationQueues.findAnnotationQueues({size:i,filters:a})).content||[];return v.info(`Retrieved ${p.length} ${o} annotation queues`),p}catch(a){throw v.error(`Failed to retrieve ${o} annotation queues`,{error:a}),a}}async deleteAnnotationQueueById(o,e){v.debug(`Deleting ${e} annotation queue with ID "${o}"`);try{await this.api.annotationQueues.deleteAnnotationQueueBatch({ids:[o]}),v.debug(`Successfully deleted ${e} annotation queue with ID "${o}"`);}catch(t){throw v.error(`Failed to delete ${e} annotation queue with ID "${o}"`,{error:t}),t}}async executeSearch(o,e,t,i){let{projectName:a,filterString:s,maxResults:p=1e3,truncate:l=true,waitForAtLeast:c,waitForTimeout:d=60}=e;v.debug(`Searching ${o}`,{projectName:a,filterString:s,maxResults:p,truncate:l,waitForAtLeast:c,waitForTimeout:d});let m=t(s),u=a!=null?a:this.config.projectName,f=()=>i(this.api,u,m,p,l);if(c===void 0)return await f();let h=await Eg(f,c,d*1e3,5e3);if(h.length<c)throw new Hn(`Timeout after ${d} seconds: expected ${c} ${o}, but only ${h.length} were found.`);return h}logFeedbackScores(o,e){var t;for(let i of o)e.create({...i,projectName:(t=i.projectName)!=null?t:this.config.projectName,source:Is.Sdk});}logTracesFeedbackScores(o){this.logFeedbackScores(o,this.traceFeedbackScoresBatchQueue);}logSpansFeedbackScores(o){this.logFeedbackScores(o,this.spanFeedbackScoresBatchQueue);}};var aR="track.decorator",Wi=new async_hooks.AsyncLocalStorage,nR=()=>{let{span:n,trace:o}=Wi.getStore()||{};if(!(!n||!o))return {span:n,trace:o}};function sR(n){return !!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function pR({name:n,parentSpan:o,projectName:e,trace:t,type:i="llm"}){v.debug("Creating new span:",{name:n,parentSpan:o==null?void 0:o.data.id,projectName:e,type:i});let a=t;a||(a=wf().trace({name:n,projectName:e}));let s=a.span({name:n,parentSpanId:o==null?void 0:o.data.id,projectName:e,type:i});return v.debug("Span created with ID:",s.data.id),{span:s,trace:a}}function cR({args:n,span:o,trace:e}){if(v.debug("Starting span execution:",{spanId:o.data.id,traceId:e==null?void 0:e.data.id}),n.length===0)return;let t={arguments:n};v.debug("Recording span input"),o.update({input:t}),e&&(v.debug("Recording trace input"),e.update({input:t}));}function Fg({result:n,span:o,trace:e,enrichSpan:t}){v.debug("Recording successful execution:",{spanId:o.data.id,traceId:e==null?void 0:e.data.id});let i=typeof n=="object"?n:{result:n},a=new Date,s={endTime:a,output:i};if(t){let p=t(n);Object.assign(s,p);}o.update(s),e&&e.update({endTime:a,output:i});}function Ng({span:n,error:o,trace:e}){var t,i;v.error("Recording execution error:",{spanId:n.data.id,traceId:e==null?void 0:e.data.id,error:o instanceof Error?{name:o.name,message:o.message,stack:o.stack}:o}),o instanceof Error&&n.update({errorInfo:{message:o.message,exceptionType:o.name,traceback:(t=o.stack)!=null?t:""}}),n.end(),e&&(e.update({errorInfo:{message:o.message,exceptionType:o.name,traceback:(i=o.stack)!=null?i:""}}),e.end());}function ts({name:n,projectName:o,type:e,enrichSpan:t}={},i){return function(...s){let p=Wi.getStore(),{span:l,trace:c}=pR({name:n!=null?n:i.name||aR,parentSpan:p==null?void 0:p.span,projectName:o,trace:p==null?void 0:p.trace,type:e}),d=!p,m=this;return Wi.run({span:l,trace:c},()=>{let u=d?c:void 0;try{cR({args:s,span:l,trace:u});let f=i.apply(m,s);return sR(f)?f.then(h=>(Fg({span:l,result:h,trace:u,enrichSpan:t}),h),h=>{throw Ng({span:l,error:h,trace:u}),h}):(Fg({span:l,result:f,trace:u,enrichSpan:t}),f)}catch(f){throw Ng({span:l,error:f,trace:u}),f}})}}function qe(n,o){if(typeof n=="function")return ts({},n);let e=n;return o?ts(e,o):function(...t){if(t.length===2&&typeof t[1]=="object"&&t[1]!==null&&"kind"in t[1]){let[s,p]=t;if(p.kind!=="method")throw new Error("track decorator is only applicable to methods");return ts(e,s)}let[,,i]=t;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=ts(e,a),i}}var xf=null;function wf(){return xf===null&&(xf=new Ar),xf}var lR=async()=>{v.debug("Starting flushAll operation");try{await Promise.all([wf().flush(),...bf.map(n=>n.flush())]),v.debug("flushAll operation completed successfully");}catch(n){throw v.error("Error during flushAll operation:",{error:n instanceof Error?n.message:n,stack:n instanceof Error?n.stack:void 0}),n}};function Mg(n,o){if(!o||typeof o!="object")throw new Error("Arguments must be an object");let e=n.validationSchema,i=e.extend(Object.fromEntries(Object.entries(e.shape).map(([a,s])=>[a,s.refine(p=>p!==void 0,{message:`${a} cannot be undefined`,path:[a]})]))).safeParse(o);if(!i.success){let a=i.error.issues.map(p=>p.path[0]).filter(Boolean),s=[...new Set(a)];throw new Error(mR(n,o,s))}}function mR(n,o,e){let t=Object.keys(o),i=e.filter(a=>!(a in o));return `Metric '${n.name}' is skipped, missing required arguments: ${i.join(", ")}. Available arguments: ${t.join(", ")}.`}var is=class{static calculateAverageScores(o){if(!o||o.length===0)return new Map;let e=new Map;for(let i of o)if(!(!i||!i.scoreResults||i.scoreResults.length===0))for(let a of i.scoreResults){if(!a||a.scoringFailed||typeof a.value!="number")continue;let s=e.get(a.name)||{sum:0,count:0};s.sum+=a.value,s.count+=1,e.set(a.name,s);}let t=new Map;return e.forEach((i,a)=>{t.set(a,i.count>0?i.sum/i.count:0);}),t}static formatScore(o){return o.toFixed(4)}static formatTime(o){let e=Math.floor(o/3600),t=Math.floor(o%3600/60),i=Math.floor(o%60);return `${e.toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}static async generateResultTable(o,e,t,i){if(o.length===0){v.info(`
|
|
18
|
+
No test results available to display.`);return}if(t.size===0){v.info(`
|
|
19
|
+
No metrics available to display.`);return}let a=[...t.keys()].sort(),s=this.formatTime(i),p=[os__default.default.bold(`Total time: ${s}`),os__default.default.bold(`Number of samples: ${o.length}`),"",...a.map(d=>{let m=this.formatScore(t.get(d)||0);return os__default.default.green(`${d}: ${m} (avg)`)})].join(`
|
|
20
|
+
`),l=await e.ensureNameLoaded(),c=dR__default.default(p,{title:`${l} (${o.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});v.info(`
|
|
21
21
|
`+c+`
|
|
22
|
-
`),
|
|
22
|
+
`),v.info(os__default.default.blue("Uploading results to Opik ... "));}static async displayExperimentLink(o){let e=await o.getUrl();v.info(`View the results ${Ji(e,"in your Opik dashboard")}`);}static async processResults(o,e,t=0){let i=this.calculateAverageScores(o);await this.generateResultTable(o,e,i,t),await this.displayExperimentLink(e);let a=await e.ensureNameLoaded();return {experimentId:e.id,experimentName:a,testResults:o}}};function Wg(n,o,e){if(!n||typeof o!="string"||o.trim()==="")return e;let t=o.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=n;for(let a of t)if(typeof i=="object"&&i!==null&&a in i)i=i[a];else return e;return i===void 0?e:i}var Bg,Rf;Bg=[qe({name:"metrics_calculation",type:Ie.General})];var it=class{constructor(o,e,t){Df(Rf,5,this);this.client=void 0;this.dataset=void 0;this.task=void 0;this.scoringMetrics=void 0;this.projectName=void 0;this.nbSamples=void 0;this.scoringKeyMapping=void 0;this.experiment=void 0;this.rootTrace=void 0;this.client=e,this.dataset=o.dataset,this.experiment=t,this.task=o.task,this.scoringMetrics=o.scoringMetrics||[],this.projectName=o.projectName,this.nbSamples=o.nbSamples,this.scoringKeyMapping=o.scoringKeyMapping;}async execute(){var d;let o=performance.now(),e=[],t=await this.dataset.getItems(this.nbSamples),i=t.length,a=v.settings.minLevel;v.settings.minLevel=6;let s=uR__default.default({text:`Evaluating dataset (0/${i} items)`}).start(),p=[];for(let m=0;m<t.length;m++){let u=t[m];try{this.rootTrace=this.client.trace({projectName:this.projectName,name:"evaluation_task",createdBy:"evaluation",input:u}),Wi.enterWith({trace:this.rootTrace});let f=await this.executeTask(u);p.push(f),this.rootTrace.update({output:f.testCase.taskOutput,endTime:new Date});}catch(f){let h=f instanceof Error?f.message:String(f);v.error(`Error processing dataset item: ${u.id} - ${h}`),f instanceof Error&&this.rootTrace.update({errorInfo:{message:f.message,exceptionType:f.name,traceback:(d=f.stack)!=null?d:""},endTime:new Date});}e.push(new Xn({datasetItemId:u.id,traceId:this.rootTrace.data.id})),s.text=`Evaluating dataset (${m+1}/${i} items, ${Math.round((m+1)/i*100)}%)`;}let c=(performance.now()-o)/1e3;return s.succeed(`Evaluation complete: ${i} items processed in ${c.toFixed(2)}s`),v.settings.minLevel=a,this.experiment.insert(e),await this.client.flush(),is.processResults(p,this.experiment,c)}async executeTask(o){let e={},t=[];v.debug(`Starting evaluation task on dataset item ${o.id}`),e=await qe({name:"llm_task",type:Ie.General},this.task)(o),v.debug(`Finished evaluation task on dataset item ${o.id}`);let i=this.prepareScoringInputs(o,e),a={traceId:this.rootTrace.data.id,datasetItemId:o.id,scoringInputs:i,taskOutput:e};return this.scoringMetrics.length>0?this.calculateScores(a):{testCase:a,scoreResults:t}}async calculateScores(o){let e=[],{scoringInputs:t}=o;for(let i of this.scoringMetrics){v.debug(`Calculating score for metric ${i.name}`);try{Mg(i,t);let a=await i.score(t),s=Array.isArray(a)?a:[a];e.push(...s);}catch(a){let s=a instanceof Error?a.message:String(a);v.error(`Metric ${i.name} failed: ${s}`);}v.debug(`Finished calculating score for metric ${i.name}`);}return e.forEach(i=>{var a;return (a=this.rootTrace)==null?void 0:a.score({name:i.name,value:i.value,reason:i.reason})}),{testCase:o,scoreResults:e}}prepareScoringInputs(o,e){let t={...o,...e};if(!this.scoringKeyMapping)return t;let i={...t};for(let[a,s]of Object.entries(this.scoringKeyMapping)){let p=Wg(t,s);p!==void 0&&(i[a]=p);}return i}};Rf=Cf(),Uf(Rf,1,"calculateScores",Bg,it),us(Rf,it);var at=class at{static getInstance(o){return at.instance||(at.instance=new Ar(o)),at.instance}};at.instance=null;var as=at;async function Vg(n){var i;if(!n.dataset)throw new Error("Dataset is required for evaluation");if(!n.task)throw new Error("Task function is required for evaluation");let o=(i=n.client)!=null?i:as.getInstance(),e=await n.dataset.getVersionInfo(),t=await o.createExperiment({name:n.experimentName,datasetName:n.dataset.name,experimentConfig:n.experimentConfig,prompts:n.prompts,datasetVersionId:e==null?void 0:e.id});try{let a=new it(n,o,t);return v.info("Starting evaluation"),a.execute()}catch(a){throw v.error(`Error during evaluation: ${a}`),a}}var Tr=class{constructor(o){this.modelName=o;}};var Bi=class n extends Error{constructor(o){super(o),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}},nt=class n extends Bi{constructor(e,t){super(e);this.cause=t;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}},er=class n extends Bi{constructor(o){super(o),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}};function yR(n,o){return n.startsWith("gpt-")||n.startsWith("o1")||n.startsWith("o3")||n.startsWith("chatgpt-")}function bR(n,o){return n.startsWith("claude-")}function xR(n,o){return n.startsWith("gemini-")||n.startsWith("gemma-")}function _f(n,o,e){if(!o)throw new er(`API key for ${n} is not configured. Please provide it via the 'apiKey' option or set the ${e} environment variable.`)}function zf(n,o){if(yR(n)){let e=(o==null?void 0:o.apiKey)||process.env.OPENAI_API_KEY;return _f("OpenAI",e,"OPENAI_API_KEY"),openai.createOpenAI({apiKey:e,...o})(n)}if(bR(n)){let e=(o==null?void 0:o.apiKey)||process.env.ANTHROPIC_API_KEY;return _f("Anthropic",e,"ANTHROPIC_API_KEY"),anthropic.createAnthropic({apiKey:e,...o})(n)}if(xR(n)){let e=(o==null?void 0:o.apiKey)||process.env.GOOGLE_API_KEY;return _f("Google Gemini",e,"GOOGLE_API_KEY"),google.createGoogleGenerativeAI({apiKey:e,...o})(n)}throw new er(`Unable to detect provider for model ID: ${n}. Supported providers are OpenAI (gpt-*, o1*, o3*, chatgpt-*), Anthropic (claude-*), and Google Gemini (gemini-*, gemma-*).`)}var wR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens"};function RR(n){if(!n||typeof n!="object")return false;let o=n,e="usage"in o,t="response"in o,i="text"in o,a="object"in o;return e||t||i||a}function Lg(n,o){if(!RR(n))return {model:o};let e={model:_R(n,o)},t=zR(n.usage);t&&(e.usage=t);let i=kR(n);i&&(e.provider=i);let a=SR(n);a&&(e.metadata=a);let s=AR(n);return s&&(e.output=s),e}function _R(n,o){var e,t;return (t=(e=n.response)==null?void 0:e.modelId)!=null?t:o}function zR(n){var i,a;if(!n)return;let o={};for(let[s,p]of Object.entries(wR)){let l=n[s];typeof l=="number"&&(o[p]=l);}let e=(i=n.inputTokenDetails)==null?void 0:i.cacheReadTokens;typeof e=="number"&&(o.cached_input_tokens=e);let t=(a=n.outputTokenDetails)==null?void 0:a.reasoningTokens;return typeof t=="number"&&(o.reasoning_tokens=t),Object.keys(o).length>0?o:void 0}function kR(n){if(!n.providerMetadata)return;let o=Object.keys(n.providerMetadata);return o.length>0?o[0]:void 0}function PR(n){if(!n)return;let o={};return n.id&&(o.id=n.id),n.timestamp&&(o.timestamp=n.timestamp.toISOString()),Object.keys(o).length>0?o:void 0}function SR(n){let o={};n.usage&&(o.usage=n.usage),n.warnings&&n.warnings.length>0&&(o.warnings=n.warnings);let e=PR(n.response);return e&&(o.response=e),n.providerMetadata&&(o.providerMetadata=n.providerMetadata),n.finishReason&&(o.finishReason=n.finishReason),Object.keys(o).length>0?o:void 0}function AR(n){let o={};return "text"in n&&n.text&&(o.text=n.text),"object"in n&&n.object!==void 0&&(o.object=n.object),"toolCalls"in n&&Array.isArray(n.toolCalls)&&(o.toolCalls=n.toolCalls),"toolResults"in n&&Array.isArray(n.toolResults)&&(o.toolResults=n.toolResults),"sources"in n&&Array.isArray(n.sources)&&(o.sources=n.sources),Object.keys(o).length>0?o:void 0}var st=class extends Tr{constructor(o,e={trackGenerations:true}){let t=typeof o=="string"?o:o.modelId;super(t);let{trackGenerations:i,...a}=e;try{typeof o!="string"?(this.model=o,v.debug("Initialized VercelAIChatModel with custom LanguageModel")):(this.model=zf(o,a),v.debug(`Initialized VercelAIChatModel with model ID: ${o}`)),i?this._generateText=qe({name:"model.generateText",type:Ie.Llm,enrichSpan:s=>Lg(s,this.modelName)},ai$1.generateText):this._generateText=ai$1.generateText;}catch(s){throw new er(`Failed to initialize model ${t}: ${s instanceof Error?s.message:String(s)}`)}}async generateString(o,e,t){try{let i;if(e){v.debug(`Generating structured output with model ${this.modelName}, input length: ${o.length}`);let a=await this._generateText({model:this.model,prompt:o,output:ai$1.Output.object({schema:e}),...t});v.debug(`Generated structured output with model ${this.modelName}`),i=JSON.stringify(a.output);}else {v.debug(`Generating text with model ${this.modelName}, input length: ${o.length}`);let a=await this._generateText({model:this.model,prompt:o,...t});v.debug(`Generated text with model ${this.modelName}, output length: ${a.text.length}`),i=a.text;}return i}catch(i){let a=e?`Failed to generate structured output with model ${this.modelName}`:`Failed to generate text with model ${this.modelName}`;throw v.error(a,{error:i}),new nt(a,i instanceof Error?i:new Error(String(i)))}}async generateProviderResponse(o,e){try{v.debug(`Generating provider response with model ${this.modelName}, messages count: ${o.length}`);let t=await this._generateText({model:this.model,messages:o,...e});return v.debug(`Generated provider response with model ${this.modelName}`),t}catch(t){let i=`Failed to generate provider response with model ${this.modelName}`;throw v.error(i,{error:t}),new nt(i,t instanceof Error?t:new Error(String(t)))}}};var Jg="gpt-4o";function kf(n,o){return new st(n,o)}function Gg(n,o){return new st(n,o)}function vR(n){return n instanceof Tr}function jR(n){return typeof n=="object"&&n!==null&&"modelId"in n&&typeof n.modelId=="string"}function ER(n){return typeof n=="string"&&n.length>0}function CR(n){let o=typeof n,e=o==="object"?JSON.stringify(n):String(n);return new Error(`Invalid model type. Expected one of:
|
|
23
23
|
- string (model ID like 'gpt-4o', 'claude-3-5-sonnet-latest')
|
|
24
24
|
- LanguageModel instance from Vercel AI SDK
|
|
25
25
|
- OpikBaseModel instance
|
|
26
|
-
- undefined (uses default model: ${
|
|
26
|
+
- undefined (uses default model: ${Jg})
|
|
27
27
|
|
|
28
|
-
Received: ${o} ${e}`)}function
|
|
29
|
-
`)}function
|
|
30
|
-
`)}function
|
|
28
|
+
Received: ${o} ${e}`)}function Vi(n,o){if(n==null)return kf(Jg,o);if(ER(n))return kf(n,o);if(vR(n))return n;if(jR(n))return Gg(n,o);throw CR(n)}function Kg(n){return n.map(o=>{let e=Array.isArray(o.content)?IR(o.content):o.content;return `${o.role}: ${e}`}).join(`
|
|
29
|
+
`)}function IR(n){return n.map(o=>o.type==="text"?o.text:o.type==="file"?`[file: ${o.filename||"unknown"}]`:o.type==="tool-call"?`[tool-call: ${o.toolName}]`:o.type==="tool-result"?`[tool-result: ${o.toolName}]`:o.type==="reasoning"?`[reasoning: ${o.text}]`:o.type==="tool-approval-request"?"[tool-approval-request]":o.type==="tool-approval-response"?"[tool-approval-response]":"").filter(o=>o.length>0).join(`
|
|
30
|
+
`)}function DR(n,o,e){return typeof n=="string"?me(n,o,e):Array.isArray(n)?n.map(i=>i.type==="text"&&typeof i.text=="string"?{...i,text:me(i.text,o,e)}:i.type==="image"&&typeof i.image=="string"?{...i,image:me(i.image,o,e)}:i.type==="file"&&typeof i.data=="string"?{...i,data:me(i.data,o,e)}:i.type==="reasoning"&&typeof i.text=="string"?{...i,text:me(i.text,o,e)}:i):n}function $g(n,o,e){let t=DR(n.content,o,e);return {...n,content:t}}async function Rye(n){var i;if(!n.dataset)throw new Error("Dataset is required for prompt evaluation");if(!n.messages||n.messages.length===0)throw new Error("Messages array is required and cannot be empty");if(n.experimentConfig!==void 0&&(typeof n.experimentConfig!="object"||n.experimentConfig===null||Array.isArray(n.experimentConfig)))throw new Error("experimentConfig must be a plain object, not an array or primitive value");let o=Vi(n.model),e={...n.experimentConfig,prompt_template:n.messages,model:o.modelName,...n.temperature!==void 0&&{temperature:n.temperature},...n.seed!==void 0&&{seed:n.seed}},t=UR(o,n.messages,(i=n.templateType)!=null?i:we.MUSTACHE,{temperature:n.temperature,seed:n.seed});return Vg({dataset:n.dataset,task:t,scoringMetrics:n.scoringMetrics,experimentName:n.experimentName,projectName:n.projectName,experimentConfig:e,prompts:n.prompts,client:n.client,nbSamples:n.nbSamples,scoringKeyMapping:n.scoringKeyMapping})}function UR(n,o,e,t){return async i=>{let a=o.map(c=>$g(c,i,e)),s=await n.generateProviderResponse(a,t),p=FR(s);return {input:Kg(a),output:p}}}function FR(n){return n&&typeof n=="object"?"text"in n&&typeof n.text=="string"?n.text:"content"in n&&typeof n.content=="string"?n.content:JSON.stringify(n):String(n)}var Re=class{constructor(o,e=true){if(this.name=o,this.trackMetric=e,e){let t=this.score.bind(this);this.score=qe({name:this.name,type:Ie.General},t);}}};var NR=zod.z.object({output:zod.z.unknown(),expected:zod.z.unknown()}),Qg=class extends Re{constructor(e="exact_match",t=true){super(e,t);this.validationSchema=NR;}async score(e){let{output:t,expected:i}=e,a=t===i?1:0;return {name:this.name,value:a,reason:`Exact match: ${a===1?"Match":"No match"}`}}};var MR=zod.z.object({output:zod.z.string(),substring:zod.z.string()}),Yg=class extends Re{constructor(e="contains",t=true,i=false){super(e,t);this.validationSchema=MR;this.caseSensitive=i;}async score(e){let{output:t,substring:i}=e,a=this.caseSensitive?t:t.toLowerCase(),s=this.caseSensitive?i:i.toLowerCase();return a.includes(s)?{name:this.name,value:1,reason:`Contains: "${i}" found in output.`}:{name:this.name,value:0,reason:`Contains: "${i}" not found in output.`}}};var WR=zod.z.object({output:zod.z.string(),pattern:zod.z.string(),flags:zod.z.string().optional()}),Xg=class extends Re{constructor(e="regex_match",t=true){super(e,t);this.validationSchema=WR;}async score(e){let{output:t,pattern:i,flags:a}=e,s;typeof i=="string"&&a?s=new RegExp(i,a):s=new RegExp(i);let p=s.test(t);return {name:this.name,value:p?1:0,reason:p?`Regex: Output matches the regex pattern: ${i}`:`Regex: Output does not match the regex pattern: ${i}`}}};var BR=zod.z.object({output:zod.z.unknown()}),Og=class extends Re{constructor(e="is_json_metric",t=true){super(e,t);this.validationSchema=BR;}async score(e){let{output:t}=e;try{return JSON.parse(t),{name:this.name,value:1,reason:"IsJson: Output is valid JSON."}}catch{return {name:this.name,value:0,reason:"IsJson: Output is not valid JSON"}}}};var je=class extends Re{constructor(o,e){var i;let t=(i=e==null?void 0:e.trackMetric)!=null?i:true;super(o,t),this.temperature=e==null?void 0:e.temperature,this.seed=e==null?void 0:e.seed,this.maxTokens=e==null?void 0:e.maxTokens,this.modelSettings=e==null?void 0:e.modelSettings,this.model=this.initModel(e==null?void 0:e.model,{trackGenerations:t});}initModel(o,e){return Vi(o,e)}buildModelOptions(){return {...this.modelSettings,...this.temperature!==void 0&&{temperature:this.temperature},...this.seed!==void 0&&{seed:this.seed},...this.maxTokens!==void 0&&{maxTokens:this.maxTokens}}}};function qg(n,o=[]){let e="";return o.length>0&&(e=`
|
|
31
31
|
|
|
32
32
|
###EXAMPLES###
|
|
33
33
|
|
|
@@ -88,8 +88,8 @@ ${e}
|
|
|
88
88
|
|
|
89
89
|
Analyze the following text and provide your verdict score, and reason in the specified JSON format:
|
|
90
90
|
|
|
91
|
-
${
|
|
92
|
-
`}var
|
|
91
|
+
${n}
|
|
92
|
+
`}var ss=class n extends Error{constructor(o){super(o),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}},_e=class n extends ss{constructor(e,t){super(e);this.cause=t;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}},ps=class n extends ss{constructor(e,t){super(e);this.cause=t;this.name="JSONParsingError",Error.captureStackTrace&&Error.captureStackTrace(this,n);}};function rr(n){try{return JSON.parse(n)}catch{return VR(n)}}function VR(n){try{let o=n.indexOf("{"),e=n.lastIndexOf("}");if(o===-1||e===-1||o>=e)throw new Error("No valid JSON object found in content");let t=n.substring(o,e+1);return JSON.parse(t)}catch(o){let e=o instanceof Error?o.message:String(o);throw new ps(`Failed to extract JSON from content: ${e}`,o instanceof Error?o:void 0)}}function ey(n,o){try{let e=rr(n),t=Number(e.score);if(isNaN(t)||t<0||t>1)throw new Error(`Moderation score must be between 0.0 and 1.0, got ${t}`);return {name:o,value:t,reason:String(e.reason||"")}}catch(e){let t=e instanceof Error?e.message:String(e);throw v.error(`Failed to parse model output: ${t}`),new _e("Failed to calculate moderation score. The model output could not be parsed.",e instanceof Error?e:void 0)}}var LR=zod.z.object({output:zod.z.string()}),HR=zod.z.object({score:zod.z.number(),reason:zod.z.string()}),cs=class extends je{constructor(e){var i,a;let t=(i=e==null?void 0:e.name)!=null?i:"moderation_metric";super(t,{model:e==null?void 0:e.model,trackMetric:e==null?void 0:e.trackMetric,temperature:e==null?void 0:e.temperature,seed:e==null?void 0:e.seed,maxTokens:e==null?void 0:e.maxTokens,modelSettings:e==null?void 0:e.modelSettings});this.validationSchema=LR;this.fewShotExamples=(a=e==null?void 0:e.fewShotExamples)!=null?a:[];}async score(e){let{output:t}=e,i=qg(t,this.fewShotExamples),a=this.buildModelOptions(),s=await this.model.generateString(i,HR,a);return ey(s,this.name)}};function ry(n,o){return `
|
|
93
93
|
You are an impartial judge tasked with evaluating the quality and usefulness of AI-generated responses.
|
|
94
94
|
Your evaluation should consider the following key factors:
|
|
95
95
|
- Helpfulness: How well does it solve the user's problem?
|
|
@@ -121,11 +121,11 @@ ${s}
|
|
|
121
121
|
|
|
122
122
|
Now, please evaluate the following:
|
|
123
123
|
|
|
124
|
-
User Question: ${
|
|
124
|
+
User Question: ${n}
|
|
125
125
|
AI Response: ${o}
|
|
126
126
|
|
|
127
127
|
Provide your evaluation in the specified JSON format.
|
|
128
|
-
`}function
|
|
128
|
+
`}function ty(n,o){try{let e=rr(n),t=Number(e.score);if(isNaN(t)||t<0||t>1)throw new Error(`Usefulness score must be between 0.0 and 1.0, got ${t}`);return {name:o,value:t,reason:String(e.reason||"")}}catch(e){let t=e instanceof Error?e.message:String(e);throw v.error(`Failed to parse model output: ${t}`),new _e("Failed to calculate usefulness score. The model output could not be parsed.",e instanceof Error?e:void 0)}}var JR=zod.z.object({input:zod.z.string(),output:zod.z.string()}),GR=zod.z.object({score:zod.z.number(),reason:zod.z.string()}),ls=class extends je{constructor(e){var i;let t=(i=e==null?void 0:e.name)!=null?i:"usefulness_metric";super(t,{model:e==null?void 0:e.model,trackMetric:e==null?void 0:e.trackMetric,temperature:e==null?void 0:e.temperature,seed:e==null?void 0:e.seed,maxTokens:e==null?void 0:e.maxTokens,modelSettings:e==null?void 0:e.modelSettings});this.validationSchema=JR;}async score(e){let{input:t,output:i}=e,a=ry(t,i),s=this.buildModelOptions(),p=await this.model.generateString(a,GR,s);return ty(p,this.name)}};var KR=`You are an expert judge tasked with evaluating the faithfulness of an AI-generated answer to the given context. Analyze the provided INPUT, CONTEXT, and OUTPUT to determine if the OUTPUT contains any hallucinations or unfaithful information.
|
|
129
129
|
|
|
130
130
|
Guidelines:
|
|
131
131
|
1. The OUTPUT must not introduce new information beyond what's provided in the CONTEXT.
|
|
@@ -160,7 +160,7 @@ It is crucial that you provide your answer in the following JSON format:
|
|
|
160
160
|
"reason": ["reason 1", "reason 2"]
|
|
161
161
|
}}
|
|
162
162
|
Reasons amount is not restricted. Output must be JSON format only.
|
|
163
|
-
|
|
163
|
+
`,$R=`You are an expert judge tasked with evaluating the factual accuracy and reliability of an AI-generated answer. Analyze the provided INPUT, and OUTPUT to determine if the OUTPUT contains any hallucinations or unfaithful information.
|
|
164
164
|
|
|
165
165
|
Guidelines:
|
|
166
166
|
1. Evaluate the OUTPUT based on generally accepted facts and reliable information.
|
|
@@ -191,11 +191,11 @@ It is crucial that you provide your answer in the following JSON format:
|
|
|
191
191
|
"reason": ["some reason 1", "some reason 2"]
|
|
192
192
|
}}
|
|
193
193
|
Reasons amount is not restricted. Output must be JSON format only.
|
|
194
|
-
`;function
|
|
194
|
+
`;function oy(n,o){return n.length===0?"":`
|
|
195
195
|
|
|
196
196
|
EXAMPLES:
|
|
197
197
|
|
|
198
|
-
${
|
|
198
|
+
${n.map(t=>{let i=o?`Context: ${JSON.stringify(t.context)}
|
|
199
199
|
`:"";return `<example>
|
|
200
200
|
Input: ${t.input}
|
|
201
201
|
${i}Output: ${t.output}
|
|
@@ -203,7 +203,7 @@ ${i}Output: ${t.output}
|
|
|
203
203
|
{"score": "${t.score}", "reason": "${t.reason}"}
|
|
204
204
|
</example>`}).join(`
|
|
205
205
|
|
|
206
|
-
`)}`}function
|
|
206
|
+
`)}`}function iy(n,o,e,t=[]){let i=oy(t,true);return KR.replace("{examples_str}",i).replace("{input}",n).replace("{context}",JSON.stringify(e)).replace("{output}",o)}function ay(n,o,e=[]){let t=oy(e,false);return $R.replace("{examples_str}",t).replace("{input}",n).replace("{output}",o)}function ny(n,o){try{let e=rr(n),t=e.score;if(t==null)throw new Error(`Hallucination score is required but got ${t}`);let i=Number(t);if(isNaN(i)||i<0||i>1)throw new Error(`Hallucination score must be between 0.0 and 1.0, got ${i}`);let a="",s=e.reason;return Array.isArray(s)?a=s.map(p=>String(p)).join(" "):s&&(a=String(s)),{name:o,value:i,reason:a}}catch(e){let t=e instanceof Error?e.message:String(e);throw v.error(`Failed to parse model output: ${t}`),new _e("Failed to calculate hallucination score. The model output could not be parsed.",e instanceof Error?e:void 0)}}var QR=zod.z.object({input:zod.z.string(),output:zod.z.string(),context:zod.z.array(zod.z.string()).optional()}),YR=zod.z.object({score:zod.z.number(),reason:zod.z.union([zod.z.string(),zod.z.array(zod.z.string())])}),ms=class extends je{constructor(e){var i,a;let t=(i=e==null?void 0:e.name)!=null?i:"hallucination_metric";super(t,{model:e==null?void 0:e.model,trackMetric:e==null?void 0:e.trackMetric,temperature:e==null?void 0:e.temperature,seed:e==null?void 0:e.seed,maxTokens:e==null?void 0:e.maxTokens,modelSettings:e==null?void 0:e.modelSettings});this.validationSchema=QR;this.fewShotExamples=(a=e==null?void 0:e.fewShotExamples)!=null?a:[];}async score(e){let{input:t,output:i,context:a}=e,s=a?iy(t,i,a,this.fewShotExamples):ay(t,i,this.fewShotExamples),p=this.buildModelOptions(),l=await this.model.generateString(s,YR,p);return ny(l,this.name)}};var sy=[{title:"Low Relevance Score",input:"What's the capital of France?",output:"The Eiffel Tower is a famous landmark.",context:["France is a country in Europe.","Paris is known for its iconic Eiffel Tower."],answer_relevance_score:.2,reason:"The answer provides information about the Eiffel Tower, which is related to France, but fails to address the specific question about the capital city. It doesn't directly answer the user's query, resulting in low relevance."},{title:"Medium Relevance Score",input:"What's the capital of France?",output:"France has many beautiful cities, including Paris.",context:["France is a country in Europe.","Paris is the capital and largest city of France."],answer_relevance_score:.6,reason:"The answer mentions Paris, which is the correct capital, but it's presented as just one of many cities rather than explicitly stating it's the capital. The response is partially relevant but lacks directness in addressing the specific question."},{title:"High Relevance Score",input:"What's the capital of France?",output:"The capital of France is Paris, a city known for its iconic Eiffel Tower.",context:["France is a country in Europe.","Paris is the capital and largest city of France."],answer_relevance_score:.9,reason:"The answer directly and correctly identifies Paris as the capital of France, which is highly relevant to the user's question. It also provides additional context about the Eiffel Tower, which aligns with the provided context. The response is comprehensive and relevant, though slightly more detailed than necessary, preventing a perfect score."}],py=[{title:"Low Relevance Score",input:"What's the capital of France?",output:"The Eiffel Tower is a famous landmark.",answer_relevance_score:.2,reason:"The answer provides information about the Eiffel Tower, which is related to France, but fails to address the specific question about the capital city. It doesn't directly answer the user's query, resulting in low relevance."},{title:"Medium Relevance Score",input:"What's the capital of France?",output:"France has many beautiful cities, including Paris.",answer_relevance_score:.6,reason:"The answer mentions Paris, which is the correct capital, but it's presented as just one of many cities rather than explicitly stating it's the capital. The response is partially relevant but lacks directness in addressing the specific question."},{title:"High Relevance Score",input:"What's the capital of France?",output:"The capital of France is Paris, a city known for its iconic Eiffel Tower.",answer_relevance_score:.9,reason:"The answer directly and correctly identifies Paris as the capital of France, which is highly relevant to the user's question. It also provides additional context about the Eiffel Tower, which aligns with the provided context. The response is comprehensive and relevant, though slightly more detailed than necessary, preventing a perfect score."}];function XR(n){return n.map((o,e)=>`#### Example ${e+1}: ${o.title}
|
|
207
207
|
|
|
208
208
|
- **Input:** "${o.input}"
|
|
209
209
|
- **Output:** "${o.output}"
|
|
@@ -216,7 +216,7 @@ ${i}Output: ${t.output}
|
|
|
216
216
|
}
|
|
217
217
|
\`\`\``).join(`
|
|
218
218
|
|
|
219
|
-
`)}function
|
|
219
|
+
`)}function ZR(n){return n.map((o,e)=>`#### Example ${e+1}: ${o.title}
|
|
220
220
|
|
|
221
221
|
- **Input:** "${o.input}"
|
|
222
222
|
- **Output:** "${o.output}"
|
|
@@ -228,7 +228,7 @@ ${i}Output: ${t.output}
|
|
|
228
228
|
}
|
|
229
229
|
\`\`\``).join(`
|
|
230
230
|
|
|
231
|
-
`)}function
|
|
231
|
+
`)}function cy(n,o,e,t){return `
|
|
232
232
|
YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
|
|
233
233
|
PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
|
|
234
234
|
ANOTHER LLM BASED ON THE USER'S INPUT AND CONTEXT PROVIDED.
|
|
@@ -274,12 +274,12 @@ ${i}Output: ${t.output}
|
|
|
274
274
|
|
|
275
275
|
###FEW-SHOT EXAMPLES###
|
|
276
276
|
|
|
277
|
-
${
|
|
277
|
+
${XR(t)}
|
|
278
278
|
|
|
279
279
|
###INPUTS:###
|
|
280
280
|
***
|
|
281
281
|
Input:
|
|
282
|
-
${
|
|
282
|
+
${n}
|
|
283
283
|
|
|
284
284
|
Output:
|
|
285
285
|
${o}
|
|
@@ -287,7 +287,7 @@ ${i}Output: ${t.output}
|
|
|
287
287
|
Context:
|
|
288
288
|
${JSON.stringify(e)}
|
|
289
289
|
***
|
|
290
|
-
`}function
|
|
290
|
+
`}function ly(n,o,e){return `
|
|
291
291
|
YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
|
|
292
292
|
PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
|
|
293
293
|
ANOTHER LLM BASED ON THE USER'S INPUT.
|
|
@@ -332,14 +332,14 @@ ${i}Output: ${t.output}
|
|
|
332
332
|
|
|
333
333
|
###FEW-SHOT EXAMPLES###
|
|
334
334
|
|
|
335
|
-
${
|
|
335
|
+
${ZR(e)}
|
|
336
336
|
|
|
337
337
|
###INPUTS:###
|
|
338
338
|
***
|
|
339
339
|
Input:
|
|
340
|
-
${
|
|
340
|
+
${n}
|
|
341
341
|
|
|
342
342
|
Output:
|
|
343
343
|
${o}
|
|
344
344
|
***
|
|
345
|
-
`}function
|
|
345
|
+
`}function my(n,o){try{let e=rr(n),t=e.answer_relevance_score;if(t==null)throw new Error(`Answer relevance score is required but got ${t}`);let i=Number(t);if(isNaN(i)||i<0||i>1)throw new Error(`Answer relevance score must be between 0.0 and 1.0, got ${i}`);return {name:o,value:i,reason:String(e.reason||"")}}catch(e){let t=e instanceof Error?e.message:String(e);throw v.error(`Failed to parse model output: ${t}`),new _e("Failed to calculate answer relevance score. The model output could not be parsed.",e instanceof Error?e:void 0)}}var OR=zod.z.object({input:zod.z.string(),output:zod.z.string(),context:zod.z.array(zod.z.string()).optional()}),qR=zod.z.object({answer_relevance_score:zod.z.number(),reason:zod.z.string()}),ds=class extends je{constructor(e){var i,a,s,p;let t=(i=e==null?void 0:e.name)!=null?i:"answer_relevance_metric";super(t,{model:e==null?void 0:e.model,trackMetric:e==null?void 0:e.trackMetric,temperature:e==null?void 0:e.temperature,seed:e==null?void 0:e.seed,maxTokens:e==null?void 0:e.maxTokens,modelSettings:e==null?void 0:e.modelSettings});this.validationSchema=OR;this.fewShotExamplesWithContext=(a=e==null?void 0:e.fewShotExamples)!=null?a:sy,this.fewShotExamplesNoContext=(s=e==null?void 0:e.fewShotExamplesNoContext)!=null?s:py,this.requireContext=(p=e==null?void 0:e.requireContext)!=null?p:true;}async score(e){let{input:t,output:i,context:a}=e;if(!a&&this.requireContext)throw new _e(`${this.name} requires context by default. If you want to allow execution in no-context mode, enable it via 'new AnswerRelevance({ requireContext: false })'`);let s=a?cy(t,i,a,this.fewShotExamplesWithContext):ly(t,i,this.fewShotExamplesNoContext),p=this.buildModelOptions(),l=await this.model.generateString(s,qR,p);return my(l,this.name)}};Object.defineProperty(exports,"z",{enumerable:true,get:function(){return zod.z}});exports.AnswerRelevance=ds;exports.BaseLLMJudgeMetric=je;exports.BaseMetric=Re;exports.Contains=Yg;exports.Dataset=zr;exports.DatasetVersion=ji;exports.DatasetVersionNotFoundError=Ei;exports.ExactMatch=Qg;exports.Hallucination=ms;exports.IsJson=Og;exports.ModelConfigurationError=er;exports.ModelError=Bi;exports.ModelGenerationError=nt;exports.Moderation=cs;exports.Opik=Ar;exports.OpikBaseModel=Tr;exports.OpikQueryLanguage=Xe;exports.OpikSpanType=Ie;exports.Prompt=Qe;exports.PromptType=we;exports.RegexMatch=Xg;exports.ThreadsAnnotationQueue=Oe;exports.TracesAnnotationQueue=Ze;exports.Usefulness=ls;exports.VercelAIChatModel=st;exports.createModel=kf;exports.createModelFromInstance=Gg;exports.detectProvider=zf;exports.disableLogger=Ry;exports.evaluate=Vg;exports.evaluatePrompt=Rye;exports.flushAll=lR;exports.generateId=ie;exports.getTrackContext=nR;exports.logger=v;exports.resolveModel=Vi;exports.setLoggerLevel=Ff;exports.track=qe;
|