opik 1.9.47 → 1.9.49

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.js CHANGED
@@ -1,28 +1,28 @@
1
- import {c,d,g,e as e$1,f as f$1}from'./chunk-LAR62UGW.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import iu from'fs';import uw from'ini';import'dotenv/config';import ch from'qs';import {v7}from'uuid';import iR from'fast-json-stable-stringify';import tR from'xxhash-wasm';import {TextDecoder}from'util';import cR from'mustache';import dR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import wR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import en from'chalk';import AR from'boxen';import TR from'ora';import {generateText,generateObject}from'ai';import {createOpenAI}from'@ai-sdk/openai';import {createAnthropic}from'@ai-sdk/anthropic';import {createGoogleGenerativeAI}from'@ai-sdk/google';import {z as z$1}from'zod';export{z}from'zod';var mw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Xt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),tu=s=>{z.settings.minLevel=mw[s];},dw=()=>{z.settings.minLevel=100;};tu(process.env.OPIK_LOG_LEVEL||"INFO");var gw="~/.opik.config",mn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function au(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function ww(){return au({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 fw(){let s=process.env.OPIK_CONFIG_PATH||gw;if(!iu.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=uw.parse(iu.readFileSync(s,"utf8"));return t.opik?au({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return z.error(`Error loading config file ${s}: ${t}`),{}}}function nu(s){let t=ww(),r=fw(),{headers:o,...i}=s||{};return hw({...mn,...r,...t,...i})}function hw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=Rw(s.apiUrl);if(t&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(t&&!s.workspaceName)throw new Error("OPIK_WORKSPACE is not set");return s}function Rw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>bw,AlertPublicAlertType:()=>Tw,AlertTriggerConfigPublicType:()=>_w,AlertTriggerConfigType:()=>zw,AlertTriggerConfigWriteType:()=>kw,AlertTriggerEventType:()=>yw,AlertTriggerPublicEventType:()=>Aw,AlertTriggerWriteEventType:()=>Sw,AlertWriteAlertType:()=>xw,AnnotationQueuePublicScope:()=>Cw,AnnotationQueueScope:()=>Pw,AnnotationQueueWriteScope:()=>vw,AssistantMessageRole:()=>Qw,AttachmentListRequestEntityType:()=>pu,BadRequestError:()=>A,CheckName:()=>Rf,CheckPublicName:()=>th,CheckPublicResult:()=>ih,CheckResult:()=>bf,ColumnCompareTypesItem:()=>nf,ColumnPublicTypesItem:()=>wf,ColumnTypesItem:()=>ff,CompleteMultipartUploadRequestEntityType:()=>Iw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>Tu,DatasetItemCompareSource:()=>sf,DatasetItemFilterOperator:()=>Zw,DatasetItemPublicSource:()=>uf,DatasetItemSource:()=>rf,DatasetItemWriteSource:()=>An,DatasetPublicStatus:()=>df,DatasetPublicVisibility:()=>mf,DatasetStatus:()=>ef,DatasetUpdateVisibility:()=>uu,DatasetVisibility:()=>qw,DatasetWriteVisibility:()=>du,DeleteAttachmentsRequestEntityType:()=>jw,DownloadAttachmentRequestEntityType:()=>cu,ExperimentItemCompareTraceVisibilityMode:()=>pf,ExperimentItemPublicTraceVisibilityMode:()=>gf,ExperimentItemTraceVisibilityMode:()=>of,ExperimentPublicStatus:()=>_f,ExperimentPublicType:()=>xf,ExperimentStatus:()=>hf,ExperimentType:()=>Tn,ExperimentUpdateStatus:()=>hu,ExperimentUpdateType:()=>fu,ExperimentWriteStatus:()=>wu,ExperimentWriteType:()=>gu,FeedbackScoreBatchItemSource:()=>oh,FeedbackScoreBatchItemThreadSource:()=>sh,FeedbackScoreCompareSource:()=>cf,FeedbackScoreExperimentItemBulkWriteViewSource:()=>zf,FeedbackScorePublicSource:()=>qf,FeedbackScoreSource:()=>tf,FindFeedbackDefinitionsRequestType:()=>Ru,FindFeedbackScoreNames1RequestType:()=>Pu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>vu,GetSpansByProjectRequestType:()=>Eu,GetWebhookExamplesRequestAlertType:()=>su,GuardrailName:()=>Af,GuardrailResult:()=>Tf,GuardrailWriteName:()=>Ef,GuardrailWriteResult:()=>Pf,LlmAsJudgeMessagePublicRole:()=>Hw,LlmAsJudgeMessageRole:()=>Uw,LlmAsJudgeMessageWriteRole:()=>Ow,LlmAsJudgeOutputSchemaPublicType:()=>Jw,LlmAsJudgeOutputSchemaType:()=>Dw,LlmAsJudgeOutputSchemaWriteType:()=>Ww,LogItemLevel:()=>$w,ManualEvaluationRequestEntityType:()=>If,NotFoundError:()=>_,NotImplementedError:()=>Me,OptimizationPublicStatus:()=>Df,OptimizationStatus:()=>jf,OptimizationUpdateStatus:()=>yu,OptimizationWriteStatus:()=>Uf,ProjectDetailedVisibility:()=>Wf,ProjectMetricRequestPublicInterval:()=>xu,ProjectMetricRequestPublicMetricType:()=>Su,ProjectMetricResponsePublicInterval:()=>Of,ProjectMetricResponsePublicMetricType:()=>Ff,ProjectPublicVisibility:()=>Nf,ProjectUpdateVisibility:()=>ku,ProjectVisibility:()=>Mf,ProjectWriteVisibility:()=>zu,PromptDetailTemplateStructure:()=>Kf,PromptPublicTemplateStructure:()=>Qf,PromptTemplateStructure:()=>Lf,PromptType:()=>Bf,PromptVersionDetailTemplateStructure:()=>Xf,PromptVersionDetailType:()=>Jf,PromptVersionPublicTemplateStructure:()=>$f,PromptVersionPublicType:()=>Gf,PromptVersionTemplateStructure:()=>Hf,PromptVersionType:()=>Vf,PromptWriteTemplateStructure:()=>Au,PromptWriteType:()=>_u,ProviderApiKeyProvider:()=>Cf,ProviderApiKeyPublicProvider:()=>vf,ProviderApiKeyWriteProvider:()=>bu,ResponseFormatType:()=>Yw,SpanExperimentItemBulkWriteViewType:()=>kf,SpanFilterOperator:()=>Mw,SpanFilterPublicOperator:()=>Xw,SpanFilterWriteOperator:()=>Bw,SpanPublicType:()=>eh,SpanSearchStreamRequestPublicType:()=>Cu,SpanType:()=>fe,SpanUpdateType:()=>Yf,SpanWriteType:()=>Zf,StartMultipartUploadRequestEntityType:()=>lu,TraceFilterOperator:()=>Nw,TraceFilterPublicOperator:()=>Kw,TraceFilterWriteOperator:()=>Lw,TracePublicVisibilityMode:()=>ah,TraceThreadFilterOperator:()=>Fw,TraceThreadFilterPublicOperator:()=>Gw,TraceThreadFilterWriteOperator:()=>Vw,TraceThreadStatus:()=>nh,TraceVisibilityMode:()=>yf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>mu,ValueEntryCompareSource:()=>lf,ValueEntryExperimentItemBulkWriteViewSource:()=>Sf,ValueEntryPublicSource:()=>rh,ValueEntrySource:()=>af,WebhookTestResultStatus:()=>Ew,alerts:()=>Kt,annotationQueues:()=>un,attachments:()=>Gt,automationRuleEvaluators:()=>wn,chatCompletions:()=>fn,check:()=>gn,dashboards:()=>hn,datasets:()=>$t,experiments:()=>Qt,feedbackDefinitions:()=>Yt,guardrails:()=>Rn,llmProviderKey:()=>Zt,manualEvaluation:()=>bn,openTelemetryIngestion:()=>yn,optimizations:()=>qt,projects:()=>ei,prompts:()=>ri,redirect:()=>_n,serviceToggles:()=>zn,spans:()=>oi,systemUsage:()=>dn,traces:()=>kn,welcomeWizard:()=>Sn,workspaces:()=>xn});var Kt={};c(Kt,{GetWebhookExamplesRequestAlertType:()=>su});var su={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Gt={};c(Gt,{AttachmentListRequestEntityType:()=>pu,DownloadAttachmentRequestEntityType:()=>cu,StartMultipartUploadRequestEntityType:()=>lu,UploadAttachmentRequestEntityType:()=>mu});var pu={Trace:"trace",Span:"span"};var cu={Trace:"trace",Span:"span"};var lu={Trace:"trace",Span:"span"};var mu={Trace:"trace",Span:"span"};var $t={};c($t,{DatasetUpdateVisibility:()=>uu,DatasetWriteVisibility:()=>du});var du={Private:"private",Public:"public"};var uu={Private:"private",Public:"public"};var Qt={};c(Qt,{ExperimentUpdateStatus:()=>hu,ExperimentUpdateType:()=>fu,ExperimentWriteStatus:()=>wu,ExperimentWriteType:()=>gu});var gu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var wu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var fu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var hu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Yt={};c(Yt,{FindFeedbackDefinitionsRequestType:()=>Ru});var Ru={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var Zt={};c(Zt,{ProviderApiKeyWriteProvider:()=>bu});var bu={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var qt={};c(qt,{OptimizationUpdateStatus:()=>yu});var yu={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var ei={};c(ei,{ProjectMetricRequestPublicInterval:()=>xu,ProjectMetricRequestPublicMetricType:()=>Su,ProjectUpdateVisibility:()=>ku,ProjectWriteVisibility:()=>zu});var zu={Private:"private",Public:"public"};var ku={Private:"private",Public:"public"};var Su={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"};var xu={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var ri={};c(ri,{CreatePromptVersionDetailTemplateStructure:()=>Tu,PromptWriteTemplateStructure:()=>Au,PromptWriteType:()=>_u});var _u={Mustache:"mustache",Jinja2:"jinja2"};var Au={Text:"text",Chat:"chat"};var Tu={Text:"text",Chat:"chat"};var oi={};c(oi,{FindFeedbackScoreNames1RequestType:()=>Pu,GetSpanStatsRequestType:()=>vu,GetSpansByProjectRequestType:()=>Eu,SpanSearchStreamRequestPublicType:()=>Cu});var Eu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Pu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var vu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Cu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var dn={};var un={};var gn={};var wn={};var fn={};var hn={};var Rn={};var bn={};var yn={};var zn={};var kn={};var Sn={};var xn={};var _n={};var bw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var yw={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 zw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var kw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Sw={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 xw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var _w={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Aw={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 Tw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Ew={Success:"success",Failure:"failure"};var Pw={Trace:"trace",Thread:"thread"};var vw={Trace:"trace",Thread:"thread"};var Cw={Trace:"trace",Thread:"thread"};var Iw={Trace:"trace",Span:"span"};var jw={Trace:"trace",Span:"span"};var Uw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Dw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Mw={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 Nw={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 Fw={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 Ow={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Ww={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Bw={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 Lw={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 Vw={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 Hw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Jw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Xw={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 Kw={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 Gw={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 $w={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Qw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Yw={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Zw={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 qw={Private:"private",Public:"public"};var ef={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var rf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var of={Default:"default",Hidden:"hidden"};var tf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var af={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var An={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var nf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var sf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var pf={Default:"default",Hidden:"hidden"};var cf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var lf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var mf={Private:"private",Public:"public"};var df={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var uf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var gf={Default:"default",Hidden:"hidden"};var wf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var ff={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Tn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var hf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Rf={Topic:"TOPIC",Pii:"PII"};var bf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var yf={Default:"default",Hidden:"hidden"};var zf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var kf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var xf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var _f={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Af={Topic:"TOPIC",Pii:"PII"};var Tf={Passed:"passed",Failed:"failed"};var Ef={Topic:"TOPIC",Pii:"PII"};var Pf={Passed:"passed",Failed:"failed"};var vf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var Cf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var If={Trace:"trace",Thread:"thread",Span:"span"};var jf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Uf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Df={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Mf={Private:"private",Public:"public"};var Nf={Private:"private",Public:"public"};var Ff={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"};var Of={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Wf={Private:"private",Public:"public"};var Bf={Mustache:"mustache",Jinja2:"jinja2"};var Lf={Text:"text",Chat:"chat"};var Vf={Mustache:"mustache",Jinja2:"jinja2"};var Hf={Text:"text",Chat:"chat"};var Jf={Mustache:"mustache",Jinja2:"jinja2"};var Xf={Text:"text",Chat:"chat"};var Kf={Text:"text",Chat:"chat"};var Gf={Mustache:"mustache",Jinja2:"jinja2"};var $f={Text:"text",Chat:"chat"};var Qf={Text:"text",Chat:"chat"};var Yf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Zf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var qf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var oh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var th={Topic:"TOPIC",Pii:"PII"};var ih={Passed:"passed",Failed:"failed"};var ah={Default:"default",Hidden:"hidden"};var nh={Active:"active",Inactive:"inactive"};var sh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ae=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(ph({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function ph({message:s,statusCode:t,body:r}){let o=[];return s!=null&&o.push(s),t!=null&&o.push(`Status code: ${t.toString()}`),r!=null&&o.push(`Body: ${Ae(r,void 0,2)}`),o.join(`
2
- `)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var A=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var M=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var W=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var _=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var $=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var Me=class s extends p{constructor(t,r){super({message:"NotImplementedError",statusCode:501,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var R={Default:"http://localhost:5173/api"};var Er;typeof globalThis.Headers!="undefined"?Er=globalThis.Headers:Er=class Iu{constructor(t){if(this.headers=new Map,t)if(t instanceof Iu)t.forEach((r,o)=>this.append(o,r));else if(Array.isArray(t))for(let[r,o]of t)if(typeof r=="string"&&typeof o=="string")this.append(r,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,o]of Object.entries(t))if(typeof o=="string")this.append(r,o);else throw new TypeError("Header values must be strings")}append(t,r){let o=t.toLowerCase(),i=this.headers.get(o)||[];this.headers.set(o,[...i,r]);}delete(t){let r=t.toLowerCase();this.headers.delete(r);}get(t){let r=t.toLowerCase(),o=this.headers.get(r);return o?o.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let o=t.toLowerCase();this.headers.set(o,[r]);}forEach(t,r){let o=r?t.bind(r):t;this.headers.forEach((i,a)=>o(i.join(", "),a,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield [t,r.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let t of this.headers.values())yield t.join(", ");}[Symbol.iterator](){return this.entries()}};var ti={headers:new Er,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},ii={headers:new Er,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function ai(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function ju(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${ch.stringify(t,{arrayFormat:"repeat"})}`:s}var m=lh();function lh(){var u,g,w,k,S;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((u=globalThis==null?void 0:globalThis.navigator)==null?void 0:u.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((g=self.constructor)==null?void 0:g.name)==="DedicatedWorkerGlobalScope"||((w=self.constructor)==null?void 0:w.name)==="ServiceWorkerGlobalScope"||((k=self.constructor)==null?void 0:k.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((S=process.versions)!=null&&S.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Uu(){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?fetch:m.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function Du({body:s,type:t}){return t.includes("json")?Ae(s):s}async function Mu(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await import('./Node18UniversalStreamWrapper-B4QPIQXU.js')).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await import('./UndiciStreamWrapper-U3LH5M6P.js')).UndiciStreamWrapper(s):new(await import('./NodePre18StreamWrapper-ZXNXS6Y3.js')).NodePre18StreamWrapper(s)}async function Nu(s,t){if(s.body!=null&&t==="blob")return await s.blob();if(s.body!=null&&t==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&t==="sse")return s.body;if(s.body!=null&&t==="streaming")return Mu(s.body);if(s.body!=null&&t==="text")return await s.text();{let r=await s.text();if(r.length>0)try{return JSON.parse(r)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:r}}}else return}}var mh="timeout";function Fu(s){let t=new AbortController,r=setTimeout(()=>t.abort(mh),s);return {signal:t.signal,abortId:r}}function Ou(...s){let t=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of t){if(o.aborted){r.abort(o==null?void 0:o.reason);break}o.addEventListener("abort",()=>r.abort(o==null?void 0:o.reason),{signal:r.signal});}return r.signal}var Wu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:T}=Fu(a);w=T,g.push(x);}l!=null&&g.push(l);let k=Ou(g),S=await s(t,{method:r,headers:o,body:i,signal:k,credentials:d?"include":void 0,duplex:u});return w!=null&&clearTimeout(w),S};function dh(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Bu(s,t=2){let r=await s();for(let o=0;o<t&&([408,429].includes(r.status)||r.status>=500);++o){let i=Math.min(1e3*Math.pow(2,o),6e4),a=dh(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function uh(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[a,l]of Object.entries(s.headers))l!=null&&(t[a]=l);let r=ju(s.url,s.queryParameters),o=await Du({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await Uu();try{let a=await Bu(async()=>Wu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Nu(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:ai(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:ai(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ti}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:ti}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:ii}:{ok:false,error:{reason:"unknown",errorMessage:Ae(a)},rawResponse:ii}}}var b=uh;var n={get:async s=>typeof s=="function"?s():s};var h=class s extends Promise{constructor(t){super(r=>{r(void 0);}),this.innerPromise=t;}static fromFunction(t,...r){return new s(t(...r))}static interceptFunction(t){return (...r)=>s.fromPromise(t(...r))}static fromPromise(t){return new s(t)}static fromExecutor(t){let r=new Promise(t);return new s(r)}static fromResult(t){let r=Promise.resolve(t);return new s(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};function Cn(s){return typeof s=="object"&&s!=null&&"name"in s}function In(s){return typeof s=="object"&&s!=null&&"path"in s}function jn(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Lu(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new En:m.type==="node"?s=new Pn:s=new vn,await s.setup(),s}var En=class{async setup(){this.fd=new(await import('formdata-node')).FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(Cn(t))return t.name;if(In(t)&&t.path)return jn(t.path.toString())}async appendFile(t,r,o){var i,a;o=this.getFileName(r,o),r instanceof Blob?(i=this.fd)==null||i.append(t,r,o):(a=this.fd)==null||a.append(t,{type:void 0,name:o,[Symbol.toStringTag]:"File",stream(){return r}});}async getRequest(){let t=new(await import('form-data-encoder')).FormDataEncoder(this.fd);return {body:(await import('readable-stream')).Readable.from(t),headers:t.headers,duplex:"half"}}},Pn=class{async setup(){this.fd=new(await import('./form_data-PYZPT4AA.js')).default;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(Cn(t))return t.name;if(In(t)&&t.path)return jn(t.path.toString())}async appendFile(t,r,o){var a,l;o=this.getFileName(r,o);let i;r instanceof Blob?i=Buffer.from(await r.arrayBuffer()):i=r,o==null?(a=this.fd)==null||a.append(t,i):(l=this.fd)==null||l.append(t,i,{filename:o});}getRequest(){return {body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}},vn=class{async setup(){this.fd=new FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(Cn(t))return t.name;if(In(t)&&t.path)return jn(t.path.toString())}async appendFile(t,r,o){var i,a;if(o=this.getFileName(r,o),r instanceof Blob){(i=this.fd)==null||i.append(t,r,o);return}(a=this.fd)==null||a.append(t,new Blob([r]),o);}getRequest(){return {body:this.fd,headers:{}}}};var e={};c(e,{JsonError:()=>ir,ParseError:()=>ar,any:()=>tg,bigint:()=>Hu,boolean:()=>ig,booleanLiteral:()=>og,date:()=>Ju,discriminant:()=>ug,enum_:()=>si,getObjectLikeUtils:()=>le,getObjectUtils:()=>Ne,getSchemaUtils:()=>U,isProperty:()=>Ee,lazy:()=>Xu,lazyObject:()=>qu,list:()=>ci,number:()=>ag,object:()=>pi,objectWithoutOptionalProperties:()=>Zu,optional:()=>Un,property:()=>Gu,record:()=>cg,set:()=>lg,string:()=>ng,stringLiteral:()=>rg,transform:()=>Dn,undiscriminatedUnion:()=>dg,union:()=>wg,unknown:()=>sg,withParsedProperties:()=>Nn});var E={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function j(s,t){return `Expected ${t}. Received ${gh(s)}.`}function gh(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 K(s){return {...s,json:Vu(s.json),parse:Vu(s.parse)}}function Vu(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
3
- `)),{ok:true,value:t}):o}}function ni(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ir=class s extends Error{constructor(r){super(r.map(ni).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var ar=class s extends Error{constructor(r){super(r.map(ni).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>wh(s),optional:()=>Un(s),optionalNullable:()=>fh(s),transform:t=>Dn(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new ar(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new ir(o.errors)}}}function wh(s){let t={parse:(r,o)=>r==null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.NULLABLE};return {...t,...U(t)}}function Un(s){let t={parse:(r,o)=>r==null?{ok:true,value:void 0}:s.parse(r,o),json:(r,o)=>o!=null&&o.omitUndefined&&r===void 0?{ok:true,value:void 0}:r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL};return {...t,...U(t)}}function fh(s){let t={parse:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL_NULLABLE};return {...t,...U(t)}}function Dn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);return a.ok?{ok:true,value:t.transform(a.value)}:a},json:(o,i)=>{let a=t.untransform(o);return s.json(a,i)},getType:()=>s.getType()};return {...r,...U(r)}}function Hu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:true,value:t}:typeof t=="number"?{ok:true,value:BigInt(t)}:{ok:false,errors:[{path:r,message:j(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:j(t,"bigint")}]}:{ok:true,value:t},getType:()=>E.BIGINT};return {...K(s),...U(s)}}var hh=/^([+-]?\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 Ju(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:hh.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:j(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:j(t,"Date object")}]},getType:()=>E.DATE};return {...K(s),...U(s)}}function Q(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...K(r),...U(r)}}}function si(s){let t=new Set(s);return Q(E.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:a,message:j(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:a,message:j(o,"enum")}]}:{ok:true,value:o})()}function Xu(s){let t=Mn(s);return {...t,...U(t)}}function Mn(s){return {parse:(t,r)=>nr(s).parse(t,r),json:(t,r)=>nr(s).json(t,r),getType:()=>nr(s).getType()}}function nr(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function Pr(s){return Object.entries(s)}function vr(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,a])=>(r.has(i)&&(o[i]=a),o),{})}function Te(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t}function Cr(s){return Object.keys(s)}function Ku(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function le(s){return {withParsedProperties:t=>Nn(s,t)}}function Nn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);if(!a.ok)return a;let l=Object.entries(t).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(a.value):g}),{});return {ok:true,value:{...a.value,...l}}},json:(o,i)=>{var d;if(!Te(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:j(o,"object")}]};let a=new Set(Object.keys(t)),l=vr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Gu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Ee(s){return s.isProperty}function pi(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Ee(o)?o.rawKey:r),_getParsedProperties:()=>Cr(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of Pr(s)){let u=Ee(d)?d.rawKey:l,g=Ee(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,Yu(g)&&a.push(u);}return $u({value:r,requiredKeys:a,getProperty:l=>{let d=i[l];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var g;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(g=o==null?void 0:o.breadcrumbsPrefix)!=null?g:[],l]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},json:(r,o)=>{let i=[];for(let[a,l]of Pr(s)){let d=Ee(l)?l.valueSchema:l;Yu(d)&&i.push(a);}return $u({value:r,requiredKeys:i,getProperty:a=>{let l=s[a];if(l!=null)return Ee(l)?{transformedKey:l.rawKey,transform:d=>{var u;return l.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}:{transformedKey:a,transform:d=>{var u;return l.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},getType:()=>E.OBJECT};return {...K(t),...U(t),...le(t),...Ne(t)}}function $u({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Te(s))return {ok:false,errors:[{path:a,message:j(s,"object")}]};let l=new Set(t),d=[],u={};for(let[g,w]of Object.entries(s)){let k=r(g);if(k!=null){l.delete(g);let S=k.transform(w);S.ok?u[k.transformedKey]=S.value:(u[g]=w,d.push(...S.errors));}else switch(o){case "fail":d.push({path:[...a,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=w;break}}return d.push(...t.filter(g=>l.has(g)).map(g=>({path:a,message:`Missing required key "${g}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function Ne(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Qu({extensionKeys:t._getRawProperties(),value:o,transformBase:a=>s.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(o,i)=>Qu({extensionKeys:t._getParsedProperties(),value:o,transformBase:a=>s.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>E.OBJECT};return {...r,...U(r),...le(r),...Ne(r)}},passthrough:()=>{let t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let i=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},json:(r,o)=>{let i=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},getType:()=>E.OBJECT};return {...t,...U(t),...le(t),...Ne(t)}}}}function Qu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=Ku(Cr(t),g=>i.has(g)),d=r(vr(t,l)),u=o(vr(t,a));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function Yu(s){return !Rh(s)}function Rh(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function Zu(s){return pi(s)}function qu(s){let t={...Mn(s),_getRawProperties:()=>nr(s)._getRawProperties(),_getParsedProperties:()=>nr(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Ne(t)}}function ci(s){let t={parse:(r,o)=>eg(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>eg(r,(i,a)=>{var l;return s.json(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),getType:()=>E.LIST};return {...K(t),...U(t)}}function eg(s,t){return Array.isArray(s)?s.map((o,i)=>t(o,i)).reduce((o,i)=>{if(o.ok&&i.ok)return {ok:true,value:[...o.value,i.value]};let a=[];return o.ok||a.push(...o.errors),i.ok||a.push(...i.errors),{ok:false,errors:a}},{ok:true,value:[]}):{ok:false,errors:[{message:j(s,"list"),path:[]}]}}function rg(s){return Q(E.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`"${s}"`)}]})()}function og(s){return Q(E.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`${s.toString()}`)}]})()}var tg=Q(E.ANY,s=>({ok:true,value:s}));var ig=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var ag=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var ng=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var sg=Q(E.UNKNOWN,s=>({ok:true,value:s}));function cg(s,t){let r={parse:(o,i)=>pg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.parse(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.parse(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>pg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.json(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.json(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>E.RECORD};return {...K(r),...U(r)}}function pg({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Te(s)?Pr(s).reduce((a,[l,d])=>{if(d===void 0)return a;let u=a,g=l;if(t){let x=l.length>0?Number(l):NaN;isNaN(x)||(g=x);}let w=r(g),k=o(d,g);if(u.ok&&w.ok&&k.ok)return {ok:true,value:{...u.value,[w.value]:k.value}};let S=[];return u.ok||S.push(...u.errors),w.ok||S.push(...w.errors),k.ok||S.push(...k.errors),{ok:false,errors:S}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:j(s,"object")}]}}function lg(s){let t=ci(s),r={parse:(o,i)=>{let a=t.parse(o,i);return a.ok?{ok:true,value:new Set(a.value)}:a},json:(o,i)=>{var l;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],message:j(o,"Set")}]}},getType:()=>E.SET};return {...K(r),...U(r)}}function dg(s){let t={parse:(r,o)=>mg((i,a)=>i.parse(r,a),s,o),json:(r,o)=>mg((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function mg(s,t,r){let o=[];for(let[i,a]of t.entries()){let l=s(a,{...r,skipValidation:false});if(l.ok)return l;for(let d of l.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function ug(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function wg(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=si(Cr(t)),a={parse:(l,d)=>gg({value:l,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(l,d)=>gg({value:l,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>E.UNION};return {...K(a),...U(a),...le(a)}}function gg({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!Te(s))return {ok:false,errors:[{path:d,message:j(s,"object")}]};let{[t]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let w=o(u);if(!w.ok)return {ok:false,errors:w.errors};let k=i(w.value);if(k==null)return a?{ok:true,value:{[r]:w.value,...g}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let S=l(g,k);return S.ok?{ok:true,value:{[r]:u,...S.value}}:S}function bh(s){var t=[];if(s.length===0)return "";if(typeof s[0]!="string")throw new TypeError("Url must be a string. Received "+s[0]);if(s[0].match(/^[^/:]+:\/*$/)&&s.length>1){var r=s.shift();s[0]=r+s[0];}s[0].match(/^file:\/\/\//)?s[0]=s[0].replace(/^([^/:]+):\/*/,"$1:///"):s[0]=s[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<s.length;o++){var i=s[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<s.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i));}var a=t.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var l=a.split("?");return a=l.shift()+(l.length>0?"?":"")+l.join("&"),a}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),bh(s)}var C={};c(C,{AggregationData:()=>El,Alert:()=>_h,AlertAlertType:()=>Ps,AlertPagePublic:()=>Ks,AlertPublic:()=>Jo,AlertPublicAlertType:()=>Bs,AlertTrigger:()=>Us,AlertTriggerConfig:()=>js,AlertTriggerConfigPublic:()=>Js,AlertTriggerConfigPublicType:()=>Hs,AlertTriggerConfigType:()=>Is,AlertTriggerConfigWrite:()=>Ms,AlertTriggerConfigWriteType:()=>Ds,AlertTriggerEventType:()=>Cs,AlertTriggerPublic:()=>Xs,AlertTriggerPublicEventType:()=>Vs,AlertTriggerWrite:()=>Fs,AlertTriggerWriteEventType:()=>Ns,AlertWrite:()=>Ho,AlertWriteAlertType:()=>Os,AnnotationQueue:()=>qs,AnnotationQueueBatch:()=>Th,AnnotationQueueBatchWrite:()=>Mo,AnnotationQueueItemIds:()=>qi,AnnotationQueuePagePublic:()=>op,AnnotationQueuePublic:()=>Xo,AnnotationQueuePublicScope:()=>ep,AnnotationQueueReviewer:()=>Zs,AnnotationQueueReviewerPublic:()=>rp,AnnotationQueueScope:()=>Ys,AnnotationQueueUpdate:()=>No,AnnotationQueueWrite:()=>Do,AnnotationQueueWriteScope:()=>gs,AssistantMessage:()=>bc,AssistantMessageRole:()=>Rc,Attachment:()=>tp,AttachmentListRequestEntityType:()=>di,AttachmentPage:()=>ip,AudioUrl:()=>mp,AudioUrlPublic:()=>Kp,AudioUrlWrite:()=>_p,AuthDetailsHolder:()=>cp,AutomationRuleEvaluator:()=>Ph,AutomationRuleEvaluatorLlmAsJudge:()=>Rp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>ot,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>jp,AutomationRuleEvaluatorObjectObjectPublic:()=>ac,AutomationRuleEvaluatorPagePublic:()=>nc,AutomationRuleEvaluatorPublic:()=>sc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Sp,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>nt,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Mp,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>xp,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>st,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>Fp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>yp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>it,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Bp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>zp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>at,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Vp,AutomationRuleEvaluatorUpdate:()=>hc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>mc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>wc,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>fc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>uc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>gc,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>dc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>bp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>tt,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Jp,AutomationRuleEvaluatorWrite:()=>Xp,AvgValueStatPublic:()=>Gc,BatchDelete:()=>F,BatchDeleteByProject:()=>$h,BiInformation:()=>xs,BiInformationResponse:()=>lr,BooleanFeedbackDefinition:()=>jl,BooleanFeedbackDefinitionCreate:()=>Wl,BooleanFeedbackDefinitionPublic:()=>ft,BooleanFeedbackDefinitionUpdate:()=>om,BooleanFeedbackDetail:()=>Il,BooleanFeedbackDetailCreate:()=>Ol,BooleanFeedbackDetailPublic:()=>Kl,BooleanFeedbackDetailUpdate:()=>rm,CategoricalFeedbackDefinition:()=>Dl,CategoricalFeedbackDefinitionCreate:()=>Ll,CategoricalFeedbackDefinitionPublic:()=>ht,CategoricalFeedbackDefinitionUpdate:()=>im,CategoricalFeedbackDetail:()=>Ul,CategoricalFeedbackDetailCreate:()=>Bl,CategoricalFeedbackDetailPublic:()=>Gl,CategoricalFeedbackDetailUpdate:()=>tm,ChatCompletionChoice:()=>zc,ChatCompletionRequest:()=>Oo,ChatCompletionResponse:()=>_c,Check:()=>wl,CheckName:()=>ul,CheckPublic:()=>Ed,CheckPublicName:()=>Ad,CheckPublicResult:()=>Td,CheckResult:()=>gl,ChunkedOutputJsonNode:()=>jh,ChunkedOutputJsonNodePublic:()=>Nh,ChunkedOutputJsonNodePublicType:()=>Cl,ChunkedOutputJsonNodeType:()=>sl,Column:()=>al,ColumnCompare:()=>jc,ColumnCompareTypesItem:()=>Ic,ColumnPublic:()=>ol,ColumnPublicTypesItem:()=>rl,ColumnTypesItem:()=>il,Comment:()=>L,CommentCompare:()=>Uc,CommentPublic:()=>qe,CompleteMultipartUploadRequest:()=>ea,CompleteMultipartUploadRequestEntityType:()=>ap,CompletionTokensDetails:()=>Sc,CountValueStatPublic:()=>$c,CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Oi,DashboardPagePublic:()=>Ac,DashboardPublic:()=>Ye,DashboardUpdatePublic:()=>Bo,DashboardWrite:()=>Wo,DataPointDouble:()=>Qh,DataPointNumberPublic:()=>Xm,Dataset:()=>vh,DatasetExpansion:()=>Ih,DatasetExpansionResponse:()=>Cc,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItem:()=>ct,DatasetItemBatch:()=>Ch,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemCompare:()=>Lc,DatasetItemCompareSource:()=>Dc,DatasetItemFilter:()=>On,DatasetItemFilterOperator:()=>Fn,DatasetItemPageCompare:()=>Vc,DatasetItemPagePublic:()=>tl,DatasetItemPublic:()=>dt,DatasetItemPublicSource:()=>qc,DatasetItemSource:()=>vc,DatasetItemStreamRequest:()=>Hr,DatasetItemUpdate:()=>Wn,DatasetItemWrite:()=>Dr,DatasetItemWriteSource:()=>Bn,DatasetItemsDelete:()=>Br,DatasetPagePublic:()=>Kc,DatasetPublic:()=>fr,DatasetPublicStatus:()=>Jc,DatasetPublicVisibility:()=>Hc,DatasetStatus:()=>Ec,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>Ri,DatasetVersionCreatePublic:()=>Xr,DatasetVersionDiff:()=>cl,DatasetVersionDiffStats:()=>pl,DatasetVersionPagePublic:()=>ll,DatasetVersionPublic:()=>hr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionSummary:()=>Pc,DatasetVersionSummaryPublic:()=>Xc,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetVisibility:()=>Tc,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>hi,DeleteAttachmentsRequest:()=>Eh,DeleteAttachmentsRequestEntityType:()=>sp,DeleteFeedbackScore:()=>xt,DeleteIdsHolder:()=>Rr,DeleteThreadFeedbackScores:()=>vo,DeleteTraceThreads:()=>Co,Delta:()=>yc,DownloadAttachmentRequestEntityType:()=>ui,ErrorCountWithDeviation:()=>kt,ErrorCountWithDeviationDetailed:()=>qm,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>qr,ErrorInfoPublic:()=>_t,ErrorInfoWrite:()=>ho,ErrorMessage:()=>ee,ErrorMessageDetail:()=>Xh,ErrorMessageDetailed:()=>Hh,ErrorMessagePublic:()=>Ah,Experiment:()=>Uh,ExperimentGroupAggregationsResponse:()=>vl,ExperimentGroupResponse:()=>Tl,ExperimentItem:()=>Qr,ExperimentItemBulkRecord:()=>bl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>os,ExperimentItemBulkUpload:()=>Dh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemCompare:()=>Bc,ExperimentItemCompareTraceVisibilityMode:()=>Wc,ExperimentItemPublic:()=>mt,ExperimentItemPublicTraceVisibilityMode:()=>el,ExperimentItemStreamRequest:()=>to,ExperimentItemTraceVisibilityMode:()=>Gn,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentPagePublic:()=>Sl,ExperimentPublic:()=>wt,ExperimentPublicStatus:()=>zl,ExperimentPublicType:()=>yl,ExperimentScore:()=>ro,ExperimentScorePublic:()=>kl,ExperimentScoreWrite:()=>Hn,ExperimentStatus:()=>dl,ExperimentStreamRequestPublic:()=>io,ExperimentType:()=>ml,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>Si,ExperimentUpdateType:()=>ki,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>zi,ExperimentWriteType:()=>yi,ExportTraceServiceRequest:()=>Bh,Feedback:()=>Fh,FeedbackCreate:()=>Xl,FeedbackDefinitionPagePublic:()=>Zl,FeedbackObjectPublic:()=>Yl,FeedbackPublic:()=>em,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>ed,FeedbackScoreAveragePublic:()=>Be,FeedbackScoreBatch:()=>Tt,FeedbackScoreBatchItem:()=>_d,FeedbackScoreBatchItemSource:()=>xd,FeedbackScoreBatchItemThread:()=>ds,FeedbackScoreBatchItemThreadSource:()=>ms,FeedbackScoreBatchThread:()=>Io,FeedbackScoreCompare:()=>Oc,FeedbackScoreCompareSource:()=>Mc,FeedbackScoreExperimentItemBulkWriteView:()=>rs,FeedbackScoreExperimentItemBulkWriteViewSource:()=>Zn,FeedbackScoreNames:()=>Jm,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>bd,FeedbackScoreSource:()=>Jn,FeedbackUpdate:()=>pm,FindFeedbackDefinitionsRequestType:()=>Ai,FindFeedbackScoreNames1RequestType:()=>Li,Function:()=>Fo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Vi,GetSpansByProjectRequestType:()=>Bi,GetWebhookExamplesRequestAlertType:()=>li,GroupContent:()=>xl,GroupContentWithAggregations:()=>Pl,GroupDetail:()=>_l,GroupDetails:()=>Al,Guardrail:()=>mm,GuardrailBatch:()=>Oh,GuardrailBatchWrite:()=>Lo,GuardrailName:()=>cm,GuardrailResult:()=>lm,GuardrailWrite:()=>Ss,GuardrailWriteName:()=>zs,GuardrailWriteResult:()=>ks,GuardrailsValidation:()=>fl,GuardrailsValidationPublic:()=>Pd,IdsHolder:()=>Mh,ImageUrl:()=>gp,ImageUrlPublic:()=>$p,ImageUrlWrite:()=>Ep,JsonListString:()=>D,JsonListStringCompare:()=>ra,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>as,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>Rs,LlmAsJudgeCode:()=>Ko,LlmAsJudgeCodePublic:()=>qp,LlmAsJudgeCodeWrite:()=>Ip,LlmAsJudgeMessage:()=>Ve,LlmAsJudgeMessageContent:()=>fp,LlmAsJudgeMessageContentPublic:()=>Yp,LlmAsJudgeMessageContentWrite:()=>vp,LlmAsJudgeMessagePublic:()=>$e,LlmAsJudgeMessagePublicRole:()=>Gp,LlmAsJudgeMessageRole:()=>up,LlmAsJudgeMessageWrite:()=>Xe,LlmAsJudgeMessageWriteRole:()=>Tp,LlmAsJudgeModelParameters:()=>Le,LlmAsJudgeModelParametersPublic:()=>Ge,LlmAsJudgeModelParametersWrite:()=>Je,LlmAsJudgeOutputSchema:()=>He,LlmAsJudgeOutputSchemaPublic:()=>Qe,LlmAsJudgeOutputSchemaPublicType:()=>Zp,LlmAsJudgeOutputSchemaType:()=>hp,LlmAsJudgeOutputSchemaWrite:()=>Ke,LlmAsJudgeOutputSchemaWriteType:()=>Cp,LogItem:()=>cc,LogItemLevel:()=>pc,LogPage:()=>lc,ManualEvaluationRequest:()=>zt,ManualEvaluationRequestEntityType:()=>wm,ManualEvaluationResponse:()=>yt,Message:()=>ws,MultipartUploadPart:()=>np,NumericalFeedbackDefinition:()=>Nl,NumericalFeedbackDefinitionCreate:()=>Hl,NumericalFeedbackDefinitionPublic:()=>Rt,NumericalFeedbackDefinitionUpdate:()=>nm,NumericalFeedbackDetail:()=>Ml,NumericalFeedbackDetailCreate:()=>Vl,NumericalFeedbackDetailPublic:()=>$l,NumericalFeedbackDetailUpdate:()=>am,Optimization:()=>Lh,OptimizationPagePublic:()=>aa,OptimizationPublic:()=>br,OptimizationPublicStatus:()=>Im,OptimizationStatus:()=>fm,OptimizationStudioConfig:()=>Sm,OptimizationStudioConfigPublic:()=>Om,OptimizationStudioConfigWrite:()=>vm,OptimizationStudioLog:()=>Wm,OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>vi,OptimizationWrite:()=>ia,OptimizationWriteStatus:()=>Cm,PageColumns:()=>nl,PercentageValueStatPublic:()=>Qc,PercentageValues:()=>xe,PercentageValuesDetailed:()=>rd,PercentageValuesPublic:()=>lt,Project:()=>Vh,ProjectDetailed:()=>td,ProjectDetailedVisibility:()=>od,ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Di,ProjectMetricRequestPublicMetricType:()=>Ui,ProjectMetricResponsePublic:()=>Qm,ProjectMetricResponsePublicInterval:()=>Gm,ProjectMetricResponsePublicMetricType:()=>Km,ProjectPagePublic:()=>Vm,ProjectPublic:()=>St,ProjectPublicVisibility:()=>Lm,ProjectRetrieveDetailed:()=>mo,ProjectStatItemObjectPublic:()=>Zc,ProjectStatsPublic:()=>Ze,ProjectStatsSummary:()=>Zm,ProjectStatsSummaryItem:()=>Ym,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>ji,ProjectVisibility:()=>Bm,ProjectWrite:()=>po,ProjectWriteVisibility:()=>Ii,Prompt:()=>Jh,PromptDetail:()=>ld,PromptDetailTemplateStructure:()=>cd,PromptPagePublic:()=>hd,PromptPublic:()=>fd,PromptPublicTemplateStructure:()=>wd,PromptTemplateStructure:()=>ad,PromptTokensDetails:()=>kc,PromptType:()=>id,PromptUpdatable:()=>wo,PromptVersion:()=>pd,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>ss,PromptVersionDetailType:()=>ns,PromptVersionLink:()=>oa,PromptVersionLinkPublic:()=>ta,PromptVersionLinkWrite:()=>_i,PromptVersionPagePublic:()=>gd,PromptVersionPublic:()=>ud,PromptVersionPublicTemplateStructure:()=>dd,PromptVersionPublicType:()=>md,PromptVersionRetrieveDetail:()=>fo,PromptVersionTemplateStructure:()=>sd,PromptVersionType:()=>nd,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Fi,PromptWriteType:()=>Ni,ProviderApiKey:()=>Wh,ProviderApiKeyPagePublic:()=>um,ProviderApiKeyProvider:()=>gm,ProviderApiKeyPublic:()=>bt,ProviderApiKeyPublicProvider:()=>dm,ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Ei,ResponseFormat:()=>bs,ResponseFormatType:()=>hs,Result:()=>er,ResultsNumberPublic:()=>$m,ScoreName:()=>Hm,ServiceTogglesConfig:()=>Rd,Span:()=>gt,SpanBatch:()=>Kh,SpanBatchUpdate:()=>zo,SpanBatchWrite:()=>bo,SpanEnrichmentOptions:()=>Ln,SpanExperimentItemBulkWriteView:()=>Yn,SpanExperimentItemBulkWriteViewType:()=>Qn,SpanFilter:()=>Se,SpanFilterOperator:()=>kp,SpanFilterPublic:()=>Oe,SpanFilterPublicOperator:()=>ls,SpanFilterWrite:()=>et,SpanFilterWriteOperator:()=>Up,SpanLlmAsJudgeCode:()=>Yo,SpanLlmAsJudgeCodePublic:()=>tc,SpanLlmAsJudgeCodeWrite:()=>Dp,SpanPagePublic:()=>Sd,SpanPublic:()=>At,SpanPublicType:()=>kd,SpanSearchStreamRequestPublic:()=>ko,SpanSearchStreamRequestPublicType:()=>Hi,SpanType:()=>Rl,SpanUpdate:()=>yo,SpanUpdateType:()=>cs,SpanUserDefinedMetricPythonCode:()=>Zo,SpanUserDefinedMetricPythonCodePublic:()=>ic,SpanUserDefinedMetricPythonCodeWrite:()=>Np,SpanWrite:()=>Ro,SpanWriteType:()=>ps,SpansCountResponse:()=>As,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>gi,StartMultipartUploadResponse:()=>pp,StreamOptions:()=>fs,StudioEvaluation:()=>zm,StudioEvaluationPublic:()=>Nm,StudioEvaluationWrite:()=>Em,StudioLlmModel:()=>bm,StudioLlmModelPublic:()=>Dm,StudioLlmModelWrite:()=>Am,StudioMessage:()=>hm,StudioMessagePublic:()=>jm,StudioMessageWrite:()=>xm,StudioMetric:()=>ym,StudioMetricPublic:()=>Mm,StudioMetricWrite:()=>Tm,StudioOptimizer:()=>km,StudioOptimizerPublic:()=>Fm,StudioOptimizerWrite:()=>Pm,StudioPrompt:()=>Rm,StudioPromptPublic:()=>Um,StudioPromptWrite:()=>_m,Tool:()=>ys,ToolCall:()=>pt,Trace:()=>ut,TraceBatch:()=>Gh,TraceBatchUpdate:()=>Ao,TraceBatchWrite:()=>xo,TraceCountResponse:()=>Es,TraceEnrichmentOptions:()=>Vn,TraceExperimentItemBulkWriteView:()=>$n,TraceFilter:()=>ke,TraceFilterOperator:()=>dp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>ts,TraceFilterWrite:()=>qo,TraceFilterWriteOperator:()=>Ap,TracePagePublic:()=>jd,TracePublic:()=>Et,TracePublicVisibilityMode:()=>vd,TraceSearchStreamRequestPublic:()=>Uo,TraceThread:()=>Pt,TraceThreadBatchIdentifier:()=>Po,TraceThreadBatchUpdate:()=>Eo,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>us,TraceThreadFilterPublic:()=>Fe,TraceThreadFilterPublicOperator:()=>is,TraceThreadFilterWrite:()=>rt,TraceThreadFilterWriteOperator:()=>Op,TraceThreadIdentifier:()=>na,TraceThreadLlmAsJudgeCode:()=>$o,TraceThreadLlmAsJudgeCodePublic:()=>rc,TraceThreadLlmAsJudgeCodeWrite:()=>Wp,TraceThreadPage:()=>Id,TraceThreadSearchStreamRequest:()=>jo,TraceThreadStatus:()=>Cd,TraceThreadUpdate:()=>To,TraceThreadUserDefinedMetricPythonCode:()=>Qo,TraceThreadUserDefinedMetricPythonCodePublic:()=>oc,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Lp,TraceUpdate:()=>_o,TraceVisibilityMode:()=>hl,TraceWrite:()=>So,UploadAttachmentRequestEntityType:()=>wi,Usage:()=>xc,UserDefinedMetricPythonCode:()=>Go,UserDefinedMetricPythonCodePublic:()=>ec,UserDefinedMetricPythonCodeWrite:()=>Hp,ValueEntry:()=>Kn,ValueEntryCompare:()=>Fc,ValueEntryCompareSource:()=>Nc,ValueEntryExperimentItemBulkWriteView:()=>es,ValueEntryExperimentItemBulkWriteViewSource:()=>qn,ValueEntryPublic:()=>zd,ValueEntryPublicSource:()=>yd,ValueEntrySource:()=>Xn,VideoUrl:()=>wp,VideoUrlPublic:()=>Qp,VideoUrlWrite:()=>Pp,Webhook:()=>vs,WebhookExamples:()=>Gs,WebhookPublic:()=>Ls,WebhookTestResult:()=>Qs,WebhookTestResultStatus:()=>$s,WebhookWrite:()=>Ws,WelcomeWizardSubmission:()=>Vo,WelcomeWizardTracking:()=>Ud,WorkspaceConfiguration:()=>vt,WorkspaceMetricRequest:()=>Yh,WorkspaceMetricResponse:()=>sa,WorkspaceMetricsSummaryRequest:()=>zr,WorkspaceMetricsSummaryResponse:()=>Dd,WorkspaceNameHolder:()=>lp,WorkspaceSpansCount:()=>_s,WorkspaceTraceCount:()=>Ts,alerts:()=>mi,annotationQueues:()=>Gi,attachments:()=>sr,chatCompletions:()=>$i,dashboards:()=>Qi,datasets:()=>bi,experiments:()=>pr,feedbackDefinitions:()=>Ti,guardrails:()=>Yi,llmProviderKey:()=>Pi,optimizations:()=>Ci,projects:()=>Mi,prompts:()=>Wi,spans:()=>cr,traces:()=>We,welcomeWizard:()=>Zi});var mi={};c(mi,{GetWebhookExamplesRequestAlertType:()=>li});var li=e.enum_(["general","slack","pagerduty"]);var sr={};c(sr,{AttachmentListRequestEntityType:()=>di,DownloadAttachmentRequestEntityType:()=>ui,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>gi,UploadAttachmentRequestEntityType:()=>wi,uploadAttachment:()=>fi});var di=e.enum_(["trace","span"]);var ui=e.enum_(["trace","span"]);var gi=e.enum_(["trace","span"]);var wi=e.enum_(["trace","span"]);var fi={};c(fi,{Request:()=>yh});var yh=e.record(e.string(),e.unknown());var Ir=e.object({fileName:e.property("file_name",e.string()),numOfFileParts:e.property("num_of_file_parts",e.number()),mimeType:e.property("mime_type",e.string().optional()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",gi),entityId:e.property("entity_id",e.string()),path:e.string()});var bi={};c(bi,{CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemStreamRequest:()=>Hr,DatasetItemsDelete:()=>Br,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>Ri,DatasetVersionCreatePublic:()=>Xr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>hi});var hi=e.enum_(["private","public"]);var Ri=e.enum_(["private","public"]);var Fn=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var On=e.object({field:e.string().optional(),operator:Fn.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Wn=e.object({input:e.string().optional(),expectedOutput:e.property("expected_output",e.string().optional()),metadata:v.optional(),data:v.optional(),tags:e.list(e.string()).optional()});var jr=e.object({ids:e.list(e.string()).optional(),filters:e.list(On).optional(),update:Wn,mergeTags:e.property("merge_tags",e.boolean().optional())});var Ur=e.object({id:e.string().optional(),name:e.string(),visibility:hi.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Bn=e.enum_(["manual","trace","span","sdk"]);var Dr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Bn,data:v,tags:e.list(e.string()).optional()});var Mr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Dr)});var Ln=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Nr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Ln)});var Vn=e.object({includeSpans:e.boolean().optional(),includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Fr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Vn)});var Or=e.object({name:e.string(),description:e.string().optional(),visibility:Ri.optional(),tags:e.list(e.string()).optional()});var Wr=e.object({datasetName:e.property("dataset_name",e.string())});var Br=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Lr=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Vr=e.object({datasetName:e.property("dataset_name",e.string())});var Hr=e.object({datasetName:e.property("dataset_name",e.string()),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),steamLimit:e.property("steam_limit",e.number().optional())});var Jr=e.object({tag:e.string()});var Xr=e.object({tags:e.list(e.string()).optional(),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional()});var Kr=e.object({versionRef:e.property("version_ref",e.string())});var Gr=e.object({changeDescription:e.property("change_description",e.string().optional()),tagsToAdd:e.property("tags_to_add",e.list(e.string()).optional())});var pr={};c(pr,{ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemStreamRequest:()=>to,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentStreamRequestPublic:()=>io,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>Si,ExperimentUpdateType:()=>ki,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>zi,ExperimentWriteType:()=>yi,findFeedbackScoreNames:()=>xi});var yi=e.enum_(["regular","trial","mini-batch"]);var zi=e.enum_(["running","completed","cancelled"]);var ki=e.enum_(["regular","trial","mini-batch"]);var Si=e.enum_(["running","completed","cancelled"]);var xi={};c(xi,{Response:()=>zh});var zh=e.list(e.string());var te=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Hn=e.object({name:e.string(),value:e.number()});var _i=e.object({id:e.string()});var $r=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:yi.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:zi.optional(),experimentScores:e.property("experiment_scores",e.list(Hn).optional()),promptVersion:e.property("prompt_version",_i.optional()),promptVersions:e.property("prompt_versions",e.list(_i).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Jn=e.enum_(["ui","sdk","online_scoring"]);var Xn=e.enum_(["ui","sdk","online_scoring"]);var Kn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Xn.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Y=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Jn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Kn).optional())});var L=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Gn=e.enum_(["default","hidden"]);var Qr=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:D.optional(),output:D.optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",Gn.optional())});var Yr=e.object({experimentItems:e.property("experiment_items",e.list(Qr))});var Zr=e.object({ids:e.list(e.string())});var me=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var qr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var $n=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Qn=e.enum_(["general","tool","llm","guardrail"]);var Yn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Qn.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var Zn=e.enum_(["ui","sdk","online_scoring"]);var qn=e.enum_(["ui","sdk","online_scoring"]);var es=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:qn.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var rs=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Zn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),es).optional())});var os=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:$n.optional(),spans:e.list(Yn).optional(),feedbackScores:e.property("feedback_scores",e.list(rs).optional())});var eo=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(os)});var ro=e.object({name:e.string(),value:e.number()});var oo=e.object({name:e.string().optional(),metadata:v.optional(),type:ki.optional(),status:Si.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional())});var to=e.object({experimentName:e.property("experiment_name",e.string()),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var io=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var Ti={};c(Ti,{FindFeedbackDefinitionsRequestType:()=>Ai});var Ai=e.enum_(["numerical","categorical","boolean"]);var Pi={};c(Pi,{ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Ei});var Ei=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var ao=e.object({provider:Ei,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var no=e.object({apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var Ci={};c(Ci,{OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>vi});var vi=e.enum_(["running","completed","cancelled","initialized","error"]);var so=e.object({name:e.string().optional(),status:vi.optional()});var Mi={};c(Mi,{ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Di,ProjectMetricRequestPublicMetricType:()=>Ui,ProjectRetrieveDetailed:()=>mo,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>ji,ProjectWrite:()=>po,ProjectWriteVisibility:()=>Ii});var Ii=e.enum_(["private","public"]);var ji=e.enum_(["private","public"]);var Ui=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Di=e.enum_(["HOURLY","DAILY","WEEKLY"]);var po=e.object({name:e.string(),visibility:Ii.optional(),description:e.string().optional()});var co=e.object({name:e.string().optional(),description:e.string().optional(),visibility:ji.optional()});var ts=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:ts.optional(),key:e.string().optional(),value:e.string().optional()});var is=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Fe=e.object({field:e.string().optional(),operator:is.optional(),key:e.string().optional(),value:e.string().optional()});var lo=e.object({metricType:e.property("metric_type",Ui.optional()),interval:Di.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional()),traceFilters:e.property("trace_filters",e.list(be).optional()),threadFilters:e.property("thread_filters",e.list(Fe).optional())});var mo=e.object({name:e.string()});var Wi={};c(Wi,{CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Oi,PromptUpdatable:()=>wo,PromptVersionRetrieveDetail:()=>fo,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Fi,PromptWriteType:()=>Ni});var Ni=e.enum_(["mustache","jinja2"]);var Fi=e.enum_(["text","chat"]);var Oi=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var uo=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:ie.optional(),changeDescription:e.property("change_description",e.string().optional()),type:Ni.optional(),templateStructure:e.property("template_structure",Fi.optional()),tags:e.list(e.string()).optional()});var as=e.record(e.string(),e.unknown());var ns=e.enum_(["mustache","jinja2"]);var ss=e.enum_(["text","chat"]);var he=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:as.optional(),type:ns.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",ss.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var go=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",Oi.optional())});var wo=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var fo=e.object({name:e.string(),commit:e.string().optional()});var cr={};c(cr,{FindFeedbackScoreNames1RequestType:()=>Li,GetSpanStatsRequestType:()=>Vi,GetSpansByProjectRequestType:()=>Bi,SpanBatchUpdate:()=>zo,SpanBatchWrite:()=>bo,SpanSearchStreamRequestPublic:()=>ko,SpanSearchStreamRequestPublicType:()=>Hi,findFeedbackScoreNames1:()=>Ji});var Bi=e.enum_(["general","tool","llm","guardrail"]);var Li=e.enum_(["general","tool","llm","guardrail"]);var Vi=e.enum_(["general","tool","llm","guardrail"]);var Hi=e.enum_(["general","tool","llm","guardrail"]);var Ji={};c(Ji,{Response:()=>kh});var kh=e.list(e.string());var ps=e.enum_(["general","tool","llm","guardrail"]);var ho=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ro=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:ps.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",ho.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var bo=e.object({spans:e.list(Ro)});var cs=e.enum_(["general","tool","llm","guardrail"]);var ye=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var yo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:cs.optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),errorInfo:e.property("error_info",ye.optional())});var zo=e.object({ids:e.list(e.string()),update:yo,mergeTags:e.property("merge_tags",e.boolean().optional())});var ls=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Oe=e.object({field:e.string().optional(),operator:ls.optional(),key:e.string().optional(),value:e.string().optional()});var ko=e.object({traceId:e.property("trace_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),type:Hi.optional(),filters:e.list(Oe).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional(),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var We={};c(We,{DeleteThreadFeedbackScores:()=>vo,DeleteTraceThreads:()=>Co,FeedbackScoreBatchThread:()=>Io,TraceBatchUpdate:()=>Ao,TraceBatchWrite:()=>xo,TraceSearchStreamRequestPublic:()=>Uo,TraceThreadBatchIdentifier:()=>Po,TraceThreadBatchUpdate:()=>Eo,TraceThreadSearchStreamRequest:()=>jo,findFeedbackScoreNames2:()=>Xi,findTraceThreadsFeedbackScoreNames:()=>Ki});var Xi={};c(Xi,{Response:()=>Sh});var Sh=e.list(e.string());var Ki={};c(Ki,{Response:()=>xh});var xh=e.list(e.string());var So=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ho.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var xo=e.object({traces:e.list(So)});var _o=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),threadId:e.property("thread_id",e.string().optional())});var Ao=e.object({ids:e.list(e.string()),update:_o,mergeTags:e.property("merge_tags",e.boolean().optional())});var To=e.object({tags:e.list(e.string()).optional()});var Eo=e.object({ids:e.list(e.string()),update:To,mergeTags:e.property("merge_tags",e.boolean().optional())});var Po=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()).optional())});var vo=e.object({projectName:e.property("project_name",e.string()),threadId:e.property("thread_id",e.string()),names:e.list(e.string()),author:e.string().optional()});var Co=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()))});var ms=e.enum_(["ui","sdk","online_scoring"]);var ds=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:ms,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var Io=e.object({scores:e.list(ds)});var us=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:us.optional(),key:e.string().optional(),value:e.string().optional()});var jo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(de).optional(),lastRetrievedThreadModelId:e.property("last_retrieved_thread_model_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Uo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(be).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Gi={};c(Gi,{AnnotationQueueBatchWrite:()=>Mo,AnnotationQueueUpdate:()=>No});var gs=e.enum_(["trace","thread"]);var Do=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:gs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Mo=e.object({annotationQueues:e.property("annotation_queues",e.list(Do))});var No=e.object({name:e.string().optional(),description:e.string().optional(),instructions:e.string().optional(),commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var $i={};c($i,{ChatCompletionRequest:()=>Oo});var ws=e.record(e.string(),e.unknown());var fs=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var hs=e.enum_(["text","json_object","json_schema"]);var Rs=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var bs=e.object({type:hs.optional(),jsonSchema:e.property("json_schema",Rs.optional())});var Fo=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ys=e.object({type:e.stringLiteral("function").optional(),function:Fo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Oo=e.object({model:e.string().optional(),messages:e.list(ws).optional(),temperature:e.number().optional(),topP:e.property("top_p",e.number().optional()),n:e.number().optional(),stream:e.boolean().optional(),streamOptions:e.property("stream_options",fs.optional()),stop:e.list(e.string()).optional(),maxTokens:e.property("max_tokens",e.number().optional()),maxCompletionTokens:e.property("max_completion_tokens",e.number().optional()),presencePenalty:e.property("presence_penalty",e.number().optional()),frequencyPenalty:e.property("frequency_penalty",e.number().optional()),logitBias:e.property("logit_bias",e.record(e.string(),e.number()).optional()),user:e.string().optional(),responseFormat:e.property("response_format",bs.optional()),seed:e.number().optional(),tools:e.list(ys).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),store:e.boolean().optional(),metadata:e.record(e.string(),e.string()).optional(),reasoningEffort:e.property("reasoning_effort",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional()),functions:e.list(Fo).optional(),functionCall:e.property("function_call",ze.optional())});var Qi={};c(Qi,{DashboardUpdatePublic:()=>Bo,DashboardWrite:()=>Wo});var Wo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Bo=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var Yi={};c(Yi,{GuardrailBatchWrite:()=>Lo});var zs=e.enum_(["TOPIC","PII"]);var ks=e.enum_(["passed","failed"]);var Ss=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:zs,result:ks,config:v,details:v});var Lo=e.object({guardrails:e.list(Ss)});var Zi={};c(Zi,{WelcomeWizardSubmission:()=>Vo});var Vo=e.object({role:e.string().optional(),integrations:e.list(e.string()).optional(),email:e.string().optional(),joinBetaProgram:e.property("join_beta_program",e.boolean().optional())});var xs=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var lr=e.object({biInformation:e.property("bi_information",e.list(xs).optional())});var _s=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var As=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(_s).optional())});var Ts=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Es=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Ts).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Ps=e.enum_(["general","slack","pagerduty"]);var vs=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Cs=e.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 Is=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var js=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Is,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Us=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Cs),triggerConfigs:e.property("trigger_configs",e.list(js).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var _h=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ps.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:vs,triggers:e.list(Us).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ds=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ms=e.object({id:e.string().optional(),type:Ds,configValue:e.property("config_value",e.record(e.string(),e.string()).optional())});var Ns=e.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 Fs=e.object({id:e.string().optional(),eventType:e.property("event_type",Ns),triggerConfigs:e.property("trigger_configs",e.list(Ms).optional())});var Os=e.enum_(["general","slack","pagerduty"]);var Ws=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional()});var Ho=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Os.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ws,triggers:e.list(Fs).optional()});var F=e.object({ids:e.list(e.string())});var Bs=e.enum_(["general","slack","pagerduty"]);var Ls=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Vs=e.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 Hs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Js=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Hs,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Xs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Vs),triggerConfigs:e.property("trigger_configs",e.list(Js).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Jo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Bs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ls,triggers:e.list(Xs).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ks=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Jo).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Ah=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Gs=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var $s=e.enum_(["success","failure"]);var Qs=e.object({status:$s.optional(),statusCode:e.property("status_code",e.number().optional()),requestBody:e.property("request_body",e.string().optional()),errorMessage:e.property("error_message",e.string().optional())});var qi=e.object({ids:e.list(e.string())});var Ys=e.enum_(["trace","thread"]);var Zs=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var qs=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:Ys,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(Zs).optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Th=e.object({annotationQueues:e.property("annotation_queues",e.list(qs))});var ep=e.enum_(["trace","thread"]);var rp=e.object({username:e.string().optional(),status:e.number().optional()});var Be=e.object({name:e.string(),value:e.number()});var Xo=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:ep,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(rp).optional(),feedbackScores:e.property("feedback_scores",e.list(Be).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var op=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Xo).optional(),sortableBy:e.list(e.string()).optional()});var tp=e.object({link:e.string().optional(),fileName:e.property("file_name",e.string()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string())});var ip=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(tp).optional(),sortableBy:e.list(e.string()).optional()});var ap=e.enum_(["trace","span"]);var np=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var ea=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",ap),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string().optional()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string().optional()),uploadId:e.property("upload_id",e.string()),uploadedFileParts:e.property("uploaded_file_parts",e.list(np))});var sp=e.enum_(["trace","span"]);var Eh=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",sp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var pp=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var cp=e.record(e.string(),e.unknown());var lp=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var mp=e.object({url:e.string()});var dp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:dp.optional(),key:e.string().optional(),value:e.string().optional()});var Le=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",v.optional())});var up=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var gp=e.object({url:e.string(),detail:e.string().optional()});var wp=e.object({url:e.string()});var fp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",gp.optional()),videoUrl:e.property("video_url",wp.optional()),audioUrl:e.property("audio_url",mp.optional())});var Ve=e.object({role:up,content:e.string().optional(),contentArray:e.property("content_array",e.list(fp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var hp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var He=e.object({name:e.string(),type:hp,description:e.string()});var Ko=e.object({model:Le,messages:e.list(Ve),variables:e.record(e.string(),e.string()),schema:e.list(He)});var Rp=e.object({filters:e.list(ke).optional(),code:Ko.optional()});var Go=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var bp=e.object({filters:e.list(ke).optional(),code:Go.optional()});var $o=e.object({model:Le,messages:e.list(Ve),schema:e.list(He)});var yp=e.object({filters:e.list(de).optional(),code:$o.optional()});var Qo=e.object({metric:e.string()});var zp=e.object({filters:e.list(de).optional(),code:Qo.optional()});var kp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Se=e.object({field:e.string().optional(),operator:kp.optional(),key:e.string().optional(),value:e.string().optional()});var Yo=e.object({model:Le,messages:e.list(Ve),variables:e.record(e.string(),e.string()),schema:e.list(He)});var Sp=e.object({filters:e.list(Se).optional(),code:Yo.optional()});var Zo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var xp=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var mr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),Ph=e.union("type",{llm_as_judge:Rp.extend(mr),user_defined_metric_python:bp.extend(mr),trace_thread_llm_as_judge:yp.extend(mr),trace_thread_user_defined_metric_python:zp.extend(mr),span_llm_as_judge:Sp.extend(mr),span_user_defined_metric_python:xp.extend(mr)}).transform({transform:s=>s,untransform:s=>s});var _p=e.object({url:e.string()});var Ap=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var qo=e.object({field:e.string().optional(),operator:Ap.optional(),key:e.string().optional(),value:e.string().optional()});var Je=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",ie.optional())});var Tp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Ep=e.object({url:e.string(),detail:e.string().optional()});var Pp=e.object({url:e.string()});var vp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Ep.optional()),videoUrl:e.property("video_url",Pp.optional()),audioUrl:e.property("audio_url",_p.optional())});var Xe=e.object({role:Tp,content:e.string().optional(),contentArray:e.property("content_array",e.list(vp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Cp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ke=e.object({name:e.string(),type:Cp,description:e.string()});var Ip=e.object({model:Je,messages:e.list(Xe),variables:e.record(e.string(),e.string()),schema:e.list(Ke)});var jp=e.object({filters:e.list(qo).optional(),code:Ip.optional()});var Up=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var et=e.object({field:e.string().optional(),operator:Up.optional(),key:e.string().optional(),value:e.string().optional()});var Dp=e.object({model:Je,messages:e.list(Xe),variables:e.record(e.string(),e.string()),schema:e.list(Ke)});var Mp=e.object({filters:e.list(et).optional(),code:Dp.optional()});var Np=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Fp=e.object({filters:e.list(et).optional(),code:Np.optional()});var Op=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var rt=e.object({field:e.string().optional(),operator:Op.optional(),key:e.string().optional(),value:e.string().optional()});var Wp=e.object({model:Je,messages:e.list(Xe),schema:e.list(Ke)});var Bp=e.object({filters:e.list(rt).optional(),code:Wp.optional()});var Lp=e.object({metric:e.string()});var Vp=e.object({filters:e.list(rt).optional(),code:Lp.optional()});var Hp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Jp=e.object({filters:e.list(qo).optional(),code:Hp.optional()});var dr=e.object({projectId:e.property("project_id",e.string()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),action:e.stringLiteral("evaluator")}),Xp=e.union("type",{llm_as_judge:jp.extend(dr),user_defined_metric_python:Jp.extend(dr),trace_thread_llm_as_judge:Bp.extend(dr),trace_thread_user_defined_metric_python:Vp.extend(dr),span_llm_as_judge:Mp.extend(dr),span_user_defined_metric_python:Fp.extend(dr)}).transform({transform:s=>s,untransform:s=>s});var Kp=e.object({url:e.string()});var Ge=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",Z.optional())});var Gp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var $p=e.object({url:e.string(),detail:e.string().optional()});var Qp=e.object({url:e.string()});var Yp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",$p.optional()),videoUrl:e.property("video_url",Qp.optional()),audioUrl:e.property("audio_url",Kp.optional())});var $e=e.object({role:Gp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Yp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Zp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Qe=e.object({name:e.string(),type:Zp,description:e.string()});var qp=e.object({model:Ge,messages:e.list($e),variables:e.record(e.string(),e.string()),schema:e.list(Qe)});var ot=e.object({filters:e.list(be).optional(),code:qp.optional()});var ec=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var tt=e.object({filters:e.list(be).optional(),code:ec.optional()});var rc=e.object({model:Ge,messages:e.list($e),schema:e.list(Qe)});var it=e.object({filters:e.list(Fe).optional(),code:rc.optional()});var oc=e.object({metric:e.string()});var at=e.object({filters:e.list(Fe).optional(),code:oc.optional()});var tc=e.object({model:Ge,messages:e.list($e),variables:e.record(e.string(),e.string()),schema:e.list(Qe)});var nt=e.object({filters:e.list(Oe).optional(),code:tc.optional()});var ic=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var st=e.object({filters:e.list(Oe).optional(),code:ic.optional()});var ur=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),ac=e.union("type",{llm_as_judge:ot.extend(ur),user_defined_metric_python:tt.extend(ur),trace_thread_llm_as_judge:it.extend(ur),trace_thread_user_defined_metric_python:at.extend(ur),span_llm_as_judge:nt.extend(ur),span_user_defined_metric_python:st.extend(ur)}).transform({transform:s=>s,untransform:s=>s});var nc=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ac).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var gr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),sc=e.union("type",{llm_as_judge:ot.extend(gr),user_defined_metric_python:tt.extend(gr),trace_thread_llm_as_judge:it.extend(gr),trace_thread_user_defined_metric_python:at.extend(gr),span_llm_as_judge:nt.extend(gr),span_user_defined_metric_python:st.extend(gr)}).transform({transform:s=>s,untransform:s=>s});var pc=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var cc=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:pc.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var lc=e.object({content:e.list(cc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var mc=e.object({filters:e.list(ke).optional(),code:Ko.optional()});var dc=e.object({filters:e.list(ke).optional(),code:Go.optional()});var uc=e.object({filters:e.list(de).optional(),code:$o.optional()});var gc=e.object({filters:e.list(de).optional(),code:Qo.optional()});var wc=e.object({filters:e.list(Se).optional(),code:Yo.optional()});var fc=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var wr=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),projectId:e.property("project_id",e.string()),action:e.stringLiteral("evaluator")}),hc=e.union("type",{llm_as_judge:mc.extend(wr),user_defined_metric_python:dc.extend(wr),trace_thread_llm_as_judge:uc.extend(wr),trace_thread_user_defined_metric_python:gc.extend(wr),span_llm_as_judge:wc.extend(wr),span_user_defined_metric_python:fc.extend(wr)}).transform({transform:s=>s,untransform:s=>s});var Rc=e.enum_(["system","user","assistant","tool","function"]);var pt=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var bc=e.object({role:Rc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(pt).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var yc=e.object({role:e.string().optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),toolCalls:e.property("tool_calls",e.list(pt).optional()),functionCall:e.property("function_call",ze.optional())});var zc=e.object({index:e.number().optional(),message:bc.optional(),delta:yc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var kc=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var Sc=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var xc=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",kc.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",Sc.optional())});var _c=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(zc).optional(),usage:xc.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var Ye=e.object({id:e.string().optional(),workspaceId:e.property("workspace_id",e.string().optional()),name:e.string(),slug:e.string().optional(),description:e.string().optional(),config:Z,createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Ac=e.object({content:e.list(Ye).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Tc=e.enum_(["private","public"]);var Ec=e.enum_(["unknown","processing","completed","failed"]);var Pc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var vh=e.object({id:e.string().optional(),name:e.string(),visibility:Tc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:Ec.optional(),latestVersion:e.property("latest_version",Pc.optional())});var vc=e.enum_(["manual","trace","span","sdk"]);var ct=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:vc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Qr).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ch=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(ct)});var Cc=e.object({generatedSamples:e.property("generated_samples",e.list(ct).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var Ih=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Ic=e.enum_(["string","number","object","boolean","array","null"]);var jc=e.object({name:e.string().optional(),types:e.list(Ic).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Uc=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Dc=e.enum_(["manual","trace","span","sdk"]);var ra=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Mc=e.enum_(["ui","sdk","online_scoring"]);var Nc=e.enum_(["ui","sdk","online_scoring"]);var Fc=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Nc.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Oc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Mc,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Fc).optional())});var Wc=e.enum_(["default","hidden"]);var Bc=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:ra.optional(),output:ra.optional(),feedbackScores:e.property("feedback_scores",e.list(Oc).optional()),comments:e.list(Uc).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",Wc.optional())});var Lc=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Dc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Bc).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Vc=e.object({content:e.list(Lc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(jc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Hc=e.enum_(["private","public"]);var Jc=e.enum_(["unknown","processing","completed","failed"]);var Xc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var fr=e.object({id:e.string().optional(),name:e.string(),visibility:Hc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:Jc.optional(),latestVersion:e.property("latest_version",Xc.optional())});var Kc=e.object({content:e.list(fr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.list(e.string()).optional()});var Gc=e.object({value:e.number().optional()});var $c=e.object({value:e.number().optional()});var lt=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Qc=e.object({value:lt.optional()});var Yc=e.object({name:e.string().optional()}),Zc=e.union("type",{PERCENTAGE:Qc.extend(Yc),COUNT:$c.extend(Yc),AVG:Gc.extend(Yc)}).transform({transform:s=>s,untransform:s=>s});var Ze=e.object({stats:e.list(Zc).optional()});var qc=e.enum_(["manual","trace","span","sdk"]);var el=e.enum_(["default","hidden"]);var mt=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",el.optional())});var dt=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:qc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(mt).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var rl=e.enum_(["string","number","object","boolean","array","null"]);var ol=e.object({name:e.string().optional(),types:e.list(rl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var tl=e.object({content:e.list(dt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(ol).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var il=e.enum_(["string","number","object","boolean","array","null"]);var al=e.object({name:e.string().optional(),types:e.list(il).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var nl=e.object({columns:e.list(al).optional()});var sl=e.object({typeName:e.string().optional()});var jh=e.object({type:sl.optional(),closed:e.boolean().optional()});var pl=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var cl=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:pl.optional()});var hr=e.object({id:e.string().optional(),datasetId:e.property("dataset_id",e.string().optional()),versionHash:e.property("version_hash",e.string().optional()),tags:e.list(e.string()).optional(),isLatest:e.property("is_latest",e.boolean().optional()),itemsTotal:e.property("items_total",e.number().optional()),itemsAdded:e.property("items_added",e.number().optional()),itemsModified:e.property("items_modified",e.number().optional()),itemsDeleted:e.property("items_deleted",e.number().optional()),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ll=e.object({content:e.list(hr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var ml=e.enum_(["regular","trial","mini-batch"]);var dl=e.enum_(["running","completed","cancelled"]);var xe=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var oa=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var Uh=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:D.optional(),type:ml.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),comments:e.list(L).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:dl.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional()),promptVersion:e.property("prompt_version",oa.optional()),promptVersions:e.property("prompt_versions",e.list(oa).optional())});var Rr=e.object({ids:e.list(e.string())});var ul=e.enum_(["TOPIC","PII"]);var gl=e.enum_(["passed","failed"]);var wl=e.object({name:ul.optional(),result:gl.optional()});var fl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(wl).optional()});var hl=e.enum_(["default","hidden"]);var ut=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(fl).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",hl.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var Rl=e.enum_(["general","tool","llm","guardrail"]);var gt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Rl.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",ye.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var bl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:ut.optional(),spans:e.list(gt).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var Dh=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(bl)});var qe=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ae=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var yl=e.enum_(["regular","trial","mini-batch"]);var zl=e.enum_(["running","completed","cancelled"]);var kl=e.object({name:e.string(),value:e.number()});var ta=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var wt=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:ae.optional(),type:yl.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Be).optional()),comments:e.list(qe).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:lt.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:zl.optional(),experimentScores:e.property("experiment_scores",e.list(kl).optional()),promptVersion:e.property("prompt_version",ta.optional()),promptVersions:e.property("prompt_versions",e.list(ta).optional())});var Sl=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wt).optional(),sortableBy:e.list(e.string()).optional()});var xl=e.object({label:e.string().optional()});var _l=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var Al=e.object({groupsDetails:e.property("groups_details",e.list(_l).optional())});var Tl=e.object({content:e.record(e.string(),xl).optional(),details:Al.optional()});var El=e.object({experimentCount:e.property("experiment_count",e.number().optional()),traceCount:e.property("trace_count",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),duration:xe.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),experimentScores:e.property("experiment_scores",e.list(re).optional())});var Pl=e.object({label:e.string().optional(),aggregations:El.optional()});var vl=e.object({content:e.record(e.string(),Pl).optional()});var Mh=e.object({ids:e.list(e.string())});var Cl=e.object({typeName:e.string().optional()});var Nh=e.object({type:Cl.optional(),closed:e.boolean().optional()});var Il=e.object({trueLabel:e.string(),falseLabel:e.string()});var jl=e.object({details:Il.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ul=e.object({categories:e.record(e.string(),e.number())});var Dl=e.object({details:Ul.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ml=e.object({max:e.number(),min:e.number()});var Nl=e.object({details:Ml.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Fl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Fh=e.union("type",{numerical:Nl.extend(Fl),categorical:Dl.extend(Fl),boolean:jl.extend(Fl)}).transform({transform:s=>s,untransform:s=>s});var Ol=e.object({trueLabel:e.string(),falseLabel:e.string()});var Wl=e.object({details:Ol.optional()});var Bl=e.object({categories:e.record(e.string(),e.number())});var Ll=e.object({details:Bl.optional()});var Vl=e.object({max:e.number(),min:e.number()});var Hl=e.object({details:Vl.optional()});var Jl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),Xl=e.union("type",{numerical:Hl.extend(Jl),categorical:Ll.extend(Jl),boolean:Wl.extend(Jl)}).transform({transform:s=>s,untransform:s=>s});var Kl=e.object({trueLabel:e.string(),falseLabel:e.string()});var ft=e.object({details:Kl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Gl=e.object({categories:e.record(e.string(),e.number())});var ht=e.object({details:Gl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $l=e.object({max:e.number(),min:e.number()});var Rt=e.object({details:$l.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ql=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Yl=e.union("type",{numerical:Rt.extend(Ql),categorical:ht.extend(Ql),boolean:ft.extend(Ql)}).transform({transform:s=>s,untransform:s=>s});var Zl=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Yl).optional()});var ql=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),em=e.union("type",{numerical:Rt.extend(ql),categorical:ht.extend(ql),boolean:ft.extend(ql)}).transform({transform:s=>s,untransform:s=>s});var rm=e.object({trueLabel:e.string(),falseLabel:e.string()});var om=e.object({details:rm.optional()});var tm=e.object({categories:e.record(e.string(),e.number())});var im=e.object({details:tm.optional()});var am=e.object({max:e.number(),min:e.number()});var nm=e.object({details:am.optional()});var sm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),pm=e.union("type",{numerical:nm.extend(sm),categorical:im.extend(sm),boolean:om.extend(sm)}).transform({transform:s=>s,untransform:s=>s});var cm=e.enum_(["TOPIC","PII"]);var lm=e.enum_(["passed","failed"]);var mm=e.object({id:e.string().optional(),entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:cm,result:lm,config:v,details:v});var Oh=e.object({guardrails:e.list(mm)});var dm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var bt=e.object({id:e.string().optional(),provider:dm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var um=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(bt).optional(),sortableBy:e.list(e.string()).optional()});var gm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var Wh=e.object({id:e.string().optional(),provider:gm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var yt=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var wm=e.enum_(["trace","thread","span"]);var zt=e.object({projectId:e.property("project_id",e.string()),entityIds:e.property("entity_ids",e.list(e.string())),ruleIds:e.property("rule_ids",e.list(e.string())),entityType:e.property("entity_type",wm)});var Bh=v;var fm=e.enum_(["running","completed","cancelled","initialized","error"]);var hm=e.object({role:e.string(),content:e.string()});var Rm=e.object({messages:e.list(hm)});var bm=e.object({model:e.string(),parameters:v.optional()});var ym=e.object({type:e.string(),parameters:v.optional()});var zm=e.object({metrics:e.list(ym)});var km=e.object({type:e.string(),parameters:v.optional()});var Sm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Rm,llmModel:e.property("llm_model",bm),evaluation:zm,optimizer:km});var Lh=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:fm,metadata:D.optional(),studioConfig:e.property("studio_config",Sm.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var xm=e.object({role:e.string(),content:e.string()});var _m=e.object({messages:e.list(xm)});var Am=e.object({model:e.string(),parameters:ie.optional()});var Tm=e.object({type:e.string(),parameters:ie.optional()});var Em=e.object({metrics:e.list(Tm)});var Pm=e.object({type:e.string(),parameters:ie.optional()});var vm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:_m,llmModel:e.property("llm_model",Am),evaluation:Em,optimizer:Pm});var Cm=e.enum_(["running","completed","cancelled","initialized","error"]);var ia=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Cm,metadata:te.optional(),studioConfig:e.property("studio_config",vm.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Im=e.enum_(["running","completed","cancelled","initialized","error"]);var jm=e.object({role:e.string(),content:e.string()});var Um=e.object({messages:e.list(jm)});var Dm=e.object({model:e.string(),parameters:Z.optional()});var Mm=e.object({type:e.string(),parameters:Z.optional()});var Nm=e.object({metrics:e.list(Mm)});var Fm=e.object({type:e.string(),parameters:Z.optional()});var Om=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Um,llmModel:e.property("llm_model",Dm),evaluation:Nm,optimizer:Fm});var br=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Im,metadata:ae.optional(),studioConfig:e.property("studio_config",Om.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(Be).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var aa=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(br).optional(),sortableBy:e.list(e.string()).optional()});var Wm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var kt=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Bm=e.enum_(["private","public"]);var Vh=e.object({id:e.string().optional(),name:e.string(),visibility:Bm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",kt.optional())});var Lm=e.enum_(["private","public"]);var St=e.object({id:e.string().optional(),name:e.string(),visibility:Lm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var Vm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(St).optional(),sortableBy:e.list(e.string()).optional()});var Hm=e.object({name:e.string().optional(),type:e.string().optional()});var Jm=e.object({scores:e.list(Hm).optional()});var Xm=e.object({time:e.date(),value:e.number().optional()});var Km=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Gm=e.enum_(["HOURLY","DAILY","WEEKLY"]);var $m=e.object({name:e.string().optional(),data:e.list(Xm).optional()});var Qm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Km.optional()),interval:Gm.optional(),results:e.list($m).optional()});var Ym=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",kt.optional())});var Zm=e.object({content:e.list(Ym).optional()});var qm=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var ed=e.object({name:e.string(),value:e.number()});var rd=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var od=e.enum_(["private","public"]);var td=e.object({id:e.string().optional(),name:e.string(),visibility:od.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(ed).optional()),duration:rd.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",qm.optional())});var Hh=e.object({errors:e.list(e.string()).optional()});var id=e.enum_(["mustache","jinja2"]);var ad=e.enum_(["text","chat"]);var nd=e.enum_(["mustache","jinja2"]);var sd=e.enum_(["text","chat"]);var pd=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:v.optional(),type:nd.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",sd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Jh=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:v.optional(),changeDescription:e.property("change_description",e.string().optional()),type:id.optional(),templateStructure:e.property("template_structure",ad.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",pd.optional())});var Xh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var cd=e.enum_(["text","chat"]);var ld=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",cd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",he.optional())});var md=e.enum_(["mustache","jinja2"]);var dd=e.enum_(["text","chat"]);var ud=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:Z.optional(),type:md.optional(),changeDescription:e.property("change_description",e.string().optional()),templateStructure:e.property("template_structure",dd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var gd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ud).optional()});var wd=e.enum_(["text","chat"]);var fd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",wd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var hd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(fd).optional(),sortableBy:e.list(e.string()).optional()});var Rd=e.object({pythonEvaluatorEnabled:e.boolean(),traceThreadPythonEvaluatorEnabled:e.boolean(),spanLlmAsJudgeEnabled:e.boolean(),spanUserDefinedMetricPythonEnabled:e.boolean(),guardrailsEnabled:e.boolean(),opikAiEnabled:e.property("opikAIEnabled",e.boolean()),alertsEnabled:e.boolean(),welcomeWizardEnabled:e.boolean(),csvUploadEnabled:e.boolean(),exportEnabled:e.boolean(),optimizationStudioEnabled:e.boolean(),dashboardsEnabled:e.boolean(),datasetVersioningEnabled:e.boolean(),openaiProviderEnabled:e.boolean(),anthropicProviderEnabled:e.boolean(),geminiProviderEnabled:e.boolean(),openrouterProviderEnabled:e.boolean(),vertexaiProviderEnabled:e.boolean(),customllmProviderEnabled:e.boolean(),opikbuiltinProviderEnabled:e.boolean()});var Kh=e.object({spans:e.list(gt)});var xt=e.object({name:e.string(),author:e.string().optional()});var _t=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var bd=e.enum_(["ui","sdk","online_scoring"]);var yd=e.enum_(["ui","sdk","online_scoring"]);var zd=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:yd.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var yr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:bd,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),zd).optional())});var kd=e.enum_(["general","tool","llm","guardrail"]);var At=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:kd.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",_t.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var Sd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(At).optional(),sortableBy:e.list(e.string()).optional()});var xd=e.enum_(["ui","sdk","online_scoring"]);var _d=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:xd,author:e.string().optional(),id:e.string()});var Tt=e.object({scores:e.list(_d)});var Gh=e.object({traces:e.list(ut)});var $h=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var Ad=e.enum_(["TOPIC","PII"]);var Td=e.enum_(["passed","failed"]);var Ed=e.object({name:Ad.optional(),result:Td.optional()});var Pd=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Ed).optional()});var vd=e.enum_(["default","hidden"]);var Et=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",_t.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Pd).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",vd.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var Cd=e.enum_(["active","inactive"]);var Pt=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),threadModelId:e.property("thread_model_id",e.string().optional()),startTime:e.property("start_time",e.date().optional()),endTime:e.property("end_time",e.date().optional()),duration:e.number().optional(),firstMessage:e.property("first_message",D.optional()),lastMessage:e.property("last_message",D.optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),status:Cd.optional(),numberOfMessages:e.property("number_of_messages",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),comments:e.list(L).optional(),tags:e.list(e.string()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var na=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string()),truncate:e.boolean().optional()});var Id=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Pt).optional(),sortableBy:e.list(e.string()).optional()});var jd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Et).optional(),sortableBy:e.list(e.string()).optional()});var Ud=e.object({completed:e.boolean().optional()});var er=e.object({name:e.string().optional(),current:e.number().optional(),previous:e.number().optional()});var zr=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var Qh=e.object({time:e.date(),value:e.number().optional()});var sa=e.object({results:e.list(er).optional()});var Yh=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),name:e.string().optional(),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var vt=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var Dd=e.object({results:e.list(er).optional()});var pa=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return h.fromPromise(this.__getDatasetBiInfo(t))}async __getDatasetBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExperimentBiInfo(t){return h.fromPromise(this.__getExperimentBiInfo(t))}async __getExperimentBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansBiInfo(t){return h.fromPromise(this.__getSpansBiInfo(t))}async __getSpansBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-spans.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansCountForWorkspaces(t){return h.fromPromise(this.__getSpansCountForWorkspaces(t))}async __getSpansCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:As.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesBiInfo(t){return h.fromPromise(this.__getTracesBiInfo(t))}async __getTracesBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesCountForWorkspaces(t){return h.fromPromise(this.__getTracesCountForWorkspaces(t))}async __getTracesCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Es.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ca=class{constructor(t={}){this._options=t;}findAlerts(t={},r){return h.fromPromise(this.__findAlerts(t,r))}async __findAlerts(t={},r){var g,w;let{page:o,size:i,sorting:a,filters:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.sorting=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/alerts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ks.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAlert(t,r){return h.fromPromise(this.__createAlert(t,r))}async __createAlert(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAlertBatch(t,r){return h.fromPromise(this.__deleteAlertBatch(t,r))}async __deleteAlertBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAlertById(t,r){return h.fromPromise(this.__getAlertById(t,r))}async __getAlertById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Jo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAlert(t,r,o){return h.fromPromise(this.__updateAlert(t,r,o))}async __updateAlert(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ho.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/alerts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getWebhookExamples(t={},r){return h.fromPromise(this.__getWebhookExamples(t,r))}async __getWebhookExamples(t={},r){var l,d;let{alertType:o}=t,i={};o!=null&&(i.alert_type=li.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}));let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/alerts/webhooks/examples"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Gs.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/webhooks/examples.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}testWebhook(t,r){return h.fromPromise(this.__testWebhook(t,r))}async __testWebhook(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/webhooks/tests"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Qs.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/webhooks/tests.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var la=class{constructor(t={}){this._options=t;}addItemsToAnnotationQueue(t,r,o){return h.fromPromise(this.__addItemsToAnnotationQueue(t,r,o))}async __addItemsToAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/add`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:qi.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/add.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findAnnotationQueues(t={},r){return h.fromPromise(this.__findAnnotationQueues(t,r))}async __findAnnotationQueues(t={},r){var w,k;let{page:o,size:i,name:a,filters:l,sorting:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.filters=l),d!=null&&(u.sorting=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/annotation-queues"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:op.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createAnnotationQueue(t,r){return h.fromPromise(this.__createAnnotationQueue(t,r))}async __createAnnotationQueue(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Do.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createAnnotationQueueBatch(t,r){return h.fromPromise(this.__createAnnotationQueueBatch(t,r))}async __createAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAnnotationQueueBatch(t,r){return h.fromPromise(this.__deleteAnnotationQueueBatch(t,r))}async __deleteAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAnnotationQueueById(t,r){return h.fromPromise(this.__getAnnotationQueueById(t,r))}async __getAnnotationQueueById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Xo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAnnotationQueue(t,r={},o){return h.fromPromise(this.__updateAnnotationQueue(t,r,o))}async __updateAnnotationQueue(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:No.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}removeItemsFromAnnotationQueue(t,r,o){return h.fromPromise(this.__removeItemsFromAnnotationQueue(t,r,o))}async __removeItemsFromAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:qi.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ma=class{constructor(t={}){this._options=t;}attachmentList(t,r){return h.fromPromise(this.__attachmentList(t,r))}async __attachmentList(t,r){var k,S;let{page:o,size:i,projectId:a,entityType:l,entityId:d,path:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),g.project_id=a,g.entity_type=di.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:ip.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}completeMultiPartUpload(t,r){return h.fromPromise(this.__completeMultiPartUpload(t,r))}async __completeMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAttachments(t,r){return h.fromPromise(this.__deleteAttachments(t,r))}async __deleteAttachments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}downloadAttachment(t,r){return h.fromPromise(this.__downloadAttachment(t,r))}async __downloadAttachment(t,r){var k,S;let{workspaceName:o,containerId:i,entityType:a,entityId:l,fileName:d,mimeType:u}=t,g={};o!=null&&(g.workspace_name=o),g.container_id=i,g.entity_type=ui.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"}),g.entity_id=l,g.file_name=d,g.mime_type=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}startMultiPartUpload(t,r){return h.fromPromise(this.__startMultiPartUpload(t,r))}async __startMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ir.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pp.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}uploadAttachment(t,r){return h.fromPromise(this.__uploadAttachment(t,r))}async __uploadAttachment(t,r){var k,S;let{fileName:o,projectName:i,mimeType:a,entityType:l,entityId:d,body:u}=t,g={};g.file_name=o,i!=null&&(g.project_name=i),a!=null&&(g.mime_type=a),g.entity_type=wi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",body:sr.uploadAttachment.Request.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:void 0,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var da=class{constructor(t={}){this._options=t;}access(t,r){return h.fromPromise(this.__access(t,r))}async __access(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:cp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return h.fromPromise(this.__getWorkspaceName(t))}async __getWorkspaceName(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new X(r.error.body,r.rawResponse);case 403:throw new $(ee.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ua=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return h.fromPromise(this.__findEvaluators(t,r))}async __findEvaluators(t={},r){var S,x;let{projectId:o,id:i,name:a,filters:l,sorting:d,page:u,size:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.id=i),a!=null&&(w.name=a),l!=null&&(w.filters=l),d!=null&&(w.sorting=d),u!=null&&(w.page=u.toString()),g!=null&&(w.size=g.toString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:nc.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createAutomationRuleEvaluator(t,r){return h.fromPromise(this.__createAutomationRuleEvaluator(t,r))}async __createAutomationRuleEvaluator(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Xp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAutomationRuleEvaluatorBatch(t,r){return h.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(t,r))}async __deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,a={};o!=null&&(a.project_id=o);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",body:F.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getEvaluatorById(t,r={},o){return h.fromPromise(this.__getEvaluatorById(t,r,o))}async __getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,a={};i!=null&&(a.project_id=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:sc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}updateAutomationRuleEvaluator(t,r,o){return h.fromPromise(this.__updateAutomationRuleEvaluator(t,r,o))}async __updateAutomationRuleEvaluator(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:hc.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getEvaluatorLogsById(t,r={},o){return h.fromPromise(this.__getEvaluatorLogsById(t,r,o))}async __getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,a={};i!=null&&(a.size=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:lc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ga=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return h.fromPromise(this.__createChatCompletions(t,r))}async __createChatCompletions(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Oo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:_c.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var wa=class{constructor(t={}){this._options=t;}findDashboards(t={},r){return h.fromPromise(this.__findDashboards(t,r))}async __findDashboards(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/dashboards"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ac.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createDashboard(t,r){return h.fromPromise(this.__createDashboard(t,r))}async __createDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ye.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDashboardById(t,r){return h.fromPromise(this.__getDashboardById(t,r))}async __getDashboardById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ye.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDashboard(t,r){return h.fromPromise(this.__deleteDashboard(t,r))}async __deleteDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDashboard(t,r={},o){return h.fromPromise(this.__updateDashboard(t,r,o))}async __updateDashboard(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Bo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Ye.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDashboardsBatch(t,r){return h.fromPromise(this.__deleteDashboardsBatch(t,r))}async __deleteDashboardsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var fa=class{constructor(t={}){this._options=t;}batchUpdateDatasetItems(t,r){return h.fromPromise(this.__batchUpdateDatasetItems(t,r))}async __batchUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findDatasets(t={},r){return h.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var x,T;let{page:o,size:i,withExperimentsOnly:a,withOptimizationsOnly:l,promptId:d,name:u,sorting:g,filters:w}=t,k={};o!=null&&(k.page=o.toString()),i!=null&&(k.size=i.toString()),a!=null&&(k.with_experiments_only=a.toString()),l!=null&&(k.with_optimizations_only=l.toString()),d!=null&&(k.prompt_id=d),u!=null&&(k.name=u),g!=null&&(k.sorting=g),w!=null&&(k.filters=w);let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(S.ok)return {data:Kc.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}createDataset(t,r){return h.fromPromise(this.__createDataset(t,r))}async __createDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ur.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return h.fromPromise(this.__createOrUpdateDatasetItems(t,r))}async __createOrUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createDatasetItemsFromCsv(t,r){return h.fromPromise(this.__createDatasetItemsFromCsv(t,r))}async __createDatasetItemsFromCsv(t,r){var l,d;let o=await Lu();o.append("file",Ae(t.file)),o.append("dataset_id",t.datasetId);let i=await o.getRequest(),a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/datasets/items/from-csv"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i.headers,...r==null?void 0:r.headers},requestType:"file",duplex:i.duplex,body:i.body,timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new A(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/from-csv.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}createDatasetItemsFromSpans(t,r,o){return h.fromPromise(this.__createDatasetItemsFromSpans(t,r,o))}async __createDatasetItemsFromSpans(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-spans`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Nr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-spans.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createDatasetItemsFromTraces(t,r,o){return h.fromPromise(this.__createDatasetItemsFromTraces(t,r,o))}async __createDatasetItemsFromTraces(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-traces`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-traces.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetById(t,r){return h.fromPromise(this.__getDatasetById(t,r))}async __getDatasetById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDataset(t,r,o){return h.fromPromise(this.__updateDataset(t,r,o))}async __updateDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDataset(t,r){return h.fromPromise(this.__deleteDataset(t,r))}async __deleteDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetByName(t,r){return h.fromPromise(this.__deleteDatasetByName(t,r))}async __deleteDatasetByName(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetItems(t,r){return h.fromPromise(this.__deleteDatasetItems(t,r))}async __deleteDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Br.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetsBatch(t,r){return h.fromPromise(this.__deleteDatasetsBatch(t,r))}async __deleteDatasetsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}expandDataset(t,r,o){return h.fromPromise(this.__expandDataset(t,r,o))}async __expandDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/expansions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Lr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Cc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/expansions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findDatasetItemsWithExperimentItems(t,r,o){return h.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var x,T;let{page:i,size:a,experimentIds:l,filters:d,sorting:u,search:g,truncate:w}=r,k={};i!=null&&(k.page=i.toString()),a!=null&&(k.size=a.toString()),k.experiment_ids=l,d!=null&&(k.filters=d),u!=null&&(k.sorting=u),g!=null&&(k.search=g),w!=null&&(k.truncate=w.toString());let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(S.ok)return {data:Vc.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}getDatasetByIdentifier(t,r){return h.fromPromise(this.__getDatasetByIdentifier(t,r))}async __getDatasetByIdentifier(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetExperimentItemsStats(t,r,o){return h.fromPromise(this.__getDatasetExperimentItemsStats(t,r,o))}async __getDatasetExperimentItemsStats(t,r,o){var u,g;let{experimentIds:i,filters:a}=r,l={};l.experiment_ids=i,a!=null&&(l.filters=a);let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/stats`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:Ze.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/stats.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getDatasetItemById(t,r){return h.fromPromise(this.__getDatasetItemById(t,r))}async __getDatasetItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}patchDatasetItem(t,r,o){return h.fromPromise(this.__patchDatasetItem(t,r,o))}async __patchDatasetItem(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Dr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetItems(t,r={},o){return h.fromPromise(this.__getDatasetItems(t,r,o))}async __getDatasetItems(t,r={},o){var k,S;let{page:i,size:a,version:l,filters:d,truncate:u}=r,g={};i!=null&&(g.page=i.toString()),a!=null&&(g.size=a.toString()),l!=null&&(g.version=l),d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(w.ok)return {data:tl.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getDatasetItemsOutputColumns(t,r={},o){return h.fromPromise(this.__getDatasetItemsOutputColumns(t,r,o))}async __getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,a={};i!=null&&(a.experiment_ids=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:nl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}streamDatasetItems(t,r){return h.fromPromise(this.__streamDatasetItems(t,r))}async __streamDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Hr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}compareDatasetVersions(t,r){return h.fromPromise(this.__compareDatasetVersions(t,r))}async __compareDatasetVersions(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/diff`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:cl.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions/diff.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createVersionTag(t,r,o,i){return h.fromPromise(this.__createVersionTag(t,r,o,i))}async __createVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}/tags`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Jr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new A(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/hash/{versionHash}/tags.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}listDatasetVersions(t,r={},o){return h.fromPromise(this.__listDatasetVersions(t,r,o))}async __listDatasetVersions(t,r={},o){var u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:ll.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new A(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createDatasetVersion(t,r={},o){return h.fromPromise(this.__createDatasetVersion(t,r,o))}async __createDatasetVersion(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Xr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteVersionTag(t,r,o,i){return h.fromPromise(this.__deleteVersionTag(t,r,o,i))}async __deleteVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(o)}/versions/${encodeURIComponent(t)}/tags/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}/versions/{versionHash}/tags/{tag}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}restoreDatasetVersion(t,r,o){return h.fromPromise(this.__restoreDatasetVersion(t,r,o))}async __restoreDatasetVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Kr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:hr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateDatasetVersion(t,r,o={},i){return h.fromPromise(this.__updateDatasetVersion(t,r,o,i))}async __updateDatasetVersion(t,r,o={},i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Gr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:hr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new A(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/{id}/versions/hash/{versionHash}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ha=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return h.fromPromise(this.__findExperiments(t,r))}async __findExperiments(t={},r){var B,O;let{page:o,size:i,datasetId:a,optimizationId:l,types:d,name:u,datasetDeleted:g,promptId:w,sorting:k,filters:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.datasetId=a),l!=null&&(x.optimization_id=l),d!=null&&(x.types=d),u!=null&&(x.name=u),g!=null&&(x.dataset_deleted=g.toString()),w!=null&&(x.prompt_id=w),k!=null&&(x.sorting=k),S!=null&&(x.filters=S);let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:Sl.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new A(T.error.body,T.rawResponse);default:throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}createExperiment(t,r){return h.fromPromise(this.__createExperiment(t,r))}async __createExperiment(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$r.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return h.fromPromise(this.__createExperimentItems(t,r))}async __createExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Yr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentItems(t,r){return h.fromPromise(this.__deleteExperimentItems(t,r))}async __deleteExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentsById(t,r){return h.fromPromise(this.__deleteExperimentsById(t,r))}async __deleteExperimentsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}experimentItemsBulk(t,r){return h.fromPromise(this.__experimentItemsBulk(t,r))}async __experimentItemsBulk(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/bulk"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:eo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/experiments/items/bulk.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames(t={},r){return h.fromPromise(this.__findFeedbackScoreNames(t,r))}async __findFeedbackScoreNames(t={},r){var l,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:pr.findFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findExperimentGroups(t={},r){return h.fromPromise(this.__findExperimentGroups(t,r))}async __findExperimentGroups(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Tl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}findExperimentGroupsAggregations(t={},r){return h.fromPromise(this.__findExperimentGroupsAggregations(t,r))}async __findExperimentGroupsAggregations(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups/aggregations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:vl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups/aggregations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}finishExperiments(t,r){return h.fromPromise(this.__finishExperiments(t,r))}async __finishExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/finish"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/finish.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getExperimentById(t,r){return h.fromPromise(this.__getExperimentById(t,r))}async __getExperimentById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:wt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateExperiment(t,r={},o){return h.fromPromise(this.__updateExperiment(t,r,o))}async __updateExperiment(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:oo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/experiments/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getExperimentItemById(t,r){return h.fromPromise(this.__getExperimentItemById(t,r))}async __getExperimentItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:mt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperimentItems(t,r){return h.fromPromise(this.__streamExperimentItems(t,r))}async __streamExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:to.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperiments(t,r){return h.fromPromise(this.__streamExperiments(t,r))}async __streamExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ra=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return h.fromPromise(this.__findFeedbackDefinitions(t,r))}async __findFeedbackDefinitions(t={},r){var g,w;let{page:o,size:i,name:a,type:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.type=Ai.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}));let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Zl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createFeedbackDefinition(t,r){return h.fromPromise(this.__createFeedbackDefinition(t,r))}async __createFeedbackDefinition(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Xl.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getFeedbackDefinitionById(t,r){return h.fromPromise(this.__getFeedbackDefinitionById(t,r))}async __getFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:em.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateFeedbackDefinition(t,r,o){return h.fromPromise(this.__updateFeedbackDefinition(t,r,o))}async __updateFeedbackDefinition(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:pm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeedbackDefinitionById(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionById(t,r))}async __deleteFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteFeedbackDefinitionsBatch(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionsBatch(t,r))}async __deleteFeedbackDefinitionsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ba=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return h.fromPromise(this.__createGuardrails(t,r))}async __createGuardrails(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Lo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ya=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return h.fromPromise(this.__deleteLlmProviderApiKeysBatch(t,r))}async __deleteLlmProviderApiKeysBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findLlmProviderKeys(t){return h.fromPromise(this.__findLlmProviderKeys(t))}async __findLlmProviderKeys(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:um.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}storeLlmProviderApiKey(t,r){return h.fromPromise(this.__storeLlmProviderApiKey(t,r))}async __storeLlmProviderApiKey(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getLlmProviderApiKeyById(t,r){return h.fromPromise(this.__getLlmProviderApiKeyById(t,r))}async __getLlmProviderApiKeyById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:bt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateLlmProviderApiKey(t,r={},o){return h.fromPromise(this.__updateLlmProviderApiKey(t,r,o))}async __updateLlmProviderApiKey(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:no.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new X(i.error.body,i.rawResponse);case 403:throw new $(ee.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var za=class{constructor(t={}){this._options=t;}evaluateSpans(t,r){return h.fromPromise(this.__evaluateSpans(t,r))}async __evaluateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:yt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateThreads(t,r){return h.fromPromise(this.__evaluateThreads(t,r))}async __evaluateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/threads"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:yt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/threads.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateTraces(t,r){return h.fromPromise(this.__evaluateTraces(t,r))}async __evaluateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:yt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ka=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return h.fromPromise(this.__receiveProtobufTraces(t))}async __receiveProtobufTraces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Sa=class{constructor(t={}){this._options=t;}cancelStudioOptimizations(t,r){return h.fromPromise(this.__cancelStudioOptimizations(t,r))}async __cancelStudioOptimizations(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/cancel`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Me(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/cancel.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findOptimizations(t={},r){return h.fromPromise(this.__findOptimizations(t,r))}async __findOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:aa.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new A(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return h.fromPromise(this.__createOptimization(t,r))}async __createOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ia.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}upsertOptimization(t,r){return h.fromPromise(this.__upsertOptimization(t,r))}async __upsertOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ia.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return h.fromPromise(this.__deleteOptimizationsById(t,r))}async __deleteOptimizationsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findStudioOptimizations(t={},r){return h.fromPromise(this.__findStudioOptimizations(t,r))}async __findStudioOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations/studio"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:aa.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new A(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getOptimizationById(t,r){return h.fromPromise(this.__getOptimizationById(t,r))}async __getOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateOptimizationsById(t,r={},o){return h.fromPromise(this.__updateOptimizationsById(t,r,o))}async __updateOptimizationsById(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:so.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getStudioOptimizationById(t,r){return h.fromPromise(this.__getStudioOptimizationById(t,r))}async __getStudioOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getStudioOptimizationLogs(t,r){return h.fromPromise(this.__getStudioOptimizationLogs(t,r))}async __getStudioOptimizationLogs(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Wm.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/logs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var xa=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Vm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return h.fromPromise(this.__getProjectById(t,r))}async __getProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:St.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteProjectById(t,r){return h.fromPromise(this.__deleteProjectById(t,r))}async __deleteProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProject(t,r={},o){return h.fromPromise(this.__updateProject(t,r,o))}async __updateProject(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:co.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteProjectsBatch(t,r){return h.fromPromise(this.__deleteProjectsBatch(t,r))}async __deleteProjectsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNamesByProjectIds(t={},r){return h.fromPromise(this.__findFeedbackScoreNamesByProjectIds(t,r))}async __findFeedbackScoreNamesByProjectIds(t={},r){var l,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Jm.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getProjectMetrics(t,r={},o){return h.fromPromise(this.__getProjectMetrics(t,r,o))}async __getProjectMetrics(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}/metrics`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:lo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Qm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getProjectStats(t={},r){return h.fromPromise(this.__getProjectStats(t,r))}async __getProjectStats(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Zm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}retrieveProject(t,r){return h.fromPromise(this.__retrieveProject(t,r))}async __retrieveProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:td.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var _a=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return h.fromPromise(this.__getPrompts(t,r))}async __getPrompts(t={},r){var w,k;let{page:o,size:i,name:a,sorting:l,filters:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.sorting=l),d!=null&&(u.filters=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:hd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createPrompt(t,r){return h.fromPromise(this.__createPrompt(t,r))}async __createPrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return h.fromPromise(this.__createPromptVersion(t,r))}async __createPromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:go.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ld.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePrompt(t,r,o){return h.fromPromise(this.__updatePrompt(t,r,o))}async __updatePrompt(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:wo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePrompt(t,r){return h.fromPromise(this.__deletePrompt(t,r))}async __deletePrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePromptsBatch(t,r){return h.fromPromise(this.__deletePromptsBatch(t,r))}async __deletePromptsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersionById(t,r){return h.fromPromise(this.__getPromptVersionById(t,r))}async __getPromptVersionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/versions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersions(t,r={},o){return h.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:gd.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}restorePromptVersion(t,r,o){return h.fromPromise(this.__restorePromptVersion(t,r,o))}async __restorePromptVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions/${encodeURIComponent(r)}/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:he.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new A(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/{promptId}/versions/{versionId}/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}retrievePromptVersion(t,r){return h.fromPromise(this.__retrievePromptVersion(t,r))}async __retrievePromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:fo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Aa=class{constructor(t={}){this._options=t;}getServiceToggles(t){return h.fromPromise(this.__getServiceToggles(t))}async __getServiceToggles(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Rd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ta=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return h.fromPromise(this.__addSpanComment(t,r,o))}async __addSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addSpanFeedbackScore(t,r,o){return h.fromPromise(this.__addSpanFeedbackScore(t,r,o))}async __addSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createSpans(t,r){return h.fromPromise(this.__createSpans(t,r))}async __createSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:bo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateSpans(t,r){return h.fromPromise(this.__batchUpdateSpans(t,r))}async __batchUpdateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpansByProject(t={},r){return h.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var Yd,Zd;let{page:o,size:i,projectName:a,projectId:l,traceId:d,type:u,filters:g,truncate:w,stripAttachments:k,sorting:S,exclude:x,fromTime:T,toTime:B}=t,O={};o!=null&&(O.page=o.toString()),i!=null&&(O.size=i.toString()),a!=null&&(O.project_name=a),l!=null&&(O.project_id=l),d!=null&&(O.trace_id=d),u!=null&&(O.type=Bi.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(O.filters=g),w!=null&&(O.truncate=w.toString()),k!=null&&(O.strip_attachments=k.toString()),S!=null&&(O.sorting=S),x!=null&&(O.exclude=x),T!=null&&(O.from_time=T.toISOString()),B!=null&&(O.to_time=B.toISOString());let G=await b({url:y((Zd=(Yd=await n.get(this._options.baseUrl))!=null?Yd:await n.get(this._options.environment))!=null?Zd:R.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(G.ok)return {data:Sd.parseOrThrow(G.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:G.rawResponse};if(G.error.reason==="status-code")throw new p({statusCode:G.error.statusCode,body:G.error.body,rawResponse:G.rawResponse});switch(G.error.reason){case "non-json":throw new p({statusCode:G.error.statusCode,body:G.error.rawBody,rawResponse:G.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:G.error.errorMessage,rawResponse:G.rawResponse})}}createSpan(t,r){return h.fromPromise(this.__createSpan(t,r))}async __createSpan(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ro.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpanById(t,r={},o){return h.fromPromise(this.__getSpanById(t,r,o))}async __getSpanById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:At.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 404:throw new _(l.error.body,l.rawResponse);default:throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteSpanById(t,r){return h.fromPromise(this.__deleteSpanById(t,r))}async __deleteSpanById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Me(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpan(t,r,o){return h.fromPromise(this.__updateSpan(t,r,o))}async __updateSpan(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:yo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteSpanComments(t,r){return h.fromPromise(this.__deleteSpanComments(t,r))}async __deleteSpanComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanFeedbackScore(t,r,o){return h.fromPromise(this.__deleteSpanFeedbackScore(t,r,o))}async __deleteSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findFeedbackScoreNames1(t={},r){return h.fromPromise(this.__findFeedbackScoreNames1(t,r))}async __findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,a={};o!=null&&(a.project_id=o),i!=null&&(a.type=Li.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:cr.findFeedbackScoreNames1.Response.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getSpanComment(t,r,o){return h.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpanStats(t={},r){return h.fromPromise(this.__getSpanStats(t,r))}async __getSpanStats(t={},r){var S,x;let{projectId:o,projectName:i,traceId:a,type:l,filters:d,fromTime:u,toTime:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.project_name=i),a!=null&&(w.trace_id=a),l!=null&&(w.type=Vi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),d!=null&&(w.filters=d),u!=null&&(w.from_time=u.toISOString()),g!=null&&(w.to_time=g.toISOString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:Ze.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}scoreBatchOfSpans(t,r){return h.fromPromise(this.__scoreBatchOfSpans(t,r))}async __scoreBatchOfSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchSpans(t={},r){return h.fromPromise(this.__searchSpans(t,r))}async __searchSpans(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ko.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpanComment(t,r,o){return h.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ea=class{constructor(t={}){this._options=t;}addThreadComment(t,r,o){return h.fromPromise(this.__addThreadComment(t,r,o))}async __addThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceComment(t,r,o){return h.fromPromise(this.__addTraceComment(t,r,o))}async __addTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceFeedbackScore(t,r,o){return h.fromPromise(this.__addTraceFeedbackScore(t,r,o))}async __addTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createTraces(t,r){return h.fromPromise(this.__createTraces(t,r))}async __createTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:xo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateTraces(t,r){return h.fromPromise(this.__batchUpdateTraces(t,r))}async __batchUpdateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateThreads(t,r){return h.fromPromise(this.__batchUpdateThreads(t,r))}async __batchUpdateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Eo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}closeTraceThread(t={},r){return h.fromPromise(this.__closeTraceThread(t,r))}async __closeTraceThread(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/close"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/close.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTracesByProject(t={},r){return h.fromPromise(this.__getTracesByProject(t,r))}async __getTracesByProject(t={},r){var O,G;let{page:o,size:i,projectName:a,projectId:l,filters:d,truncate:u,stripAttachments:g,sorting:w,exclude:k,fromTime:S,toTime:x}=t,T={};o!=null&&(T.page=o.toString()),i!=null&&(T.size=i.toString()),a!=null&&(T.project_name=a),l!=null&&(T.project_id=l),d!=null&&(T.filters=d),u!=null&&(T.truncate=u.toString()),g!=null&&(T.strip_attachments=g.toString()),w!=null&&(T.sorting=w),k!=null&&(T.exclude=k),S!=null&&(T.from_time=S.toISOString()),x!=null&&(T.to_time=x.toISOString());let B=await b({url:y((G=(O=await n.get(this._options.baseUrl))!=null?O:await n.get(this._options.environment))!=null?G:R.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(B.ok)return {data:jd.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")throw new p({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse});switch(B.error.reason){case "non-json":throw new p({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createTrace(t,r){return h.fromPromise(this.__createTrace(t,r))}async __createTrace(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:So.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceById(t,r={},o){return h.fromPromise(this.__getTraceById(t,r,o))}async __getTraceById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Et.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteTraceById(t,r){return h.fromPromise(this.__deleteTraceById(t,r))}async __deleteTraceById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTrace(t,r,o){return h.fromPromise(this.__updateTrace(t,r,o))}async __updateTrace(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_o.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteThreadComments(t,r){return h.fromPromise(this.__deleteThreadComments(t,r))}async __deleteThreadComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteThreadFeedbackScores(t,r){return h.fromPromise(this.__deleteThreadFeedbackScores(t,r))}async __deleteThreadFeedbackScores(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/feedback-scores/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceComments(t,r){return h.fromPromise(this.__deleteTraceComments(t,r))}async __deleteTraceComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceFeedbackScore(t,r,o){return h.fromPromise(this.__deleteTraceFeedbackScore(t,r,o))}async __deleteTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:xt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceThreads(t,r){return h.fromPromise(this.__deleteTraceThreads(t,r))}async __deleteTraceThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Co.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraces(t,r){return h.fromPromise(this.__deleteTraces(t,r))}async __deleteTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames2(t={},r){return h.fromPromise(this.__findFeedbackScoreNames2(t,r))}async __findFeedbackScoreNames2(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:We.findFeedbackScoreNames2.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findTraceThreadsFeedbackScoreNames(t={},r){return h.fromPromise(this.__findTraceThreadsFeedbackScoreNames(t,r))}async __findTraceThreadsFeedbackScoreNames(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/threads/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:We.findTraceThreadsFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getTraceStats(t={},r){return h.fromPromise(this.__getTraceStats(t,r))}async __getTraceStats(t={},r){var w,k;let{projectId:o,projectName:i,filters:a,fromTime:l,toTime:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),a!=null&&(u.filters=a),l!=null&&(u.from_time=l.toISOString()),d!=null&&(u.to_time=d.toISOString());let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Ze.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getThreadComment(t,r,o){return h.fromPromise(this.__getThreadComment(t,r,o))}async __getThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/{threadId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceComment(t,r,o){return h.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThread(t,r){return h.fromPromise(this.__getTraceThread(t,r))}async __getTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:na.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Pt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceThreads(t={},r){return h.fromPromise(this.__getTraceThreads(t,r))}async __getTraceThreads(t={},r){var B,O;let{page:o,size:i,projectName:a,projectId:l,truncate:d,stripAttachments:u,filters:g,sorting:w,fromTime:k,toTime:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.project_name=a),l!=null&&(x.project_id=l),d!=null&&(x.truncate=d.toString()),u!=null&&(x.strip_attachments=u.toString()),g!=null&&(x.filters=g),w!=null&&(x.sorting=w),k!=null&&(x.from_time=k.toISOString()),S!=null&&(x.to_time=S.toISOString());let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:Id.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse});switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}openTraceThread(t,r){return h.fromPromise(this.__openTraceThread(t,r))}async __openTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/open"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:na.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/open.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfThreads(t,r){return h.fromPromise(this.__scoreBatchOfThreads(t,r))}async __scoreBatchOfThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfTraces(t,r){return h.fromPromise(this.__scoreBatchOfTraces(t,r))}async __scoreBatchOfTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraceThreads(t={},r){return h.fromPromise(this.__searchTraceThreads(t,r))}async __searchTraceThreads(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraces(t={},r){return h.fromPromise(this.__searchTraces(t,r))}async __searchTraces(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 401:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateThread(t,r,o){return h.fromPromise(this.__updateThread(t,r,o))}async __updateThread(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:To.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/{threadModelId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateThreadComment(t,r,o){return h.fromPromise(this.__updateThreadComment(t,r,o))}async __updateThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateTraceComment(t,r,o){return h.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Pa=class{constructor(t={}){this._options=t;}getWelcomeWizardStatus(t){return h.fromPromise(this.__getWelcomeWizardStatus(t))}async __getWelcomeWizardStatus(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/welcome-wizard"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Ud.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/welcome-wizard.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}submitWelcomeWizard(t={},r){return h.fromPromise(this.__submitWelcomeWizard(t,r))}async __submitWelcomeWizard(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/welcome-wizard"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/welcome-wizard.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var va=class{constructor(t={}){this._options=t;}costsSummary(t,r){return h.fromPromise(this.__costsSummary(t,r))}async __costsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:er.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceConfiguration(t){return h.fromPromise(this.__getWorkspaceConfiguration(t))}async __getWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:vt.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new _(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertWorkspaceConfiguration(t,r){return h.fromPromise(this.__upsertWorkspaceConfiguration(t,r))}async __upsertWorkspaceConfiguration(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/configurations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:vt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/workspaces/configurations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteWorkspaceConfiguration(t){return h.fromPromise(this.__deleteWorkspaceConfiguration(t))}async __deleteWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new _(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCost(t,r){return h.fromPromise(this.__getCost(t,r))}async __getCost(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:sa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMetric(t,r){return h.fromPromise(this.__getMetric(t,r))}async __getMetric(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:sa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}metricsSummary(t,r){return h.fromPromise(this.__metricsSummary(t,r))}async __metricsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Dd.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ca=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return h.fromPromise(this.__datasetsRedirect(t,r))}async __datasetsRedirect(t,r){var u,g;let{datasetId:o,workspaceName:i,path:a}=t,l={};l.dataset_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new A(d.error.body,d.rawResponse);case 404:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}experimentsRedirect(t,r){return h.fromPromise(this.__experimentsRedirect(t,r))}async __experimentsRedirect(t,r){var g,w;let{datasetId:o,experimentId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.experiment_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new A(u.error.body,u.rawResponse);case 404:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}optimizationsRedirect(t,r){return h.fromPromise(this.__optimizationsRedirect(t,r))}async __optimizationsRedirect(t,r){var g,w;let{datasetId:o,optimizationId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.optimization_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new A(u.error.body,u.rawResponse);case 404:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/optimizations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}projectsRedirect(t,r){return h.fromPromise(this.__projectsRedirect(t,r))}async __projectsRedirect(t,r){var u,g;let{traceId:o,workspaceName:i,path:a}=t,l={};l.trace_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new A(d.error.body,d.rawResponse);case 404:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ct=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new pa(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new ca(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new la(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new ma(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new da(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ua(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new ga(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new wa(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new fa(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new ha(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new Ra(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new ba(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new ya(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new za(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new ka(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new Sa(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new xa(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new _a(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Aa(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Ta(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Ea(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new Pa(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new va(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ca(this._options)}isAlive(t){return h.fromPromise(this.__isAlive(t))}async __isAlive(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return h.fromPromise(this.__version(t))}async __version(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var q=()=>v7();var Ia=class s{constructor(t,r){this.data=t;this.opik=r;this.childSpans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=t=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...t};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...t},this};this.span=t=>{var a;let r=(a=this.data.projectName)!=null?a:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.traceId,parentSpanId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new s(o,this.opik);return this.childSpans.push(i),i};}};var ja=class{constructor(t,r){this.data=t;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=t=>{var a,l;let r=(l=(a=this.data.projectName)!=null?a:t.projectName)!=null?l:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new Ia(o,this.opik);return this.spans.push(i),i};this.update=t=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...t};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var fg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Ua={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},qh=s=>Object.entries(s).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%26/g,"&").replace(/%3F/g,"?").replace(/%3D/g,"="),eR=s=>s.replace(/\/api$/,""),rR=s=>Buffer.from(s).toString("base64"),hg=(s,t,r)=>{let o=qh(r),i=`${t}?${o}`;return new URL(i,s).toString()},Rg=({datasetId:s,experimentId:t,baseUrl:r})=>hg(r,fg.EXPERIMENTS,{[Ua.EXPERIMENT_ID]:t,[Ua.DATASET_ID]:s,[Ua.PATH]:rR(r)});var bg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=eR(r),i=`${t}/${fg.PROJECT_BY_NAME}`;return hg(o,i,{[Ua.PROJECT_NAME]:s})};var oR=300,Da=100,It=class{constructor({action:t,batchSize:r=Da,delay:o,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=(t,r)=>{if(this.queue.set(t,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(t,r)=>{let o=this.queue.get(t);o&&(this.queue.set(t,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let t=new Map(this.queue);this.queue.clear(),z.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(z.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{z.error(`Failed to flush ${this.name}:`,r,t);}),await this.promise;};this.action=t,this.batchSize=r,this.delay=o,this.enableBatch=i,this.name=a;}},se=class{constructor({delay:t=oR,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Da,updateBatchSize:l=Da,deleteBatchSize:d=Da,name:u="BatchQueue"}={}){this.create=t=>{let r=this.getId(t);this.createQueue.add(r,t);};this.get=async t=>{let r=this.createQueue.queue.get(t);return r||this.getEntity(t)};this.update=(t,r)=>{if(this.createQueue.queue.get(t)){this.createQueue.update(t,r);return}this.updateQueue.add(t,r);};this.delete=t=>{if(this.createQueue.queue.has(t)){this.createQueue.queue.delete(t);return}this.deleteQueue.add(t);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=u,this.createQueue=new It({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new It({action:async g=>{await this.createQueue.flush();let w=Array.from(g.entries());for(let[k,S]of w)await this.updateEntity(k,S);},delay:t,enableBatch:o,batchSize:l,name:`${u}:updateQueue`}),this.deleteQueue=new It({action:async g=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(g.keys()));},delay:t,enableBatch:i,batchSize:d,name:`${u}:deleteQueue`});}};var Ma=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r},this.api.requestOptions);}async getEntity(r){return await this.api.spans.getSpanById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o,this.api.requestOptions);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o,this.api.requestOptions);}};var Na=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Fa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r},this.api.requestOptions);}async getEntity(r){return await this.api.traces.getTraceById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o,this.api.requestOptions);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r},this.api.requestOptions);}};var Oa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.traces.deleteTraceFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Wa=class extends Ct{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var Ba=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"DatasetBatchQueue"});this.api=r;}getId(r){return r.id||""}async createEntities(r){for(let o of r)await this.api.datasets.createDataset(o,this.api.requestOptions);}async getEntity(r){try{return await this.api.datasets.getDatasetById(r,this.api.requestOptions)}catch{return}}async updateEntity(r,o){await this.api.datasets.updateDataset(r,{name:o.name||"",visibility:o.visibility,description:o.description},this.api.requestOptions);}async deleteEntities(r){await this.api.datasets.deleteDatasetsBatch({ids:r},this.api.requestOptions);}};var Md=null;async function yg(){return Md||(Md=await tR()),Md}var jt=class s{constructor(t){let{id:r,traceId:o,spanId:i,source:a,...l}=t;this.id=r||q(),this.traceId=o,this.spanId=i,this.source=a||An.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=iR(t);return (await yg()).h32(r,43981).toString(16)}toApiModel(){return {id:this.id,traceId:this.traceId,spanId:this.spanId,source:this.source,data:this.getContent()}}static fromApiModel(t){return new s({id:t.id,traceId:t.traceId,spanId:t.spanId,source:t.source,...t.data})}};async function Pe(s,t,r){var l;if(r===0)return [];let o=new TextDecoder("utf-8"),i=[],a="";try{for await(let d of s){a+=o.decode(d,{stream:!0});let u=a.split(`
4
- `);a=(l=u.pop())!=null?l:"";for(let g of u)if(!(!g.trim()||g==="{}"||g==="[]"||g==="null"))try{let w=JSON.parse(g),k=t.parse(w);if(k.ok){if(i.push(k.value),r!==void 0&&i.length>=r)return i}else z.error("Error parsing experiment item:",k.errors);}catch(w){z.error("Error parsing JSON line:",w instanceof Error?w.message:String(w));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let d=JSON.parse(a),u=t.parse(d);u.ok?i.push(u.value):z.error("Error parsing experiment item:",u.errors);}catch(d){z.error("Error parsing remaining buffer:",d instanceof Error?d.message:String(d));}}catch(d){z.error("Error processing stream:",d instanceof Error?d.message:String(d));}return i}function Ut(s,t){let r=[];for(let o=0;o<s.length;o+=t.maxBatchSize)r.push(s.slice(o,o+t.maxBatchSize));return r}var ne=class extends Error{constructor(t){var r;super(t.message),this.name=this.constructor.name,this.code=t.code,this.statusCode=t.statusCode,this.details=t.details,this.originalError=t.originalError,z.error(this.message),(r=Error.captureStackTrace)==null||r.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 zg={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,t)=>`Item at position ${s} is not an object (${t})`,INSERTION_FAILED:s=>`Failed to insert items from JSON: ${s}`,DATASET_JSON_PARSE_ERROR:s=>`Failed to parse JSON input: ${s}`};var nR={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID"},La=class extends ne{constructor(t){super({message:zg.DATASET_ITEM_MISSING_ID(t),code:nR.DATASET_ITEM_MISSING_ID});}};var sR={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Va=class extends ne{constructor(t){super({message:t,code:sR.SEARCH_TIMEOUT});}};var Ha={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,t)=>`Item at position ${s} is not an object (${t})`};var Nd={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},Ja=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Ha.JSON_PARSE_ERROR,code:Nd.JSON_PARSE_ERROR,originalError:r});}},Xa=class extends ne{constructor(t){super({message:Ha.JSON_NOT_ARRAY(t),code:Nd.JSON_NOT_ARRAY});}},Ka=class extends ne{constructor(t,r){super({message:Ha.JSON_ITEM_NOT_OBJECT(t,r),code:Nd.JSON_ITEM_NOT_OBJECT});}};var kr=class{constructor({name:t,description:r,id:o},i){this.opik=i;this.idToHash=new Map;this.hashes=new Set;this.id=o||q(),this.name=t,this.description=r;}async insert(t){if(!t||t.length===0)return;await this.opik.datasetBatchQueue.flush(),await this.syncHashes();let r=await this.getDeduplicatedItems(t),o=Ut(r,{maxBatchSize:1e3});try{let i=0;for(let a of o)await this.opik.api.datasets.createOrUpdateDatasetItems({datasetId:this.id,items:a}),i+=a.length,z.info(`Inserted ${Math.min(i,r.length)} of ${r.length} items into dataset ${this.id}`);}catch(i){throw z.error(`Error inserting items into dataset: ${i instanceof Error?i.message:String(i)}`),i}}async update(t){if(!(!t||t.length===0)){for(let r=0;r<t.length;r++)if(!t[r].id)throw new La(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Ut(t,{maxBatchSize:100});for await(let o of r){z.debug("Deleting dataset items batch",{batchSize:o.length,datasetId:this.id}),await this.opik.api.datasets.deleteDatasetItems({itemIds:o});for(let i of o)if(this.idToHash.has(i)){let a=this.idToHash.get(i);this.hashes.delete(a),this.idToHash.delete(i);}}}async clear(){let r=(await this.getItems()).map(o=>o.id).filter(Boolean);r.length!==0&&await this.delete(r);}async getItems(t,r){return (await this.getItemsAsDataclasses(t,r)).map(i=>i.getContent(true))}async getItemsAsDataclasses(t,r){let o=t?Math.min(t,2e3):2e3,i=await this.opik.api.datasets.streamDatasetItems({datasetName:this.name,lastRetrievedId:r,steamLimit:o});return (await Pe(i,C.DatasetItemPublic,t)).map(l=>jt.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new Ja(l)}if(!Array.isArray(i))throw new Xa(typeof i);if(i.length===0)return;for(let l=0;l<i.length;l++){let d=i[l];if(typeof d!="object"||d===null)throw new Ka(l,typeof d)}let a=i.map(l=>{let d=l,u={};for(let[g,w]of Object.entries(d)){if(o.includes(g))continue;let k=r[g]||g;u[k]=w;}return u});await this.insert(a);}async toJson(t={}){let o=(await this.getItems()).map(i=>{let a={...i};if(Object.keys(t).length>0){for(let[l,d]of Object.entries(t))if(l in a){let u=a[l];delete a[l],a[d]=u;}}return a});return iR(o)}async getDeduplicatedItems(t){let r=[];for(let o of t){let i=new jt(o),a=await i.contentHash();if(this.hashes.has(a)){z.debug("Duplicate item found - skipping",{contentHash:a,datasetId:this.id});continue}r.push(i.toApiModel()),this.hashes.add(a),this.idToHash.set(i.id,a);}return r}clearHashState(){this.idToHash.clear(),this.hashes.clear();}async syncHashes(){z.debug("Syncing dataset hashes with backend",{datasetId:this.id});try{let t=await this.getItemsAsDataclasses();this.clearHashState();for(let r of t){let o=await r.contentHash();this.idToHash.set(r.id,o),this.hashes.add(o);}z.debug("Dataset hash sync completed",{datasetId:this.id,itemCount:t.length});}catch(t){if(t instanceof p&&t.statusCode===404){z.debug("Dataset not found - starting with empty hash state",{datasetId:this.id}),this.clearHashState();return}throw t}}};var Fd=class extends Error{constructor(t){super(t),this.name="DatasetError";}},Dt=class extends Fd{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var Ga=class{constructor(t){if(!t.datasetItemId)throw new Error("datasetItemId is required");if(!t.traceId)throw new Error("traceId is required");this.datasetItemId=t.datasetItemId,this.traceId=t.traceId;}},$a=class s{constructor(t){this.id=t.id,this.datasetItemId=t.datasetItemId,this.traceId=t.traceId,this.datasetItemData=t.datasetItemData,this.evaluationTaskOutput=t.evaluationTaskOutput,this.feedbackScores=[...t.feedbackScores];}static fromRestExperimentItemCompare(t){var o,i;let r=(i=(o=t.feedbackScores)==null?void 0:o.map(a=>({categoryName:a.categoryName,name:a.name,reason:a.reason,value:a.value,source:a.source})))!=null?i:[];return new s({id:t.id,traceId:t.traceId,datasetItemId:t.datasetItemId,datasetItemData:t.input,evaluationTaskOutput:t.output,feedbackScores:r})}};var rr=class{constructor({id:t,name:r,datasetName:o,prompts:i},a){this.opik=a;this.id=t||q(),this._name=r,this.datasetName=o,this.prompts=i;}get name(){return this._name}async ensureNameLoaded(){if(this._name!==void 0)return this._name;let t=await this.opik.api.experiments.getExperimentById(this.id);if(this._name=t.name,!this._name)throw new Error("Experiment name is not loaded");return this._name}async insert(t){if(t.length===0)return;let r=t.map(i=>({id:q(),experimentId:this.id,datasetItemId:i.datasetItemId,traceId:i.traceId})),o=Ut(r,{maxBatchSize:50});try{for(let i of o)await this.opik.api.experiments.createExperimentItems({experimentItems:i});z.debug(`Inserted ${t.length} items into experiment ${this.id}`);}catch(i){throw z.error(`Error inserting items into experiment: ${i instanceof Error?i.message:String(i)}`),i}}async getItems(t){let r=[],{maxResults:i,truncate:a=false}=t||{},l,d=true;try{for(;d&&!(i!==void 0&&r.length>=i);){let u=i?Math.min(i-r.length,2e3):2e3,g=await this.opik.api.experiments.streamExperimentItems({experimentName:this.name,limit:u,lastRetrievedId:l,truncate:a});try{let w=await Pe(g,C.ExperimentItemCompare,u);if(w.length===0){d=!1;break}for(let k of w){let S=$a.fromRestExperimentItemCompare(k);if(r.push(S),i!==void 0&&r.length>=i){d=!1;break}}l=w[w.length-1].id;}catch(w){z.error("Error parsing experiment item: "+(w instanceof Error?w.message:String(w))),d=!1;break}}}catch(u){throw z.error("Error retrieving experiment items: "+(u instanceof Error?u.message:String(u))),u}return z.info(`Retrieved ${r.length} items${i?` (limited by maxResults=${i})`:""}`),r}async getUrl(){let t=await this.opik.getDataset(this.datasetName),r=this.opik.config.apiUrl||mn.apiUrl;return Rg({datasetId:t.id,experimentId:this.id,baseUrl:r})}};var Qa={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
+ import {c,d,g,e as e$1,f as f$1}from'./chunk-LAR62UGW.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import nu from'fs';import ww from'ini';import'dotenv/config';import mh from'qs';import {v7}from'uuid';import nR from'fast-json-stable-stringify';import aR from'xxhash-wasm';import {TextDecoder}from'util';import mR from'mustache';import gR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import hR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import rn from'chalk';import ER from'boxen';import PR from'ora';import {generateText,generateObject}from'ai';import {createOpenAI}from'@ai-sdk/openai';import {createAnthropic}from'@ai-sdk/anthropic';import {createGoogleGenerativeAI}from'@ai-sdk/google';import {z as z$1}from'zod';export{z}from'zod';var uw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Kt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),au=s=>{z.settings.minLevel=uw[s];},gw=()=>{z.settings.minLevel=100;};au(process.env.OPIK_LOG_LEVEL||"INFO");var fw="~/.opik.config",dn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function su(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function hw(){return su({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 Rw(){let s=process.env.OPIK_CONFIG_PATH||fw;if(!nu.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=ww.parse(nu.readFileSync(s,"utf8"));return t.opik?su({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return z.error(`Error loading config file ${s}: ${t}`),{}}}function pu(s){let t=hw(),r=Rw(),{headers:o,...i}=s||{};return bw({...dn,...r,...t,...i})}function bw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=yw(s.apiUrl);if(t&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(t&&!s.workspaceName)throw new Error("OPIK_WORKSPACE is not set");return s}function yw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>zw,AlertPublicAlertType:()=>Pw,AlertTriggerConfigPublicType:()=>Tw,AlertTriggerConfigType:()=>Sw,AlertTriggerConfigWriteType:()=>xw,AlertTriggerEventType:()=>kw,AlertTriggerPublicEventType:()=>Ew,AlertTriggerWriteEventType:()=>_w,AlertWriteAlertType:()=>Aw,AnnotationQueuePublicScope:()=>jw,AnnotationQueueScope:()=>Cw,AnnotationQueueWriteScope:()=>Iw,AssistantMessageRole:()=>Zw,AttachmentListRequestEntityType:()=>lu,BadRequestError:()=>_,CheckName:()=>yf,CheckPublicName:()=>ah,CheckPublicResult:()=>nh,CheckResult:()=>zf,ColumnCompareTypesItem:()=>pf,ColumnPublicTypesItem:()=>hf,ColumnTypesItem:()=>Rf,CompleteMultipartUploadRequestEntityType:()=>Uw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>Pu,DatasetItemCompareSource:()=>cf,DatasetItemFilterOperator:()=>ef,DatasetItemPublicSource:()=>wf,DatasetItemSource:()=>tf,DatasetItemWriteSource:()=>Tn,DatasetPublicStatus:()=>gf,DatasetPublicVisibility:()=>uf,DatasetStatus:()=>of,DatasetUpdateVisibility:()=>wu,DatasetVisibility:()=>rf,DatasetWriteVisibility:()=>gu,DeleteAttachmentsRequestEntityType:()=>Dw,DownloadAttachmentRequestEntityType:()=>mu,ExperimentItemCompareTraceVisibilityMode:()=>lf,ExperimentItemPublicTraceVisibilityMode:()=>ff,ExperimentItemTraceVisibilityMode:()=>af,ExperimentPublicStatus:()=>Tf,ExperimentPublicType:()=>Af,ExperimentStatus:()=>bf,ExperimentType:()=>En,ExperimentUpdateStatus:()=>bu,ExperimentUpdateType:()=>Ru,ExperimentWriteStatus:()=>hu,ExperimentWriteType:()=>fu,FeedbackScoreBatchItemSource:()=>ih,FeedbackScoreBatchItemThreadSource:()=>ch,FeedbackScoreCompareSource:()=>mf,FeedbackScoreExperimentItemBulkWriteViewSource:()=>Sf,FeedbackScorePublicSource:()=>rh,FeedbackScoreSource:()=>nf,FindFeedbackDefinitionsRequestType:()=>yu,FindFeedbackScoreNames1RequestType:()=>Cu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>Iu,GetSpansByProjectRequestType:()=>vu,GetWebhookExamplesRequestAlertType:()=>cu,GuardrailName:()=>Ef,GuardrailResult:()=>Pf,GuardrailWriteName:()=>vf,GuardrailWriteResult:()=>Cf,LlmAsJudgeMessagePublicRole:()=>Xw,LlmAsJudgeMessageRole:()=>Mw,LlmAsJudgeMessageWriteRole:()=>Bw,LlmAsJudgeOutputSchemaPublicType:()=>Kw,LlmAsJudgeOutputSchemaType:()=>Nw,LlmAsJudgeOutputSchemaWriteType:()=>Lw,LogItemLevel:()=>Yw,ManualEvaluationRequestEntityType:()=>Uf,NotFoundError:()=>A,NotImplementedError:()=>Ne,OptimizationPublicStatus:()=>Nf,OptimizationStatus:()=>Df,OptimizationUpdateStatus:()=>ku,OptimizationWriteStatus:()=>Mf,ProjectDetailedVisibility:()=>Lf,ProjectMetricRequestPublicInterval:()=>Au,ProjectMetricRequestPublicMetricType:()=>_u,ProjectMetricResponsePublicInterval:()=>Bf,ProjectMetricResponsePublicMetricType:()=>Wf,ProjectPublicVisibility:()=>Of,ProjectUpdateVisibility:()=>xu,ProjectVisibility:()=>Ff,ProjectWriteVisibility:()=>Su,PromptDetailTemplateStructure:()=>$f,PromptPublicTemplateStructure:()=>Zf,PromptTemplateStructure:()=>Hf,PromptType:()=>Vf,PromptVersionDetailTemplateStructure:()=>Gf,PromptVersionDetailType:()=>Kf,PromptVersionPublicTemplateStructure:()=>Yf,PromptVersionPublicType:()=>Qf,PromptVersionTemplateStructure:()=>Xf,PromptVersionType:()=>Jf,PromptWriteTemplateStructure:()=>Eu,PromptWriteType:()=>Tu,ProviderApiKeyProvider:()=>jf,ProviderApiKeyPublicProvider:()=>If,ProviderApiKeyWriteProvider:()=>zu,ResponseFormatType:()=>qw,SpanExperimentItemBulkWriteViewType:()=>xf,SpanFilterOperator:()=>Fw,SpanFilterPublicOperator:()=>Gw,SpanFilterWriteOperator:()=>Vw,SpanPublicType:()=>oh,SpanSearchStreamRequestPublicType:()=>ju,SpanType:()=>fe,SpanUpdateType:()=>qf,SpanWriteType:()=>eh,StartMultipartUploadRequestEntityType:()=>du,TraceFilterOperator:()=>Ow,TraceFilterPublicOperator:()=>$w,TraceFilterWriteOperator:()=>Hw,TracePublicVisibilityMode:()=>sh,TraceThreadFilterOperator:()=>Ww,TraceThreadFilterPublicOperator:()=>Qw,TraceThreadFilterWriteOperator:()=>Jw,TraceThreadStatus:()=>ph,TraceVisibilityMode:()=>kf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>uu,ValueEntryCompareSource:()=>df,ValueEntryExperimentItemBulkWriteViewSource:()=>_f,ValueEntryPublicSource:()=>th,ValueEntrySource:()=>sf,WebhookTestResultStatus:()=>vw,alerts:()=>Gt,annotationQueues:()=>gn,attachments:()=>$t,automationRuleEvaluators:()=>fn,chatCompletions:()=>hn,check:()=>wn,dashboards:()=>Rn,datasets:()=>Qt,experiments:()=>Yt,feedbackDefinitions:()=>Zt,guardrails:()=>bn,llmProviderKey:()=>qt,manualEvaluation:()=>yn,openTelemetryIngestion:()=>zn,optimizations:()=>ei,projects:()=>ri,prompts:()=>oi,redirect:()=>An,serviceToggles:()=>kn,spans:()=>ti,systemUsage:()=>un,traces:()=>Sn,welcomeWizard:()=>xn,workspaces:()=>_n});var Gt={};c(Gt,{GetWebhookExamplesRequestAlertType:()=>cu});var cu={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var $t={};c($t,{AttachmentListRequestEntityType:()=>lu,DownloadAttachmentRequestEntityType:()=>mu,StartMultipartUploadRequestEntityType:()=>du,UploadAttachmentRequestEntityType:()=>uu});var lu={Trace:"trace",Span:"span"};var mu={Trace:"trace",Span:"span"};var du={Trace:"trace",Span:"span"};var uu={Trace:"trace",Span:"span"};var Qt={};c(Qt,{DatasetUpdateVisibility:()=>wu,DatasetWriteVisibility:()=>gu});var gu={Private:"private",Public:"public"};var wu={Private:"private",Public:"public"};var Yt={};c(Yt,{ExperimentUpdateStatus:()=>bu,ExperimentUpdateType:()=>Ru,ExperimentWriteStatus:()=>hu,ExperimentWriteType:()=>fu});var fu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var hu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Ru={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var bu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Zt={};c(Zt,{FindFeedbackDefinitionsRequestType:()=>yu});var yu={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var qt={};c(qt,{ProviderApiKeyWriteProvider:()=>zu});var zu={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var ei={};c(ei,{OptimizationUpdateStatus:()=>ku});var ku={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var ri={};c(ri,{ProjectMetricRequestPublicInterval:()=>Au,ProjectMetricRequestPublicMetricType:()=>_u,ProjectUpdateVisibility:()=>xu,ProjectWriteVisibility:()=>Su});var Su={Private:"private",Public:"public"};var xu={Private:"private",Public:"public"};var _u={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"};var Au={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var oi={};c(oi,{CreatePromptVersionDetailTemplateStructure:()=>Pu,PromptWriteTemplateStructure:()=>Eu,PromptWriteType:()=>Tu});var Tu={Mustache:"mustache",Jinja2:"jinja2"};var Eu={Text:"text",Chat:"chat"};var Pu={Text:"text",Chat:"chat"};var ti={};c(ti,{FindFeedbackScoreNames1RequestType:()=>Cu,GetSpanStatsRequestType:()=>Iu,GetSpansByProjectRequestType:()=>vu,SpanSearchStreamRequestPublicType:()=>ju});var vu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Cu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Iu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ju={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var un={};var gn={};var wn={};var fn={};var hn={};var Rn={};var bn={};var yn={};var zn={};var kn={};var Sn={};var xn={};var _n={};var An={};var zw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var kw={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 Sw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var xw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var _w={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 Aw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Tw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Ew={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 Pw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var vw={Success:"success",Failure:"failure"};var Cw={Trace:"trace",Thread:"thread"};var Iw={Trace:"trace",Thread:"thread"};var jw={Trace:"trace",Thread:"thread"};var Uw={Trace:"trace",Span:"span"};var Dw={Trace:"trace",Span:"span"};var Mw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Nw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Fw={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 Ow={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 Ww={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 Bw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Lw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Vw={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 Hw={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 Jw={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 Xw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Kw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Gw={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 $w={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 Qw={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 Yw={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Zw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var qw={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var ef={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 rf={Private:"private",Public:"public"};var of={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var tf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var af={Default:"default",Hidden:"hidden"};var nf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Tn={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var pf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var cf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var lf={Default:"default",Hidden:"hidden"};var mf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var df={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var uf={Private:"private",Public:"public"};var gf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var wf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var ff={Default:"default",Hidden:"hidden"};var hf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Rf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var En={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var bf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var yf={Topic:"TOPIC",Pii:"PII"};var zf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var kf={Default:"default",Hidden:"hidden"};var Sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var xf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var _f={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Af={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Tf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Ef={Topic:"TOPIC",Pii:"PII"};var Pf={Passed:"passed",Failed:"failed"};var vf={Topic:"TOPIC",Pii:"PII"};var Cf={Passed:"passed",Failed:"failed"};var If={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var jf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var Uf={Trace:"trace",Thread:"thread",Span:"span"};var Df={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Mf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Nf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Ff={Private:"private",Public:"public"};var Of={Private:"private",Public:"public"};var Wf={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"};var Bf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Lf={Private:"private",Public:"public"};var Vf={Mustache:"mustache",Jinja2:"jinja2"};var Hf={Text:"text",Chat:"chat"};var Jf={Mustache:"mustache",Jinja2:"jinja2"};var Xf={Text:"text",Chat:"chat"};var Kf={Mustache:"mustache",Jinja2:"jinja2"};var Gf={Text:"text",Chat:"chat"};var $f={Text:"text",Chat:"chat"};var Qf={Mustache:"mustache",Jinja2:"jinja2"};var Yf={Text:"text",Chat:"chat"};var Zf={Text:"text",Chat:"chat"};var qf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var oh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var th={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ih={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ah={Topic:"TOPIC",Pii:"PII"};var nh={Passed:"passed",Failed:"failed"};var sh={Default:"default",Hidden:"hidden"};var ph={Active:"active",Inactive:"inactive"};var ch={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ae=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(lh({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function lh({message:s,statusCode:t,body:r}){let o=[];return s!=null&&o.push(s),t!=null&&o.push(`Status code: ${t.toString()}`),r!=null&&o.push(`Body: ${Ae(r,void 0,2)}`),o.join(`
2
+ `)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var _=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var M=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var W=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var A=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var $=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var Ne=class s extends p{constructor(t,r){super({message:"NotImplementedError",statusCode:501,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var R={Default:"http://localhost:5173/api"};var Er;typeof globalThis.Headers!="undefined"?Er=globalThis.Headers:Er=class Uu{constructor(t){if(this.headers=new Map,t)if(t instanceof Uu)t.forEach((r,o)=>this.append(o,r));else if(Array.isArray(t))for(let[r,o]of t)if(typeof r=="string"&&typeof o=="string")this.append(r,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,o]of Object.entries(t))if(typeof o=="string")this.append(r,o);else throw new TypeError("Header values must be strings")}append(t,r){let o=t.toLowerCase(),i=this.headers.get(o)||[];this.headers.set(o,[...i,r]);}delete(t){let r=t.toLowerCase();this.headers.delete(r);}get(t){let r=t.toLowerCase(),o=this.headers.get(r);return o?o.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let o=t.toLowerCase();this.headers.set(o,[r]);}forEach(t,r){let o=r?t.bind(r):t;this.headers.forEach((i,a)=>o(i.join(", "),a,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield [t,r.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let t of this.headers.values())yield t.join(", ");}[Symbol.iterator](){return this.entries()}};var ii={headers:new Er,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},ai={headers:new Er,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function ni(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Du(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${mh.stringify(t,{arrayFormat:"repeat"})}`:s}var m=dh();function dh(){var u,g,w,k,S;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((u=globalThis==null?void 0:globalThis.navigator)==null?void 0:u.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((g=self.constructor)==null?void 0:g.name)==="DedicatedWorkerGlobalScope"||((w=self.constructor)==null?void 0:w.name)==="ServiceWorkerGlobalScope"||((k=self.constructor)==null?void 0:k.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((S=process.versions)!=null&&S.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Mu(){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?fetch:m.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function Nu({body:s,type:t}){return t.includes("json")?Ae(s):s}async function Fu(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await import('./Node18UniversalStreamWrapper-B4QPIQXU.js')).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await import('./UndiciStreamWrapper-U3LH5M6P.js')).UndiciStreamWrapper(s):new(await import('./NodePre18StreamWrapper-ZXNXS6Y3.js')).NodePre18StreamWrapper(s)}async function Ou(s,t){if(s.body!=null&&t==="blob")return await s.blob();if(s.body!=null&&t==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&t==="sse")return s.body;if(s.body!=null&&t==="streaming")return Fu(s.body);if(s.body!=null&&t==="text")return await s.text();{let r=await s.text();if(r.length>0)try{return JSON.parse(r)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:r}}}else return}}var uh="timeout";function Wu(s){let t=new AbortController,r=setTimeout(()=>t.abort(uh),s);return {signal:t.signal,abortId:r}}function Bu(...s){let t=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of t){if(o.aborted){r.abort(o==null?void 0:o.reason);break}o.addEventListener("abort",()=>r.abort(o==null?void 0:o.reason),{signal:r.signal});}return r.signal}var Lu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:T}=Wu(a);w=T,g.push(x);}l!=null&&g.push(l);let k=Bu(g),S=await s(t,{method:r,headers:o,body:i,signal:k,credentials:d?"include":void 0,duplex:u});return w!=null&&clearTimeout(w),S};function gh(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Vu(s,t=2){let r=await s();for(let o=0;o<t&&([408,429].includes(r.status)||r.status>=500);++o){let i=Math.min(1e3*Math.pow(2,o),6e4),a=gh(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function wh(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[a,l]of Object.entries(s.headers))l!=null&&(t[a]=l);let r=Du(s.url,s.queryParameters),o=await Nu({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await Mu();try{let a=await Vu(async()=>Lu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Ou(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:ni(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:ni(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ii}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:ii}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:ai}:{ok:false,error:{reason:"unknown",errorMessage:Ae(a)},rawResponse:ai}}}var b=wh;var n={get:async s=>typeof s=="function"?s():s};var h=class s extends Promise{constructor(t){super(r=>{r(void 0);}),this.innerPromise=t;}static fromFunction(t,...r){return new s(t(...r))}static interceptFunction(t){return (...r)=>s.fromPromise(t(...r))}static fromPromise(t){return new s(t)}static fromExecutor(t){let r=new Promise(t);return new s(r)}static fromResult(t){let r=Promise.resolve(t);return new s(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};function In(s){return typeof s=="object"&&s!=null&&"name"in s}function jn(s){return typeof s=="object"&&s!=null&&"path"in s}function Un(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Hu(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new Pn:m.type==="node"?s=new vn:s=new Cn,await s.setup(),s}var Pn=class{async setup(){this.fd=new(await import('formdata-node')).FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var i,a;o=this.getFileName(r,o),r instanceof Blob?(i=this.fd)==null||i.append(t,r,o):(a=this.fd)==null||a.append(t,{type:void 0,name:o,[Symbol.toStringTag]:"File",stream(){return r}});}async getRequest(){let t=new(await import('form-data-encoder')).FormDataEncoder(this.fd);return {body:(await import('readable-stream')).Readable.from(t),headers:t.headers,duplex:"half"}}},vn=class{async setup(){this.fd=new(await import('./form_data-PYZPT4AA.js')).default;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var a,l;o=this.getFileName(r,o);let i;r instanceof Blob?i=Buffer.from(await r.arrayBuffer()):i=r,o==null?(a=this.fd)==null||a.append(t,i):(l=this.fd)==null||l.append(t,i,{filename:o});}getRequest(){return {body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}},Cn=class{async setup(){this.fd=new FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var i,a;if(o=this.getFileName(r,o),r instanceof Blob){(i=this.fd)==null||i.append(t,r,o);return}(a=this.fd)==null||a.append(t,new Blob([r]),o);}getRequest(){return {body:this.fd,headers:{}}}};var e={};c(e,{JsonError:()=>ir,ParseError:()=>ar,any:()=>ag,bigint:()=>Xu,boolean:()=>ng,booleanLiteral:()=>ig,date:()=>Ku,discriminant:()=>wg,enum_:()=>pi,getObjectLikeUtils:()=>le,getObjectUtils:()=>Fe,getSchemaUtils:()=>U,isProperty:()=>Ee,lazy:()=>Gu,lazyObject:()=>rg,list:()=>li,number:()=>sg,object:()=>ci,objectWithoutOptionalProperties:()=>eg,optional:()=>Dn,property:()=>Qu,record:()=>mg,set:()=>dg,string:()=>pg,stringLiteral:()=>tg,transform:()=>Mn,undiscriminatedUnion:()=>gg,union:()=>hg,unknown:()=>cg,withParsedProperties:()=>Fn});var E={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function j(s,t){return `Expected ${t}. Received ${fh(s)}.`}function fh(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 K(s){return {...s,json:Ju(s.json),parse:Ju(s.parse)}}function Ju(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
3
+ `)),{ok:true,value:t}):o}}function si(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ir=class s extends Error{constructor(r){super(r.map(si).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var ar=class s extends Error{constructor(r){super(r.map(si).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>hh(s),optional:()=>Dn(s),optionalNullable:()=>Rh(s),transform:t=>Mn(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new ar(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new ir(o.errors)}}}function hh(s){let t={parse:(r,o)=>r==null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.NULLABLE};return {...t,...U(t)}}function Dn(s){let t={parse:(r,o)=>r==null?{ok:true,value:void 0}:s.parse(r,o),json:(r,o)=>o!=null&&o.omitUndefined&&r===void 0?{ok:true,value:void 0}:r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL};return {...t,...U(t)}}function Rh(s){let t={parse:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL_NULLABLE};return {...t,...U(t)}}function Mn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);return a.ok?{ok:true,value:t.transform(a.value)}:a},json:(o,i)=>{let a=t.untransform(o);return s.json(a,i)},getType:()=>s.getType()};return {...r,...U(r)}}function Xu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:true,value:t}:typeof t=="number"?{ok:true,value:BigInt(t)}:{ok:false,errors:[{path:r,message:j(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:j(t,"bigint")}]}:{ok:true,value:t},getType:()=>E.BIGINT};return {...K(s),...U(s)}}var bh=/^([+-]?\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 Ku(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:bh.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:j(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:j(t,"Date object")}]},getType:()=>E.DATE};return {...K(s),...U(s)}}function Q(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...K(r),...U(r)}}}function pi(s){let t=new Set(s);return Q(E.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:a,message:j(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:a,message:j(o,"enum")}]}:{ok:true,value:o})()}function Gu(s){let t=Nn(s);return {...t,...U(t)}}function Nn(s){return {parse:(t,r)=>nr(s).parse(t,r),json:(t,r)=>nr(s).json(t,r),getType:()=>nr(s).getType()}}function nr(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function Pr(s){return Object.entries(s)}function vr(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,a])=>(r.has(i)&&(o[i]=a),o),{})}function Te(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t}function Cr(s){return Object.keys(s)}function $u(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function le(s){return {withParsedProperties:t=>Fn(s,t)}}function Fn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);if(!a.ok)return a;let l=Object.entries(t).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(a.value):g}),{});return {ok:true,value:{...a.value,...l}}},json:(o,i)=>{var d;if(!Te(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:j(o,"object")}]};let a=new Set(Object.keys(t)),l=vr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Qu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Ee(s){return s.isProperty}function ci(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Ee(o)?o.rawKey:r),_getParsedProperties:()=>Cr(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of Pr(s)){let u=Ee(d)?d.rawKey:l,g=Ee(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,qu(g)&&a.push(u);}return Yu({value:r,requiredKeys:a,getProperty:l=>{let d=i[l];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var g;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(g=o==null?void 0:o.breadcrumbsPrefix)!=null?g:[],l]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},json:(r,o)=>{let i=[];for(let[a,l]of Pr(s)){let d=Ee(l)?l.valueSchema:l;qu(d)&&i.push(a);}return Yu({value:r,requiredKeys:i,getProperty:a=>{let l=s[a];if(l!=null)return Ee(l)?{transformedKey:l.rawKey,transform:d=>{var u;return l.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}:{transformedKey:a,transform:d=>{var u;return l.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},getType:()=>E.OBJECT};return {...K(t),...U(t),...le(t),...Fe(t)}}function Yu({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Te(s))return {ok:false,errors:[{path:a,message:j(s,"object")}]};let l=new Set(t),d=[],u={};for(let[g,w]of Object.entries(s)){let k=r(g);if(k!=null){l.delete(g);let S=k.transform(w);S.ok?u[k.transformedKey]=S.value:(u[g]=w,d.push(...S.errors));}else switch(o){case "fail":d.push({path:[...a,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=w;break}}return d.push(...t.filter(g=>l.has(g)).map(g=>({path:a,message:`Missing required key "${g}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function Fe(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Zu({extensionKeys:t._getRawProperties(),value:o,transformBase:a=>s.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(o,i)=>Zu({extensionKeys:t._getParsedProperties(),value:o,transformBase:a=>s.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>E.OBJECT};return {...r,...U(r),...le(r),...Fe(r)}},passthrough:()=>{let t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let i=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},json:(r,o)=>{let i=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},getType:()=>E.OBJECT};return {...t,...U(t),...le(t),...Fe(t)}}}}function Zu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=$u(Cr(t),g=>i.has(g)),d=r(vr(t,l)),u=o(vr(t,a));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function qu(s){return !yh(s)}function yh(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function eg(s){return ci(s)}function rg(s){let t={...Nn(s),_getRawProperties:()=>nr(s)._getRawProperties(),_getParsedProperties:()=>nr(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Fe(t)}}function li(s){let t={parse:(r,o)=>og(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>og(r,(i,a)=>{var l;return s.json(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),getType:()=>E.LIST};return {...K(t),...U(t)}}function og(s,t){return Array.isArray(s)?s.map((o,i)=>t(o,i)).reduce((o,i)=>{if(o.ok&&i.ok)return {ok:true,value:[...o.value,i.value]};let a=[];return o.ok||a.push(...o.errors),i.ok||a.push(...i.errors),{ok:false,errors:a}},{ok:true,value:[]}):{ok:false,errors:[{message:j(s,"list"),path:[]}]}}function tg(s){return Q(E.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`"${s}"`)}]})()}function ig(s){return Q(E.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`${s.toString()}`)}]})()}var ag=Q(E.ANY,s=>({ok:true,value:s}));var ng=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var sg=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var pg=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var cg=Q(E.UNKNOWN,s=>({ok:true,value:s}));function mg(s,t){let r={parse:(o,i)=>lg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.parse(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.parse(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>lg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.json(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.json(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>E.RECORD};return {...K(r),...U(r)}}function lg({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Te(s)?Pr(s).reduce((a,[l,d])=>{if(d===void 0)return a;let u=a,g=l;if(t){let x=l.length>0?Number(l):NaN;isNaN(x)||(g=x);}let w=r(g),k=o(d,g);if(u.ok&&w.ok&&k.ok)return {ok:true,value:{...u.value,[w.value]:k.value}};let S=[];return u.ok||S.push(...u.errors),w.ok||S.push(...w.errors),k.ok||S.push(...k.errors),{ok:false,errors:S}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:j(s,"object")}]}}function dg(s){let t=li(s),r={parse:(o,i)=>{let a=t.parse(o,i);return a.ok?{ok:true,value:new Set(a.value)}:a},json:(o,i)=>{var l;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],message:j(o,"Set")}]}},getType:()=>E.SET};return {...K(r),...U(r)}}function gg(s){let t={parse:(r,o)=>ug((i,a)=>i.parse(r,a),s,o),json:(r,o)=>ug((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function ug(s,t,r){let o=[];for(let[i,a]of t.entries()){let l=s(a,{...r,skipValidation:false});if(l.ok)return l;for(let d of l.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function wg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function hg(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=pi(Cr(t)),a={parse:(l,d)=>fg({value:l,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(l,d)=>fg({value:l,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>E.UNION};return {...K(a),...U(a),...le(a)}}function fg({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!Te(s))return {ok:false,errors:[{path:d,message:j(s,"object")}]};let{[t]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let w=o(u);if(!w.ok)return {ok:false,errors:w.errors};let k=i(w.value);if(k==null)return a?{ok:true,value:{[r]:w.value,...g}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let S=l(g,k);return S.ok?{ok:true,value:{[r]:u,...S.value}}:S}function zh(s){var t=[];if(s.length===0)return "";if(typeof s[0]!="string")throw new TypeError("Url must be a string. Received "+s[0]);if(s[0].match(/^[^/:]+:\/*$/)&&s.length>1){var r=s.shift();s[0]=r+s[0];}s[0].match(/^file:\/\/\//)?s[0]=s[0].replace(/^([^/:]+):\/*/,"$1:///"):s[0]=s[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<s.length;o++){var i=s[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<s.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i));}var a=t.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var l=a.split("?");return a=l.shift()+(l.length>0?"?":"")+l.join("&"),a}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),zh(s)}var C={};c(C,{AggregationData:()=>vl,Alert:()=>Th,AlertAlertType:()=>Cs,AlertPagePublic:()=>$s,AlertPublic:()=>Xo,AlertPublicAlertType:()=>Vs,AlertTrigger:()=>Ms,AlertTriggerConfig:()=>Ds,AlertTriggerConfigPublic:()=>Ks,AlertTriggerConfigPublicType:()=>Xs,AlertTriggerConfigType:()=>Us,AlertTriggerConfigWrite:()=>Fs,AlertTriggerConfigWriteType:()=>Ns,AlertTriggerEventType:()=>js,AlertTriggerPublic:()=>Gs,AlertTriggerPublicEventType:()=>Js,AlertTriggerWrite:()=>Ws,AlertTriggerWriteEventType:()=>Os,AlertWrite:()=>Jo,AlertWriteAlertType:()=>Bs,AnnotationQueue:()=>rp,AnnotationQueueBatch:()=>Ph,AnnotationQueueBatchWrite:()=>No,AnnotationQueueItemIds:()=>ea,AnnotationQueuePagePublic:()=>ip,AnnotationQueuePublic:()=>Ko,AnnotationQueuePublicScope:()=>op,AnnotationQueueReviewer:()=>ep,AnnotationQueueReviewerPublic:()=>tp,AnnotationQueueScope:()=>qs,AnnotationQueueUpdate:()=>Fo,AnnotationQueueWrite:()=>Mo,AnnotationQueueWriteScope:()=>fs,AssistantMessage:()=>zc,AssistantMessageRole:()=>yc,Attachment:()=>ap,AttachmentListRequestEntityType:()=>ui,AttachmentPage:()=>np,AudioUrl:()=>up,AudioUrlPublic:()=>$p,AudioUrlWrite:()=>Tp,AuthDetailsHolder:()=>mp,AutomationRuleEvaluator:()=>Ch,AutomationRuleEvaluatorLlmAsJudge:()=>yp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>tt,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Dp,AutomationRuleEvaluatorObjectObjectPublic:()=>sc,AutomationRuleEvaluatorPagePublic:()=>pc,AutomationRuleEvaluatorPublic:()=>cc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>_p,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>st,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Fp,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Ap,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>pt,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>Wp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>kp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>at,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Vp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>Sp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>nt,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Jp,AutomationRuleEvaluatorUpdate:()=>bc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>uc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>hc,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>Rc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>wc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>fc,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>gc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>zp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>it,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Kp,AutomationRuleEvaluatorWrite:()=>Gp,AvgValueStatPublic:()=>Qc,BatchDelete:()=>F,BatchDeleteByProject:()=>Yh,BiInformation:()=>As,BiInformationResponse:()=>lr,BooleanFeedbackDefinition:()=>Dl,BooleanFeedbackDefinitionCreate:()=>Ll,BooleanFeedbackDefinitionPublic:()=>ht,BooleanFeedbackDefinitionUpdate:()=>im,BooleanFeedbackDetail:()=>Ul,BooleanFeedbackDetailCreate:()=>Bl,BooleanFeedbackDetailPublic:()=>$l,BooleanFeedbackDetailUpdate:()=>tm,CategoricalFeedbackDefinition:()=>Nl,CategoricalFeedbackDefinitionCreate:()=>Hl,CategoricalFeedbackDefinitionPublic:()=>Rt,CategoricalFeedbackDefinitionUpdate:()=>nm,CategoricalFeedbackDetail:()=>Ml,CategoricalFeedbackDetailCreate:()=>Vl,CategoricalFeedbackDetailPublic:()=>Ql,CategoricalFeedbackDetailUpdate:()=>am,ChatCompletionChoice:()=>Sc,ChatCompletionRequest:()=>Wo,ChatCompletionResponse:()=>Tc,Check:()=>hl,CheckName:()=>wl,CheckPublic:()=>vd,CheckPublicName:()=>Ed,CheckPublicResult:()=>Pd,CheckResult:()=>fl,ChunkedOutputJsonNode:()=>Dh,ChunkedOutputJsonNodePublic:()=>Oh,ChunkedOutputJsonNodePublicType:()=>jl,ChunkedOutputJsonNodeType:()=>cl,Column:()=>sl,ColumnCompare:()=>Dc,ColumnCompareTypesItem:()=>Uc,ColumnPublic:()=>il,ColumnPublicTypesItem:()=>tl,ColumnTypesItem:()=>nl,Comment:()=>L,CommentCompare:()=>Mc,CommentPublic:()=>qe,CompleteMultipartUploadRequest:()=>ra,CompleteMultipartUploadRequestEntityType:()=>sp,CompletionTokensDetails:()=>_c,CountValueStatPublic:()=>Yc,CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Wi,DashboardPagePublic:()=>Ec,DashboardPublic:()=>Ze,DashboardUpdatePublic:()=>Lo,DashboardWrite:()=>Bo,DataPointDouble:()=>Zh,DataPointNumberPublic:()=>Gm,Dataset:()=>Ih,DatasetExpansion:()=>Uh,DatasetExpansionResponse:()=>jc,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItem:()=>lt,DatasetItemBatch:()=>jh,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemCompare:()=>Hc,DatasetItemCompareSource:()=>Nc,DatasetItemFilter:()=>Wn,DatasetItemFilterOperator:()=>On,DatasetItemPageCompare:()=>Jc,DatasetItemPagePublic:()=>al,DatasetItemPublic:()=>ut,DatasetItemPublicSource:()=>rl,DatasetItemSource:()=>Ic,DatasetItemStreamRequest:()=>Hr,DatasetItemUpdate:()=>Bn,DatasetItemWrite:()=>Dr,DatasetItemWriteSource:()=>Ln,DatasetItemsDelete:()=>Br,DatasetPagePublic:()=>$c,DatasetPublic:()=>fr,DatasetPublicStatus:()=>Kc,DatasetPublicVisibility:()=>Xc,DatasetStatus:()=>vc,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>bi,DatasetVersionCreatePublic:()=>Xr,DatasetVersionDiff:()=>ml,DatasetVersionDiffStats:()=>ll,DatasetVersionPagePublic:()=>dl,DatasetVersionPublic:()=>hr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionSummary:()=>Cc,DatasetVersionSummaryPublic:()=>Gc,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetVisibility:()=>Pc,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>Ri,DeleteAttachmentsRequest:()=>vh,DeleteAttachmentsRequestEntityType:()=>cp,DeleteFeedbackScore:()=>_t,DeleteIdsHolder:()=>Rr,DeleteThreadFeedbackScores:()=>Co,DeleteTraceThreads:()=>Io,Delta:()=>kc,DownloadAttachmentRequestEntityType:()=>gi,ErrorCountWithDeviation:()=>St,ErrorCountWithDeviationDetailed:()=>rd,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>qr,ErrorInfoPublic:()=>At,ErrorInfoWrite:()=>Ro,ErrorMessage:()=>ee,ErrorMessageDetail:()=>Gh,ErrorMessageDetailed:()=>Xh,ErrorMessagePublic:()=>Eh,Experiment:()=>Mh,ExperimentGroupAggregationsResponse:()=>Il,ExperimentGroupResponse:()=>Pl,ExperimentItem:()=>Qr,ExperimentItemBulkRecord:()=>zl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>ts,ExperimentItemBulkUpload:()=>Nh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemCompare:()=>Vc,ExperimentItemCompareTraceVisibilityMode:()=>Lc,ExperimentItemPublic:()=>dt,ExperimentItemPublicTraceVisibilityMode:()=>ol,ExperimentItemStreamRequest:()=>to,ExperimentItemTraceVisibilityMode:()=>$n,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentPagePublic:()=>_l,ExperimentPublic:()=>ft,ExperimentPublicStatus:()=>Sl,ExperimentPublicType:()=>kl,ExperimentScore:()=>ro,ExperimentScorePublic:()=>xl,ExperimentScoreWrite:()=>Jn,ExperimentStatus:()=>gl,ExperimentStreamRequestPublic:()=>io,ExperimentType:()=>ul,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>xi,ExperimentUpdateType:()=>Si,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>ki,ExperimentWriteType:()=>zi,ExportTraceServiceRequest:()=>Vh,Feedback:()=>Wh,FeedbackCreate:()=>Gl,FeedbackDefinitionPagePublic:()=>em,FeedbackObjectPublic:()=>ql,FeedbackPublic:()=>om,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>od,FeedbackScoreAveragePublic:()=>Le,FeedbackScoreBatch:()=>Et,FeedbackScoreBatchItem:()=>Td,FeedbackScoreBatchItemSource:()=>Ad,FeedbackScoreBatchItemThread:()=>gs,FeedbackScoreBatchItemThreadSource:()=>us,FeedbackScoreBatchThread:()=>jo,FeedbackScoreCompare:()=>Bc,FeedbackScoreCompareSource:()=>Fc,FeedbackScoreExperimentItemBulkWriteView:()=>os,FeedbackScoreExperimentItemBulkWriteViewSource:()=>qn,FeedbackScoreNames:()=>Km,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>zd,FeedbackScoreSource:()=>Xn,FeedbackUpdate:()=>lm,FindFeedbackDefinitionsRequestType:()=>Ti,FindFeedbackScoreNames1RequestType:()=>Vi,Function:()=>Oo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Hi,GetSpansByProjectRequestType:()=>Li,GetWebhookExamplesRequestAlertType:()=>mi,GroupContent:()=>Al,GroupContentWithAggregations:()=>Cl,GroupDetail:()=>Tl,GroupDetails:()=>El,Guardrail:()=>um,GuardrailBatch:()=>Bh,GuardrailBatchWrite:()=>Vo,GuardrailName:()=>mm,GuardrailResult:()=>dm,GuardrailWrite:()=>_s,GuardrailWriteName:()=>Ss,GuardrailWriteResult:()=>xs,GuardrailsValidation:()=>Rl,GuardrailsValidationPublic:()=>Cd,IdsHolder:()=>Fh,ImageUrl:()=>fp,ImageUrlPublic:()=>Yp,ImageUrlWrite:()=>vp,JsonListString:()=>D,JsonListStringCompare:()=>oa,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>ns,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>ys,LlmAsJudgeCode:()=>Go,LlmAsJudgeCodePublic:()=>rc,LlmAsJudgeCodeWrite:()=>Up,LlmAsJudgeMessage:()=>He,LlmAsJudgeMessageContent:()=>Rp,LlmAsJudgeMessageContentPublic:()=>qp,LlmAsJudgeMessageContentWrite:()=>Ip,LlmAsJudgeMessagePublic:()=>Qe,LlmAsJudgeMessagePublicRole:()=>Qp,LlmAsJudgeMessageRole:()=>wp,LlmAsJudgeMessageWrite:()=>Ke,LlmAsJudgeMessageWriteRole:()=>Pp,LlmAsJudgeModelParameters:()=>Ve,LlmAsJudgeModelParametersPublic:()=>$e,LlmAsJudgeModelParametersWrite:()=>Xe,LlmAsJudgeOutputSchema:()=>Je,LlmAsJudgeOutputSchemaPublic:()=>Ye,LlmAsJudgeOutputSchemaPublicType:()=>ec,LlmAsJudgeOutputSchemaType:()=>bp,LlmAsJudgeOutputSchemaWrite:()=>Ge,LlmAsJudgeOutputSchemaWriteType:()=>jp,LogItem:()=>mc,LogItemLevel:()=>lc,LogPage:()=>dc,ManualEvaluationRequest:()=>kt,ManualEvaluationRequestEntityType:()=>hm,ManualEvaluationResponse:()=>zt,Message:()=>hs,MultipartUploadPart:()=>pp,NumericalFeedbackDefinition:()=>Ol,NumericalFeedbackDefinitionCreate:()=>Xl,NumericalFeedbackDefinitionPublic:()=>bt,NumericalFeedbackDefinitionUpdate:()=>pm,NumericalFeedbackDetail:()=>Fl,NumericalFeedbackDetailCreate:()=>Jl,NumericalFeedbackDetailPublic:()=>Yl,NumericalFeedbackDetailUpdate:()=>sm,Optimization:()=>Hh,OptimizationPagePublic:()=>na,OptimizationPublic:()=>br,OptimizationPublicStatus:()=>Um,OptimizationStatus:()=>Rm,OptimizationStudioConfig:()=>_m,OptimizationStudioConfigPublic:()=>Bm,OptimizationStudioConfigWrite:()=>Im,OptimizationStudioLog:()=>Lm,OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>Ci,OptimizationWrite:()=>aa,OptimizationWriteStatus:()=>jm,PageColumns:()=>pl,PercentageValueStatPublic:()=>Zc,PercentageValues:()=>xe,PercentageValuesDetailed:()=>td,PercentageValuesPublic:()=>mt,Project:()=>Jh,ProjectDetailed:()=>ad,ProjectDetailedVisibility:()=>id,ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Mi,ProjectMetricRequestPublicMetricType:()=>Di,ProjectMetricResponsePublic:()=>Zm,ProjectMetricResponsePublicInterval:()=>Qm,ProjectMetricResponsePublicMetricType:()=>$m,ProjectPagePublic:()=>Jm,ProjectPublic:()=>xt,ProjectPublicVisibility:()=>Hm,ProjectRetrieveDetailed:()=>mo,ProjectStatItemObjectPublic:()=>el,ProjectStatsPublic:()=>Pe,ProjectStatsSummary:()=>ed,ProjectStatsSummaryItem:()=>qm,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>Ui,ProjectVisibility:()=>Vm,ProjectWrite:()=>po,ProjectWriteVisibility:()=>ji,Prompt:()=>Kh,PromptDetail:()=>dd,PromptDetailTemplateStructure:()=>md,PromptPagePublic:()=>bd,PromptPublic:()=>Rd,PromptPublicTemplateStructure:()=>hd,PromptTemplateStructure:()=>sd,PromptTokensDetails:()=>xc,PromptType:()=>nd,PromptUpdatable:()=>fo,PromptVersion:()=>ld,PromptVersionBatchUpdate:()=>wo,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>ps,PromptVersionDetailType:()=>ss,PromptVersionLink:()=>ta,PromptVersionLinkPublic:()=>ia,PromptVersionLinkWrite:()=>Ai,PromptVersionPagePublic:()=>fd,PromptVersionPublic:()=>wd,PromptVersionPublicTemplateStructure:()=>gd,PromptVersionPublicType:()=>ud,PromptVersionRetrieveDetail:()=>ho,PromptVersionTemplateStructure:()=>cd,PromptVersionType:()=>pd,PromptVersionUpdate:()=>cs,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Oi,PromptWriteType:()=>Fi,ProviderApiKey:()=>Lh,ProviderApiKeyPagePublic:()=>wm,ProviderApiKeyProvider:()=>fm,ProviderApiKeyPublic:()=>yt,ProviderApiKeyPublicProvider:()=>gm,ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Pi,ResponseFormat:()=>zs,ResponseFormatType:()=>bs,Result:()=>er,ResultsNumberPublic:()=>Ym,ScoreName:()=>Xm,ServiceTogglesConfig:()=>yd,Span:()=>wt,SpanBatch:()=>$h,SpanBatchUpdate:()=>ko,SpanBatchWrite:()=>yo,SpanEnrichmentOptions:()=>Vn,SpanExperimentItemBulkWriteView:()=>Zn,SpanExperimentItemBulkWriteViewType:()=>Yn,SpanFilter:()=>Se,SpanFilterOperator:()=>xp,SpanFilterPublic:()=>We,SpanFilterPublicOperator:()=>ds,SpanFilterWrite:()=>rt,SpanFilterWriteOperator:()=>Mp,SpanLlmAsJudgeCode:()=>Zo,SpanLlmAsJudgeCodePublic:()=>ac,SpanLlmAsJudgeCodeWrite:()=>Np,SpanPagePublic:()=>_d,SpanPublic:()=>Tt,SpanPublicType:()=>xd,SpanSearchStreamRequestPublic:()=>So,SpanSearchStreamRequestPublicType:()=>Ji,SpanType:()=>yl,SpanUpdate:()=>zo,SpanUpdateType:()=>ms,SpanUserDefinedMetricPythonCode:()=>qo,SpanUserDefinedMetricPythonCodePublic:()=>nc,SpanUserDefinedMetricPythonCodeWrite:()=>Op,SpanWrite:()=>bo,SpanWriteType:()=>ls,SpansCountResponse:()=>Es,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>wi,StartMultipartUploadResponse:()=>lp,StreamOptions:()=>Rs,StudioEvaluation:()=>Sm,StudioEvaluationPublic:()=>Om,StudioEvaluationWrite:()=>vm,StudioLlmModel:()=>zm,StudioLlmModelPublic:()=>Nm,StudioLlmModelWrite:()=>Em,StudioMessage:()=>bm,StudioMessagePublic:()=>Dm,StudioMessageWrite:()=>Am,StudioMetric:()=>km,StudioMetricPublic:()=>Fm,StudioMetricWrite:()=>Pm,StudioOptimizer:()=>xm,StudioOptimizerPublic:()=>Wm,StudioOptimizerWrite:()=>Cm,StudioPrompt:()=>ym,StudioPromptPublic:()=>Mm,StudioPromptWrite:()=>Tm,Tool:()=>ks,ToolCall:()=>ct,Trace:()=>gt,TraceBatch:()=>Qh,TraceBatchUpdate:()=>To,TraceBatchWrite:()=>_o,TraceCountResponse:()=>vs,TraceEnrichmentOptions:()=>Hn,TraceExperimentItemBulkWriteView:()=>Qn,TraceFilter:()=>ke,TraceFilterOperator:()=>gp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>is,TraceFilterWrite:()=>et,TraceFilterWriteOperator:()=>Ep,TracePagePublic:()=>Dd,TracePublic:()=>Pt,TracePublicVisibilityMode:()=>Id,TraceSearchStreamRequestPublic:()=>Do,TraceThread:()=>vt,TraceThreadBatchIdentifier:()=>vo,TraceThreadBatchUpdate:()=>Po,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>ws,TraceThreadFilterPublic:()=>Oe,TraceThreadFilterPublicOperator:()=>as,TraceThreadFilterWrite:()=>ot,TraceThreadFilterWriteOperator:()=>Bp,TraceThreadIdentifier:()=>sa,TraceThreadLlmAsJudgeCode:()=>Qo,TraceThreadLlmAsJudgeCodePublic:()=>tc,TraceThreadLlmAsJudgeCodeWrite:()=>Lp,TraceThreadPage:()=>Ud,TraceThreadSearchStreamRequest:()=>Uo,TraceThreadStatus:()=>jd,TraceThreadUpdate:()=>Eo,TraceThreadUserDefinedMetricPythonCode:()=>Yo,TraceThreadUserDefinedMetricPythonCodePublic:()=>ic,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Hp,TraceUpdate:()=>Ao,TraceVisibilityMode:()=>bl,TraceWrite:()=>xo,UploadAttachmentRequestEntityType:()=>fi,Usage:()=>Ac,UserDefinedMetricPythonCode:()=>$o,UserDefinedMetricPythonCodePublic:()=>oc,UserDefinedMetricPythonCodeWrite:()=>Xp,ValueEntry:()=>Gn,ValueEntryCompare:()=>Wc,ValueEntryCompareSource:()=>Oc,ValueEntryExperimentItemBulkWriteView:()=>rs,ValueEntryExperimentItemBulkWriteViewSource:()=>es,ValueEntryPublic:()=>Sd,ValueEntryPublicSource:()=>kd,ValueEntrySource:()=>Kn,VideoUrl:()=>hp,VideoUrlPublic:()=>Zp,VideoUrlWrite:()=>Cp,Webhook:()=>Is,WebhookExamples:()=>Qs,WebhookPublic:()=>Hs,WebhookTestResult:()=>Zs,WebhookTestResultStatus:()=>Ys,WebhookWrite:()=>Ls,WelcomeWizardSubmission:()=>Ho,WelcomeWizardTracking:()=>Md,WorkspaceConfiguration:()=>Ct,WorkspaceMetricRequest:()=>qh,WorkspaceMetricResponse:()=>pa,WorkspaceMetricsSummaryRequest:()=>zr,WorkspaceMetricsSummaryResponse:()=>Nd,WorkspaceNameHolder:()=>dp,WorkspaceSpansCount:()=>Ts,WorkspaceTraceCount:()=>Ps,alerts:()=>di,annotationQueues:()=>$i,attachments:()=>sr,chatCompletions:()=>Qi,dashboards:()=>Yi,datasets:()=>yi,experiments:()=>pr,feedbackDefinitions:()=>Ei,guardrails:()=>Zi,llmProviderKey:()=>vi,optimizations:()=>Ii,projects:()=>Ni,prompts:()=>Bi,spans:()=>cr,traces:()=>Be,welcomeWizard:()=>qi});var di={};c(di,{GetWebhookExamplesRequestAlertType:()=>mi});var mi=e.enum_(["general","slack","pagerduty"]);var sr={};c(sr,{AttachmentListRequestEntityType:()=>ui,DownloadAttachmentRequestEntityType:()=>gi,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>wi,UploadAttachmentRequestEntityType:()=>fi,uploadAttachment:()=>hi});var ui=e.enum_(["trace","span"]);var gi=e.enum_(["trace","span"]);var wi=e.enum_(["trace","span"]);var fi=e.enum_(["trace","span"]);var hi={};c(hi,{Request:()=>kh});var kh=e.record(e.string(),e.unknown());var Ir=e.object({fileName:e.property("file_name",e.string()),numOfFileParts:e.property("num_of_file_parts",e.number()),mimeType:e.property("mime_type",e.string().optional()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",wi),entityId:e.property("entity_id",e.string()),path:e.string()});var yi={};c(yi,{CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemStreamRequest:()=>Hr,DatasetItemsDelete:()=>Br,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>bi,DatasetVersionCreatePublic:()=>Xr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>Ri});var Ri=e.enum_(["private","public"]);var bi=e.enum_(["private","public"]);var On=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Wn=e.object({field:e.string().optional(),operator:On.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Bn=e.object({input:e.string().optional(),expectedOutput:e.property("expected_output",e.string().optional()),metadata:v.optional(),data:v.optional(),tags:e.list(e.string()).optional()});var jr=e.object({ids:e.list(e.string()).optional(),filters:e.list(Wn).optional(),update:Bn,mergeTags:e.property("merge_tags",e.boolean().optional())});var Ur=e.object({id:e.string().optional(),name:e.string(),visibility:Ri.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Ln=e.enum_(["manual","trace","span","sdk"]);var Dr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ln,data:v,tags:e.list(e.string()).optional()});var Mr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Dr)});var Vn=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Nr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Vn)});var Hn=e.object({includeSpans:e.boolean().optional(),includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Fr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Hn)});var Or=e.object({name:e.string(),description:e.string().optional(),visibility:bi.optional(),tags:e.list(e.string()).optional()});var Wr=e.object({datasetName:e.property("dataset_name",e.string())});var Br=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Lr=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Vr=e.object({datasetName:e.property("dataset_name",e.string())});var Hr=e.object({datasetName:e.property("dataset_name",e.string()),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),steamLimit:e.property("steam_limit",e.number().optional())});var Jr=e.object({tag:e.string()});var Xr=e.object({tags:e.list(e.string()).optional(),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional()});var Kr=e.object({versionRef:e.property("version_ref",e.string())});var Gr=e.object({changeDescription:e.property("change_description",e.string().optional()),tagsToAdd:e.property("tags_to_add",e.list(e.string()).optional())});var pr={};c(pr,{ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemStreamRequest:()=>to,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentStreamRequestPublic:()=>io,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>xi,ExperimentUpdateType:()=>Si,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>ki,ExperimentWriteType:()=>zi,findFeedbackScoreNames:()=>_i});var zi=e.enum_(["regular","trial","mini-batch"]);var ki=e.enum_(["running","completed","cancelled"]);var Si=e.enum_(["regular","trial","mini-batch"]);var xi=e.enum_(["running","completed","cancelled"]);var _i={};c(_i,{Response:()=>Sh});var Sh=e.list(e.string());var te=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Jn=e.object({name:e.string(),value:e.number()});var Ai=e.object({id:e.string()});var $r=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:zi.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:ki.optional(),experimentScores:e.property("experiment_scores",e.list(Jn).optional()),promptVersion:e.property("prompt_version",Ai.optional()),promptVersions:e.property("prompt_versions",e.list(Ai).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Xn=e.enum_(["ui","sdk","online_scoring"]);var Kn=e.enum_(["ui","sdk","online_scoring"]);var Gn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Kn.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Y=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Xn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Gn).optional())});var L=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $n=e.enum_(["default","hidden"]);var Qr=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:D.optional(),output:D.optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",$n.optional())});var Yr=e.object({experimentItems:e.property("experiment_items",e.list(Qr))});var Zr=e.object({ids:e.list(e.string())});var me=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var qr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Qn=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Yn=e.enum_(["general","tool","llm","guardrail"]);var Zn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Yn.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var qn=e.enum_(["ui","sdk","online_scoring"]);var es=e.enum_(["ui","sdk","online_scoring"]);var rs=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:es.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var os=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:qn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),rs).optional())});var ts=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Qn.optional(),spans:e.list(Zn).optional(),feedbackScores:e.property("feedback_scores",e.list(os).optional())});var eo=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(ts)});var ro=e.object({name:e.string(),value:e.number()});var oo=e.object({name:e.string().optional(),metadata:v.optional(),type:Si.optional(),status:xi.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional())});var to=e.object({experimentName:e.property("experiment_name",e.string()),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var io=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var Ei={};c(Ei,{FindFeedbackDefinitionsRequestType:()=>Ti});var Ti=e.enum_(["numerical","categorical","boolean"]);var vi={};c(vi,{ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Pi});var Pi=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var ao=e.object({provider:Pi,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var no=e.object({apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var Ii={};c(Ii,{OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>Ci});var Ci=e.enum_(["running","completed","cancelled","initialized","error"]);var so=e.object({name:e.string().optional(),status:Ci.optional()});var Ni={};c(Ni,{ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Mi,ProjectMetricRequestPublicMetricType:()=>Di,ProjectRetrieveDetailed:()=>mo,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>Ui,ProjectWrite:()=>po,ProjectWriteVisibility:()=>ji});var ji=e.enum_(["private","public"]);var Ui=e.enum_(["private","public"]);var Di=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Mi=e.enum_(["HOURLY","DAILY","WEEKLY"]);var po=e.object({name:e.string(),visibility:ji.optional(),description:e.string().optional()});var co=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Ui.optional()});var is=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:is.optional(),key:e.string().optional(),value:e.string().optional()});var as=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Oe=e.object({field:e.string().optional(),operator:as.optional(),key:e.string().optional(),value:e.string().optional()});var lo=e.object({metricType:e.property("metric_type",Di.optional()),interval:Mi.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional()),traceFilters:e.property("trace_filters",e.list(be).optional()),threadFilters:e.property("thread_filters",e.list(Oe).optional())});var mo=e.object({name:e.string()});var Bi={};c(Bi,{CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Wi,PromptUpdatable:()=>fo,PromptVersionBatchUpdate:()=>wo,PromptVersionRetrieveDetail:()=>ho,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Oi,PromptWriteType:()=>Fi});var Fi=e.enum_(["mustache","jinja2"]);var Oi=e.enum_(["text","chat"]);var Wi=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var uo=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:ie.optional(),changeDescription:e.property("change_description",e.string().optional()),type:Fi.optional(),templateStructure:e.property("template_structure",Oi.optional()),tags:e.list(e.string()).optional()});var ns=e.record(e.string(),e.unknown());var ss=e.enum_(["mustache","jinja2"]);var ps=e.enum_(["text","chat"]);var he=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:ns.optional(),type:ss.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",ps.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var go=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",Wi.optional())});var cs=e.object({tags:e.list(e.string()).optional()});var wo=e.object({ids:e.list(e.string()),update:cs,mergeTags:e.property("merge_tags",e.boolean().optional())});var fo=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var ho=e.object({name:e.string(),commit:e.string().optional()});var cr={};c(cr,{FindFeedbackScoreNames1RequestType:()=>Vi,GetSpanStatsRequestType:()=>Hi,GetSpansByProjectRequestType:()=>Li,SpanBatchUpdate:()=>ko,SpanBatchWrite:()=>yo,SpanSearchStreamRequestPublic:()=>So,SpanSearchStreamRequestPublicType:()=>Ji,findFeedbackScoreNames1:()=>Xi});var Li=e.enum_(["general","tool","llm","guardrail"]);var Vi=e.enum_(["general","tool","llm","guardrail"]);var Hi=e.enum_(["general","tool","llm","guardrail"]);var Ji=e.enum_(["general","tool","llm","guardrail"]);var Xi={};c(Xi,{Response:()=>xh});var xh=e.list(e.string());var ls=e.enum_(["general","tool","llm","guardrail"]);var Ro=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var bo=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:ls.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Ro.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var yo=e.object({spans:e.list(bo)});var ms=e.enum_(["general","tool","llm","guardrail"]);var ye=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:ms.optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),errorInfo:e.property("error_info",ye.optional())});var ko=e.object({ids:e.list(e.string()),update:zo,mergeTags:e.property("merge_tags",e.boolean().optional())});var ds=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var We=e.object({field:e.string().optional(),operator:ds.optional(),key:e.string().optional(),value:e.string().optional()});var So=e.object({traceId:e.property("trace_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),type:Ji.optional(),filters:e.list(We).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional(),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Be={};c(Be,{DeleteThreadFeedbackScores:()=>Co,DeleteTraceThreads:()=>Io,FeedbackScoreBatchThread:()=>jo,TraceBatchUpdate:()=>To,TraceBatchWrite:()=>_o,TraceSearchStreamRequestPublic:()=>Do,TraceThreadBatchIdentifier:()=>vo,TraceThreadBatchUpdate:()=>Po,TraceThreadSearchStreamRequest:()=>Uo,findFeedbackScoreNames2:()=>Ki,findTraceThreadsFeedbackScoreNames:()=>Gi});var Ki={};c(Ki,{Response:()=>_h});var _h=e.list(e.string());var Gi={};c(Gi,{Response:()=>Ah});var Ah=e.list(e.string());var xo=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Ro.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var _o=e.object({traces:e.list(xo)});var Ao=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),threadId:e.property("thread_id",e.string().optional())});var To=e.object({ids:e.list(e.string()),update:Ao,mergeTags:e.property("merge_tags",e.boolean().optional())});var Eo=e.object({tags:e.list(e.string()).optional()});var Po=e.object({ids:e.list(e.string()),update:Eo,mergeTags:e.property("merge_tags",e.boolean().optional())});var vo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()).optional())});var Co=e.object({projectName:e.property("project_name",e.string()),threadId:e.property("thread_id",e.string()),names:e.list(e.string()),author:e.string().optional()});var Io=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()))});var us=e.enum_(["ui","sdk","online_scoring"]);var gs=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:us,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var jo=e.object({scores:e.list(gs)});var ws=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:ws.optional(),key:e.string().optional(),value:e.string().optional()});var Uo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(de).optional(),lastRetrievedThreadModelId:e.property("last_retrieved_thread_model_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Do=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(be).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var $i={};c($i,{AnnotationQueueBatchWrite:()=>No,AnnotationQueueUpdate:()=>Fo});var fs=e.enum_(["trace","thread"]);var Mo=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:fs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var No=e.object({annotationQueues:e.property("annotation_queues",e.list(Mo))});var Fo=e.object({name:e.string().optional(),description:e.string().optional(),instructions:e.string().optional(),commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Qi={};c(Qi,{ChatCompletionRequest:()=>Wo});var hs=e.record(e.string(),e.unknown());var Rs=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var bs=e.enum_(["text","json_object","json_schema"]);var ys=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var zs=e.object({type:bs.optional(),jsonSchema:e.property("json_schema",ys.optional())});var Oo=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ks=e.object({type:e.stringLiteral("function").optional(),function:Oo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Wo=e.object({model:e.string().optional(),messages:e.list(hs).optional(),temperature:e.number().optional(),topP:e.property("top_p",e.number().optional()),n:e.number().optional(),stream:e.boolean().optional(),streamOptions:e.property("stream_options",Rs.optional()),stop:e.list(e.string()).optional(),maxTokens:e.property("max_tokens",e.number().optional()),maxCompletionTokens:e.property("max_completion_tokens",e.number().optional()),presencePenalty:e.property("presence_penalty",e.number().optional()),frequencyPenalty:e.property("frequency_penalty",e.number().optional()),logitBias:e.property("logit_bias",e.record(e.string(),e.number()).optional()),user:e.string().optional(),responseFormat:e.property("response_format",zs.optional()),seed:e.number().optional(),tools:e.list(ks).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),store:e.boolean().optional(),metadata:e.record(e.string(),e.string()).optional(),reasoningEffort:e.property("reasoning_effort",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional()),functions:e.list(Oo).optional(),functionCall:e.property("function_call",ze.optional())});var Yi={};c(Yi,{DashboardUpdatePublic:()=>Lo,DashboardWrite:()=>Bo});var Bo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Lo=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var Zi={};c(Zi,{GuardrailBatchWrite:()=>Vo});var Ss=e.enum_(["TOPIC","PII"]);var xs=e.enum_(["passed","failed"]);var _s=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:Ss,result:xs,config:v,details:v});var Vo=e.object({guardrails:e.list(_s)});var qi={};c(qi,{WelcomeWizardSubmission:()=>Ho});var Ho=e.object({role:e.string().optional(),integrations:e.list(e.string()).optional(),email:e.string().optional(),joinBetaProgram:e.property("join_beta_program",e.boolean().optional())});var As=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var lr=e.object({biInformation:e.property("bi_information",e.list(As).optional())});var Ts=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Es=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Ts).optional())});var Ps=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var vs=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Ps).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Cs=e.enum_(["general","slack","pagerduty"]);var Is=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var js=e.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 Us=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ds=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Us,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ms=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",js),triggerConfigs:e.property("trigger_configs",e.list(Ds).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Th=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Cs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Is,triggers:e.list(Ms).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ns=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Fs=e.object({id:e.string().optional(),type:Ns,configValue:e.property("config_value",e.record(e.string(),e.string()).optional())});var Os=e.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 Ws=e.object({id:e.string().optional(),eventType:e.property("event_type",Os),triggerConfigs:e.property("trigger_configs",e.list(Fs).optional())});var Bs=e.enum_(["general","slack","pagerduty"]);var Ls=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional()});var Jo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Bs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ls,triggers:e.list(Ws).optional()});var F=e.object({ids:e.list(e.string())});var Vs=e.enum_(["general","slack","pagerduty"]);var Hs=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Js=e.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 Xs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ks=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Xs,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Gs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Js),triggerConfigs:e.property("trigger_configs",e.list(Ks).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Xo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Vs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Hs,triggers:e.list(Gs).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $s=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Xo).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Eh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Qs=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Ys=e.enum_(["success","failure"]);var Zs=e.object({status:Ys.optional(),statusCode:e.property("status_code",e.number().optional()),requestBody:e.property("request_body",e.string().optional()),errorMessage:e.property("error_message",e.string().optional())});var ea=e.object({ids:e.list(e.string())});var qs=e.enum_(["trace","thread"]);var ep=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var rp=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:qs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(ep).optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ph=e.object({annotationQueues:e.property("annotation_queues",e.list(rp))});var op=e.enum_(["trace","thread"]);var tp=e.object({username:e.string().optional(),status:e.number().optional()});var Le=e.object({name:e.string(),value:e.number()});var Ko=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:op,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(tp).optional(),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ip=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ko).optional(),sortableBy:e.list(e.string()).optional()});var ap=e.object({link:e.string().optional(),fileName:e.property("file_name",e.string()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string())});var np=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ap).optional(),sortableBy:e.list(e.string()).optional()});var sp=e.enum_(["trace","span"]);var pp=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var ra=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",sp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string().optional()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string().optional()),uploadId:e.property("upload_id",e.string()),uploadedFileParts:e.property("uploaded_file_parts",e.list(pp))});var cp=e.enum_(["trace","span"]);var vh=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",cp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var lp=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var mp=e.record(e.string(),e.unknown());var dp=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var up=e.object({url:e.string()});var gp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:gp.optional(),key:e.string().optional(),value:e.string().optional()});var Ve=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",v.optional())});var wp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var fp=e.object({url:e.string(),detail:e.string().optional()});var hp=e.object({url:e.string()});var Rp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",fp.optional()),videoUrl:e.property("video_url",hp.optional()),audioUrl:e.property("audio_url",up.optional())});var He=e.object({role:wp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Rp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var bp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:bp,description:e.string()});var Go=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var yp=e.object({filters:e.list(ke).optional(),code:Go.optional()});var $o=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var zp=e.object({filters:e.list(ke).optional(),code:$o.optional()});var Qo=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var kp=e.object({filters:e.list(de).optional(),code:Qo.optional()});var Yo=e.object({metric:e.string()});var Sp=e.object({filters:e.list(de).optional(),code:Yo.optional()});var xp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Se=e.object({field:e.string().optional(),operator:xp.optional(),key:e.string().optional(),value:e.string().optional()});var Zo=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var _p=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var qo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Ap=e.object({filters:e.list(Se).optional(),code:qo.optional()});var mr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),Ch=e.union("type",{llm_as_judge:yp.extend(mr),user_defined_metric_python:zp.extend(mr),trace_thread_llm_as_judge:kp.extend(mr),trace_thread_user_defined_metric_python:Sp.extend(mr),span_llm_as_judge:_p.extend(mr),span_user_defined_metric_python:Ap.extend(mr)}).transform({transform:s=>s,untransform:s=>s});var Tp=e.object({url:e.string()});var Ep=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var et=e.object({field:e.string().optional(),operator:Ep.optional(),key:e.string().optional(),value:e.string().optional()});var Xe=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",ie.optional())});var Pp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var vp=e.object({url:e.string(),detail:e.string().optional()});var Cp=e.object({url:e.string()});var Ip=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",vp.optional()),videoUrl:e.property("video_url",Cp.optional()),audioUrl:e.property("audio_url",Tp.optional())});var Ke=e.object({role:Pp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Ip).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var jp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:jp,description:e.string()});var Up=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Dp=e.object({filters:e.list(et).optional(),code:Up.optional()});var Mp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var rt=e.object({field:e.string().optional(),operator:Mp.optional(),key:e.string().optional(),value:e.string().optional()});var Np=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Fp=e.object({filters:e.list(rt).optional(),code:Np.optional()});var Op=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Wp=e.object({filters:e.list(rt).optional(),code:Op.optional()});var Bp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ot=e.object({field:e.string().optional(),operator:Bp.optional(),key:e.string().optional(),value:e.string().optional()});var Lp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var Vp=e.object({filters:e.list(ot).optional(),code:Lp.optional()});var Hp=e.object({metric:e.string()});var Jp=e.object({filters:e.list(ot).optional(),code:Hp.optional()});var Xp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Kp=e.object({filters:e.list(et).optional(),code:Xp.optional()});var dr=e.object({projectId:e.property("project_id",e.string()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),action:e.stringLiteral("evaluator")}),Gp=e.union("type",{llm_as_judge:Dp.extend(dr),user_defined_metric_python:Kp.extend(dr),trace_thread_llm_as_judge:Vp.extend(dr),trace_thread_user_defined_metric_python:Jp.extend(dr),span_llm_as_judge:Fp.extend(dr),span_user_defined_metric_python:Wp.extend(dr)}).transform({transform:s=>s,untransform:s=>s});var $p=e.object({url:e.string()});var $e=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",Z.optional())});var Qp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Yp=e.object({url:e.string(),detail:e.string().optional()});var Zp=e.object({url:e.string()});var qp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Yp.optional()),videoUrl:e.property("video_url",Zp.optional()),audioUrl:e.property("audio_url",$p.optional())});var Qe=e.object({role:Qp,content:e.string().optional(),contentArray:e.property("content_array",e.list(qp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var ec=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ye=e.object({name:e.string(),type:ec,description:e.string()});var rc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var tt=e.object({filters:e.list(be).optional(),code:rc.optional()});var oc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var it=e.object({filters:e.list(be).optional(),code:oc.optional()});var tc=e.object({model:$e,messages:e.list(Qe),schema:e.list(Ye)});var at=e.object({filters:e.list(Oe).optional(),code:tc.optional()});var ic=e.object({metric:e.string()});var nt=e.object({filters:e.list(Oe).optional(),code:ic.optional()});var ac=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var st=e.object({filters:e.list(We).optional(),code:ac.optional()});var nc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var pt=e.object({filters:e.list(We).optional(),code:nc.optional()});var ur=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),sc=e.union("type",{llm_as_judge:tt.extend(ur),user_defined_metric_python:it.extend(ur),trace_thread_llm_as_judge:at.extend(ur),trace_thread_user_defined_metric_python:nt.extend(ur),span_llm_as_judge:st.extend(ur),span_user_defined_metric_python:pt.extend(ur)}).transform({transform:s=>s,untransform:s=>s});var pc=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(sc).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var gr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),cc=e.union("type",{llm_as_judge:tt.extend(gr),user_defined_metric_python:it.extend(gr),trace_thread_llm_as_judge:at.extend(gr),trace_thread_user_defined_metric_python:nt.extend(gr),span_llm_as_judge:st.extend(gr),span_user_defined_metric_python:pt.extend(gr)}).transform({transform:s=>s,untransform:s=>s});var lc=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var mc=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:lc.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var dc=e.object({content:e.list(mc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var uc=e.object({filters:e.list(ke).optional(),code:Go.optional()});var gc=e.object({filters:e.list(ke).optional(),code:$o.optional()});var wc=e.object({filters:e.list(de).optional(),code:Qo.optional()});var fc=e.object({filters:e.list(de).optional(),code:Yo.optional()});var hc=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var Rc=e.object({filters:e.list(Se).optional(),code:qo.optional()});var wr=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),projectId:e.property("project_id",e.string()),action:e.stringLiteral("evaluator")}),bc=e.union("type",{llm_as_judge:uc.extend(wr),user_defined_metric_python:gc.extend(wr),trace_thread_llm_as_judge:wc.extend(wr),trace_thread_user_defined_metric_python:fc.extend(wr),span_llm_as_judge:hc.extend(wr),span_user_defined_metric_python:Rc.extend(wr)}).transform({transform:s=>s,untransform:s=>s});var yc=e.enum_(["system","user","assistant","tool","function"]);var ct=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var zc=e.object({role:yc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(ct).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var kc=e.object({role:e.string().optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),toolCalls:e.property("tool_calls",e.list(ct).optional()),functionCall:e.property("function_call",ze.optional())});var Sc=e.object({index:e.number().optional(),message:zc.optional(),delta:kc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var xc=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var _c=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Ac=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",xc.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",_c.optional())});var Tc=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(Sc).optional(),usage:Ac.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var Ze=e.object({id:e.string().optional(),workspaceId:e.property("workspace_id",e.string().optional()),name:e.string(),slug:e.string().optional(),description:e.string().optional(),config:Z,createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Ec=e.object({content:e.list(Ze).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Pc=e.enum_(["private","public"]);var vc=e.enum_(["unknown","processing","completed","failed"]);var Cc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var Ih=e.object({id:e.string().optional(),name:e.string(),visibility:Pc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:vc.optional(),latestVersion:e.property("latest_version",Cc.optional())});var Ic=e.enum_(["manual","trace","span","sdk"]);var lt=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ic,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Qr).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var jh=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(lt)});var jc=e.object({generatedSamples:e.property("generated_samples",e.list(lt).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var Uh=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Uc=e.enum_(["string","number","object","boolean","array","null"]);var Dc=e.object({name:e.string().optional(),types:e.list(Uc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Mc=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Nc=e.enum_(["manual","trace","span","sdk"]);var oa=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Fc=e.enum_(["ui","sdk","online_scoring"]);var Oc=e.enum_(["ui","sdk","online_scoring"]);var Wc=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Oc.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Bc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Fc,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Wc).optional())});var Lc=e.enum_(["default","hidden"]);var Vc=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:oa.optional(),output:oa.optional(),feedbackScores:e.property("feedback_scores",e.list(Bc).optional()),comments:e.list(Mc).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",Lc.optional())});var Hc=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Nc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Vc).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Jc=e.object({content:e.list(Hc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Dc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Xc=e.enum_(["private","public"]);var Kc=e.enum_(["unknown","processing","completed","failed"]);var Gc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var fr=e.object({id:e.string().optional(),name:e.string(),visibility:Xc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:Kc.optional(),latestVersion:e.property("latest_version",Gc.optional())});var $c=e.object({content:e.list(fr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.list(e.string()).optional()});var Qc=e.object({value:e.number().optional()});var Yc=e.object({value:e.number().optional()});var mt=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Zc=e.object({value:mt.optional()});var qc=e.object({name:e.string().optional()}),el=e.union("type",{PERCENTAGE:Zc.extend(qc),COUNT:Yc.extend(qc),AVG:Qc.extend(qc)}).transform({transform:s=>s,untransform:s=>s});var Pe=e.object({stats:e.list(el).optional()});var rl=e.enum_(["manual","trace","span","sdk"]);var ol=e.enum_(["default","hidden"]);var dt=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",ol.optional())});var ut=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:rl,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(dt).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var tl=e.enum_(["string","number","object","boolean","array","null"]);var il=e.object({name:e.string().optional(),types:e.list(tl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var al=e.object({content:e.list(ut).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(il).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var nl=e.enum_(["string","number","object","boolean","array","null"]);var sl=e.object({name:e.string().optional(),types:e.list(nl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var pl=e.object({columns:e.list(sl).optional()});var cl=e.object({typeName:e.string().optional()});var Dh=e.object({type:cl.optional(),closed:e.boolean().optional()});var ll=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var ml=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:ll.optional()});var hr=e.object({id:e.string().optional(),datasetId:e.property("dataset_id",e.string().optional()),versionHash:e.property("version_hash",e.string().optional()),tags:e.list(e.string()).optional(),isLatest:e.property("is_latest",e.boolean().optional()),itemsTotal:e.property("items_total",e.number().optional()),itemsAdded:e.property("items_added",e.number().optional()),itemsModified:e.property("items_modified",e.number().optional()),itemsDeleted:e.property("items_deleted",e.number().optional()),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var dl=e.object({content:e.list(hr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var ul=e.enum_(["regular","trial","mini-batch"]);var gl=e.enum_(["running","completed","cancelled"]);var xe=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ta=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var Mh=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:D.optional(),type:ul.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),comments:e.list(L).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:gl.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional()),promptVersion:e.property("prompt_version",ta.optional()),promptVersions:e.property("prompt_versions",e.list(ta).optional())});var Rr=e.object({ids:e.list(e.string())});var wl=e.enum_(["TOPIC","PII"]);var fl=e.enum_(["passed","failed"]);var hl=e.object({name:wl.optional(),result:fl.optional()});var Rl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(hl).optional()});var bl=e.enum_(["default","hidden"]);var gt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Rl).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",bl.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var yl=e.enum_(["general","tool","llm","guardrail"]);var wt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:yl.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",ye.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var zl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:gt.optional(),spans:e.list(wt).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var Nh=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(zl)});var qe=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ae=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var kl=e.enum_(["regular","trial","mini-batch"]);var Sl=e.enum_(["running","completed","cancelled"]);var xl=e.object({name:e.string(),value:e.number()});var ia=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var ft=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:ae.optional(),type:kl.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),comments:e.list(qe).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:mt.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:Sl.optional(),experimentScores:e.property("experiment_scores",e.list(xl).optional()),promptVersion:e.property("prompt_version",ia.optional()),promptVersions:e.property("prompt_versions",e.list(ia).optional())});var _l=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ft).optional(),sortableBy:e.list(e.string()).optional()});var Al=e.object({label:e.string().optional()});var Tl=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var El=e.object({groupsDetails:e.property("groups_details",e.list(Tl).optional())});var Pl=e.object({content:e.record(e.string(),Al).optional(),details:El.optional()});var vl=e.object({experimentCount:e.property("experiment_count",e.number().optional()),traceCount:e.property("trace_count",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),duration:xe.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),experimentScores:e.property("experiment_scores",e.list(re).optional())});var Cl=e.object({label:e.string().optional(),aggregations:vl.optional()});var Il=e.object({content:e.record(e.string(),Cl).optional()});var Fh=e.object({ids:e.list(e.string())});var jl=e.object({typeName:e.string().optional()});var Oh=e.object({type:jl.optional(),closed:e.boolean().optional()});var Ul=e.object({trueLabel:e.string(),falseLabel:e.string()});var Dl=e.object({details:Ul.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ml=e.object({categories:e.record(e.string(),e.number())});var Nl=e.object({details:Ml.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Fl=e.object({max:e.number(),min:e.number()});var Ol=e.object({details:Fl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Wl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Wh=e.union("type",{numerical:Ol.extend(Wl),categorical:Nl.extend(Wl),boolean:Dl.extend(Wl)}).transform({transform:s=>s,untransform:s=>s});var Bl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Ll=e.object({details:Bl.optional()});var Vl=e.object({categories:e.record(e.string(),e.number())});var Hl=e.object({details:Vl.optional()});var Jl=e.object({max:e.number(),min:e.number()});var Xl=e.object({details:Jl.optional()});var Kl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),Gl=e.union("type",{numerical:Xl.extend(Kl),categorical:Hl.extend(Kl),boolean:Ll.extend(Kl)}).transform({transform:s=>s,untransform:s=>s});var $l=e.object({trueLabel:e.string(),falseLabel:e.string()});var ht=e.object({details:$l.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ql=e.object({categories:e.record(e.string(),e.number())});var Rt=e.object({details:Ql.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Yl=e.object({max:e.number(),min:e.number()});var bt=e.object({details:Yl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Zl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),ql=e.union("type",{numerical:bt.extend(Zl),categorical:Rt.extend(Zl),boolean:ht.extend(Zl)}).transform({transform:s=>s,untransform:s=>s});var em=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ql).optional()});var rm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),om=e.union("type",{numerical:bt.extend(rm),categorical:Rt.extend(rm),boolean:ht.extend(rm)}).transform({transform:s=>s,untransform:s=>s});var tm=e.object({trueLabel:e.string(),falseLabel:e.string()});var im=e.object({details:tm.optional()});var am=e.object({categories:e.record(e.string(),e.number())});var nm=e.object({details:am.optional()});var sm=e.object({max:e.number(),min:e.number()});var pm=e.object({details:sm.optional()});var cm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),lm=e.union("type",{numerical:pm.extend(cm),categorical:nm.extend(cm),boolean:im.extend(cm)}).transform({transform:s=>s,untransform:s=>s});var mm=e.enum_(["TOPIC","PII"]);var dm=e.enum_(["passed","failed"]);var um=e.object({id:e.string().optional(),entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:mm,result:dm,config:v,details:v});var Bh=e.object({guardrails:e.list(um)});var gm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var yt=e.object({id:e.string().optional(),provider:gm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var wm=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(yt).optional(),sortableBy:e.list(e.string()).optional()});var fm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var Lh=e.object({id:e.string().optional(),provider:fm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var zt=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var hm=e.enum_(["trace","thread","span"]);var kt=e.object({projectId:e.property("project_id",e.string()),entityIds:e.property("entity_ids",e.list(e.string())),ruleIds:e.property("rule_ids",e.list(e.string())),entityType:e.property("entity_type",hm)});var Vh=v;var Rm=e.enum_(["running","completed","cancelled","initialized","error"]);var bm=e.object({role:e.string(),content:e.string()});var ym=e.object({messages:e.list(bm)});var zm=e.object({model:e.string(),parameters:v.optional()});var km=e.object({type:e.string(),parameters:v.optional()});var Sm=e.object({metrics:e.list(km)});var xm=e.object({type:e.string(),parameters:v.optional()});var _m=e.object({datasetName:e.property("dataset_name",e.string()),prompt:ym,llmModel:e.property("llm_model",zm),evaluation:Sm,optimizer:xm});var Hh=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Rm,metadata:D.optional(),studioConfig:e.property("studio_config",_m.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Am=e.object({role:e.string(),content:e.string()});var Tm=e.object({messages:e.list(Am)});var Em=e.object({model:e.string(),parameters:ie.optional()});var Pm=e.object({type:e.string(),parameters:ie.optional()});var vm=e.object({metrics:e.list(Pm)});var Cm=e.object({type:e.string(),parameters:ie.optional()});var Im=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Tm,llmModel:e.property("llm_model",Em),evaluation:vm,optimizer:Cm});var jm=e.enum_(["running","completed","cancelled","initialized","error"]);var aa=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:jm,metadata:te.optional(),studioConfig:e.property("studio_config",Im.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Um=e.enum_(["running","completed","cancelled","initialized","error"]);var Dm=e.object({role:e.string(),content:e.string()});var Mm=e.object({messages:e.list(Dm)});var Nm=e.object({model:e.string(),parameters:Z.optional()});var Fm=e.object({type:e.string(),parameters:Z.optional()});var Om=e.object({metrics:e.list(Fm)});var Wm=e.object({type:e.string(),parameters:Z.optional()});var Bm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Mm,llmModel:e.property("llm_model",Nm),evaluation:Om,optimizer:Wm});var br=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Um,metadata:ae.optional(),studioConfig:e.property("studio_config",Bm.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(br).optional(),sortableBy:e.list(e.string()).optional()});var Lm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var St=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Vm=e.enum_(["private","public"]);var Jh=e.object({id:e.string().optional(),name:e.string(),visibility:Vm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",St.optional())});var Hm=e.enum_(["private","public"]);var xt=e.object({id:e.string().optional(),name:e.string(),visibility:Hm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var Jm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(xt).optional(),sortableBy:e.list(e.string()).optional()});var Xm=e.object({name:e.string().optional(),type:e.string().optional()});var Km=e.object({scores:e.list(Xm).optional()});var Gm=e.object({time:e.date(),value:e.number().optional()});var $m=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Qm=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Ym=e.object({name:e.string().optional(),data:e.list(Gm).optional()});var Zm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",$m.optional()),interval:Qm.optional(),results:e.list(Ym).optional()});var qm=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",St.optional())});var ed=e.object({content:e.list(qm).optional()});var rd=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var od=e.object({name:e.string(),value:e.number()});var td=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var id=e.enum_(["private","public"]);var ad=e.object({id:e.string().optional(),name:e.string(),visibility:id.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(od).optional()),duration:td.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",rd.optional())});var Xh=e.object({errors:e.list(e.string()).optional()});var nd=e.enum_(["mustache","jinja2"]);var sd=e.enum_(["text","chat"]);var pd=e.enum_(["mustache","jinja2"]);var cd=e.enum_(["text","chat"]);var ld=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:v.optional(),type:pd.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",cd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Kh=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:v.optional(),changeDescription:e.property("change_description",e.string().optional()),type:nd.optional(),templateStructure:e.property("template_structure",sd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",ld.optional())});var Gh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var md=e.enum_(["text","chat"]);var dd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",md.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",he.optional())});var ud=e.enum_(["mustache","jinja2"]);var gd=e.enum_(["text","chat"]);var wd=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:Z.optional(),type:ud.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),templateStructure:e.property("template_structure",gd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var fd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wd).optional(),sortableBy:e.list(e.string()).optional()});var hd=e.enum_(["text","chat"]);var Rd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",hd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var bd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rd).optional(),sortableBy:e.list(e.string()).optional()});var yd=e.object({pythonEvaluatorEnabled:e.boolean(),traceThreadPythonEvaluatorEnabled:e.boolean(),spanLlmAsJudgeEnabled:e.boolean(),spanUserDefinedMetricPythonEnabled:e.boolean(),guardrailsEnabled:e.boolean(),opikAiEnabled:e.property("opikAIEnabled",e.boolean()),alertsEnabled:e.boolean(),welcomeWizardEnabled:e.boolean(),csvUploadEnabled:e.boolean(),exportEnabled:e.boolean(),optimizationStudioEnabled:e.boolean(),dashboardsEnabled:e.boolean(),datasetVersioningEnabled:e.boolean(),openaiProviderEnabled:e.boolean(),anthropicProviderEnabled:e.boolean(),geminiProviderEnabled:e.boolean(),openrouterProviderEnabled:e.boolean(),vertexaiProviderEnabled:e.boolean(),customllmProviderEnabled:e.boolean(),opikbuiltinProviderEnabled:e.boolean(),collaboratorsTabEnabled:e.boolean()});var $h=e.object({spans:e.list(wt)});var _t=e.object({name:e.string(),author:e.string().optional()});var At=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zd=e.enum_(["ui","sdk","online_scoring"]);var kd=e.enum_(["ui","sdk","online_scoring"]);var Sd=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:kd.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var yr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:zd,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Sd).optional())});var xd=e.enum_(["general","tool","llm","guardrail"]);var Tt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:xd.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",At.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var _d=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Tt).optional(),sortableBy:e.list(e.string()).optional()});var Ad=e.enum_(["ui","sdk","online_scoring"]);var Td=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Ad,author:e.string().optional(),id:e.string()});var Et=e.object({scores:e.list(Td)});var Qh=e.object({traces:e.list(gt)});var Yh=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var Ed=e.enum_(["TOPIC","PII"]);var Pd=e.enum_(["passed","failed"]);var vd=e.object({name:Ed.optional(),result:Pd.optional()});var Cd=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(vd).optional()});var Id=e.enum_(["default","hidden"]);var Pt=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",At.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Cd).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",Id.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var jd=e.enum_(["active","inactive"]);var vt=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),threadModelId:e.property("thread_model_id",e.string().optional()),startTime:e.property("start_time",e.date().optional()),endTime:e.property("end_time",e.date().optional()),duration:e.number().optional(),firstMessage:e.property("first_message",D.optional()),lastMessage:e.property("last_message",D.optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),status:jd.optional(),numberOfMessages:e.property("number_of_messages",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),comments:e.list(L).optional(),tags:e.list(e.string()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var sa=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string()),truncate:e.boolean().optional()});var Ud=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(vt).optional(),sortableBy:e.list(e.string()).optional()});var Dd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Pt).optional(),sortableBy:e.list(e.string()).optional()});var Md=e.object({completed:e.boolean().optional()});var er=e.object({name:e.string().optional(),current:e.number().optional(),previous:e.number().optional()});var zr=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var Zh=e.object({time:e.date(),value:e.number().optional()});var pa=e.object({results:e.list(er).optional()});var qh=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),name:e.string().optional(),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var Ct=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var Nd=e.object({results:e.list(er).optional()});var ca=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return h.fromPromise(this.__getDatasetBiInfo(t))}async __getDatasetBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExperimentBiInfo(t){return h.fromPromise(this.__getExperimentBiInfo(t))}async __getExperimentBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansBiInfo(t){return h.fromPromise(this.__getSpansBiInfo(t))}async __getSpansBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-spans.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansCountForWorkspaces(t){return h.fromPromise(this.__getSpansCountForWorkspaces(t))}async __getSpansCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Es.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesBiInfo(t){return h.fromPromise(this.__getTracesBiInfo(t))}async __getTracesBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesCountForWorkspaces(t){return h.fromPromise(this.__getTracesCountForWorkspaces(t))}async __getTracesCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:vs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var la=class{constructor(t={}){this._options=t;}findAlerts(t={},r){return h.fromPromise(this.__findAlerts(t,r))}async __findAlerts(t={},r){var g,w;let{page:o,size:i,sorting:a,filters:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.sorting=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/alerts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:$s.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAlert(t,r){return h.fromPromise(this.__createAlert(t,r))}async __createAlert(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAlertBatch(t,r){return h.fromPromise(this.__deleteAlertBatch(t,r))}async __deleteAlertBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAlertById(t,r){return h.fromPromise(this.__getAlertById(t,r))}async __getAlertById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Xo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAlert(t,r,o){return h.fromPromise(this.__updateAlert(t,r,o))}async __updateAlert(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/alerts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getWebhookExamples(t={},r){return h.fromPromise(this.__getWebhookExamples(t,r))}async __getWebhookExamples(t={},r){var l,d;let{alertType:o}=t,i={};o!=null&&(i.alert_type=mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}));let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/alerts/webhooks/examples"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Qs.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/webhooks/examples.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}testWebhook(t,r){return h.fromPromise(this.__testWebhook(t,r))}async __testWebhook(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/webhooks/tests"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Zs.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/webhooks/tests.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ma=class{constructor(t={}){this._options=t;}addItemsToAnnotationQueue(t,r,o){return h.fromPromise(this.__addItemsToAnnotationQueue(t,r,o))}async __addItemsToAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/add`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/add.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findAnnotationQueues(t={},r){return h.fromPromise(this.__findAnnotationQueues(t,r))}async __findAnnotationQueues(t={},r){var w,k;let{page:o,size:i,name:a,filters:l,sorting:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.filters=l),d!=null&&(u.sorting=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/annotation-queues"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:ip.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createAnnotationQueue(t,r){return h.fromPromise(this.__createAnnotationQueue(t,r))}async __createAnnotationQueue(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createAnnotationQueueBatch(t,r){return h.fromPromise(this.__createAnnotationQueueBatch(t,r))}async __createAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:No.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAnnotationQueueBatch(t,r){return h.fromPromise(this.__deleteAnnotationQueueBatch(t,r))}async __deleteAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAnnotationQueueById(t,r){return h.fromPromise(this.__getAnnotationQueueById(t,r))}async __getAnnotationQueueById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ko.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAnnotationQueue(t,r={},o){return h.fromPromise(this.__updateAnnotationQueue(t,r,o))}async __updateAnnotationQueue(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}removeItemsFromAnnotationQueue(t,r,o){return h.fromPromise(this.__removeItemsFromAnnotationQueue(t,r,o))}async __removeItemsFromAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var da=class{constructor(t={}){this._options=t;}attachmentList(t,r){return h.fromPromise(this.__attachmentList(t,r))}async __attachmentList(t,r){var k,S;let{page:o,size:i,projectId:a,entityType:l,entityId:d,path:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),g.project_id=a,g.entity_type=ui.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:np.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}completeMultiPartUpload(t,r){return h.fromPromise(this.__completeMultiPartUpload(t,r))}async __completeMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAttachments(t,r){return h.fromPromise(this.__deleteAttachments(t,r))}async __deleteAttachments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}downloadAttachment(t,r){return h.fromPromise(this.__downloadAttachment(t,r))}async __downloadAttachment(t,r){var k,S;let{workspaceName:o,containerId:i,entityType:a,entityId:l,fileName:d,mimeType:u}=t,g={};o!=null&&(g.workspace_name=o),g.container_id=i,g.entity_type=gi.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"}),g.entity_id=l,g.file_name=d,g.mime_type=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}startMultiPartUpload(t,r){return h.fromPromise(this.__startMultiPartUpload(t,r))}async __startMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ir.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:lp.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}uploadAttachment(t,r){return h.fromPromise(this.__uploadAttachment(t,r))}async __uploadAttachment(t,r){var k,S;let{fileName:o,projectName:i,mimeType:a,entityType:l,entityId:d,body:u}=t,g={};g.file_name=o,i!=null&&(g.project_name=i),a!=null&&(g.mime_type=a),g.entity_type=fi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",body:sr.uploadAttachment.Request.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:void 0,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ua=class{constructor(t={}){this._options=t;}access(t,r){return h.fromPromise(this.__access(t,r))}async __access(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return h.fromPromise(this.__getWorkspaceName(t))}async __getWorkspaceName(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:dp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new X(r.error.body,r.rawResponse);case 403:throw new $(ee.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ga=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return h.fromPromise(this.__findEvaluators(t,r))}async __findEvaluators(t={},r){var S,x;let{projectId:o,id:i,name:a,filters:l,sorting:d,page:u,size:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.id=i),a!=null&&(w.name=a),l!=null&&(w.filters=l),d!=null&&(w.sorting=d),u!=null&&(w.page=u.toString()),g!=null&&(w.size=g.toString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:pc.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createAutomationRuleEvaluator(t,r){return h.fromPromise(this.__createAutomationRuleEvaluator(t,r))}async __createAutomationRuleEvaluator(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Gp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAutomationRuleEvaluatorBatch(t,r){return h.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(t,r))}async __deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,a={};o!=null&&(a.project_id=o);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",body:F.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getEvaluatorById(t,r={},o){return h.fromPromise(this.__getEvaluatorById(t,r,o))}async __getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,a={};i!=null&&(a.project_id=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:cc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}updateAutomationRuleEvaluator(t,r,o){return h.fromPromise(this.__updateAutomationRuleEvaluator(t,r,o))}async __updateAutomationRuleEvaluator(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:bc.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getEvaluatorLogsById(t,r={},o){return h.fromPromise(this.__getEvaluatorLogsById(t,r,o))}async __getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,a={};i!=null&&(a.size=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:dc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var wa=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return h.fromPromise(this.__createChatCompletions(t,r))}async __createChatCompletions(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Tc.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var fa=class{constructor(t={}){this._options=t;}findDashboards(t={},r){return h.fromPromise(this.__findDashboards(t,r))}async __findDashboards(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/dashboards"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ec.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createDashboard(t,r){return h.fromPromise(this.__createDashboard(t,r))}async __createDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Bo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ze.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDashboardById(t,r){return h.fromPromise(this.__getDashboardById(t,r))}async __getDashboardById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ze.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDashboard(t,r){return h.fromPromise(this.__deleteDashboard(t,r))}async __deleteDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDashboard(t,r={},o){return h.fromPromise(this.__updateDashboard(t,r,o))}async __updateDashboard(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Lo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Ze.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDashboardsBatch(t,r){return h.fromPromise(this.__deleteDashboardsBatch(t,r))}async __deleteDashboardsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ha=class{constructor(t={}){this._options=t;}batchUpdateDatasetItems(t,r){return h.fromPromise(this.__batchUpdateDatasetItems(t,r))}async __batchUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findDatasets(t={},r){return h.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var x,T;let{page:o,size:i,withExperimentsOnly:a,withOptimizationsOnly:l,promptId:d,name:u,sorting:g,filters:w}=t,k={};o!=null&&(k.page=o.toString()),i!=null&&(k.size=i.toString()),a!=null&&(k.with_experiments_only=a.toString()),l!=null&&(k.with_optimizations_only=l.toString()),d!=null&&(k.prompt_id=d),u!=null&&(k.name=u),g!=null&&(k.sorting=g),w!=null&&(k.filters=w);let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(S.ok)return {data:$c.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}createDataset(t,r){return h.fromPromise(this.__createDataset(t,r))}async __createDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ur.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return h.fromPromise(this.__createOrUpdateDatasetItems(t,r))}async __createOrUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createDatasetItemsFromCsv(t,r){return h.fromPromise(this.__createDatasetItemsFromCsv(t,r))}async __createDatasetItemsFromCsv(t,r){var l,d;let o=await Hu();o.append("file",Ae(t.file)),o.append("dataset_id",t.datasetId);let i=await o.getRequest(),a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/datasets/items/from-csv"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i.headers,...r==null?void 0:r.headers},requestType:"file",duplex:i.duplex,body:i.body,timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/from-csv.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}createDatasetItemsFromSpans(t,r,o){return h.fromPromise(this.__createDatasetItemsFromSpans(t,r,o))}async __createDatasetItemsFromSpans(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-spans`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Nr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-spans.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createDatasetItemsFromTraces(t,r,o){return h.fromPromise(this.__createDatasetItemsFromTraces(t,r,o))}async __createDatasetItemsFromTraces(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-traces`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-traces.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetById(t,r){return h.fromPromise(this.__getDatasetById(t,r))}async __getDatasetById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDataset(t,r,o){return h.fromPromise(this.__updateDataset(t,r,o))}async __updateDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDataset(t,r){return h.fromPromise(this.__deleteDataset(t,r))}async __deleteDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetByName(t,r){return h.fromPromise(this.__deleteDatasetByName(t,r))}async __deleteDatasetByName(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetItems(t,r){return h.fromPromise(this.__deleteDatasetItems(t,r))}async __deleteDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Br.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetsBatch(t,r){return h.fromPromise(this.__deleteDatasetsBatch(t,r))}async __deleteDatasetsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}expandDataset(t,r,o){return h.fromPromise(this.__expandDataset(t,r,o))}async __expandDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/expansions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Lr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:jc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/expansions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findDatasetItemsWithExperimentItems(t,r,o){return h.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var x,T;let{page:i,size:a,experimentIds:l,filters:d,sorting:u,search:g,truncate:w}=r,k={};i!=null&&(k.page=i.toString()),a!=null&&(k.size=a.toString()),k.experiment_ids=l,d!=null&&(k.filters=d),u!=null&&(k.sorting=u),g!=null&&(k.search=g),w!=null&&(k.truncate=w.toString());let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(S.ok)return {data:Jc.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}getDatasetByIdentifier(t,r){return h.fromPromise(this.__getDatasetByIdentifier(t,r))}async __getDatasetByIdentifier(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetExperimentItemsStats(t,r,o){return h.fromPromise(this.__getDatasetExperimentItemsStats(t,r,o))}async __getDatasetExperimentItemsStats(t,r,o){var u,g;let{experimentIds:i,filters:a}=r,l={};l.experiment_ids=i,a!=null&&(l.filters=a);let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/stats`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:Pe.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/stats.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getDatasetItemById(t,r){return h.fromPromise(this.__getDatasetItemById(t,r))}async __getDatasetItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ut.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}patchDatasetItem(t,r,o){return h.fromPromise(this.__patchDatasetItem(t,r,o))}async __patchDatasetItem(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Dr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetItems(t,r={},o){return h.fromPromise(this.__getDatasetItems(t,r,o))}async __getDatasetItems(t,r={},o){var k,S;let{page:i,size:a,version:l,filters:d,truncate:u}=r,g={};i!=null&&(g.page=i.toString()),a!=null&&(g.size=a.toString()),l!=null&&(g.version=l),d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(w.ok)return {data:al.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getDatasetItemsOutputColumns(t,r={},o){return h.fromPromise(this.__getDatasetItemsOutputColumns(t,r,o))}async __getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,a={};i!=null&&(a.experiment_ids=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:pl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}streamDatasetItems(t,r){return h.fromPromise(this.__streamDatasetItems(t,r))}async __streamDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Hr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}compareDatasetVersions(t,r){return h.fromPromise(this.__compareDatasetVersions(t,r))}async __compareDatasetVersions(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/diff`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ml.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions/diff.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createVersionTag(t,r,o,i){return h.fromPromise(this.__createVersionTag(t,r,o,i))}async __createVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}/tags`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Jr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/hash/{versionHash}/tags.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}listDatasetVersions(t,r={},o){return h.fromPromise(this.__listDatasetVersions(t,r,o))}async __listDatasetVersions(t,r={},o){var u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:dl.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createDatasetVersion(t,r={},o){return h.fromPromise(this.__createDatasetVersion(t,r,o))}async __createDatasetVersion(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Xr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteVersionTag(t,r,o,i){return h.fromPromise(this.__deleteVersionTag(t,r,o,i))}async __deleteVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(o)}/versions/${encodeURIComponent(t)}/tags/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}/versions/{versionHash}/tags/{tag}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}restoreDatasetVersion(t,r,o){return h.fromPromise(this.__restoreDatasetVersion(t,r,o))}async __restoreDatasetVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Kr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:hr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateDatasetVersion(t,r,o={},i){return h.fromPromise(this.__updateDatasetVersion(t,r,o,i))}async __updateDatasetVersion(t,r,o={},i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Gr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:hr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/{id}/versions/hash/{versionHash}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ra=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return h.fromPromise(this.__findExperiments(t,r))}async __findExperiments(t={},r){var B,O;let{page:o,size:i,datasetId:a,optimizationId:l,types:d,name:u,datasetDeleted:g,promptId:w,sorting:k,filters:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.datasetId=a),l!=null&&(x.optimization_id=l),d!=null&&(x.types=d),u!=null&&(x.name=u),g!=null&&(x.dataset_deleted=g.toString()),w!=null&&(x.prompt_id=w),k!=null&&(x.sorting=k),S!=null&&(x.filters=S);let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:_l.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new _(T.error.body,T.rawResponse);default:throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}createExperiment(t,r){return h.fromPromise(this.__createExperiment(t,r))}async __createExperiment(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$r.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return h.fromPromise(this.__createExperimentItems(t,r))}async __createExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Yr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentItems(t,r){return h.fromPromise(this.__deleteExperimentItems(t,r))}async __deleteExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentsById(t,r){return h.fromPromise(this.__deleteExperimentsById(t,r))}async __deleteExperimentsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}experimentItemsBulk(t,r){return h.fromPromise(this.__experimentItemsBulk(t,r))}async __experimentItemsBulk(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/bulk"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:eo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/experiments/items/bulk.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames(t={},r){return h.fromPromise(this.__findFeedbackScoreNames(t,r))}async __findFeedbackScoreNames(t={},r){var l,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:pr.findFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findExperimentGroups(t={},r){return h.fromPromise(this.__findExperimentGroups(t,r))}async __findExperimentGroups(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Pl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}findExperimentGroupsAggregations(t={},r){return h.fromPromise(this.__findExperimentGroupsAggregations(t,r))}async __findExperimentGroupsAggregations(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups/aggregations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Il.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups/aggregations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}finishExperiments(t,r){return h.fromPromise(this.__finishExperiments(t,r))}async __finishExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/finish"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/finish.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getExperimentById(t,r){return h.fromPromise(this.__getExperimentById(t,r))}async __getExperimentById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ft.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateExperiment(t,r={},o){return h.fromPromise(this.__updateExperiment(t,r,o))}async __updateExperiment(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:oo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/experiments/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getExperimentItemById(t,r){return h.fromPromise(this.__getExperimentItemById(t,r))}async __getExperimentItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperimentItems(t,r){return h.fromPromise(this.__streamExperimentItems(t,r))}async __streamExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:to.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperiments(t,r){return h.fromPromise(this.__streamExperiments(t,r))}async __streamExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ba=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return h.fromPromise(this.__findFeedbackDefinitions(t,r))}async __findFeedbackDefinitions(t={},r){var g,w;let{page:o,size:i,name:a,type:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.type=Ti.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}));let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:em.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createFeedbackDefinition(t,r){return h.fromPromise(this.__createFeedbackDefinition(t,r))}async __createFeedbackDefinition(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Gl.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getFeedbackDefinitionById(t,r){return h.fromPromise(this.__getFeedbackDefinitionById(t,r))}async __getFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:om.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateFeedbackDefinition(t,r,o){return h.fromPromise(this.__updateFeedbackDefinition(t,r,o))}async __updateFeedbackDefinition(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:lm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeedbackDefinitionById(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionById(t,r))}async __deleteFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteFeedbackDefinitionsBatch(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionsBatch(t,r))}async __deleteFeedbackDefinitionsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ya=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return h.fromPromise(this.__createGuardrails(t,r))}async __createGuardrails(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var za=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return h.fromPromise(this.__deleteLlmProviderApiKeysBatch(t,r))}async __deleteLlmProviderApiKeysBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findLlmProviderKeys(t){return h.fromPromise(this.__findLlmProviderKeys(t))}async __findLlmProviderKeys(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:wm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}storeLlmProviderApiKey(t,r){return h.fromPromise(this.__storeLlmProviderApiKey(t,r))}async __storeLlmProviderApiKey(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getLlmProviderApiKeyById(t,r){return h.fromPromise(this.__getLlmProviderApiKeyById(t,r))}async __getLlmProviderApiKeyById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:yt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateLlmProviderApiKey(t,r={},o){return h.fromPromise(this.__updateLlmProviderApiKey(t,r,o))}async __updateLlmProviderApiKey(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:no.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new X(i.error.body,i.rawResponse);case 403:throw new $(ee.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ka=class{constructor(t={}){this._options=t;}evaluateSpans(t,r){return h.fromPromise(this.__evaluateSpans(t,r))}async __evaluateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateThreads(t,r){return h.fromPromise(this.__evaluateThreads(t,r))}async __evaluateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/threads"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/threads.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateTraces(t,r){return h.fromPromise(this.__evaluateTraces(t,r))}async __evaluateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Sa=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return h.fromPromise(this.__receiveProtobufTraces(t))}async __receiveProtobufTraces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var xa=class{constructor(t={}){this._options=t;}cancelStudioOptimizations(t,r){return h.fromPromise(this.__cancelStudioOptimizations(t,r))}async __cancelStudioOptimizations(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/cancel`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Ne(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/cancel.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findOptimizations(t={},r){return h.fromPromise(this.__findOptimizations(t,r))}async __findOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:na.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return h.fromPromise(this.__createOptimization(t,r))}async __createOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:aa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}upsertOptimization(t,r){return h.fromPromise(this.__upsertOptimization(t,r))}async __upsertOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:aa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return h.fromPromise(this.__deleteOptimizationsById(t,r))}async __deleteOptimizationsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findStudioOptimizations(t={},r){return h.fromPromise(this.__findStudioOptimizations(t,r))}async __findStudioOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations/studio"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:na.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getOptimizationById(t,r){return h.fromPromise(this.__getOptimizationById(t,r))}async __getOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateOptimizationsById(t,r={},o){return h.fromPromise(this.__updateOptimizationsById(t,r,o))}async __updateOptimizationsById(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:so.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getStudioOptimizationById(t,r){return h.fromPromise(this.__getStudioOptimizationById(t,r))}async __getStudioOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getStudioOptimizationLogs(t,r){return h.fromPromise(this.__getStudioOptimizationLogs(t,r))}async __getStudioOptimizationLogs(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Lm.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/logs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var _a=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Jm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return h.fromPromise(this.__getProjectById(t,r))}async __getProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:xt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteProjectById(t,r){return h.fromPromise(this.__deleteProjectById(t,r))}async __deleteProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProject(t,r={},o){return h.fromPromise(this.__updateProject(t,r,o))}async __updateProject(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:co.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteProjectsBatch(t,r){return h.fromPromise(this.__deleteProjectsBatch(t,r))}async __deleteProjectsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNamesByProjectIds(t={},r){return h.fromPromise(this.__findFeedbackScoreNamesByProjectIds(t,r))}async __findFeedbackScoreNamesByProjectIds(t={},r){var l,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Km.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getProjectMetrics(t,r={},o){return h.fromPromise(this.__getProjectMetrics(t,r,o))}async __getProjectMetrics(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}/metrics`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:lo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Zm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getProjectStats(t={},r){return h.fromPromise(this.__getProjectStats(t,r))}async __getProjectStats(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:ed.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}retrieveProject(t,r){return h.fromPromise(this.__retrieveProject(t,r))}async __retrieveProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ad.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Aa=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return h.fromPromise(this.__getPrompts(t,r))}async __getPrompts(t={},r){var w,k;let{page:o,size:i,name:a,sorting:l,filters:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.sorting=l),d!=null&&(u.filters=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:bd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createPrompt(t,r){return h.fromPromise(this.__createPrompt(t,r))}async __createPrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return h.fromPromise(this.__createPromptVersion(t,r))}async __createPromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:go.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePromptVersions(t,r){return h.fromPromise(this.__updatePromptVersions(t,r))}async __updatePromptVersions(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:wo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dd.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePrompt(t,r,o){return h.fromPromise(this.__updatePrompt(t,r,o))}async __updatePrompt(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:fo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePrompt(t,r){return h.fromPromise(this.__deletePrompt(t,r))}async __deletePrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePromptsBatch(t,r){return h.fromPromise(this.__deletePromptsBatch(t,r))}async __deletePromptsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersionById(t,r){return h.fromPromise(this.__getPromptVersionById(t,r))}async __getPromptVersionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/versions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersions(t,r={},o){return h.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var k,S;let{page:i,size:a,search:l,sorting:d,filters:u}=r,g={};i!=null&&(g.page=i.toString()),a!=null&&(g.size=a.toString()),l!=null&&(g.search=l),d!=null&&(g.sorting=d),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(w.ok)return {data:fd.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}restorePromptVersion(t,r,o){return h.fromPromise(this.__restorePromptVersion(t,r,o))}async __restorePromptVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions/${encodeURIComponent(r)}/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:he.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/{promptId}/versions/{versionId}/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}retrievePromptVersion(t,r){return h.fromPromise(this.__retrievePromptVersion(t,r))}async __retrievePromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ta=class{constructor(t={}){this._options=t;}getServiceToggles(t){return h.fromPromise(this.__getServiceToggles(t))}async __getServiceToggles(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:yd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ea=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return h.fromPromise(this.__addSpanComment(t,r,o))}async __addSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addSpanFeedbackScore(t,r,o){return h.fromPromise(this.__addSpanFeedbackScore(t,r,o))}async __addSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createSpans(t,r){return h.fromPromise(this.__createSpans(t,r))}async __createSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:yo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateSpans(t,r){return h.fromPromise(this.__batchUpdateSpans(t,r))}async __batchUpdateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ko.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpansByProject(t={},r){return h.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var qd,eu;let{page:o,size:i,projectName:a,projectId:l,traceId:d,type:u,filters:g,truncate:w,stripAttachments:k,sorting:S,exclude:x,fromTime:T,toTime:B}=t,O={};o!=null&&(O.page=o.toString()),i!=null&&(O.size=i.toString()),a!=null&&(O.project_name=a),l!=null&&(O.project_id=l),d!=null&&(O.trace_id=d),u!=null&&(O.type=Li.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(O.filters=g),w!=null&&(O.truncate=w.toString()),k!=null&&(O.strip_attachments=k.toString()),S!=null&&(O.sorting=S),x!=null&&(O.exclude=x),T!=null&&(O.from_time=T.toISOString()),B!=null&&(O.to_time=B.toISOString());let G=await b({url:y((eu=(qd=await n.get(this._options.baseUrl))!=null?qd:await n.get(this._options.environment))!=null?eu:R.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(G.ok)return {data:_d.parseOrThrow(G.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:G.rawResponse};if(G.error.reason==="status-code")throw new p({statusCode:G.error.statusCode,body:G.error.body,rawResponse:G.rawResponse});switch(G.error.reason){case "non-json":throw new p({statusCode:G.error.statusCode,body:G.error.rawBody,rawResponse:G.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:G.error.errorMessage,rawResponse:G.rawResponse})}}createSpan(t,r){return h.fromPromise(this.__createSpan(t,r))}async __createSpan(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:bo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpanById(t,r={},o){return h.fromPromise(this.__getSpanById(t,r,o))}async __getSpanById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Tt.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 404:throw new A(l.error.body,l.rawResponse);default:throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteSpanById(t,r){return h.fromPromise(this.__deleteSpanById(t,r))}async __deleteSpanById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Ne(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpan(t,r,o){return h.fromPromise(this.__updateSpan(t,r,o))}async __updateSpan(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:zo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteSpanComments(t,r){return h.fromPromise(this.__deleteSpanComments(t,r))}async __deleteSpanComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanFeedbackScore(t,r,o){return h.fromPromise(this.__deleteSpanFeedbackScore(t,r,o))}async __deleteSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findFeedbackScoreNames1(t={},r){return h.fromPromise(this.__findFeedbackScoreNames1(t,r))}async __findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,a={};o!=null&&(a.project_id=o),i!=null&&(a.type=Vi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:cr.findFeedbackScoreNames1.Response.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getSpanComment(t,r,o){return h.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpanStats(t={},r){return h.fromPromise(this.__getSpanStats(t,r))}async __getSpanStats(t={},r){var S,x;let{projectId:o,projectName:i,traceId:a,type:l,filters:d,fromTime:u,toTime:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.project_name=i),a!=null&&(w.trace_id=a),l!=null&&(w.type=Hi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),d!=null&&(w.filters=d),u!=null&&(w.from_time=u.toISOString()),g!=null&&(w.to_time=g.toISOString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:Pe.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}scoreBatchOfSpans(t,r){return h.fromPromise(this.__scoreBatchOfSpans(t,r))}async __scoreBatchOfSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchSpans(t={},r){return h.fromPromise(this.__searchSpans(t,r))}async __searchSpans(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:So.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpanComment(t,r,o){return h.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Pa=class{constructor(t={}){this._options=t;}addThreadComment(t,r,o){return h.fromPromise(this.__addThreadComment(t,r,o))}async __addThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceComment(t,r,o){return h.fromPromise(this.__addTraceComment(t,r,o))}async __addTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceFeedbackScore(t,r,o){return h.fromPromise(this.__addTraceFeedbackScore(t,r,o))}async __addTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createTraces(t,r){return h.fromPromise(this.__createTraces(t,r))}async __createTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:_o.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateTraces(t,r){return h.fromPromise(this.__batchUpdateTraces(t,r))}async __batchUpdateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:To.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateThreads(t,r){return h.fromPromise(this.__batchUpdateThreads(t,r))}async __batchUpdateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}closeTraceThread(t={},r){return h.fromPromise(this.__closeTraceThread(t,r))}async __closeTraceThread(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/close"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/close.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTracesByProject(t={},r){return h.fromPromise(this.__getTracesByProject(t,r))}async __getTracesByProject(t={},r){var O,G;let{page:o,size:i,projectName:a,projectId:l,filters:d,truncate:u,stripAttachments:g,sorting:w,exclude:k,fromTime:S,toTime:x}=t,T={};o!=null&&(T.page=o.toString()),i!=null&&(T.size=i.toString()),a!=null&&(T.project_name=a),l!=null&&(T.project_id=l),d!=null&&(T.filters=d),u!=null&&(T.truncate=u.toString()),g!=null&&(T.strip_attachments=g.toString()),w!=null&&(T.sorting=w),k!=null&&(T.exclude=k),S!=null&&(T.from_time=S.toISOString()),x!=null&&(T.to_time=x.toISOString());let B=await b({url:y((G=(O=await n.get(this._options.baseUrl))!=null?O:await n.get(this._options.environment))!=null?G:R.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(B.ok)return {data:Dd.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")throw new p({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse});switch(B.error.reason){case "non-json":throw new p({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createTrace(t,r){return h.fromPromise(this.__createTrace(t,r))}async __createTrace(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:xo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceById(t,r={},o){return h.fromPromise(this.__getTraceById(t,r,o))}async __getTraceById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Pt.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteTraceById(t,r){return h.fromPromise(this.__deleteTraceById(t,r))}async __deleteTraceById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTrace(t,r,o){return h.fromPromise(this.__updateTrace(t,r,o))}async __updateTrace(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ao.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteThreadComments(t,r){return h.fromPromise(this.__deleteThreadComments(t,r))}async __deleteThreadComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteThreadFeedbackScores(t,r){return h.fromPromise(this.__deleteThreadFeedbackScores(t,r))}async __deleteThreadFeedbackScores(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Co.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/feedback-scores/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceComments(t,r){return h.fromPromise(this.__deleteTraceComments(t,r))}async __deleteTraceComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceFeedbackScore(t,r,o){return h.fromPromise(this.__deleteTraceFeedbackScore(t,r,o))}async __deleteTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceThreads(t,r){return h.fromPromise(this.__deleteTraceThreads(t,r))}async __deleteTraceThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraces(t,r){return h.fromPromise(this.__deleteTraces(t,r))}async __deleteTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames2(t={},r){return h.fromPromise(this.__findFeedbackScoreNames2(t,r))}async __findFeedbackScoreNames2(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Be.findFeedbackScoreNames2.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findTraceThreadsFeedbackScoreNames(t={},r){return h.fromPromise(this.__findTraceThreadsFeedbackScoreNames(t,r))}async __findTraceThreadsFeedbackScoreNames(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/threads/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Be.findTraceThreadsFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getTraceStats(t={},r){return h.fromPromise(this.__getTraceStats(t,r))}async __getTraceStats(t={},r){var w,k;let{projectId:o,projectName:i,filters:a,fromTime:l,toTime:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),a!=null&&(u.filters=a),l!=null&&(u.from_time=l.toISOString()),d!=null&&(u.to_time=d.toISOString());let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Pe.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getThreadComment(t,r,o){return h.fromPromise(this.__getThreadComment(t,r,o))}async __getThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/{threadId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThreadStats(t={},r){return h.fromPromise(this.__getTraceThreadStats(t,r))}async __getTraceThreadStats(t={},r){var w,k;let{projectId:o,projectName:i,filters:a,fromTime:l,toTime:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),a!=null&&(u.filters=a),l!=null&&(u.from_time=l.toISOString()),d!=null&&(u.to_time=d.toISOString());let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/threads/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Pe.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/stats.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getTraceComment(t,r,o){return h.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThread(t,r){return h.fromPromise(this.__getTraceThread(t,r))}async __getTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:sa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:vt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceThreads(t={},r){return h.fromPromise(this.__getTraceThreads(t,r))}async __getTraceThreads(t={},r){var B,O;let{page:o,size:i,projectName:a,projectId:l,truncate:d,stripAttachments:u,filters:g,sorting:w,fromTime:k,toTime:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.project_name=a),l!=null&&(x.project_id=l),d!=null&&(x.truncate=d.toString()),u!=null&&(x.strip_attachments=u.toString()),g!=null&&(x.filters=g),w!=null&&(x.sorting=w),k!=null&&(x.from_time=k.toISOString()),S!=null&&(x.to_time=S.toISOString());let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:Ud.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse});switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}openTraceThread(t,r){return h.fromPromise(this.__openTraceThread(t,r))}async __openTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/open"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:sa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/open.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfThreads(t,r){return h.fromPromise(this.__scoreBatchOfThreads(t,r))}async __scoreBatchOfThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfTraces(t,r){return h.fromPromise(this.__scoreBatchOfTraces(t,r))}async __scoreBatchOfTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraceThreads(t={},r){return h.fromPromise(this.__searchTraceThreads(t,r))}async __searchTraceThreads(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraces(t={},r){return h.fromPromise(this.__searchTraces(t,r))}async __searchTraces(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Do.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 401:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateThread(t,r,o){return h.fromPromise(this.__updateThread(t,r,o))}async __updateThread(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Eo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/{threadModelId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateThreadComment(t,r,o){return h.fromPromise(this.__updateThreadComment(t,r,o))}async __updateThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateTraceComment(t,r,o){return h.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var va=class{constructor(t={}){this._options=t;}getWelcomeWizardStatus(t){return h.fromPromise(this.__getWelcomeWizardStatus(t))}async __getWelcomeWizardStatus(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/welcome-wizard"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Md.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/welcome-wizard.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}submitWelcomeWizard(t={},r){return h.fromPromise(this.__submitWelcomeWizard(t,r))}async __submitWelcomeWizard(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/welcome-wizard"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/welcome-wizard.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ca=class{constructor(t={}){this._options=t;}costsSummary(t,r){return h.fromPromise(this.__costsSummary(t,r))}async __costsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:er.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceConfiguration(t){return h.fromPromise(this.__getWorkspaceConfiguration(t))}async __getWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Ct.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new A(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertWorkspaceConfiguration(t,r){return h.fromPromise(this.__upsertWorkspaceConfiguration(t,r))}async __upsertWorkspaceConfiguration(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/configurations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ct.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/workspaces/configurations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteWorkspaceConfiguration(t){return h.fromPromise(this.__deleteWorkspaceConfiguration(t))}async __deleteWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new A(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCost(t,r){return h.fromPromise(this.__getCost(t,r))}async __getCost(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMetric(t,r){return h.fromPromise(this.__getMetric(t,r))}async __getMetric(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}metricsSummary(t,r){return h.fromPromise(this.__metricsSummary(t,r))}async __metricsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Nd.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ia=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return h.fromPromise(this.__datasetsRedirect(t,r))}async __datasetsRedirect(t,r){var u,g;let{datasetId:o,workspaceName:i,path:a}=t,l={};l.dataset_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);case 404:throw new A(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}experimentsRedirect(t,r){return h.fromPromise(this.__experimentsRedirect(t,r))}async __experimentsRedirect(t,r){var g,w;let{datasetId:o,experimentId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.experiment_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);case 404:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}optimizationsRedirect(t,r){return h.fromPromise(this.__optimizationsRedirect(t,r))}async __optimizationsRedirect(t,r){var g,w;let{datasetId:o,optimizationId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.optimization_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);case 404:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/optimizations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}projectsRedirect(t,r){return h.fromPromise(this.__projectsRedirect(t,r))}async __projectsRedirect(t,r){var u,g;let{traceId:o,workspaceName:i,path:a}=t,l={};l.trace_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);case 404:throw new A(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var It=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new ca(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new la(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new ma(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new da(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new ua(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ga(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new wa(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new fa(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new ha(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new Ra(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new ba(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new ya(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new za(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new ka(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Sa(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new xa(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new _a(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Aa(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Ta(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Ea(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Pa(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new va(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new Ca(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ia(this._options)}isAlive(t){return h.fromPromise(this.__isAlive(t))}async __isAlive(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return h.fromPromise(this.__version(t))}async __version(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var q=()=>v7();var ja=class s{constructor(t,r){this.data=t;this.opik=r;this.childSpans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=t=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...t};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...t},this};this.span=t=>{var a;let r=(a=this.data.projectName)!=null?a:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.traceId,parentSpanId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new s(o,this.opik);return this.childSpans.push(i),i};}};var Ua=class{constructor(t,r){this.data=t;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=t=>{var a,l;let r=(l=(a=this.data.projectName)!=null?a:t.projectName)!=null?l:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new ja(o,this.opik);return this.spans.push(i),i};this.update=t=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...t};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var Rg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Da={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},rR=s=>Object.entries(s).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%26/g,"&").replace(/%3F/g,"?").replace(/%3D/g,"="),oR=s=>s.replace(/\/api$/,""),tR=s=>Buffer.from(s).toString("base64"),bg=(s,t,r)=>{let o=rR(r),i=`${t}?${o}`;return new URL(i,s).toString()},yg=({datasetId:s,experimentId:t,baseUrl:r})=>bg(r,Rg.EXPERIMENTS,{[Da.EXPERIMENT_ID]:t,[Da.DATASET_ID]:s,[Da.PATH]:tR(r)});var zg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=oR(r),i=`${t}/${Rg.PROJECT_BY_NAME}`;return bg(o,i,{[Da.PROJECT_NAME]:s})};var iR=300,Ma=100,jt=class{constructor({action:t,batchSize:r=Ma,delay:o,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=(t,r)=>{if(this.queue.set(t,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(t,r)=>{let o=this.queue.get(t);o&&(this.queue.set(t,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let t=new Map(this.queue);this.queue.clear(),z.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(z.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{z.error(`Failed to flush ${this.name}:`,r,t);}),await this.promise;};this.action=t,this.batchSize=r,this.delay=o,this.enableBatch=i,this.name=a;}},se=class{constructor({delay:t=iR,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Ma,updateBatchSize:l=Ma,deleteBatchSize:d=Ma,name:u="BatchQueue"}={}){this.create=t=>{let r=this.getId(t);this.createQueue.add(r,t);};this.get=async t=>{let r=this.createQueue.queue.get(t);return r||this.getEntity(t)};this.update=(t,r)=>{if(this.createQueue.queue.get(t)){this.createQueue.update(t,r);return}this.updateQueue.add(t,r);};this.delete=t=>{if(this.createQueue.queue.has(t)){this.createQueue.queue.delete(t);return}this.deleteQueue.add(t);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=u,this.createQueue=new jt({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new jt({action:async g=>{await this.createQueue.flush();let w=Array.from(g.entries());for(let[k,S]of w)await this.updateEntity(k,S);},delay:t,enableBatch:o,batchSize:l,name:`${u}:updateQueue`}),this.deleteQueue=new jt({action:async g=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(g.keys()));},delay:t,enableBatch:i,batchSize:d,name:`${u}:deleteQueue`});}};var Na=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r},this.api.requestOptions);}async getEntity(r){return await this.api.spans.getSpanById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o,this.api.requestOptions);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o,this.api.requestOptions);}};var Fa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Oa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r},this.api.requestOptions);}async getEntity(r){return await this.api.traces.getTraceById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o,this.api.requestOptions);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r},this.api.requestOptions);}};var Wa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.traces.deleteTraceFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Ba=class extends It{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var La=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"DatasetBatchQueue"});this.api=r;}getId(r){return r.id||""}async createEntities(r){for(let o of r)await this.api.datasets.createDataset(o,this.api.requestOptions);}async getEntity(r){try{return await this.api.datasets.getDatasetById(r,this.api.requestOptions)}catch{return}}async updateEntity(r,o){await this.api.datasets.updateDataset(r,{name:o.name||"",visibility:o.visibility,description:o.description},this.api.requestOptions);}async deleteEntities(r){await this.api.datasets.deleteDatasetsBatch({ids:r},this.api.requestOptions);}};var Fd=null;async function kg(){return Fd||(Fd=await aR()),Fd}var Ut=class s{constructor(t){let{id:r,traceId:o,spanId:i,source:a,...l}=t;this.id=r||q(),this.traceId=o,this.spanId=i,this.source=a||Tn.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=nR(t);return (await kg()).h32(r,43981).toString(16)}toApiModel(){return {id:this.id,traceId:this.traceId,spanId:this.spanId,source:this.source,data:this.getContent()}}static fromApiModel(t){return new s({id:t.id,traceId:t.traceId,spanId:t.spanId,source:t.source,...t.data})}};async function ve(s,t,r){var l;if(r===0)return [];let o=new TextDecoder("utf-8"),i=[],a="";try{for await(let d of s){a+=o.decode(d,{stream:!0});let u=a.split(`
4
+ `);a=(l=u.pop())!=null?l:"";for(let g of u)if(!(!g.trim()||g==="{}"||g==="[]"||g==="null"))try{let w=JSON.parse(g),k=t.parse(w);if(k.ok){if(i.push(k.value),r!==void 0&&i.length>=r)return i}else z.error("Error parsing experiment item:",k.errors);}catch(w){z.error("Error parsing JSON line:",w instanceof Error?w.message:String(w));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let d=JSON.parse(a),u=t.parse(d);u.ok?i.push(u.value):z.error("Error parsing experiment item:",u.errors);}catch(d){z.error("Error parsing remaining buffer:",d instanceof Error?d.message:String(d));}}catch(d){z.error("Error processing stream:",d instanceof Error?d.message:String(d));}return i}function Dt(s,t){let r=[];for(let o=0;o<s.length;o+=t.maxBatchSize)r.push(s.slice(o,o+t.maxBatchSize));return r}var ne=class extends Error{constructor(t){var r;super(t.message),this.name=this.constructor.name,this.code=t.code,this.statusCode=t.statusCode,this.details=t.details,this.originalError=t.originalError,z.error(this.message),(r=Error.captureStackTrace)==null||r.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 Sg={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,t)=>`Item at position ${s} is not an object (${t})`,INSERTION_FAILED:s=>`Failed to insert items from JSON: ${s}`,DATASET_JSON_PARSE_ERROR:s=>`Failed to parse JSON input: ${s}`};var pR={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID"},Va=class extends ne{constructor(t){super({message:Sg.DATASET_ITEM_MISSING_ID(t),code:pR.DATASET_ITEM_MISSING_ID});}};var cR={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Ha=class extends ne{constructor(t){super({message:t,code:cR.SEARCH_TIMEOUT});}};var Ja={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,t)=>`Item at position ${s} is not an object (${t})`};var Od={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},Xa=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Ja.JSON_PARSE_ERROR,code:Od.JSON_PARSE_ERROR,originalError:r});}},Ka=class extends ne{constructor(t){super({message:Ja.JSON_NOT_ARRAY(t),code:Od.JSON_NOT_ARRAY});}},Ga=class extends ne{constructor(t,r){super({message:Ja.JSON_ITEM_NOT_OBJECT(t,r),code:Od.JSON_ITEM_NOT_OBJECT});}};var kr=class{constructor({name:t,description:r,id:o},i){this.opik=i;this.idToHash=new Map;this.hashes=new Set;this.id=o||q(),this.name=t,this.description=r;}async insert(t){if(!t||t.length===0)return;await this.opik.datasetBatchQueue.flush(),await this.syncHashes();let r=await this.getDeduplicatedItems(t),o=Dt(r,{maxBatchSize:1e3});try{let i=0;for(let a of o)await this.opik.api.datasets.createOrUpdateDatasetItems({datasetId:this.id,items:a}),i+=a.length,z.info(`Inserted ${Math.min(i,r.length)} of ${r.length} items into dataset ${this.id}`);}catch(i){throw z.error(`Error inserting items into dataset: ${i instanceof Error?i.message:String(i)}`),i}}async update(t){if(!(!t||t.length===0)){for(let r=0;r<t.length;r++)if(!t[r].id)throw new Va(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Dt(t,{maxBatchSize:100});for await(let o of r){z.debug("Deleting dataset items batch",{batchSize:o.length,datasetId:this.id}),await this.opik.api.datasets.deleteDatasetItems({itemIds:o});for(let i of o)if(this.idToHash.has(i)){let a=this.idToHash.get(i);this.hashes.delete(a),this.idToHash.delete(i);}}}async clear(){let r=(await this.getItems()).map(o=>o.id).filter(Boolean);r.length!==0&&await this.delete(r);}async getItems(t,r){return (await this.getItemsAsDataclasses(t,r)).map(i=>i.getContent(true))}async getItemsAsDataclasses(t,r){let o=t?Math.min(t,2e3):2e3,i=await this.opik.api.datasets.streamDatasetItems({datasetName:this.name,lastRetrievedId:r,steamLimit:o});return (await ve(i,C.DatasetItemPublic,t)).map(l=>Ut.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new Xa(l)}if(!Array.isArray(i))throw new Ka(typeof i);if(i.length===0)return;for(let l=0;l<i.length;l++){let d=i[l];if(typeof d!="object"||d===null)throw new Ga(l,typeof d)}let a=i.map(l=>{let d=l,u={};for(let[g,w]of Object.entries(d)){if(o.includes(g))continue;let k=r[g]||g;u[k]=w;}return u});await this.insert(a);}async toJson(t={}){let o=(await this.getItems()).map(i=>{let a={...i};if(Object.keys(t).length>0){for(let[l,d]of Object.entries(t))if(l in a){let u=a[l];delete a[l],a[d]=u;}}return a});return nR(o)}async getDeduplicatedItems(t){let r=[];for(let o of t){let i=new Ut(o),a=await i.contentHash();if(this.hashes.has(a)){z.debug("Duplicate item found - skipping",{contentHash:a,datasetId:this.id});continue}r.push(i.toApiModel()),this.hashes.add(a),this.idToHash.set(i.id,a);}return r}clearHashState(){this.idToHash.clear(),this.hashes.clear();}async syncHashes(){z.debug("Syncing dataset hashes with backend",{datasetId:this.id});try{let t=await this.getItemsAsDataclasses();this.clearHashState();for(let r of t){let o=await r.contentHash();this.idToHash.set(r.id,o),this.hashes.add(o);}z.debug("Dataset hash sync completed",{datasetId:this.id,itemCount:t.length});}catch(t){if(t instanceof p&&t.statusCode===404){z.debug("Dataset not found - starting with empty hash state",{datasetId:this.id}),this.clearHashState();return}throw t}}};var Wd=class extends Error{constructor(t){super(t),this.name="DatasetError";}},Mt=class extends Wd{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var $a=class{constructor(t){if(!t.datasetItemId)throw new Error("datasetItemId is required");if(!t.traceId)throw new Error("traceId is required");this.datasetItemId=t.datasetItemId,this.traceId=t.traceId;}},Qa=class s{constructor(t){this.id=t.id,this.datasetItemId=t.datasetItemId,this.traceId=t.traceId,this.datasetItemData=t.datasetItemData,this.evaluationTaskOutput=t.evaluationTaskOutput,this.feedbackScores=[...t.feedbackScores];}static fromRestExperimentItemCompare(t){var o,i;let r=(i=(o=t.feedbackScores)==null?void 0:o.map(a=>({categoryName:a.categoryName,name:a.name,reason:a.reason,value:a.value,source:a.source})))!=null?i:[];return new s({id:t.id,traceId:t.traceId,datasetItemId:t.datasetItemId,datasetItemData:t.input,evaluationTaskOutput:t.output,feedbackScores:r})}};var rr=class{constructor({id:t,name:r,datasetName:o,prompts:i},a){this.opik=a;this.id=t||q(),this._name=r,this.datasetName=o,this.prompts=i;}get name(){return this._name}async ensureNameLoaded(){if(this._name!==void 0)return this._name;let t=await this.opik.api.experiments.getExperimentById(this.id);if(this._name=t.name,!this._name)throw new Error("Experiment name is not loaded");return this._name}async insert(t){if(t.length===0)return;let r=t.map(i=>({id:q(),experimentId:this.id,datasetItemId:i.datasetItemId,traceId:i.traceId})),o=Dt(r,{maxBatchSize:50});try{for(let i of o)await this.opik.api.experiments.createExperimentItems({experimentItems:i});z.debug(`Inserted ${t.length} items into experiment ${this.id}`);}catch(i){throw z.error(`Error inserting items into experiment: ${i instanceof Error?i.message:String(i)}`),i}}async getItems(t){let r=[],{maxResults:i,truncate:a=false}=t||{},l,d=true;try{for(;d&&!(i!==void 0&&r.length>=i);){let u=i?Math.min(i-r.length,2e3):2e3,g=await this.opik.api.experiments.streamExperimentItems({experimentName:this.name,limit:u,lastRetrievedId:l,truncate:a});try{let w=await ve(g,C.ExperimentItemCompare,u);if(w.length===0){d=!1;break}for(let k of w){let S=Qa.fromRestExperimentItemCompare(k);if(r.push(S),i!==void 0&&r.length>=i){d=!1;break}}l=w[w.length-1].id;}catch(w){z.error("Error parsing experiment item: "+(w instanceof Error?w.message:String(w))),d=!1;break}}}catch(u){throw z.error("Error retrieving experiment items: "+(u instanceof Error?u.message:String(u))),u}return z.info(`Retrieved ${r.length} items${i?` (limited by maxResults=${i})`:""}`),r}async getUrl(){let t=await this.opik.getDataset(this.datasetName),r=this.opik.config.apiUrl||dn.apiUrl;return yg({datasetId:t.id,experimentId:this.id,baseUrl:r})}};var Ya={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:
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 Od={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Mt=class extends ne{constructor(t){super({message:Qa.EXPERIMENT_NOT_FOUND(t),code:Od.EXPERIMENT_NOT_FOUND});}},Nt=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(Qa.INVALID_CONFIG_TYPE(t),Od.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(Qa.CONFIG_PROMPTS_CONFLICT(),Od.CONFIG_PROMPTS_CONFLICT)}};function kg(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw Nt.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw Nt.promptsConflict();if(!s&&(!t||t.length===0))return [void 0,void 0];let r=s?structuredClone(s):{},o;if(t&&t.length>0){o=[];let i={};for(let a of t)o.push({id:a.versionId}),i[a.name]=a.prompt;r.prompts=i;}return Object.keys(r).length===0?[void 0,void 0]:[r,o]}var ue={MUSTACHE:"mustache",JINJA2:"jinja2"};var J=class s extends Error{constructor(t){super(t),this.name="PromptValidationError",Object.setPrototypeOf(this,s.prototype);}};function lR(s){try{let r=cR.parse(s).filter(o=>{let i=o[0];return i==="name"||i==="#"||i==="&"||i==="^"}).map(o=>o[1].split(".")[0]);return new Set(r)}catch(t){throw new J(`Invalid Mustache template syntax: ${t instanceof Error?t.message:String(t)}`)}}function Sg(s,t,r){if(r!=="mustache")return;let o=lR(s),i=new Set(Object.keys(t)),a=new Set([...o].filter(l=>!i.has(l)));if(a.size>0){let l=[];throw l.push(`Missing required variables: ${[...a].join(", ")}`),l.push(`Template placeholders: {${[...o].join(", ")}}`),l.push(`Provided variables: {${[...i].join(", ")}}`),new J(`Template variables validation failed:
8
+ The prompts parameter is recommended for prompt version tracking.`};var Bd={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Nt=class extends ne{constructor(t){super({message:Ya.EXPERIMENT_NOT_FOUND(t),code:Bd.EXPERIMENT_NOT_FOUND});}},Ft=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(Ya.INVALID_CONFIG_TYPE(t),Bd.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(Ya.CONFIG_PROMPTS_CONFLICT(),Bd.CONFIG_PROMPTS_CONFLICT)}};function xg(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw Ft.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw Ft.promptsConflict();if(!s&&(!t||t.length===0))return [void 0,void 0];let r=s?structuredClone(s):{},o;if(t&&t.length>0){o=[];let i={};for(let a of t)o.push({id:a.versionId}),i[a.name]=a.prompt;r.prompts=i;}return Object.keys(r).length===0?[void 0,void 0]:[r,o]}var ue={MUSTACHE:"mustache",JINJA2:"jinja2"};var J=class s extends Error{constructor(t){super(t),this.name="PromptValidationError",Object.setPrototypeOf(this,s.prototype);}};function dR(s){try{let r=mR.parse(s).filter(o=>{let i=o[0];return i==="name"||i==="#"||i==="&"||i==="^"}).map(o=>o[1].split(".")[0]);return new Set(r)}catch(t){throw new J(`Invalid Mustache template syntax: ${t instanceof Error?t.message:String(t)}`)}}function _g(s,t,r){if(r!=="mustache")return;let o=dR(s),i=new Set(Object.keys(t)),a=new Set([...o].filter(l=>!i.has(l)));if(a.size>0){let l=[];throw l.push(`Missing required variables: ${[...a].join(", ")}`),l.push(`Template placeholders: {${[...o].join(", ")}}`),l.push(`Provided variables: {${[...i].join(", ")}}`),new J(`Template variables validation failed:
9
9
  ${l.join(`
10
- `)}`)}}function Re(s,t,r){try{switch(Sg(s,t,r),r){case "mustache":return cR.render(s,t,{},{escape:o=>o});case "jinja2":return dR.renderString(s,t);default:return s}}catch(o){if(o instanceof J)throw o;let i=o instanceof Error?o.message:String(o);throw new J(`Failed to format prompt template: ${i}`)}}var Ft=class s{constructor(t){this.id=t.versionId,this.name=t.name,this.prompt=t.prompt,this.commit=t.commit,this.type=t.type,this.metadata=t.metadata,this.changeDescription=t.changeDescription,this.createdAt=t.createdAt,this.createdBy=t.createdBy;}format(t){return Re(this.prompt,t,this.type)}getVersionAge(){return this.createdAt?formatDistanceToNow(new Date(this.createdAt),{addSuffix:true}):"Unknown"}getVersionInfo(){let t=[`[${this.commit}]`];if(this.createdAt){let r=new Date(this.createdAt);t.push(r.toISOString().split("T")[0]);}return this.createdBy&&t.push(`by ${this.createdBy}`),this.changeDescription&&t.push(`- ${this.changeDescription}`),t.join(" ")}compareTo(t){let r=`Current version [${this.commit}]`,o=`Other version [${t.commit}]`,i=diffStringsUnified(t.prompt,this.prompt,{aAnnotation:o,bAnnotation:r,includeChangeCounts:true,contextLines:3,expand:false});return z.info(`
10
+ `)}`)}}function Re(s,t,r){try{switch(_g(s,t,r),r){case "mustache":return mR.render(s,t,{},{escape:o=>o});case "jinja2":return gR.renderString(s,t);default:return s}}catch(o){if(o instanceof J)throw o;let i=o instanceof Error?o.message:String(o);throw new J(`Failed to format prompt template: ${i}`)}}var Ot=class s{constructor(t){this.id=t.versionId,this.name=t.name,this.prompt=t.prompt,this.commit=t.commit,this.type=t.type,this.metadata=t.metadata,this.changeDescription=t.changeDescription,this.createdAt=t.createdAt,this.createdBy=t.createdBy;}format(t){return Re(this.prompt,t,this.type)}getVersionAge(){return this.createdAt?formatDistanceToNow(new Date(this.createdAt),{addSuffix:true}):"Unknown"}getVersionInfo(){let t=[`[${this.commit}]`];if(this.createdAt){let r=new Date(this.createdAt);t.push(r.toISOString().split("T")[0]);}return this.createdBy&&t.push(`by ${this.createdBy}`),this.changeDescription&&t.push(`- ${this.changeDescription}`),t.join(" ")}compareTo(t){let r=`Current version [${this.commit}]`,o=`Other version [${t.commit}]`,i=diffStringsUnified(t.prompt,this.prompt,{aAnnotation:o,bAnnotation:r,includeChangeCounts:true,contextLines:3,expand:false});return z.info(`
11
11
  Prompt version comparison:
12
- ${i}`),i}static fromApiResponse(t,r){var o;if(!r.template)throw new J("Invalid API response: missing required field 'template'");if(!r.commit)throw new J("Invalid API response: missing required field 'commit'");if(!r.promptId)throw new J("Invalid API response: missing required field 'promptId'");if(!r.id)throw new J("Invalid API response: missing required field 'id'");return new s({name:t,prompt:r.template,commit:r.commit,promptId:r.promptId,versionId:r.id,type:(o=r.type)!=null?o:ue.MUSTACHE,metadata:r.metadata,changeDescription:r.changeDescription,createdAt:r.createdAt?new Date(r.createdAt):void 0,createdBy:r.createdBy})}};var ve=class s{constructor({promptId:t,versionId:r,name:o,prompt:i,commit:a,metadata:l,type:d,changeDescription:u,description:g,tags:w=[]},k){this.opik=k;this.id=t,this.versionId=r,this.prompt=i,this.commit=a,this.type=d!=null?d:ue.MUSTACHE,this.changeDescription=u,this._name=o,this._description=g,this._tags=[...w],this._metadata=l;}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)}format(t){return Re(this.prompt,t,this.type)}static fromApiResponse(t,r,o){var a;if(!r.template)throw new J("Invalid API response: missing required field 'template'");if(!r.commit)throw new J("Invalid API response: missing required field 'commit'");if(!r.promptId)throw new J("Invalid API response: missing required field 'promptId'");if(!r.id)throw new J("Invalid API response: missing required field 'id' (version ID)");let i=(a=r.type)!=null?a:ue.MUSTACHE;if(i!=="mustache"&&i!=="jinja2")throw new J(`Invalid API response: unknown prompt type '${i}'`);return new s({promptId:r.promptId,versionId:r.id,name:t.name,prompt:r.template,commit:r.commit,metadata:r.metadata,type:i,changeDescription:r.changeDescription,description:t.description,tags:t.tags},o)}async updateProperties(t){var r,o,i,a;return await this.opik.api.prompts.updatePrompt(this.id,{name:(r=t.name)!=null?r:this._name,description:t.description,tags:t.tags},this.opik.api.requestOptions),this._name=(o=t.name)!=null?o:this._name,this._description=(i=t.description)!=null?i:this._description,this._tags=(a=t.tags)!=null?a:this._tags,this}async delete(){await this.opik.deletePrompts([this.id]);}async getVersions(){var t;z.debug("Getting versions for prompt",{promptId:this.id,name:this.name});try{let r=[],o=1,i=100;for(;;){let l=(t=(await this.opik.api.prompts.getPromptVersions(this.id,{page:o,size:i},this.opik.api.requestOptions)).content)!=null?t:[];if(r.push(...l),l.length<i)break;o++;}return z.debug("Successfully retrieved prompt versions",{promptId:this.id,name:this.name,totalVersions:r.length}),r.map(a=>Ft.fromApiResponse(this.name,a))}catch(r){throw z.error("Failed to get prompt versions",{promptId:this.id,name:this.name,error:r}),r}}async useVersion(t){z.debug("Restoring prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit});try{let r=await this.opik.api.prompts.restorePromptVersion(this.id,t.id,this.opik.api.requestOptions);return z.debug("Successfully restored prompt version",{promptId:this.id,name:this.name,restoredVersionId:r.id,restoredCommit:r.commit}),s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){throw z.error("Failed to restore prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit,error:r}),r}}async getVersion(t){try{let r=await this.opik.api.prompts.retrievePromptVersion({name:this.name,commit:t},this.opik.api.requestOptions);return s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){if(r&&typeof r=="object"&&"statusCode"in r&&r.statusCode===404)return null;throw z.error("Failed to retrieve prompt version",{promptName:this.name,commit:t,error:r}),r}}};async function xg(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(hR(o))return null;throw o}}function _g(s,t,r){return t?t.template!==s.prompt||!fR(t.metadata,s.metadata)||t.type!==r:true}function fR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return wR(r,o)}function hR(s){return typeof s=="object"&&s!==null&&"statusCode"in s&&s.statusCode===404}var oe=class{constructor(t){this.input=t;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(t){return this.input[this.cursor+t]}consumeChar(){return this.input[this.cursor++]}advance(t=1){this.cursor+=t;}skipWhitespace(){for(;this.cursor<this.input.length&&/\s/.test(this.input[this.cursor]);)this.cursor++;}consumeWhile(t){let r=this.cursor;for(;this.cursor<this.input.length&&t(this.input[this.cursor]);)this.cursor++;return this.input.slice(r,this.cursor)}sliceFrom(t){return this.input.slice(t,this.cursor)}static isFieldChar(t){return /[a-zA-Z0-9_]/.test(t)}static isLetterChar(t){return /[a-zA-Z]/.test(t)}static isDigitChar(t){return /\d/.test(t)}static isWhitespaceChar(t){return /\s/.test(t)}static isQuoteChar(t){return t==='"'||t==="'"}};var V={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"]},Ce={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"},Ag={id:V.STRING_OPS,name:V.STRING_OPS,status:V.LIMITED_STRING_OPS,start_time:V.DATETIME_OPS,end_time:V.DATETIME_OPS,input:V.LIMITED_STRING_OPS,output:V.LIMITED_STRING_OPS,metadata:V.DICT_OPS,feedback_scores:V.NUMERIC_OPS,tags:V.LIST_OPS,"usage.total_tokens":V.NUMERIC_OPS,"usage.prompt_tokens":V.NUMERIC_OPS,"usage.completion_tokens":V.NUMERIC_OPS,duration:V.NUMERIC_OPS,number_of_messages:V.NUMERIC_OPS,created_by:V.STRING_OPS,thread_id:V.STRING_OPS,total_estimated_cost:V.NUMERIC_OPS,type:V.STRING_OPS,model:V.STRING_OPS,provider:V.STRING_OPS},Ya={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function Tg(s){let t=Ya.SPECIAL_FIELDS.includes(s),r=Object.keys(Ce).includes(s);if(!t&&!r){let o=Object.keys(Ce).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${o} are supported.`)}}function Eg(s,t){if(!Ya.SPECIAL_FIELDS.includes(s)){let r=Object.keys(Ce).join(", ");throw new Error(`Field ${s}.${t} is not supported, only the fields ${r} are supported.`)}if(s==="usage"&&!Ya.USAGE_KEYS.includes(t))throw new Error(`When querying usage, ${t} is not supported, only usage.total_tokens, usage.prompt_tokens and usage.completion_tokens are supported.`)}function Wd(s,t){let r=Ag[s];if(!(r!=null&&r.includes(t))){let o=(r==null?void 0:r.join(", "))||"none";throw new Error(`Operator ${t} is not supported for field ${s}, only the operators ${o} are supported.`)}}function Pg(s){let t=s.toLowerCase();if(t==="and")return true;throw t==="or"?new Error("Invalid filter string, OR is not currently supported"):new Error(`Invalid filter string, trailing characters ${s}`)}function Za(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Ot=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return Tg(r),t.peekChar()==="."?this.parseFieldWithKey(t,r):{type:"simple",field:r,columnType:Ce[r]}}static parseFieldName(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseFieldWithKey(t,r){t.advance();let o=this.parseKey(t);if(Eg(r,o),r==="usage"){let i=`usage.${o}`;return {type:"simple",field:i,columnType:Ce[i]}}return {type:"nested",field:r,key:o,columnType:Ce[r]}}static parseKey(t){let r=t.peekChar();return oe.isQuoteChar(r)?this.parseQuotedKey(t,r):this.parseUnquotedKey(t)}static parseUnquotedKey(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseQuotedKey(t,r){let o=t.getPosition();t.advance();let i="",a=false;for(;!t.isAtEnd();){let d=t.peekChar();if(d===r){if(t.peekCharAt(1)===r){i+=r,t.advance(2);continue}a=true,t.advance();break}i+=d,t.advance();}let l=t.getFullInput().slice(o);return Za(a,o,l),i}};var Wt=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Wd(r,i),{operator:i};let a=this.parseWordOperator(t);return Wd(r,a),{operator:a}}static tryParseSymbolicOperator(t,r){if(r==="=")return t.advance(),"=";if(r==="<"||r===">"){let o=r;return t.advance(),t.peekChar()==="="?(t.advance(),o+"="):o}return r==="!"&&t.peekCharAt(1)==="="?(t.advance(2),"!="):null}static parseWordOperator(t){return t.consumeWhile(r=>!oe.isWhitespaceChar(r))}};var Bt=class{static parse(t){t.skipWhitespace();let r=t.getPosition(),o=t.peekChar();if(o==='"')return this.parseQuotedString(t,r);if(oe.isDigitChar(o)||o==="-")return this.parseNumber(t);let i=t.getRemainingInput();throw new Error(`Invalid value ${i.slice(0,20)}, expected a string in double quotes("value") or a number`)}static parseQuotedString(t,r){t.advance();let o=t.getPosition(),i=false;for(;!t.isAtEnd();){if(t.peekChar()==='"'){i=true;break}t.advance();}Za(i,r,`value starting at position ${r}`);let a=t.sliceFrom(o);return t.advance(),{value:a}}static parseNumber(t){let r="";return t.peekChar()==="-"&&(r+=t.consumeChar()),r+=this.parseDigits(t),t.peekChar()==="."&&(r+=t.consumeChar(),r+=this.parseDigits(t)),{value:r}}static parseDigits(t){return t.consumeWhile(r=>oe.isDigitChar(r))}};var Ie=class{constructor(t){let r=t||"";this.filterExpressions=r?this.parse(r):null,this.parsedFilters=this.filterExpressions?JSON.stringify(this.filterExpressions):null;}getFilterExpressions(){return this.filterExpressions}parse(t){let r=new oe(t),o=[];for(;!r.isAtEnd();){let i=this.parseExpression(r);if(o.push(i),r.skipWhitespace(),!r.isAtEnd()&&!this.parseConnector(r))break}return o}parseExpression(t){let r=Ot.parse(t),o=Wt.parse(t,this.getFieldName(r)),i=Bt.parse(t);return this.buildExpression(r,o,i)}getFieldName(t){return t.field}buildExpression(t,r,o){let i={field:t.field,operator:r.operator,value:o.value,type:t.columnType};return t.type==="nested"&&(i.key=t.key),i}parseConnector(t){let r=t.getPosition(),o=t.consumeWhile(i=>oe.isLetterChar(i));try{return Pg(o)}catch(i){if(i instanceof Error&&i.message.includes("trailing characters")){let a=t.getFullInput().slice(r);throw new Error(`Invalid filter string, trailing characters ${a}`)}throw i}}};async function vg(s,t,r,o,i){let a=await s.traces.searchTraces({projectName:t,filters:r!=null?r:void 0,limit:o,truncate:i});return await Pe(a,C.TracePublic,o)}async function Cg(s,t,r,o){let i=Date.now(),a=[];for(;;){if(a=await s(),a.length>=t||Date.now()-i>=r)return a;await new Promise(d=>setTimeout(d,o));}}function Ig(s){if(!s)return null;let r=new Ie(s).getFilterExpressions();return r?r.map(o=>{let i={field:o.field,operator:o.operator,value:o.value};return o.key&&(i.key=o.key),i}):null}var Bd=[],or=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=bg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Xt(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;z.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new ja({id:q(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),z.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.getDataset=async t=>{z.debug(`Getting dataset with name "${t}"`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.getDatasetByIdentifier({datasetName:t});return new kr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Dt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new kr({name:t,description:r},this);try{return this.datasetBatchQueue.create({name:o.name,description:o.description,id:o.id}),z.debug("Dataset added to the queue with name:",o.name),o}catch(i){throw z.error(`Failed to create dataset "${t}"`,{error:i}),new Error(`Error creating dataset "${t}": ${i}`)}};this.getOrCreateDataset=async(t,r)=>{z.debug(`Attempting to retrieve or create dataset with name: "${t}"`);try{return await this.getDataset(t)}catch(o){if(o instanceof Dt)return z.info(`Dataset "${t}" not found. Proceeding to create a new one.`),this.createDataset(t,r);throw z.error(`Error retrieving dataset "${t}":`,o),o}};this.getDatasets=async(t=100)=>{z.debug(`Getting all datasets (limit: ${t})`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.findDatasets({size:t}),o=[];for(let i of r.content||[])o.push(new kr(i,this));return z.info(`Retrieved ${o.length} datasets`),o}catch(r){throw z.error("Failed to retrieve datasets",{error:r}),new Error("Failed to retrieve datasets")}};this.deleteDataset=async t=>{z.debug(`Deleting dataset with name "${t}"`);try{let r=await this.getDataset(t);if(!r.id)throw new Error(`Cannot delete dataset "${t}": ID not available`);this.datasetBatchQueue.delete(r.id);}catch(r){throw z.error(`Failed to delete dataset "${t}"`,{error:r}),new Error(`Failed to delete dataset "${t}": ${r}`)}};this.createExperiment=async({datasetName:t,name:r,experimentConfig:o,prompts:i,type:a=Tn.Regular,optimizationId:l})=>{if(z.debug(`Creating experiment for dataset "${t}"`),!t)throw new Error("Dataset name is required to create an experiment");let[d,u]=kg(o,i),g=q(),w=new rr({id:g,name:r,datasetName:t,prompts:i},this);try{return this.api.experiments.createExperiment({id:g,datasetName:t,name:r,metadata:d,promptVersions:u,type:a,optimizationId:l}),z.debug("Experiment added to the queue with id:",g),w}catch(k){throw z.error(`Failed to create experiment for dataset "${t}"`,{error:k}),new Error(`Error creating experiment: ${k}`)}};this.updateExperiment=async(t,r)=>{if(!t)throw new Error("id is required to update an experiment");let{name:o,experimentConfig:i}=r;if(!o&&!i)throw new Error("At least one of 'name' or 'experimentConfig' must be provided to update an experiment");z.debug(`Updating experiment with ID "${t}"`);let a={};o!==void 0&&(a.name=o),i!==void 0&&(a.metadata=i);try{await this.api.experiments.updateExperiment(t,a);}catch(l){throw z.error(`Failed to update experiment with ID "${t}"`,{error:l}),l}};this.getExperimentById=async t=>{z.debug(`Getting experiment with ID "${t}"`);try{let r=await this.api.experiments.getExperimentById(t);return new rr({id:r.id,name:r.name,datasetName:r.datasetName},this)}catch(r){throw r instanceof p&&r.statusCode===404?new Mt(`No experiment found with ID '${t}'`):(z.error(`Failed to get experiment with ID "${t}"`,{error:r}),r)}};this.getExperimentsByName=async t=>{z.debug(`Getting experiments with name "${t}"`);try{let r=await this.api.experiments.streamExperiments({name:t});return (await Pe(r,C.ExperimentPublic)).map(i=>new rr({id:i.id,name:i.name,datasetName:i.datasetName},this))}catch(r){throw z.error(`Failed to get experiments with name "${t}"`,{error:r}),r}};this.getExperiment=async t=>{z.debug(`Getting experiment with name "${t}"`);let r=await this.getExperimentsByName(t);if(r.length===0)throw new Mt(t);return r[0]};this.getDatasetExperiments=async(t,r=100)=>{var l;z.debug(`Getting experiments for dataset "${t}"`);let o=await this.getDataset(t),i=Math.min(100,r),a=[];try{let d=1;for(;a.length<r;){let u=await this.api.experiments.findExperiments({page:d,size:i,datasetId:o.id}),g=(l=u==null?void 0:u.content)!=null?l:[];if(g.length===0)break;let w=r-a.length,k=Math.min(g.length,w);for(let S=0;S<k;S++){let x=g[S];a.push(new rr({id:x.id,name:x.name,datasetName:x.datasetName},this));}if(k<g.length)break;d+=1;}return a}catch(d){throw z.error(`Failed to get experiments for dataset "${t}"`,{error:d}),d}};this.deleteExperiment=async t=>{z.debug(`Deleting experiment with ID "${t}"`);try{await this.api.experiments.deleteExperimentsById({ids:[t]});}catch(r){throw z.error(`Failed to delete experiment with ID "${t}"`,{error:r}),r}};this.createPrompt=async t=>{var r;z.debug("Creating prompt",{name:t.name});try{let o=await xg(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=_g(t,o,i),l;if(a?(z.debug("Creating new prompt version",{name:t.name}),l=await this.api.prompts.createPromptVersion({name:t.name,version:{template:t.prompt,metadata:t.metadata,type:i}},this.api.requestOptions)):(z.debug("Returning existing prompt version",{name:t.name}),l=o),!l.promptId)throw new Error("Invalid API response: missing promptId");let d=await this.api.prompts.getPromptById(l.promptId,this.api.requestOptions),u=ve.fromApiResponse(d,l,this);return z.debug("Prompt created",{name:t.name}),t.description||t.tags?await u.updateProperties({description:t.description,tags:t.tags}):u}catch(o){throw z.error("Failed to create prompt",{name:t.name,error:o}),o}};this.getPrompt=async t=>{var r;z.debug("Getting prompt",t);try{let i=(r=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:t.name}]),size:1},this.api.requestOptions)).content)==null?void 0:r[0];if(!i)return z.debug("Prompt not found",{name:t.name}),null;let a=await this.api.prompts.retrievePromptVersion(t,this.api.requestOptions);return ve.fromApiResponse(i,a,this)}catch(o){if(o instanceof p&&o.statusCode===404)return null;throw z.error("Failed to get prompt",{name:t.name,error:o}),o}};this.searchPrompts=async t=>{var r;z.debug("Searching prompts",{filterString:t});try{let o;if(t){let u=new Ie(t).getFilterExpressions();o=u?JSON.stringify(u):void 0;}let a=(r=(await this.api.prompts.getPrompts({filters:o,size:1e3},this.api.requestOptions)).content)!=null?r:[];return (await Promise.all(a.map(async d=>{if(!d.name)return null;try{let u=await this.api.prompts.retrievePromptVersion({name:d.name},this.api.requestOptions);return ve.fromApiResponse(d,u,this)}catch(u){return z.debug("Failed to get version for prompt",{name:d.name,error:u}),null}}))).filter(d=>d!==null)}catch(o){throw z.error("Failed to search prompts",{error:o}),o}};this.deletePrompts=async t=>{z.debug("Deleting prompts in batch",{count:t.length});try{await this.api.prompts.deletePromptsBatch({ids:t},this.api.requestOptions),z.info("Successfully deleted prompts",{count:t.length});}catch(r){throw z.error("Failed to delete prompts",{count:t.length,error:r}),r}};this.searchTraces=async t=>{let{projectName:r,filterString:o,maxResults:i=1e3,truncate:a=true,waitForAtLeast:l,waitForTimeout:d=60}=t!=null?t:{};z.debug("Searching traces",{projectName:r,filterString:o,maxResults:i,truncate:a,waitForAtLeast:l,waitForTimeout:d});let u=Ig(o),g=r!=null?r:this.config.projectName,w=()=>vg(this.api,g,u,i,a);if(l===void 0)return await w();let k=await Cg(w,l,d*1e3,5e3);if(k.length<l)throw new Va(`Timeout after ${d} seconds: expected ${l} traces, but only ${k.length} were found.`);return k};this.flush=async()=>{z.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(),z.info("Successfully flushed all data to Opik");}catch(t){z.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};z.debug("Initializing OpikClient with config:",t),this.config=nu(t);let r={apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName};t!=null&&t.headers&&(z.debug("Initializing OpikClient with additional headers:",t==null?void 0:t.headers),r.requestOptions={headers:t==null?void 0:t.headers}),this.api=new Wa(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Ma(this.api,o),this.traceBatchQueue=new Fa(this.api,o),this.spanFeedbackScoresBatchQueue=new Na(this.api,o),this.traceFeedbackScoresBatchQueue=new Oa(this.api,o),this.datasetBatchQueue=new Ba(this.api,o),Bd.push(this);}};var bR="track.decorator",Lt=new AsyncLocalStorage,yR=()=>{let{span:s,trace:t}=Lt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function zR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function kR({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){z.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let a=o;a||(a=Vd().trace({name:s,projectName:r}));let l=a.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return z.debug("Span created with ID:",l.data.id),{span:l,trace:a}}function SR({args:s,span:t,trace:r}){if(z.debug("Starting span execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};z.debug("Recording span input"),t.update({input:o}),r&&(z.debug("Recording trace input"),r.update({input:o}));}function jg({result:s,span:t,trace:r,enrichSpan:o}){z.debug("Recording successful execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id});let i=typeof s=="object"?s:{result:s},a=new Date,l={endTime:a,output:i};if(o){let d=o(s);Object.assign(l,d);}t.update(l),r&&r.update({endTime:a,output:i});}function Ug({span:s,error:t,trace:r}){var o,i;z.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function qa({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Lt.getStore(),{span:u,trace:g}=kR({name:s!=null?s:i.name||bR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Lt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{SR({args:l,span:u,trace:S});let x=i.apply(k,l);return zR(x)?x.then(T=>(jg({span:u,result:T,trace:S,enrichSpan:o}),T),T=>{throw Ug({span:u,error:T,trace:S}),T}):(jg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw Ug({span:u,error:x,trace:S}),x}})}}function _e(s,t){if(typeof s=="function")return qa({},s);let r=s;return t?qa(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return qa(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=qa(r,a),i}}var Ld=null;function Vd(){return Ld===null&&(Ld=new or),Ld}var xR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([Vd().flush(),...Bd.map(s=>s.flush())]),z.debug("flushAll operation completed successfully");}catch(s){throw z.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};function Dg(s,t){if(!t||typeof t!="object")throw new Error("Arguments must be an object");let r=s.validationSchema,i=r.extend(Object.fromEntries(Object.entries(r.shape).map(([a,l])=>[a,l.refine(d=>d!==void 0,{message:`${a} cannot be undefined`,path:[a]})]))).safeParse(t);if(!i.success){let a=i.error.issues.map(d=>d.path[0]).filter(Boolean),l=[...new Set(a)];throw new Error(_R(s,t,l))}}function _R(s,t,r){let o=Object.keys(t),i=r.filter(a=>!(a in t));return `Metric '${s.name}' is skipped, missing required arguments: ${i.join(", ")}. Available arguments: ${o.join(", ")}.`}var rn=class{static calculateAverageScores(t){if(!t||t.length===0)return new Map;let r=new Map;for(let i of t)if(!(!i||!i.scoreResults||i.scoreResults.length===0))for(let a of i.scoreResults){if(!a||a.scoringFailed||typeof a.value!="number")continue;let l=r.get(a.name)||{sum:0,count:0};l.sum+=a.value,l.count+=1,r.set(a.name,l);}let o=new Map;return r.forEach((i,a)=>{o.set(a,i.count>0?i.sum/i.count:0);}),o}static formatScore(t){return t.toFixed(4)}static formatTime(t){let r=Math.floor(t/3600),o=Math.floor(t%3600/60),i=Math.floor(t%60);return `${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}static async generateResultTable(t,r,o,i){if(t.length===0){z.info(`
12
+ ${i}`),i}static fromApiResponse(t,r){var o;if(!r.template)throw new J("Invalid API response: missing required field 'template'");if(!r.commit)throw new J("Invalid API response: missing required field 'commit'");if(!r.promptId)throw new J("Invalid API response: missing required field 'promptId'");if(!r.id)throw new J("Invalid API response: missing required field 'id'");return new s({name:t,prompt:r.template,commit:r.commit,promptId:r.promptId,versionId:r.id,type:(o=r.type)!=null?o:ue.MUSTACHE,metadata:r.metadata,changeDescription:r.changeDescription,createdAt:r.createdAt?new Date(r.createdAt):void 0,createdBy:r.createdBy})}};var Ce=class s{constructor({promptId:t,versionId:r,name:o,prompt:i,commit:a,metadata:l,type:d,changeDescription:u,description:g,tags:w=[]},k){this.opik=k;this.id=t,this.versionId=r,this.prompt=i,this.commit=a,this.type=d!=null?d:ue.MUSTACHE,this.changeDescription=u,this._name=o,this._description=g,this._tags=[...w],this._metadata=l;}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)}format(t){return Re(this.prompt,t,this.type)}static fromApiResponse(t,r,o){var a;if(!r.template)throw new J("Invalid API response: missing required field 'template'");if(!r.commit)throw new J("Invalid API response: missing required field 'commit'");if(!r.promptId)throw new J("Invalid API response: missing required field 'promptId'");if(!r.id)throw new J("Invalid API response: missing required field 'id' (version ID)");let i=(a=r.type)!=null?a:ue.MUSTACHE;if(i!=="mustache"&&i!=="jinja2")throw new J(`Invalid API response: unknown prompt type '${i}'`);return new s({promptId:r.promptId,versionId:r.id,name:t.name,prompt:r.template,commit:r.commit,metadata:r.metadata,type:i,changeDescription:r.changeDescription,description:t.description,tags:t.tags},o)}async updateProperties(t){var r,o,i,a;return await this.opik.api.prompts.updatePrompt(this.id,{name:(r=t.name)!=null?r:this._name,description:t.description,tags:t.tags},this.opik.api.requestOptions),this._name=(o=t.name)!=null?o:this._name,this._description=(i=t.description)!=null?i:this._description,this._tags=(a=t.tags)!=null?a:this._tags,this}async delete(){await this.opik.deletePrompts([this.id]);}async getVersions(){var t;z.debug("Getting versions for prompt",{promptId:this.id,name:this.name});try{let r=[],o=1,i=100;for(;;){let l=(t=(await this.opik.api.prompts.getPromptVersions(this.id,{page:o,size:i},this.opik.api.requestOptions)).content)!=null?t:[];if(r.push(...l),l.length<i)break;o++;}return z.debug("Successfully retrieved prompt versions",{promptId:this.id,name:this.name,totalVersions:r.length}),r.map(a=>Ot.fromApiResponse(this.name,a))}catch(r){throw z.error("Failed to get prompt versions",{promptId:this.id,name:this.name,error:r}),r}}async useVersion(t){z.debug("Restoring prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit});try{let r=await this.opik.api.prompts.restorePromptVersion(this.id,t.id,this.opik.api.requestOptions);return z.debug("Successfully restored prompt version",{promptId:this.id,name:this.name,restoredVersionId:r.id,restoredCommit:r.commit}),s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){throw z.error("Failed to restore prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit,error:r}),r}}async getVersion(t){try{let r=await this.opik.api.prompts.retrievePromptVersion({name:this.name,commit:t},this.opik.api.requestOptions);return s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){if(r&&typeof r=="object"&&"statusCode"in r&&r.statusCode===404)return null;throw z.error("Failed to retrieve prompt version",{promptName:this.name,commit:t,error:r}),r}}};async function Ag(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(bR(o))return null;throw o}}function Tg(s,t,r){return t?t.template!==s.prompt||!RR(t.metadata,s.metadata)||t.type!==r:true}function RR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return hR(r,o)}function bR(s){return typeof s=="object"&&s!==null&&"statusCode"in s&&s.statusCode===404}var oe=class{constructor(t){this.input=t;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(t){return this.input[this.cursor+t]}consumeChar(){return this.input[this.cursor++]}advance(t=1){this.cursor+=t;}skipWhitespace(){for(;this.cursor<this.input.length&&/\s/.test(this.input[this.cursor]);)this.cursor++;}consumeWhile(t){let r=this.cursor;for(;this.cursor<this.input.length&&t(this.input[this.cursor]);)this.cursor++;return this.input.slice(r,this.cursor)}sliceFrom(t){return this.input.slice(t,this.cursor)}static isFieldChar(t){return /[a-zA-Z0-9_]/.test(t)}static isLetterChar(t){return /[a-zA-Z]/.test(t)}static isDigitChar(t){return /\d/.test(t)}static isWhitespaceChar(t){return /\s/.test(t)}static isQuoteChar(t){return t==='"'||t==="'"}};var V={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"]},Ie={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"},Eg={id:V.STRING_OPS,name:V.STRING_OPS,status:V.LIMITED_STRING_OPS,start_time:V.DATETIME_OPS,end_time:V.DATETIME_OPS,input:V.LIMITED_STRING_OPS,output:V.LIMITED_STRING_OPS,metadata:V.DICT_OPS,feedback_scores:V.NUMERIC_OPS,tags:V.LIST_OPS,"usage.total_tokens":V.NUMERIC_OPS,"usage.prompt_tokens":V.NUMERIC_OPS,"usage.completion_tokens":V.NUMERIC_OPS,duration:V.NUMERIC_OPS,number_of_messages:V.NUMERIC_OPS,created_by:V.STRING_OPS,thread_id:V.STRING_OPS,total_estimated_cost:V.NUMERIC_OPS,type:V.STRING_OPS,model:V.STRING_OPS,provider:V.STRING_OPS},Za={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function Pg(s){let t=Za.SPECIAL_FIELDS.includes(s),r=Object.keys(Ie).includes(s);if(!t&&!r){let o=Object.keys(Ie).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${o} are supported.`)}}function vg(s,t){if(!Za.SPECIAL_FIELDS.includes(s)){let r=Object.keys(Ie).join(", ");throw new Error(`Field ${s}.${t} is not supported, only the fields ${r} are supported.`)}if(s==="usage"&&!Za.USAGE_KEYS.includes(t))throw new Error(`When querying usage, ${t} is not supported, only usage.total_tokens, usage.prompt_tokens and usage.completion_tokens are supported.`)}function Ld(s,t){let r=Eg[s];if(!(r!=null&&r.includes(t))){let o=(r==null?void 0:r.join(", "))||"none";throw new Error(`Operator ${t} is not supported for field ${s}, only the operators ${o} are supported.`)}}function Cg(s){let t=s.toLowerCase();if(t==="and")return true;throw t==="or"?new Error("Invalid filter string, OR is not currently supported"):new Error(`Invalid filter string, trailing characters ${s}`)}function qa(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Wt=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return Pg(r),t.peekChar()==="."?this.parseFieldWithKey(t,r):{type:"simple",field:r,columnType:Ie[r]}}static parseFieldName(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseFieldWithKey(t,r){t.advance();let o=this.parseKey(t);if(vg(r,o),r==="usage"){let i=`usage.${o}`;return {type:"simple",field:i,columnType:Ie[i]}}return {type:"nested",field:r,key:o,columnType:Ie[r]}}static parseKey(t){let r=t.peekChar();return oe.isQuoteChar(r)?this.parseQuotedKey(t,r):this.parseUnquotedKey(t)}static parseUnquotedKey(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseQuotedKey(t,r){let o=t.getPosition();t.advance();let i="",a=false;for(;!t.isAtEnd();){let d=t.peekChar();if(d===r){if(t.peekCharAt(1)===r){i+=r,t.advance(2);continue}a=true,t.advance();break}i+=d,t.advance();}let l=t.getFullInput().slice(o);return qa(a,o,l),i}};var Bt=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Ld(r,i),{operator:i};let a=this.parseWordOperator(t);return Ld(r,a),{operator:a}}static tryParseSymbolicOperator(t,r){if(r==="=")return t.advance(),"=";if(r==="<"||r===">"){let o=r;return t.advance(),t.peekChar()==="="?(t.advance(),o+"="):o}return r==="!"&&t.peekCharAt(1)==="="?(t.advance(2),"!="):null}static parseWordOperator(t){return t.consumeWhile(r=>!oe.isWhitespaceChar(r))}};var Lt=class{static parse(t){t.skipWhitespace();let r=t.getPosition(),o=t.peekChar();if(o==='"')return this.parseQuotedString(t,r);if(oe.isDigitChar(o)||o==="-")return this.parseNumber(t);let i=t.getRemainingInput();throw new Error(`Invalid value ${i.slice(0,20)}, expected a string in double quotes("value") or a number`)}static parseQuotedString(t,r){t.advance();let o=t.getPosition(),i=false;for(;!t.isAtEnd();){if(t.peekChar()==='"'){i=true;break}t.advance();}qa(i,r,`value starting at position ${r}`);let a=t.sliceFrom(o);return t.advance(),{value:a}}static parseNumber(t){let r="";return t.peekChar()==="-"&&(r+=t.consumeChar()),r+=this.parseDigits(t),t.peekChar()==="."&&(r+=t.consumeChar(),r+=this.parseDigits(t)),{value:r}}static parseDigits(t){return t.consumeWhile(r=>oe.isDigitChar(r))}};var je=class{constructor(t){let r=t||"";this.filterExpressions=r?this.parse(r):null,this.parsedFilters=this.filterExpressions?JSON.stringify(this.filterExpressions):null;}getFilterExpressions(){return this.filterExpressions}parse(t){let r=new oe(t),o=[];for(;!r.isAtEnd();){let i=this.parseExpression(r);if(o.push(i),r.skipWhitespace(),!r.isAtEnd()&&!this.parseConnector(r))break}return o}parseExpression(t){let r=Wt.parse(t),o=Bt.parse(t,this.getFieldName(r)),i=Lt.parse(t);return this.buildExpression(r,o,i)}getFieldName(t){return t.field}buildExpression(t,r,o){let i={field:t.field,operator:r.operator,value:o.value,type:t.columnType};return t.type==="nested"&&(i.key=t.key),i}parseConnector(t){let r=t.getPosition(),o=t.consumeWhile(i=>oe.isLetterChar(i));try{return Cg(o)}catch(i){if(i instanceof Error&&i.message.includes("trailing characters")){let a=t.getFullInput().slice(r);throw new Error(`Invalid filter string, trailing characters ${a}`)}throw i}}};async function Ig(s,t,r,o,i){let a=await s.traces.searchTraces({projectName:t,filters:r!=null?r:void 0,limit:o,truncate:i});return await ve(a,C.TracePublic,o)}async function jg(s,t,r,o){let i=Date.now(),a=[];for(;;){if(a=await s(),a.length>=t||Date.now()-i>=r)return a;await new Promise(d=>setTimeout(d,o));}}function Ug(s){if(!s)return null;let r=new je(s).getFilterExpressions();return r?r.map(o=>{let i={field:o.field,operator:o.operator,value:o.value};return o.key&&(i.key=o.key),i}):null}var Vd=[],or=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=zg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Kt(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;z.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new Ua({id:q(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),z.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.getDataset=async t=>{z.debug(`Getting dataset with name "${t}"`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.getDatasetByIdentifier({datasetName:t});return new kr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Mt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new kr({name:t,description:r},this);try{return this.datasetBatchQueue.create({name:o.name,description:o.description,id:o.id}),z.debug("Dataset added to the queue with name:",o.name),o}catch(i){throw z.error(`Failed to create dataset "${t}"`,{error:i}),new Error(`Error creating dataset "${t}": ${i}`)}};this.getOrCreateDataset=async(t,r)=>{z.debug(`Attempting to retrieve or create dataset with name: "${t}"`);try{return await this.getDataset(t)}catch(o){if(o instanceof Mt)return z.info(`Dataset "${t}" not found. Proceeding to create a new one.`),this.createDataset(t,r);throw z.error(`Error retrieving dataset "${t}":`,o),o}};this.getDatasets=async(t=100)=>{z.debug(`Getting all datasets (limit: ${t})`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.findDatasets({size:t}),o=[];for(let i of r.content||[])o.push(new kr(i,this));return z.info(`Retrieved ${o.length} datasets`),o}catch(r){throw z.error("Failed to retrieve datasets",{error:r}),new Error("Failed to retrieve datasets")}};this.deleteDataset=async t=>{z.debug(`Deleting dataset with name "${t}"`);try{let r=await this.getDataset(t);if(!r.id)throw new Error(`Cannot delete dataset "${t}": ID not available`);this.datasetBatchQueue.delete(r.id);}catch(r){throw z.error(`Failed to delete dataset "${t}"`,{error:r}),new Error(`Failed to delete dataset "${t}": ${r}`)}};this.createExperiment=async({datasetName:t,name:r,experimentConfig:o,prompts:i,type:a=En.Regular,optimizationId:l})=>{if(z.debug(`Creating experiment for dataset "${t}"`),!t)throw new Error("Dataset name is required to create an experiment");let[d,u]=xg(o,i),g=q(),w=new rr({id:g,name:r,datasetName:t,prompts:i},this);try{return this.api.experiments.createExperiment({id:g,datasetName:t,name:r,metadata:d,promptVersions:u,type:a,optimizationId:l}),z.debug("Experiment added to the queue with id:",g),w}catch(k){throw z.error(`Failed to create experiment for dataset "${t}"`,{error:k}),new Error(`Error creating experiment: ${k}`)}};this.updateExperiment=async(t,r)=>{if(!t)throw new Error("id is required to update an experiment");let{name:o,experimentConfig:i}=r;if(!o&&!i)throw new Error("At least one of 'name' or 'experimentConfig' must be provided to update an experiment");z.debug(`Updating experiment with ID "${t}"`);let a={};o!==void 0&&(a.name=o),i!==void 0&&(a.metadata=i);try{await this.api.experiments.updateExperiment(t,a);}catch(l){throw z.error(`Failed to update experiment with ID "${t}"`,{error:l}),l}};this.getExperimentById=async t=>{z.debug(`Getting experiment with ID "${t}"`);try{let r=await this.api.experiments.getExperimentById(t);return new rr({id:r.id,name:r.name,datasetName:r.datasetName},this)}catch(r){throw r instanceof p&&r.statusCode===404?new Nt(`No experiment found with ID '${t}'`):(z.error(`Failed to get experiment with ID "${t}"`,{error:r}),r)}};this.getExperimentsByName=async t=>{z.debug(`Getting experiments with name "${t}"`);try{let r=await this.api.experiments.streamExperiments({name:t});return (await ve(r,C.ExperimentPublic)).map(i=>new rr({id:i.id,name:i.name,datasetName:i.datasetName},this))}catch(r){throw z.error(`Failed to get experiments with name "${t}"`,{error:r}),r}};this.getExperiment=async t=>{z.debug(`Getting experiment with name "${t}"`);let r=await this.getExperimentsByName(t);if(r.length===0)throw new Nt(t);return r[0]};this.getDatasetExperiments=async(t,r=100)=>{var l;z.debug(`Getting experiments for dataset "${t}"`);let o=await this.getDataset(t),i=Math.min(100,r),a=[];try{let d=1;for(;a.length<r;){let u=await this.api.experiments.findExperiments({page:d,size:i,datasetId:o.id}),g=(l=u==null?void 0:u.content)!=null?l:[];if(g.length===0)break;let w=r-a.length,k=Math.min(g.length,w);for(let S=0;S<k;S++){let x=g[S];a.push(new rr({id:x.id,name:x.name,datasetName:x.datasetName},this));}if(k<g.length)break;d+=1;}return a}catch(d){throw z.error(`Failed to get experiments for dataset "${t}"`,{error:d}),d}};this.deleteExperiment=async t=>{z.debug(`Deleting experiment with ID "${t}"`);try{await this.api.experiments.deleteExperimentsById({ids:[t]});}catch(r){throw z.error(`Failed to delete experiment with ID "${t}"`,{error:r}),r}};this.createPrompt=async t=>{var r;z.debug("Creating prompt",{name:t.name});try{let o=await Ag(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=Tg(t,o,i),l;if(a?(z.debug("Creating new prompt version",{name:t.name}),l=await this.api.prompts.createPromptVersion({name:t.name,version:{template:t.prompt,metadata:t.metadata,type:i}},this.api.requestOptions)):(z.debug("Returning existing prompt version",{name:t.name}),l=o),!l.promptId)throw new Error("Invalid API response: missing promptId");let d=await this.api.prompts.getPromptById(l.promptId,this.api.requestOptions),u=Ce.fromApiResponse(d,l,this);return z.debug("Prompt created",{name:t.name}),t.description||t.tags?await u.updateProperties({description:t.description,tags:t.tags}):u}catch(o){throw z.error("Failed to create prompt",{name:t.name,error:o}),o}};this.getPrompt=async t=>{var r;z.debug("Getting prompt",t);try{let i=(r=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:t.name}]),size:1},this.api.requestOptions)).content)==null?void 0:r[0];if(!i)return z.debug("Prompt not found",{name:t.name}),null;let a=await this.api.prompts.retrievePromptVersion(t,this.api.requestOptions);return Ce.fromApiResponse(i,a,this)}catch(o){if(o instanceof p&&o.statusCode===404)return null;throw z.error("Failed to get prompt",{name:t.name,error:o}),o}};this.searchPrompts=async t=>{var r;z.debug("Searching prompts",{filterString:t});try{let o;if(t){let u=new je(t).getFilterExpressions();o=u?JSON.stringify(u):void 0;}let a=(r=(await this.api.prompts.getPrompts({filters:o,size:1e3},this.api.requestOptions)).content)!=null?r:[];return (await Promise.all(a.map(async d=>{if(!d.name)return null;try{let u=await this.api.prompts.retrievePromptVersion({name:d.name},this.api.requestOptions);return Ce.fromApiResponse(d,u,this)}catch(u){return z.debug("Failed to get version for prompt",{name:d.name,error:u}),null}}))).filter(d=>d!==null)}catch(o){throw z.error("Failed to search prompts",{error:o}),o}};this.deletePrompts=async t=>{z.debug("Deleting prompts in batch",{count:t.length});try{await this.api.prompts.deletePromptsBatch({ids:t},this.api.requestOptions),z.info("Successfully deleted prompts",{count:t.length});}catch(r){throw z.error("Failed to delete prompts",{count:t.length,error:r}),r}};this.searchTraces=async t=>{let{projectName:r,filterString:o,maxResults:i=1e3,truncate:a=true,waitForAtLeast:l,waitForTimeout:d=60}=t!=null?t:{};z.debug("Searching traces",{projectName:r,filterString:o,maxResults:i,truncate:a,waitForAtLeast:l,waitForTimeout:d});let u=Ug(o),g=r!=null?r:this.config.projectName,w=()=>Ig(this.api,g,u,i,a);if(l===void 0)return await w();let k=await jg(w,l,d*1e3,5e3);if(k.length<l)throw new Ha(`Timeout after ${d} seconds: expected ${l} traces, but only ${k.length} were found.`);return k};this.flush=async()=>{z.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(),z.info("Successfully flushed all data to Opik");}catch(t){z.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};z.debug("Initializing OpikClient with config:",t),this.config=pu(t);let r={apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName};t!=null&&t.headers&&(z.debug("Initializing OpikClient with additional headers:",t==null?void 0:t.headers),r.requestOptions={headers:t==null?void 0:t.headers}),this.api=new Ba(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Na(this.api,o),this.traceBatchQueue=new Oa(this.api,o),this.spanFeedbackScoresBatchQueue=new Fa(this.api,o),this.traceFeedbackScoresBatchQueue=new Wa(this.api,o),this.datasetBatchQueue=new La(this.api,o),Vd.push(this);}};var zR="track.decorator",Vt=new AsyncLocalStorage,kR=()=>{let{span:s,trace:t}=Vt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function SR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function xR({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){z.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let a=o;a||(a=Jd().trace({name:s,projectName:r}));let l=a.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return z.debug("Span created with ID:",l.data.id),{span:l,trace:a}}function _R({args:s,span:t,trace:r}){if(z.debug("Starting span execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};z.debug("Recording span input"),t.update({input:o}),r&&(z.debug("Recording trace input"),r.update({input:o}));}function Dg({result:s,span:t,trace:r,enrichSpan:o}){z.debug("Recording successful execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id});let i=typeof s=="object"?s:{result:s},a=new Date,l={endTime:a,output:i};if(o){let d=o(s);Object.assign(l,d);}t.update(l),r&&r.update({endTime:a,output:i});}function Mg({span:s,error:t,trace:r}){var o,i;z.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function en({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Vt.getStore(),{span:u,trace:g}=xR({name:s!=null?s:i.name||zR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Vt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{_R({args:l,span:u,trace:S});let x=i.apply(k,l);return SR(x)?x.then(T=>(Dg({span:u,result:T,trace:S,enrichSpan:o}),T),T=>{throw Mg({span:u,error:T,trace:S}),T}):(Dg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw Mg({span:u,error:x,trace:S}),x}})}}function _e(s,t){if(typeof s=="function")return en({},s);let r=s;return t?en(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return en(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=en(r,a),i}}var Hd=null;function Jd(){return Hd===null&&(Hd=new or),Hd}var AR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([Jd().flush(),...Vd.map(s=>s.flush())]),z.debug("flushAll operation completed successfully");}catch(s){throw z.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};function Ng(s,t){if(!t||typeof t!="object")throw new Error("Arguments must be an object");let r=s.validationSchema,i=r.extend(Object.fromEntries(Object.entries(r.shape).map(([a,l])=>[a,l.refine(d=>d!==void 0,{message:`${a} cannot be undefined`,path:[a]})]))).safeParse(t);if(!i.success){let a=i.error.issues.map(d=>d.path[0]).filter(Boolean),l=[...new Set(a)];throw new Error(TR(s,t,l))}}function TR(s,t,r){let o=Object.keys(t),i=r.filter(a=>!(a in t));return `Metric '${s.name}' is skipped, missing required arguments: ${i.join(", ")}. Available arguments: ${o.join(", ")}.`}var on=class{static calculateAverageScores(t){if(!t||t.length===0)return new Map;let r=new Map;for(let i of t)if(!(!i||!i.scoreResults||i.scoreResults.length===0))for(let a of i.scoreResults){if(!a||a.scoringFailed||typeof a.value!="number")continue;let l=r.get(a.name)||{sum:0,count:0};l.sum+=a.value,l.count+=1,r.set(a.name,l);}let o=new Map;return r.forEach((i,a)=>{o.set(a,i.count>0?i.sum/i.count:0);}),o}static formatScore(t){return t.toFixed(4)}static formatTime(t){let r=Math.floor(t/3600),o=Math.floor(t%3600/60),i=Math.floor(t%60);return `${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}static async generateResultTable(t,r,o,i){if(t.length===0){z.info(`
13
13
  No test results available to display.`);return}if(o.size===0){z.info(`
14
- No metrics available to display.`);return}let a=[...o.keys()].sort(),l=this.formatTime(i),d=[en.bold(`Total time: ${l}`),en.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return en.green(`${w}: ${k} (avg)`)})].join(`
15
- `),u=await r.ensureNameLoaded(),g=AR(d,{title:`${u} (${t.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});z.info(`
14
+ No metrics available to display.`);return}let a=[...o.keys()].sort(),l=this.formatTime(i),d=[rn.bold(`Total time: ${l}`),rn.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return rn.green(`${w}: ${k} (avg)`)})].join(`
15
+ `),u=await r.ensureNameLoaded(),g=ER(d,{title:`${u} (${t.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});z.info(`
16
16
  `+g+`
17
- `),z.info(en.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${Xt(r,"in your Opik dashboard")}`);}static async processResults(t,r,o=0){let i=this.calculateAverageScores(t);await this.generateResultTable(t,r,i,o),await this.displayExperimentLink(r);let a=await r.ensureNameLoaded();return {experimentId:r.id,experimentName:a,testResults:t}}};function Mg(s,t,r){if(!s||typeof t!="string"||t.trim()==="")return r;let o=t.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=s;for(let a of o)if(typeof i=="object"&&i!==null&&a in i)i=i[a];else return r;return i===void 0?r:i}var Ng,Hd;Ng=[_e({name:"metrics_calculation",type:fe.General})];var Sr=class{constructor(t,r,o){f$1(Hd,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=r,this.dataset=t.dataset,this.experiment=o,this.task=t.task,this.scoringMetrics=t.scoringMetrics||[],this.projectName=t.projectName,this.nbSamples=t.nbSamples,this.scoringKeyMapping=t.scoringKeyMapping;}async execute(){var w;let t=performance.now(),r=[],o=await this.dataset.getItems(this.nbSamples),i=o.length,a=z.settings.minLevel;z.settings.minLevel=6;let l=TR({text:`Evaluating dataset (0/${i} items)`}).start(),d=[];for(let k=0;k<o.length;k++){let S=o[k];try{this.rootTrace=this.client.trace({projectName:this.projectName,name:"evaluation_task",createdBy:"evaluation",input:S}),Lt.enterWith({trace:this.rootTrace});let x=await this.executeTask(S);d.push(x),this.rootTrace.update({output:x.testCase.taskOutput,endTime:new Date});}catch(x){let T=x instanceof Error?x.message:String(x);z.error(`Error processing dataset item: ${S.id} - ${T}`),x instanceof Error&&this.rootTrace.update({errorInfo:{message:x.message,exceptionType:x.name,traceback:(w=x.stack)!=null?w:""},endTime:new Date});}r.push(new Ga({datasetItemId:S.id,traceId:this.rootTrace.data.id})),l.text=`Evaluating dataset (${k+1}/${i} items, ${Math.round((k+1)/i*100)}%)`;}let g=(performance.now()-t)/1e3;return l.succeed(`Evaluation complete: ${i} items processed in ${g.toFixed(2)}s`),z.settings.minLevel=a,this.experiment.insert(r),await this.client.flush(),rn.processResults(d,this.experiment,g)}async executeTask(t){let r={},o=[];z.debug(`Starting evaluation task on dataset item ${t.id}`),r=await _e({name:"llm_task",type:fe.General},this.task)(t),z.debug(`Finished evaluation task on dataset item ${t.id}`);let i=this.prepareScoringInputs(t,r),a={traceId:this.rootTrace.data.id,datasetItemId:t.id,scoringInputs:i,taskOutput:r};return this.scoringMetrics.length>0?this.calculateScores(a):{testCase:a,scoreResults:o}}async calculateScores(t){let r=[],{scoringInputs:o}=t;for(let i of this.scoringMetrics){z.debug(`Calculating score for metric ${i.name}`);try{Dg(i,o);let a=await i.score(o),l=Array.isArray(a)?a:[a];r.push(...l);}catch(a){let l=a instanceof Error?a.message:String(a);z.error(`Metric ${i.name} failed: ${l}`);}z.debug(`Finished calculating score for metric ${i.name}`);}return r.forEach(i=>{var a;return (a=this.rootTrace)==null?void 0:a.score({name:i.name,value:i.value,reason:i.reason})}),{testCase:t,scoreResults:r}}prepareScoringInputs(t,r){let o={...t,...r};if(!this.scoringKeyMapping)return o;let i={...o};for(let[a,l]of Object.entries(this.scoringKeyMapping)){let d=Mg(o,l);d!==void 0&&(i[a]=d);}return i}};Hd=d(null),g(Hd,1,"calculateScores",Ng,Sr),e$1(Hd,Sr);var xr=class xr{static getInstance(t){return xr.instance||(xr.instance=new or(t)),xr.instance}};xr.instance=null;var on=xr;async function Fg(s){var o;if(!s.dataset)throw new Error("Dataset is required for evaluation");if(!s.task)throw new Error("Task function is required for evaluation");let t=(o=s.client)!=null?o:on.getInstance(),r=await t.createExperiment({name:s.experimentName,datasetName:s.dataset.name,experimentConfig:s.experimentConfig,prompts:s.prompts});try{let i=new Sr(s,t,r);return z.info("Starting evaluation"),i.execute()}catch(i){throw z.error(`Error during evaluation: ${i}`),i}}var tr=class{constructor(t){this.modelName=t;}};var Vt=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},_r=class s extends Vt{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},je=class s extends Vt{constructor(t){super(t),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function CR(s,t){return s.startsWith("gpt-")||s.startsWith("o1")||s.startsWith("o3")||s.startsWith("chatgpt-")}function IR(s,t){return s.startsWith("claude-")}function jR(s,t){return s.startsWith("gemini-")||s.startsWith("gemma-")}function Jd(s,t,r){if(!t)throw new je(`API key for ${s} is not configured. Please provide it via the 'apiKey' option or set the ${r} environment variable.`)}function Xd(s,t){if(CR(s)){let r=(t==null?void 0:t.apiKey)||process.env.OPENAI_API_KEY;return Jd("OpenAI",r,"OPENAI_API_KEY"),createOpenAI({apiKey:r,...t})(s)}if(IR(s)){let r=(t==null?void 0:t.apiKey)||process.env.ANTHROPIC_API_KEY;return Jd("Anthropic",r,"ANTHROPIC_API_KEY"),createAnthropic({apiKey:r,...t})(s)}if(jR(s)){let r=(t==null?void 0:t.apiKey)||process.env.GOOGLE_API_KEY;return Jd("Google Gemini",r,"GOOGLE_API_KEY"),createGoogleGenerativeAI({apiKey:r,...t})(s)}throw new je(`Unable to detect provider for model ID: ${s}. Supported providers are OpenAI (gpt-*, o1*, o3*, chatgpt-*), Anthropic (claude-*), and Google Gemini (gemini-*, gemma-*).`)}var UR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens",reasoningTokens:"reasoning_tokens",cachedInputTokens:"cached_input_tokens"};function DR(s){if(!s||typeof s!="object")return false;let t=s,r="usage"in t,o="response"in t,i="text"in t,a="object"in t;return r||o||i||a}function Kd(s,t){if(!DR(s))return {model:t};let r={model:MR(s,t)},o=NR(s.usage);o&&(r.usage=o);let i=FR(s);i&&(r.provider=i);let a=WR(s);a&&(r.metadata=a);let l=BR(s);return l&&(r.output=l),r}function MR(s,t){var r,o;return (o=(r=s.response)==null?void 0:r.modelId)!=null?o:t}function NR(s){if(!s)return;let t={};for(let[r,o]of Object.entries(UR)){let i=s[r];i!==void 0&&(t[o]=i);}return Object.keys(t).length>0?t:void 0}function FR(s){if(!s.providerMetadata)return;let t=Object.keys(s.providerMetadata);return t.length>0?t[0]:void 0}function OR(s){if(!s)return;let t={};return s.id&&(t.id=s.id),s.timestamp&&(t.timestamp=s.timestamp.toISOString()),Object.keys(t).length>0?t:void 0}function WR(s){let t={};s.usage&&(t.usage=s.usage),s.warnings&&s.warnings.length>0&&(t.warnings=s.warnings);let r=OR(s.response);return r&&(t.response=r),s.providerMetadata&&(t.providerMetadata=s.providerMetadata),s.finishReason&&(t.finishReason=s.finishReason),Object.keys(t).length>0?t:void 0}function BR(s){let t={};return "text"in s&&s.text&&(t.text=s.text),"object"in s&&s.object!==void 0&&(t.object=s.object),"toolCalls"in s&&Array.isArray(s.toolCalls)&&(t.toolCalls=s.toolCalls),"toolResults"in s&&Array.isArray(s.toolResults)&&(t.toolResults=s.toolResults),"sources"in s&&Array.isArray(s.sources)&&(t.sources=s.sources),Object.keys(t).length>0?t:void 0}var Ar=class extends tr{constructor(t,r={trackGenerations:true}){let o=typeof t=="string"?t:t.modelId;super(o);let{trackGenerations:i,...a}=r;try{typeof t!="string"?(this.model=t,z.debug("Initialized VercelAIChatModel with custom LanguageModel")):(this.model=Xd(t,a),z.debug(`Initialized VercelAIChatModel with model ID: ${t}`)),i?(this._generateText=_e({name:"model.generateText",type:fe.Llm,enrichSpan:l=>Kd(l,this.modelName)},generateText),this._generateObject=_e({name:"model.generateObject",type:fe.Llm,enrichSpan:l=>Kd(l,this.modelName)},generateObject)):(this._generateText=generateText,this._generateObject=generateObject);}catch(l){throw new je(`Failed to initialize model ${o}: ${l instanceof Error?l.message:String(l)}`)}}async generateString(t,r,o){try{let i;if(r){z.debug(`Generating structured output with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateObject({model:this.model,prompt:t,schema:r,...o});z.debug(`Generated structured output with model ${this.modelName}`),i=JSON.stringify(a.object);}else {z.debug(`Generating text with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateText({model:this.model,prompt:t,...o});z.debug(`Generated text with model ${this.modelName}, output length: ${a.text.length}`),i=a.text;}return i}catch(i){let a=r?`Failed to generate structured output with model ${this.modelName}`:`Failed to generate text with model ${this.modelName}`;throw z.error(a,{error:i}),new _r(a,i instanceof Error?i:new Error(String(i)))}}async generateProviderResponse(t,r){try{z.debug(`Generating provider response with model ${this.modelName}, messages count: ${t.length}`);let o=await this._generateText({model:this.model,messages:t,...r});return z.debug(`Generated provider response with model ${this.modelName}`),o}catch(o){let i=`Failed to generate provider response with model ${this.modelName}`;throw z.error(i,{error:o}),new _r(i,o instanceof Error?o:new Error(String(o)))}}};var Bg="gpt-4o";function Gd(s,t){return new Ar(s,t)}function Lg(s,t){return new Ar(s,t)}function LR(s){return s instanceof tr}function VR(s){return typeof s=="object"&&s!==null&&"modelId"in s&&typeof s.modelId=="string"}function HR(s){return typeof s=="string"&&s.length>0}function JR(s){let t=typeof s,r=t==="object"?JSON.stringify(s):String(s);return new Error(`Invalid model type. Expected one of:
17
+ `),z.info(rn.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${Kt(r,"in your Opik dashboard")}`);}static async processResults(t,r,o=0){let i=this.calculateAverageScores(t);await this.generateResultTable(t,r,i,o),await this.displayExperimentLink(r);let a=await r.ensureNameLoaded();return {experimentId:r.id,experimentName:a,testResults:t}}};function Fg(s,t,r){if(!s||typeof t!="string"||t.trim()==="")return r;let o=t.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=s;for(let a of o)if(typeof i=="object"&&i!==null&&a in i)i=i[a];else return r;return i===void 0?r:i}var Og,Xd;Og=[_e({name:"metrics_calculation",type:fe.General})];var Sr=class{constructor(t,r,o){f$1(Xd,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=r,this.dataset=t.dataset,this.experiment=o,this.task=t.task,this.scoringMetrics=t.scoringMetrics||[],this.projectName=t.projectName,this.nbSamples=t.nbSamples,this.scoringKeyMapping=t.scoringKeyMapping;}async execute(){var w;let t=performance.now(),r=[],o=await this.dataset.getItems(this.nbSamples),i=o.length,a=z.settings.minLevel;z.settings.minLevel=6;let l=PR({text:`Evaluating dataset (0/${i} items)`}).start(),d=[];for(let k=0;k<o.length;k++){let S=o[k];try{this.rootTrace=this.client.trace({projectName:this.projectName,name:"evaluation_task",createdBy:"evaluation",input:S}),Vt.enterWith({trace:this.rootTrace});let x=await this.executeTask(S);d.push(x),this.rootTrace.update({output:x.testCase.taskOutput,endTime:new Date});}catch(x){let T=x instanceof Error?x.message:String(x);z.error(`Error processing dataset item: ${S.id} - ${T}`),x instanceof Error&&this.rootTrace.update({errorInfo:{message:x.message,exceptionType:x.name,traceback:(w=x.stack)!=null?w:""},endTime:new Date});}r.push(new $a({datasetItemId:S.id,traceId:this.rootTrace.data.id})),l.text=`Evaluating dataset (${k+1}/${i} items, ${Math.round((k+1)/i*100)}%)`;}let g=(performance.now()-t)/1e3;return l.succeed(`Evaluation complete: ${i} items processed in ${g.toFixed(2)}s`),z.settings.minLevel=a,this.experiment.insert(r),await this.client.flush(),on.processResults(d,this.experiment,g)}async executeTask(t){let r={},o=[];z.debug(`Starting evaluation task on dataset item ${t.id}`),r=await _e({name:"llm_task",type:fe.General},this.task)(t),z.debug(`Finished evaluation task on dataset item ${t.id}`);let i=this.prepareScoringInputs(t,r),a={traceId:this.rootTrace.data.id,datasetItemId:t.id,scoringInputs:i,taskOutput:r};return this.scoringMetrics.length>0?this.calculateScores(a):{testCase:a,scoreResults:o}}async calculateScores(t){let r=[],{scoringInputs:o}=t;for(let i of this.scoringMetrics){z.debug(`Calculating score for metric ${i.name}`);try{Ng(i,o);let a=await i.score(o),l=Array.isArray(a)?a:[a];r.push(...l);}catch(a){let l=a instanceof Error?a.message:String(a);z.error(`Metric ${i.name} failed: ${l}`);}z.debug(`Finished calculating score for metric ${i.name}`);}return r.forEach(i=>{var a;return (a=this.rootTrace)==null?void 0:a.score({name:i.name,value:i.value,reason:i.reason})}),{testCase:t,scoreResults:r}}prepareScoringInputs(t,r){let o={...t,...r};if(!this.scoringKeyMapping)return o;let i={...o};for(let[a,l]of Object.entries(this.scoringKeyMapping)){let d=Fg(o,l);d!==void 0&&(i[a]=d);}return i}};Xd=d(null),g(Xd,1,"calculateScores",Og,Sr),e$1(Xd,Sr);var xr=class xr{static getInstance(t){return xr.instance||(xr.instance=new or(t)),xr.instance}};xr.instance=null;var tn=xr;async function Wg(s){var o;if(!s.dataset)throw new Error("Dataset is required for evaluation");if(!s.task)throw new Error("Task function is required for evaluation");let t=(o=s.client)!=null?o:tn.getInstance(),r=await t.createExperiment({name:s.experimentName,datasetName:s.dataset.name,experimentConfig:s.experimentConfig,prompts:s.prompts});try{let i=new Sr(s,t,r);return z.info("Starting evaluation"),i.execute()}catch(i){throw z.error(`Error during evaluation: ${i}`),i}}var tr=class{constructor(t){this.modelName=t;}};var Ht=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},_r=class s extends Ht{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ue=class s extends Ht{constructor(t){super(t),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function jR(s,t){return s.startsWith("gpt-")||s.startsWith("o1")||s.startsWith("o3")||s.startsWith("chatgpt-")}function UR(s,t){return s.startsWith("claude-")}function DR(s,t){return s.startsWith("gemini-")||s.startsWith("gemma-")}function Kd(s,t,r){if(!t)throw new Ue(`API key for ${s} is not configured. Please provide it via the 'apiKey' option or set the ${r} environment variable.`)}function Gd(s,t){if(jR(s)){let r=(t==null?void 0:t.apiKey)||process.env.OPENAI_API_KEY;return Kd("OpenAI",r,"OPENAI_API_KEY"),createOpenAI({apiKey:r,...t})(s)}if(UR(s)){let r=(t==null?void 0:t.apiKey)||process.env.ANTHROPIC_API_KEY;return Kd("Anthropic",r,"ANTHROPIC_API_KEY"),createAnthropic({apiKey:r,...t})(s)}if(DR(s)){let r=(t==null?void 0:t.apiKey)||process.env.GOOGLE_API_KEY;return Kd("Google Gemini",r,"GOOGLE_API_KEY"),createGoogleGenerativeAI({apiKey:r,...t})(s)}throw new Ue(`Unable to detect provider for model ID: ${s}. Supported providers are OpenAI (gpt-*, o1*, o3*, chatgpt-*), Anthropic (claude-*), and Google Gemini (gemini-*, gemma-*).`)}var MR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens",reasoningTokens:"reasoning_tokens",cachedInputTokens:"cached_input_tokens"};function NR(s){if(!s||typeof s!="object")return false;let t=s,r="usage"in t,o="response"in t,i="text"in t,a="object"in t;return r||o||i||a}function $d(s,t){if(!NR(s))return {model:t};let r={model:FR(s,t)},o=OR(s.usage);o&&(r.usage=o);let i=WR(s);i&&(r.provider=i);let a=LR(s);a&&(r.metadata=a);let l=VR(s);return l&&(r.output=l),r}function FR(s,t){var r,o;return (o=(r=s.response)==null?void 0:r.modelId)!=null?o:t}function OR(s){if(!s)return;let t={};for(let[r,o]of Object.entries(MR)){let i=s[r];i!==void 0&&(t[o]=i);}return Object.keys(t).length>0?t:void 0}function WR(s){if(!s.providerMetadata)return;let t=Object.keys(s.providerMetadata);return t.length>0?t[0]:void 0}function BR(s){if(!s)return;let t={};return s.id&&(t.id=s.id),s.timestamp&&(t.timestamp=s.timestamp.toISOString()),Object.keys(t).length>0?t:void 0}function LR(s){let t={};s.usage&&(t.usage=s.usage),s.warnings&&s.warnings.length>0&&(t.warnings=s.warnings);let r=BR(s.response);return r&&(t.response=r),s.providerMetadata&&(t.providerMetadata=s.providerMetadata),s.finishReason&&(t.finishReason=s.finishReason),Object.keys(t).length>0?t:void 0}function VR(s){let t={};return "text"in s&&s.text&&(t.text=s.text),"object"in s&&s.object!==void 0&&(t.object=s.object),"toolCalls"in s&&Array.isArray(s.toolCalls)&&(t.toolCalls=s.toolCalls),"toolResults"in s&&Array.isArray(s.toolResults)&&(t.toolResults=s.toolResults),"sources"in s&&Array.isArray(s.sources)&&(t.sources=s.sources),Object.keys(t).length>0?t:void 0}var Ar=class extends tr{constructor(t,r={trackGenerations:true}){let o=typeof t=="string"?t:t.modelId;super(o);let{trackGenerations:i,...a}=r;try{typeof t!="string"?(this.model=t,z.debug("Initialized VercelAIChatModel with custom LanguageModel")):(this.model=Gd(t,a),z.debug(`Initialized VercelAIChatModel with model ID: ${t}`)),i?(this._generateText=_e({name:"model.generateText",type:fe.Llm,enrichSpan:l=>$d(l,this.modelName)},generateText),this._generateObject=_e({name:"model.generateObject",type:fe.Llm,enrichSpan:l=>$d(l,this.modelName)},generateObject)):(this._generateText=generateText,this._generateObject=generateObject);}catch(l){throw new Ue(`Failed to initialize model ${o}: ${l instanceof Error?l.message:String(l)}`)}}async generateString(t,r,o){try{let i;if(r){z.debug(`Generating structured output with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateObject({model:this.model,prompt:t,schema:r,...o});z.debug(`Generated structured output with model ${this.modelName}`),i=JSON.stringify(a.object);}else {z.debug(`Generating text with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateText({model:this.model,prompt:t,...o});z.debug(`Generated text with model ${this.modelName}, output length: ${a.text.length}`),i=a.text;}return i}catch(i){let a=r?`Failed to generate structured output with model ${this.modelName}`:`Failed to generate text with model ${this.modelName}`;throw z.error(a,{error:i}),new _r(a,i instanceof Error?i:new Error(String(i)))}}async generateProviderResponse(t,r){try{z.debug(`Generating provider response with model ${this.modelName}, messages count: ${t.length}`);let o=await this._generateText({model:this.model,messages:t,...r});return z.debug(`Generated provider response with model ${this.modelName}`),o}catch(o){let i=`Failed to generate provider response with model ${this.modelName}`;throw z.error(i,{error:o}),new _r(i,o instanceof Error?o:new Error(String(o)))}}};var Vg="gpt-4o";function Qd(s,t){return new Ar(s,t)}function Hg(s,t){return new Ar(s,t)}function HR(s){return s instanceof tr}function JR(s){return typeof s=="object"&&s!==null&&"modelId"in s&&typeof s.modelId=="string"}function XR(s){return typeof s=="string"&&s.length>0}function KR(s){let t=typeof s,r=t==="object"?JSON.stringify(s):String(s);return new Error(`Invalid model type. Expected one of:
18
18
  - string (model ID like 'gpt-4o', 'claude-3-5-sonnet-latest')
19
19
  - LanguageModel instance from Vercel AI SDK
20
20
  - OpikBaseModel instance
21
- - undefined (uses default model: ${Bg})
21
+ - undefined (uses default model: ${Vg})
22
22
 
23
- Received: ${t} ${r}`)}function Ht(s,t){if(s==null)return Gd(Bg,t);if(HR(s))return Gd(s,t);if(LR(s))return s;if(VR(s))return Lg(s,t);throw JR(s)}function Vg(s){return s.map(t=>{let r=Array.isArray(t.content)?XR(t.content):t.content;return `${t.role}: ${r}`}).join(`
24
- `)}function XR(s){return s.map(t=>t.type==="text"?t.text:t.type==="file"?`[file: ${t.filename||"unknown"}]`:t.type==="tool-call"?`[tool-call: ${t.toolName}]`:t.type==="tool-result"?`[tool-result: ${t.toolName}]`:t.type==="reasoning"?`[reasoning: ${t.text}]`:"").filter(t=>t.length>0).join(`
25
- `)}function KR(s,t,r){return typeof s=="string"?Re(s,t,r):Array.isArray(s)?s.map(i=>i.type==="text"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i.type==="image"&&typeof i.image=="string"?{...i,image:Re(i.image,t,r)}:i.type==="file"&&typeof i.data=="string"?{...i,data:Re(i.data,t,r)}:i.type==="reasoning"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i):s}function Hg(s,t,r){let o=KR(s.content,t,r);return {...s,content:o}}async function _le(s){var i;if(!s.dataset)throw new Error("Dataset is required for prompt evaluation");if(!s.messages||s.messages.length===0)throw new Error("Messages array is required and cannot be empty");if(s.experimentConfig!==void 0&&(typeof s.experimentConfig!="object"||s.experimentConfig===null||Array.isArray(s.experimentConfig)))throw new Error("experimentConfig must be a plain object, not an array or primitive value");let t=Ht(s.model),r={...s.experimentConfig,prompt_template:s.messages,model:t.modelName,...s.temperature!==void 0&&{temperature:s.temperature},...s.seed!==void 0&&{seed:s.seed}},o=GR(t,s.messages,(i=s.templateType)!=null?i:ue.MUSTACHE,{temperature:s.temperature,seed:s.seed});return Fg({dataset:s.dataset,task:o,scoringMetrics:s.scoringMetrics,experimentName:s.experimentName,projectName:s.projectName,experimentConfig:r,prompts:s.prompts,client:s.client,nbSamples:s.nbSamples,scoringKeyMapping:s.scoringKeyMapping})}function GR(s,t,r,o){return async i=>{let a=t.map(g=>Hg(g,i,r)),l=await s.generateProviderResponse(a,o),d=$R(l);return {input:Vg(a),output:d}}}function $R(s){return s&&typeof s=="object"?"text"in s&&typeof s.text=="string"?s.text:"content"in s&&typeof s.content=="string"?s.content:JSON.stringify(s):String(s)}var pe=class{constructor(t,r=true){if(this.name=t,this.trackMetric=r,r){let o=this.score.bind(this);this.score=_e({name:this.name,type:fe.General},o);}}};var QR=z$1.object({output:z$1.unknown(),expected:z$1.unknown()}),Jg=class extends pe{constructor(r="exact_match",o=true){super(r,o);this.validationSchema=QR;}async score(r){let{output:o,expected:i}=r,a=o===i?1:0;return {name:this.name,value:a,reason:`Exact match: ${a===1?"Match":"No match"}`}}};var YR=z$1.object({output:z$1.string(),substring:z$1.string()}),Xg=class extends pe{constructor(r="contains",o=true,i=false){super(r,o);this.validationSchema=YR;this.caseSensitive=i;}async score(r){let{output:o,substring:i}=r,a=this.caseSensitive?o:o.toLowerCase(),l=this.caseSensitive?i:i.toLowerCase();return a.includes(l)?{name:this.name,value:1,reason:`Contains: "${i}" found in output.`}:{name:this.name,value:0,reason:`Contains: "${i}" not found in output.`}}};var ZR=z$1.object({output:z$1.string(),pattern:z$1.string(),flags:z$1.string().optional()}),Kg=class extends pe{constructor(r="regex_match",o=true){super(r,o);this.validationSchema=ZR;}async score(r){let{output:o,pattern:i,flags:a}=r,l;typeof i=="string"&&a?l=new RegExp(i,a):l=new RegExp(i);let d=l.test(o);return {name:this.name,value:d?1:0,reason:d?`Regex: Output matches the regex pattern: ${i}`:`Regex: Output does not match the regex pattern: ${i}`}}};var qR=z$1.object({output:z$1.unknown()}),$g=class extends pe{constructor(r="is_json_metric",o=true){super(r,o);this.validationSchema=qR;}async score(r){let{output:o}=r;try{return JSON.parse(o),{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 ge=class extends pe{constructor(t,r){var i;let o=(i=r==null?void 0:r.trackMetric)!=null?i:true;super(t,o),this.temperature=r==null?void 0:r.temperature,this.seed=r==null?void 0:r.seed,this.maxTokens=r==null?void 0:r.maxTokens,this.modelSettings=r==null?void 0:r.modelSettings,this.model=this.initModel(r==null?void 0:r.model,{trackGenerations:o});}initModel(t,r){return Ht(t,r)}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(s,t=[]){let r="";return t.length>0&&(r=`
23
+ Received: ${t} ${r}`)}function Jt(s,t){if(s==null)return Qd(Vg,t);if(XR(s))return Qd(s,t);if(HR(s))return s;if(JR(s))return Hg(s,t);throw KR(s)}function Jg(s){return s.map(t=>{let r=Array.isArray(t.content)?GR(t.content):t.content;return `${t.role}: ${r}`}).join(`
24
+ `)}function GR(s){return s.map(t=>t.type==="text"?t.text:t.type==="file"?`[file: ${t.filename||"unknown"}]`:t.type==="tool-call"?`[tool-call: ${t.toolName}]`:t.type==="tool-result"?`[tool-result: ${t.toolName}]`:t.type==="reasoning"?`[reasoning: ${t.text}]`:"").filter(t=>t.length>0).join(`
25
+ `)}function $R(s,t,r){return typeof s=="string"?Re(s,t,r):Array.isArray(s)?s.map(i=>i.type==="text"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i.type==="image"&&typeof i.image=="string"?{...i,image:Re(i.image,t,r)}:i.type==="file"&&typeof i.data=="string"?{...i,data:Re(i.data,t,r)}:i.type==="reasoning"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i):s}function Xg(s,t,r){let o=$R(s.content,t,r);return {...s,content:o}}async function jle(s){var i;if(!s.dataset)throw new Error("Dataset is required for prompt evaluation");if(!s.messages||s.messages.length===0)throw new Error("Messages array is required and cannot be empty");if(s.experimentConfig!==void 0&&(typeof s.experimentConfig!="object"||s.experimentConfig===null||Array.isArray(s.experimentConfig)))throw new Error("experimentConfig must be a plain object, not an array or primitive value");let t=Jt(s.model),r={...s.experimentConfig,prompt_template:s.messages,model:t.modelName,...s.temperature!==void 0&&{temperature:s.temperature},...s.seed!==void 0&&{seed:s.seed}},o=QR(t,s.messages,(i=s.templateType)!=null?i:ue.MUSTACHE,{temperature:s.temperature,seed:s.seed});return Wg({dataset:s.dataset,task:o,scoringMetrics:s.scoringMetrics,experimentName:s.experimentName,projectName:s.projectName,experimentConfig:r,prompts:s.prompts,client:s.client,nbSamples:s.nbSamples,scoringKeyMapping:s.scoringKeyMapping})}function QR(s,t,r,o){return async i=>{let a=t.map(g=>Xg(g,i,r)),l=await s.generateProviderResponse(a,o),d=YR(l);return {input:Jg(a),output:d}}}function YR(s){return s&&typeof s=="object"?"text"in s&&typeof s.text=="string"?s.text:"content"in s&&typeof s.content=="string"?s.content:JSON.stringify(s):String(s)}var pe=class{constructor(t,r=true){if(this.name=t,this.trackMetric=r,r){let o=this.score.bind(this);this.score=_e({name:this.name,type:fe.General},o);}}};var ZR=z$1.object({output:z$1.unknown(),expected:z$1.unknown()}),Kg=class extends pe{constructor(r="exact_match",o=true){super(r,o);this.validationSchema=ZR;}async score(r){let{output:o,expected:i}=r,a=o===i?1:0;return {name:this.name,value:a,reason:`Exact match: ${a===1?"Match":"No match"}`}}};var qR=z$1.object({output:z$1.string(),substring:z$1.string()}),Gg=class extends pe{constructor(r="contains",o=true,i=false){super(r,o);this.validationSchema=qR;this.caseSensitive=i;}async score(r){let{output:o,substring:i}=r,a=this.caseSensitive?o:o.toLowerCase(),l=this.caseSensitive?i:i.toLowerCase();return a.includes(l)?{name:this.name,value:1,reason:`Contains: "${i}" found in output.`}:{name:this.name,value:0,reason:`Contains: "${i}" not found in output.`}}};var eb=z$1.object({output:z$1.string(),pattern:z$1.string(),flags:z$1.string().optional()}),$g=class extends pe{constructor(r="regex_match",o=true){super(r,o);this.validationSchema=eb;}async score(r){let{output:o,pattern:i,flags:a}=r,l;typeof i=="string"&&a?l=new RegExp(i,a):l=new RegExp(i);let d=l.test(o);return {name:this.name,value:d?1:0,reason:d?`Regex: Output matches the regex pattern: ${i}`:`Regex: Output does not match the regex pattern: ${i}`}}};var rb=z$1.object({output:z$1.unknown()}),Yg=class extends pe{constructor(r="is_json_metric",o=true){super(r,o);this.validationSchema=rb;}async score(r){let{output:o}=r;try{return JSON.parse(o),{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 ge=class extends pe{constructor(t,r){var i;let o=(i=r==null?void 0:r.trackMetric)!=null?i:true;super(t,o),this.temperature=r==null?void 0:r.temperature,this.seed=r==null?void 0:r.seed,this.maxTokens=r==null?void 0:r.maxTokens,this.modelSettings=r==null?void 0:r.modelSettings,this.model=this.initModel(r==null?void 0:r.model,{trackGenerations:o});}initModel(t,r){return Jt(t,r)}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 Zg(s,t=[]){let r="";return t.length>0&&(r=`
26
26
 
27
27
  ###EXAMPLES###
28
28
 
@@ -84,7 +84,7 @@ ${r}
84
84
  Analyze the following text and provide your verdict score, and reason in the specified JSON format:
85
85
 
86
86
  ${s}
87
- `}var an=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends an{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},nn=class s extends an{constructor(r,o){super(r);this.cause=o;this.name="JSONParsingError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function Ue(s){try{return JSON.parse(s)}catch{return eb(s)}}function eb(s){try{let t=s.indexOf("{"),r=s.lastIndexOf("}");if(t===-1||r===-1||t>=r)throw new Error("No valid JSON object found in content");let o=s.substring(t,r+1);return JSON.parse(o)}catch(t){let r=t instanceof Error?t.message:String(t);throw new nn(`Failed to extract JSON from content: ${r}`,t instanceof Error?t:void 0)}}function Yg(s,t){try{let r=Ue(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Moderation score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate moderation score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var rb=z$1.object({output:z$1.string()}),ob=z$1.object({score:z$1.number(),reason:z$1.string()}),sn=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"moderation_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=rb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{output:o}=r,i=Qg(o,this.fewShotExamples),a=this.buildModelOptions(),l=await this.model.generateString(i,ob,a);return Yg(l,this.name)}};function Zg(s,t){return `
87
+ `}var nn=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends nn{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},sn=class s extends nn{constructor(r,o){super(r);this.cause=o;this.name="JSONParsingError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function De(s){try{return JSON.parse(s)}catch{return ob(s)}}function ob(s){try{let t=s.indexOf("{"),r=s.lastIndexOf("}");if(t===-1||r===-1||t>=r)throw new Error("No valid JSON object found in content");let o=s.substring(t,r+1);return JSON.parse(o)}catch(t){let r=t instanceof Error?t.message:String(t);throw new sn(`Failed to extract JSON from content: ${r}`,t instanceof Error?t:void 0)}}function qg(s,t){try{let r=De(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Moderation score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate moderation score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var tb=z$1.object({output:z$1.string()}),ib=z$1.object({score:z$1.number(),reason:z$1.string()}),pn=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"moderation_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=tb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{output:o}=r,i=Zg(o,this.fewShotExamples),a=this.buildModelOptions(),l=await this.model.generateString(i,ib,a);return qg(l,this.name)}};function ew(s,t){return `
88
88
  You are an impartial judge tasked with evaluating the quality and usefulness of AI-generated responses.
89
89
  Your evaluation should consider the following key factors:
90
90
  - Helpfulness: How well does it solve the user's problem?
@@ -120,7 +120,7 @@ ${s}
120
120
  AI Response: ${t}
121
121
 
122
122
  Provide your evaluation in the specified JSON format.
123
- `}function qg(s,t){try{let r=Ue(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Usefulness score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate usefulness score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var tb=z$1.object({input:z$1.string(),output:z$1.string()}),ib=z$1.object({score:z$1.number(),reason:z$1.string()}),pn=class extends ge{constructor(r){var i;let o=(i=r==null?void 0:r.name)!=null?i:"usefulness_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=tb;}async score(r){let{input:o,output:i}=r,a=Zg(o,i),l=this.buildModelOptions(),d=await this.model.generateString(a,ib,l);return qg(d,this.name)}};var ab=`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.
123
+ `}function rw(s,t){try{let r=De(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Usefulness score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate usefulness score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var ab=z$1.object({input:z$1.string(),output:z$1.string()}),nb=z$1.object({score:z$1.number(),reason:z$1.string()}),cn=class extends ge{constructor(r){var i;let o=(i=r==null?void 0:r.name)!=null?i:"usefulness_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=ab;}async score(r){let{input:o,output:i}=r,a=ew(o,i),l=this.buildModelOptions(),d=await this.model.generateString(a,nb,l);return rw(d,this.name)}};var sb=`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.
124
124
 
125
125
  Guidelines:
126
126
  1. The OUTPUT must not introduce new information beyond what's provided in the CONTEXT.
@@ -155,7 +155,7 @@ It is crucial that you provide your answer in the following JSON format:
155
155
  "reason": ["reason 1", "reason 2"]
156
156
  }}
157
157
  Reasons amount is not restricted. Output must be JSON format only.
158
- `,nb=`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.
158
+ `,pb=`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.
159
159
 
160
160
  Guidelines:
161
161
  1. Evaluate the OUTPUT based on generally accepted facts and reliable information.
@@ -186,7 +186,7 @@ It is crucial that you provide your answer in the following JSON format:
186
186
  "reason": ["some reason 1", "some reason 2"]
187
187
  }}
188
188
  Reasons amount is not restricted. Output must be JSON format only.
189
- `;function ew(s,t){return s.length===0?"":`
189
+ `;function ow(s,t){return s.length===0?"":`
190
190
 
191
191
  EXAMPLES:
192
192
 
@@ -198,7 +198,7 @@ ${i}Output: ${o.output}
198
198
  {"score": "${o.score}", "reason": "${o.reason}"}
199
199
  </example>`}).join(`
200
200
 
201
- `)}`}function rw(s,t,r,o=[]){let i=ew(o,true);return ab.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function ow(s,t,r=[]){let o=ew(r,false);return nb.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function tw(s,t){try{let r=Ue(s),o=r.score;if(o==null)throw new Error(`Hallucination score is required but got ${o}`);let i=Number(o);if(isNaN(i)||i<0||i>1)throw new Error(`Hallucination score must be between 0.0 and 1.0, got ${i}`);let a="",l=r.reason;return Array.isArray(l)?a=l.map(d=>String(d)).join(" "):l&&(a=String(l)),{name:t,value:i,reason:a}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate hallucination score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var sb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),pb=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),cn=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"hallucination_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=sb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{input:o,output:i,context:a}=r,l=a?rw(o,i,a,this.fewShotExamples):ow(o,i,this.fewShotExamples),d=this.buildModelOptions(),u=await this.model.generateString(l,pb,d);return tw(u,this.name)}};var iw=[{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."}],aw=[{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 cb(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
201
+ `)}`}function tw(s,t,r,o=[]){let i=ow(o,true);return sb.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function iw(s,t,r=[]){let o=ow(r,false);return pb.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function aw(s,t){try{let r=De(s),o=r.score;if(o==null)throw new Error(`Hallucination score is required but got ${o}`);let i=Number(o);if(isNaN(i)||i<0||i>1)throw new Error(`Hallucination score must be between 0.0 and 1.0, got ${i}`);let a="",l=r.reason;return Array.isArray(l)?a=l.map(d=>String(d)).join(" "):l&&(a=String(l)),{name:t,value:i,reason:a}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate hallucination score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var cb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),lb=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),ln=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"hallucination_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=cb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{input:o,output:i,context:a}=r,l=a?tw(o,i,a,this.fewShotExamples):iw(o,i,this.fewShotExamples),d=this.buildModelOptions(),u=await this.model.generateString(l,lb,d);return aw(u,this.name)}};var nw=[{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."}],sw=[{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 mb(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
202
202
 
203
203
  - **Input:** "${t.input}"
204
204
  - **Output:** "${t.output}"
@@ -211,7 +211,7 @@ ${i}Output: ${o.output}
211
211
  }
212
212
  \`\`\``).join(`
213
213
 
214
- `)}function lb(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
214
+ `)}function db(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
215
215
 
216
216
  - **Input:** "${t.input}"
217
217
  - **Output:** "${t.output}"
@@ -223,7 +223,7 @@ ${i}Output: ${o.output}
223
223
  }
224
224
  \`\`\``).join(`
225
225
 
226
- `)}function nw(s,t,r,o){return `
226
+ `)}function pw(s,t,r,o){return `
227
227
  YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
228
228
  PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
229
229
  ANOTHER LLM BASED ON THE USER'S INPUT AND CONTEXT PROVIDED.
@@ -269,7 +269,7 @@ ${i}Output: ${o.output}
269
269
 
270
270
  ###FEW-SHOT EXAMPLES###
271
271
 
272
- ${cb(o)}
272
+ ${mb(o)}
273
273
 
274
274
  ###INPUTS:###
275
275
  ***
@@ -282,7 +282,7 @@ ${i}Output: ${o.output}
282
282
  Context:
283
283
  ${JSON.stringify(r)}
284
284
  ***
285
- `}function sw(s,t,r){return `
285
+ `}function cw(s,t,r){return `
286
286
  YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
287
287
  PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
288
288
  ANOTHER LLM BASED ON THE USER'S INPUT.
@@ -327,7 +327,7 @@ ${i}Output: ${o.output}
327
327
 
328
328
  ###FEW-SHOT EXAMPLES###
329
329
 
330
- ${lb(r)}
330
+ ${db(r)}
331
331
 
332
332
  ###INPUTS:###
333
333
  ***
@@ -337,4 +337,4 @@ ${i}Output: ${o.output}
337
337
  Output:
338
338
  ${t}
339
339
  ***
340
- `}function pw(s,t){try{let r=Ue(s),o=r.answer_relevance_score;if(o==null)throw new Error(`Answer relevance score is required but got ${o}`);let i=Number(o);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:t,value:i,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate answer relevance score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var mb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),db=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),ln=class extends ge{constructor(r){var i,a,l,d;let o=(i=r==null?void 0:r.name)!=null?i:"answer_relevance_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=mb;this.fewShotExamplesWithContext=(a=r==null?void 0:r.fewShotExamples)!=null?a:iw,this.fewShotExamplesNoContext=(l=r==null?void 0:r.fewShotExamplesNoContext)!=null?l:aw,this.requireContext=(d=r==null?void 0:r.requireContext)!=null?d:true;}async score(r){let{input:o,output:i,context:a}=r;if(!a&&this.requireContext)throw new ce(`${this.name} requires context by default. If you want to allow execution in no-context mode, enable it via 'new AnswerRelevance({ requireContext: false })'`);let l=a?nw(o,i,a,this.fewShotExamplesWithContext):sw(o,i,this.fewShotExamplesNoContext),d=this.buildModelOptions(),u=await this.model.generateString(l,db,d);return pw(u,this.name)}};export{ln as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,Xg as Contains,Jg as ExactMatch,cn as Hallucination,$g as IsJson,je as ModelConfigurationError,Vt as ModelError,_r as ModelGenerationError,sn as Moderation,or as Opik,tr as OpikBaseModel,Ie as OpikQueryLanguage,fe as OpikSpanType,ve as Prompt,ue as PromptType,Kg as RegexMatch,pn as Usefulness,Ar as VercelAIChatModel,Gd as createModel,Lg as createModelFromInstance,Xd as detectProvider,dw as disableLogger,Fg as evaluate,_le as evaluatePrompt,xR as flushAll,q as generateId,yR as getTrackContext,z as logger,Ht as resolveModel,tu as setLoggerLevel,_e as track};
340
+ `}function lw(s,t){try{let r=De(s),o=r.answer_relevance_score;if(o==null)throw new Error(`Answer relevance score is required but got ${o}`);let i=Number(o);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:t,value:i,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate answer relevance score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var ub=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),gb=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),mn=class extends ge{constructor(r){var i,a,l,d;let o=(i=r==null?void 0:r.name)!=null?i:"answer_relevance_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=ub;this.fewShotExamplesWithContext=(a=r==null?void 0:r.fewShotExamples)!=null?a:nw,this.fewShotExamplesNoContext=(l=r==null?void 0:r.fewShotExamplesNoContext)!=null?l:sw,this.requireContext=(d=r==null?void 0:r.requireContext)!=null?d:true;}async score(r){let{input:o,output:i,context:a}=r;if(!a&&this.requireContext)throw new ce(`${this.name} requires context by default. If you want to allow execution in no-context mode, enable it via 'new AnswerRelevance({ requireContext: false })'`);let l=a?pw(o,i,a,this.fewShotExamplesWithContext):cw(o,i,this.fewShotExamplesNoContext),d=this.buildModelOptions(),u=await this.model.generateString(l,gb,d);return lw(u,this.name)}};export{mn as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,Gg as Contains,Kg as ExactMatch,ln as Hallucination,Yg as IsJson,Ue as ModelConfigurationError,Ht as ModelError,_r as ModelGenerationError,pn as Moderation,or as Opik,tr as OpikBaseModel,je as OpikQueryLanguage,fe as OpikSpanType,Ce as Prompt,ue as PromptType,$g as RegexMatch,cn as Usefulness,Ar as VercelAIChatModel,Qd as createModel,Hg as createModelFromInstance,Gd as detectProvider,gw as disableLogger,Wg as evaluate,jle as evaluatePrompt,AR as flushAll,q as generateId,kR as getTrackContext,z as logger,Jt as resolveModel,au as setLoggerLevel,_e as track};