opik 1.9.52 → 1.9.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts +26 -14
- package/dist/index.d.ts +26 -14
- package/dist/index.js +15 -15
- package/package.json +1 -1
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 su from'fs';import fw from'ini';import'dotenv/config';import dh from'qs';import {v7}from'uuid';import sR from'fast-json-stable-stringify';import nR from'xxhash-wasm';import {TextDecoder}from'util';import dR from'mustache';import wR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import RR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import on from'chalk';import PR from'boxen';import vR 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 gw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Gt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),nu=s=>{z.settings.minLevel=gw[s];},ww=()=>{z.settings.minLevel=100;};nu(process.env.OPIK_LOG_LEVEL||"INFO");var hw="~/.opik.config",un={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function pu(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function Rw(){return pu({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 bw(){let s=process.env.OPIK_CONFIG_PATH||hw;if(!su.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=fw.parse(su.readFileSync(s,"utf8"));return t.opik?pu({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 cu(s){let t=Rw(),r=bw(),{headers:o,...i}=s||{};return yw({...un,...r,...t,...i})}function yw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=zw(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 zw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>kw,AlertPublicAlertType:()=>vw,AlertTriggerConfigPublicType:()=>Ew,AlertTriggerConfigType:()=>xw,AlertTriggerConfigWriteType:()=>_w,AlertTriggerEventType:()=>Sw,AlertTriggerPublicEventType:()=>Pw,AlertTriggerWriteEventType:()=>Aw,AlertWriteAlertType:()=>Tw,AnnotationQueuePublicScope:()=>Uw,AnnotationQueueScope:()=>Iw,AnnotationQueueWriteScope:()=>jw,AssistantMessageRole:()=>qw,AttachmentListRequestEntityType:()=>mu,BadRequestError:()=>_,CheckName:()=>zf,CheckPublicName:()=>nh,CheckPublicResult:()=>sh,CheckResult:()=>kf,ColumnCompareTypesItem:()=>cf,ColumnPublicTypesItem:()=>Rf,ColumnTypesItem:()=>bf,CompleteMultipartUploadRequestEntityType:()=>Dw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>vu,DatasetItemCompareSource:()=>lf,DatasetItemFilterOperator:()=>rf,DatasetItemPublicSource:()=>ff,DatasetItemSource:()=>af,DatasetItemWriteSource:()=>En,DatasetPublicStatus:()=>wf,DatasetPublicVisibility:()=>gf,DatasetStatus:()=>tf,DatasetUpdateVisibility:()=>fu,DatasetVisibility:()=>of,DatasetWriteVisibility:()=>wu,DeleteAttachmentsRequestEntityType:()=>Mw,DownloadAttachmentRequestEntityType:()=>du,ExperimentItemCompareTraceVisibilityMode:()=>mf,ExperimentItemPublicTraceVisibilityMode:()=>hf,ExperimentItemTraceVisibilityMode:()=>nf,ExperimentPublicStatus:()=>Ef,ExperimentPublicType:()=>Tf,ExperimentStatus:()=>yf,ExperimentType:()=>Pn,ExperimentUpdateStatus:()=>yu,ExperimentUpdateType:()=>bu,ExperimentWriteStatus:()=>Ru,ExperimentWriteType:()=>hu,FeedbackScoreBatchItemSource:()=>ah,FeedbackScoreBatchItemThreadSource:()=>lh,FeedbackScoreCompareSource:()=>df,FeedbackScoreExperimentItemBulkWriteViewSource:()=>xf,FeedbackScorePublicSource:()=>oh,FeedbackScoreSource:()=>sf,FindFeedbackDefinitionsRequestType:()=>zu,FindFeedbackScoreNames1RequestType:()=>Iu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>ju,GetSpansByProjectRequestType:()=>Cu,GetWebhookExamplesRequestAlertType:()=>lu,GuardrailName:()=>Pf,GuardrailResult:()=>vf,GuardrailWriteName:()=>Cf,GuardrailWriteResult:()=>If,LlmAsJudgeMessagePublicRole:()=>Kw,LlmAsJudgeMessageRole:()=>Nw,LlmAsJudgeMessageWriteRole:()=>Lw,LlmAsJudgeOutputSchemaPublicType:()=>Gw,LlmAsJudgeOutputSchemaType:()=>Fw,LlmAsJudgeOutputSchemaWriteType:()=>Vw,LogItemLevel:()=>Zw,ManualEvaluationRequestEntityType:()=>Df,NotFoundError:()=>A,NotImplementedError:()=>Ne,OptimizationPublicStatus:()=>Ff,OptimizationStatus:()=>Mf,OptimizationUpdateStatus:()=>Su,OptimizationWriteStatus:()=>Nf,ProjectDetailedVisibility:()=>Vf,ProjectMetricRequestPublicInterval:()=>Tu,ProjectMetricRequestPublicMetricType:()=>Au,ProjectMetricResponsePublicInterval:()=>Lf,ProjectMetricResponsePublicMetricType:()=>Bf,ProjectPublicVisibility:()=>Wf,ProjectUpdateVisibility:()=>_u,ProjectVisibility:()=>Of,ProjectWriteVisibility:()=>xu,PromptDetailTemplateStructure:()=>Qf,PromptPublicTemplateStructure:()=>qf,PromptTemplateStructure:()=>Jf,PromptType:()=>Hf,PromptVersionDetailTemplateStructure:()=>$f,PromptVersionDetailType:()=>Gf,PromptVersionPublicTemplateStructure:()=>Zf,PromptVersionPublicType:()=>Yf,PromptVersionTemplateStructure:()=>Kf,PromptVersionType:()=>Xf,PromptWriteTemplateStructure:()=>Pu,PromptWriteType:()=>Eu,ProviderApiKeyProvider:()=>Uf,ProviderApiKeyPublicProvider:()=>jf,ProviderApiKeyWriteProvider:()=>ku,ResponseFormatType:()=>ef,SpanExperimentItemBulkWriteViewType:()=>_f,SpanFilterOperator:()=>Ow,SpanFilterPublicOperator:()=>$w,SpanFilterWriteOperator:()=>Hw,SpanPublicType:()=>th,SpanSearchStreamRequestPublicType:()=>Uu,SpanType:()=>fe,SpanUpdateType:()=>eh,SpanWriteType:()=>rh,StartMultipartUploadRequestEntityType:()=>uu,TraceFilterOperator:()=>Ww,TraceFilterPublicOperator:()=>Qw,TraceFilterWriteOperator:()=>Jw,TracePublicVisibilityMode:()=>ph,TraceThreadFilterOperator:()=>Bw,TraceThreadFilterPublicOperator:()=>Yw,TraceThreadFilterWriteOperator:()=>Xw,TraceThreadStatus:()=>ch,TraceVisibilityMode:()=>Sf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>gu,ValueEntryCompareSource:()=>uf,ValueEntryExperimentItemBulkWriteViewSource:()=>Af,ValueEntryPublicSource:()=>ih,ValueEntrySource:()=>pf,WebhookTestResultStatus:()=>Cw,alerts:()=>$t,annotationQueues:()=>wn,attachments:()=>Qt,automationRuleEvaluators:()=>hn,chatCompletions:()=>Rn,check:()=>fn,dashboards:()=>bn,datasets:()=>Yt,experiments:()=>Zt,feedbackDefinitions:()=>qt,guardrails:()=>yn,llmProviderKey:()=>ei,manualEvaluation:()=>zn,openTelemetryIngestion:()=>kn,optimizations:()=>ri,projects:()=>oi,prompts:()=>ti,redirect:()=>Tn,serviceToggles:()=>Sn,spans:()=>ii,systemUsage:()=>gn,traces:()=>xn,welcomeWizard:()=>_n,workspaces:()=>An});var $t={};c($t,{GetWebhookExamplesRequestAlertType:()=>lu});var lu={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Qt={};c(Qt,{AttachmentListRequestEntityType:()=>mu,DownloadAttachmentRequestEntityType:()=>du,StartMultipartUploadRequestEntityType:()=>uu,UploadAttachmentRequestEntityType:()=>gu});var mu={Trace:"trace",Span:"span"};var du={Trace:"trace",Span:"span"};var uu={Trace:"trace",Span:"span"};var gu={Trace:"trace",Span:"span"};var Yt={};c(Yt,{DatasetUpdateVisibility:()=>fu,DatasetWriteVisibility:()=>wu});var wu={Private:"private",Public:"public"};var fu={Private:"private",Public:"public"};var Zt={};c(Zt,{ExperimentUpdateStatus:()=>yu,ExperimentUpdateType:()=>bu,ExperimentWriteStatus:()=>Ru,ExperimentWriteType:()=>hu});var hu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ru={Running:"running",Completed:"completed",Cancelled:"cancelled"};var bu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var yu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var qt={};c(qt,{FindFeedbackDefinitionsRequestType:()=>zu});var zu={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var ei={};c(ei,{ProviderApiKeyWriteProvider:()=>ku});var ku={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var ri={};c(ri,{OptimizationUpdateStatus:()=>Su});var Su={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var oi={};c(oi,{ProjectMetricRequestPublicInterval:()=>Tu,ProjectMetricRequestPublicMetricType:()=>Au,ProjectUpdateVisibility:()=>_u,ProjectWriteVisibility:()=>xu});var xu={Private:"private",Public:"public"};var _u={Private:"private",Public:"public"};var Au={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 Tu={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var ti={};c(ti,{CreatePromptVersionDetailTemplateStructure:()=>vu,PromptWriteTemplateStructure:()=>Pu,PromptWriteType:()=>Eu});var Eu={Mustache:"mustache",Jinja2:"jinja2"};var Pu={Text:"text",Chat:"chat"};var vu={Text:"text",Chat:"chat"};var ii={};c(ii,{FindFeedbackScoreNames1RequestType:()=>Iu,GetSpanStatsRequestType:()=>ju,GetSpansByProjectRequestType:()=>Cu,SpanSearchStreamRequestPublicType:()=>Uu});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 Uu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};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 Tn={};var kw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};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={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};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={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Pw={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 vw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Cw={Success:"success",Failure:"failure"};var Iw={Trace:"trace",Thread:"thread"};var jw={Trace:"trace",Thread:"thread"};var Uw={Trace:"trace",Thread:"thread"};var Dw={Trace:"trace",Span:"span"};var Mw={Trace:"trace",Span:"span"};var Nw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Fw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Vw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Gw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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 Zw={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var qw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var ef={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var rf={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 of={Private:"private",Public:"public"};var tf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var af={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var nf={Default:"default",Hidden:"hidden"};var sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var pf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var En={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var cf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var lf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var mf={Default:"default",Hidden:"hidden"};var df={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var uf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var gf={Private:"private",Public:"public"};var wf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var ff={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var hf={Default:"default",Hidden:"hidden"};var Rf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var bf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Pn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var yf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var zf={Topic:"TOPIC",Pii:"PII"};var kf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Sf={Default:"default",Hidden:"hidden"};var xf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var _f={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Af={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Tf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ef={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Pf={Topic:"TOPIC",Pii:"PII"};var vf={Passed:"passed",Failed:"failed"};var Cf={Topic:"TOPIC",Pii:"PII"};var If={Passed:"passed",Failed:"failed"};var jf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var Uf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var Df={Trace:"trace",Thread:"thread",Span:"span"};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={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Of={Private:"private",Public:"public"};var Wf={Private:"private",Public:"public"};var Bf={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 Lf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Vf={Private:"private",Public:"public"};var Hf={Mustache:"mustache",Jinja2:"jinja2"};var Jf={Text:"text",Chat:"chat"};var Xf={Mustache:"mustache",Jinja2:"jinja2"};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={Mustache:"mustache",Jinja2:"jinja2"};var Zf={Text:"text",Chat:"chat"};var qf={Text:"text",Chat:"chat"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var oh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var th={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ih={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ah={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var nh={Topic:"TOPIC",Pii:"PII"};var sh={Passed:"passed",Failed:"failed"};var ph={Default:"default",Hidden:"hidden"};var ch={Active:"active",Inactive:"inactive"};var lh={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(mh({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function mh({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 Pr;typeof globalThis.Headers!="undefined"?Pr=globalThis.Headers:Pr=class Du{constructor(t){if(this.headers=new Map,t)if(t instanceof Du)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 ai={headers:new Pr,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},ni={headers:new Pr,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function si(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Mu(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${dh.stringify(t,{arrayFormat:"repeat"})}`:s}var m=uh();function uh(){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 Nu(){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 Fu({body:s,type:t}){return t.includes("json")?Ae(s):s}async function Ou(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 Wu(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 Ou(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 gh="timeout";function Bu(s){let t=new AbortController,r=setTimeout(()=>t.abort(gh),s);return {signal:t.signal,abortId:r}}function Lu(...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 Vu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:T}=Bu(a);w=T,g.push(x);}l!=null&&g.push(l);let k=Lu(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 wh(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Hu(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=wh(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function fh(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=Mu(s.url,s.queryParameters),o=await Fu({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await Nu();try{let a=await Hu(async()=>Vu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Wu(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:si(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:si(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ai}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:ai}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:ni}:{ok:false,error:{reason:"unknown",errorMessage:Ae(a)},rawResponse:ni}}}var b=fh;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 jn(s){return typeof s=="object"&&s!=null&&"name"in s}function Un(s){return typeof s=="object"&&s!=null&&"path"in s}function Dn(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Ju(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new vn:m.type==="node"?s=new Cn:s=new In,await s.setup(),s}var vn=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(jn(t))return t.name;if(Un(t)&&t.path)return Dn(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"}}},Cn=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(jn(t))return t.name;if(Un(t)&&t.path)return Dn(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():{}}}},In=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(jn(t))return t.name;if(Un(t)&&t.path)return Dn(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:()=>ng,bigint:()=>Ku,boolean:()=>sg,booleanLiteral:()=>ag,date:()=>Gu,discriminant:()=>fg,enum_:()=>ci,getObjectLikeUtils:()=>le,getObjectUtils:()=>Fe,getSchemaUtils:()=>U,isProperty:()=>Ee,lazy:()=>$u,lazyObject:()=>og,list:()=>mi,number:()=>pg,object:()=>li,objectWithoutOptionalProperties:()=>rg,optional:()=>Mn,property:()=>Yu,record:()=>dg,set:()=>ug,string:()=>cg,stringLiteral:()=>ig,transform:()=>Nn,undiscriminatedUnion:()=>wg,union:()=>Rg,unknown:()=>lg,withParsedProperties:()=>On});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 ${hh(s)}.`}function hh(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:Xu(s.json),parse:Xu(s.parse)}}function Xu(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 pi(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ir=class s extends Error{constructor(r){super(r.map(pi).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var ar=class s extends Error{constructor(r){super(r.map(pi).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>Rh(s),optional:()=>Mn(s),optionalNullable:()=>bh(s),transform:t=>Nn(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 Rh(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 Mn(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 bh(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 Nn(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 Ku(){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 yh=/^([+-]?\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 Gu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:yh.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 ci(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 $u(s){let t=Fn(s);return {...t,...U(t)}}function Fn(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 vr(s){return Object.entries(s)}function Cr(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 Ir(s){return Object.keys(s)}function Qu(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=>On(s,t)}}function On(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=Cr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Yu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Ee(s){return s.isProperty}function li(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Ee(o)?o.rawKey:r),_getParsedProperties:()=>Ir(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of vr(s)){let u=Ee(d)?d.rawKey:l,g=Ee(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,eg(g)&&a.push(u);}return Zu({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 vr(s)){let d=Ee(l)?l.valueSchema:l;eg(d)&&i.push(a);}return Zu({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 Zu({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)=>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),...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 qu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=Qu(Ir(t),g=>i.has(g)),d=r(Cr(t,l)),u=o(Cr(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 eg(s){return !zh(s)}function zh(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function rg(s){return li(s)}function og(s){let t={...Fn(s),_getRawProperties:()=>nr(s)._getRawProperties(),_getParsedProperties:()=>nr(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Fe(t)}}function mi(s){let t={parse:(r,o)=>tg(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>tg(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 tg(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 ig(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 ag(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 ng=Q(E.ANY,s=>({ok:true,value:s}));var sg=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var pg=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var cg=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var lg=Q(E.UNKNOWN,s=>({ok:true,value:s}));function dg(s,t){let r={parse:(o,i)=>mg({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)=>mg({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 mg({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Te(s)?vr(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 ug(s){let t=mi(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 wg(s){let t={parse:(r,o)=>gg((i,a)=>i.parse(r,a),s,o),json:(r,o)=>gg((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function gg(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 fg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function Rg(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=ci(Ir(t)),a={parse:(l,d)=>hg({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)=>hg({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 hg({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 kh(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),kh(s)}var C={};c(C,{AggregationData:()=>Cl,Alert:()=>Eh,AlertAlertType:()=>Is,AlertPagePublic:()=>Qs,AlertPublic:()=>Ko,AlertPublicAlertType:()=>Hs,AlertTrigger:()=>Ns,AlertTriggerConfig:()=>Ms,AlertTriggerConfigPublic:()=>Gs,AlertTriggerConfigPublicType:()=>Ks,AlertTriggerConfigType:()=>Ds,AlertTriggerConfigWrite:()=>Os,AlertTriggerConfigWriteType:()=>Fs,AlertTriggerEventType:()=>Us,AlertTriggerPublic:()=>$s,AlertTriggerPublicEventType:()=>Xs,AlertTriggerWrite:()=>Bs,AlertTriggerWriteEventType:()=>Ws,AlertWrite:()=>Xo,AlertWriteAlertType:()=>Ls,AnnotationQueue:()=>op,AnnotationQueueBatch:()=>vh,AnnotationQueueBatchWrite:()=>Fo,AnnotationQueueItemIds:()=>ra,AnnotationQueuePagePublic:()=>ap,AnnotationQueuePublic:()=>Go,AnnotationQueuePublicScope:()=>tp,AnnotationQueueReviewer:()=>rp,AnnotationQueueReviewerPublic:()=>ip,AnnotationQueueScope:()=>ep,AnnotationQueueUpdate:()=>Oo,AnnotationQueueWrite:()=>No,AnnotationQueueWriteScope:()=>hs,AssistantMessage:()=>kc,AssistantMessageRole:()=>zc,Attachment:()=>np,AttachmentListRequestEntityType:()=>gi,AttachmentPage:()=>sp,AudioUrl:()=>gp,AudioUrlPublic:()=>Qp,AudioUrlWrite:()=>Ep,AuthDetailsHolder:()=>dp,AutomationRuleEvaluator:()=>Ih,AutomationRuleEvaluatorLlmAsJudge:()=>zp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>it,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Mp,AutomationRuleEvaluatorObjectObjectPublic:()=>pc,AutomationRuleEvaluatorPagePublic:()=>cc,AutomationRuleEvaluatorPublic:()=>lc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Ap,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>pt,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Op,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Tp,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>ct,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>Bp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>Sp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>nt,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Hp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>xp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>st,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Xp,AutomationRuleEvaluatorUpdate:()=>yc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>gc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>Rc,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>bc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>fc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>hc,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>wc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>kp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>at,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Gp,AutomationRuleEvaluatorWrite:()=>$p,AvgValueStatPublic:()=>Yc,BatchDelete:()=>F,BatchDeleteByProject:()=>Zh,BiInformation:()=>Ts,BiInformationResponse:()=>lr,BooleanFeedbackDefinition:()=>Ml,BooleanFeedbackDefinitionCreate:()=>Vl,BooleanFeedbackDefinitionPublic:()=>Rt,BooleanFeedbackDefinitionUpdate:()=>am,BooleanFeedbackDetail:()=>Dl,BooleanFeedbackDetailCreate:()=>Ll,BooleanFeedbackDetailPublic:()=>Ql,BooleanFeedbackDetailUpdate:()=>im,CategoricalFeedbackDefinition:()=>Fl,CategoricalFeedbackDefinitionCreate:()=>Jl,CategoricalFeedbackDefinitionPublic:()=>bt,CategoricalFeedbackDefinitionUpdate:()=>sm,CategoricalFeedbackDetail:()=>Nl,CategoricalFeedbackDetailCreate:()=>Hl,CategoricalFeedbackDetailPublic:()=>Yl,CategoricalFeedbackDetailUpdate:()=>nm,ChatCompletionChoice:()=>xc,ChatCompletionRequest:()=>Bo,ChatCompletionResponse:()=>Ec,Check:()=>Rl,CheckName:()=>fl,CheckPublic:()=>Cd,CheckPublicName:()=>Pd,CheckPublicResult:()=>vd,CheckResult:()=>hl,ChunkedOutputJsonNode:()=>Mh,ChunkedOutputJsonNodePublic:()=>Wh,ChunkedOutputJsonNodePublicType:()=>Ul,ChunkedOutputJsonNodeType:()=>ll,Column:()=>pl,ColumnCompare:()=>Mc,ColumnCompareTypesItem:()=>Dc,ColumnPublic:()=>al,ColumnPublicTypesItem:()=>il,ColumnTypesItem:()=>sl,Comment:()=>L,CommentCompare:()=>Nc,CommentPublic:()=>qe,CompleteMultipartUploadRequest:()=>oa,CompleteMultipartUploadRequestEntityType:()=>pp,CompletionTokensDetails:()=>Ac,CountValueStatPublic:()=>Zc,CreateDatasetItemsFromSpansRequest:()=>Fr,CreateDatasetItemsFromTracesRequest:()=>Or,CreatePromptVersionDetail:()=>wo,CreatePromptVersionDetailTemplateStructure:()=>Bi,DashboardPagePublic:()=>Pc,DashboardPublic:()=>Ze,DashboardUpdatePublic:()=>Vo,DashboardWrite:()=>Lo,DataPointDouble:()=>qh,DataPointNumberPublic:()=>$m,Dataset:()=>jh,DatasetExpansion:()=>Dh,DatasetExpansionResponse:()=>Uc,DatasetExpansionWrite:()=>Vr,DatasetIdentifier:()=>Br,DatasetIdentifierPublic:()=>Hr,DatasetItem:()=>mt,DatasetItemBatch:()=>Uh,DatasetItemBatchUpdate:()=>Ur,DatasetItemBatchWrite:()=>Nr,DatasetItemCompare:()=>Jc,DatasetItemCompareSource:()=>Fc,DatasetItemFilter:()=>Bn,DatasetItemFilterOperator:()=>Wn,DatasetItemPageCompare:()=>Xc,DatasetItemPagePublic:()=>nl,DatasetItemPublic:()=>gt,DatasetItemPublicSource:()=>ol,DatasetItemSource:()=>jc,DatasetItemStreamRequest:()=>Jr,DatasetItemUpdate:()=>Ln,DatasetItemWrite:()=>Mr,DatasetItemWriteSource:()=>Vn,DatasetItemsDelete:()=>Lr,DatasetPagePublic:()=>Qc,DatasetPublic:()=>fr,DatasetPublicStatus:()=>Gc,DatasetPublicVisibility:()=>Kc,DatasetStatus:()=>Cc,DatasetUpdate:()=>Wr,DatasetUpdateVisibility:()=>yi,DatasetVersionCreatePublic:()=>Kr,DatasetVersionDiff:()=>dl,DatasetVersionDiffStats:()=>ml,DatasetVersionPagePublic:()=>ul,DatasetVersionPublic:()=>hr,DatasetVersionRestorePublic:()=>Gr,DatasetVersionSummary:()=>Ic,DatasetVersionSummaryPublic:()=>$c,DatasetVersionTag:()=>Xr,DatasetVersionUpdatePublic:()=>$r,DatasetVisibility:()=>vc,DatasetWrite:()=>Dr,DatasetWriteVisibility:()=>bi,DeleteAttachmentsRequest:()=>Ch,DeleteAttachmentsRequestEntityType:()=>lp,DeleteFeedbackScore:()=>At,DeleteIdsHolder:()=>Rr,DeleteThreadFeedbackScores:()=>Io,DeleteTraceThreads:()=>jo,Delta:()=>Sc,DownloadAttachmentRequestEntityType:()=>wi,ErrorCountWithDeviation:()=>xt,ErrorCountWithDeviationDetailed:()=>od,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>eo,ErrorInfoPublic:()=>Tt,ErrorInfoWrite:()=>bo,ErrorMessage:()=>ee,ErrorMessageDetail:()=>$h,ErrorMessageDetailed:()=>Kh,ErrorMessagePublic:()=>Ph,Experiment:()=>Nh,ExperimentGroupAggregationsResponse:()=>jl,ExperimentGroupResponse:()=>vl,ExperimentItem:()=>Yr,ExperimentItemBulkRecord:()=>kl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>is,ExperimentItemBulkUpload:()=>Fh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>ro,ExperimentItemCompare:()=>Hc,ExperimentItemCompareTraceVisibilityMode:()=>Vc,ExperimentItemPublic:()=>ut,ExperimentItemPublicTraceVisibilityMode:()=>tl,ExperimentItemStreamRequest:()=>io,ExperimentItemTraceVisibilityMode:()=>Qn,ExperimentItemsBatch:()=>Zr,ExperimentItemsDelete:()=>qr,ExperimentPagePublic:()=>Al,ExperimentPublic:()=>ht,ExperimentPublicStatus:()=>xl,ExperimentPublicType:()=>Sl,ExperimentScore:()=>oo,ExperimentScorePublic:()=>_l,ExperimentScoreWrite:()=>Xn,ExperimentStatus:()=>wl,ExperimentStreamRequestPublic:()=>ao,ExperimentType:()=>gl,ExperimentUpdate:()=>to,ExperimentUpdateStatus:()=>_i,ExperimentUpdateType:()=>xi,ExperimentWrite:()=>Qr,ExperimentWriteStatus:()=>Si,ExperimentWriteType:()=>ki,ExportTraceServiceRequest:()=>Hh,Feedback:()=>Bh,FeedbackCreate:()=>$l,FeedbackDefinitionPagePublic:()=>rm,FeedbackObjectPublic:()=>em,FeedbackPublic:()=>tm,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>td,FeedbackScoreAveragePublic:()=>Le,FeedbackScoreBatch:()=>Pt,FeedbackScoreBatchItem:()=>Ed,FeedbackScoreBatchItemSource:()=>Td,FeedbackScoreBatchItemThread:()=>ws,FeedbackScoreBatchItemThreadSource:()=>gs,FeedbackScoreBatchThread:()=>Uo,FeedbackScoreCompare:()=>Lc,FeedbackScoreCompareSource:()=>Oc,FeedbackScoreExperimentItemBulkWriteView:()=>ts,FeedbackScoreExperimentItemBulkWriteViewSource:()=>es,FeedbackScoreNames:()=>Gm,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>kd,FeedbackScoreSource:()=>Kn,FeedbackUpdate:()=>mm,FindFeedbackDefinitionsRequestType:()=>Ei,FindFeedbackScoreNames1RequestType:()=>Hi,Function:()=>Wo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Ji,GetSpansByProjectRequestType:()=>Vi,GetWebhookExamplesRequestAlertType:()=>di,GroupContent:()=>Tl,GroupContentWithAggregations:()=>Il,GroupDetail:()=>El,GroupDetails:()=>Pl,Guardrail:()=>gm,GuardrailBatch:()=>Lh,GuardrailBatchWrite:()=>Ho,GuardrailName:()=>dm,GuardrailResult:()=>um,GuardrailWrite:()=>As,GuardrailWriteName:()=>xs,GuardrailWriteResult:()=>_s,GuardrailsValidation:()=>bl,GuardrailsValidationPublic:()=>Id,IdsHolder:()=>Oh,ImageUrl:()=>hp,ImageUrlPublic:()=>Zp,ImageUrlWrite:()=>Cp,JsonListString:()=>D,JsonListStringCompare:()=>ta,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>ss,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>zs,LlmAsJudgeCode:()=>$o,LlmAsJudgeCodePublic:()=>oc,LlmAsJudgeCodeWrite:()=>Dp,LlmAsJudgeMessage:()=>He,LlmAsJudgeMessageContent:()=>bp,LlmAsJudgeMessageContentPublic:()=>ec,LlmAsJudgeMessageContentWrite:()=>jp,LlmAsJudgeMessagePublic:()=>Qe,LlmAsJudgeMessagePublicRole:()=>Yp,LlmAsJudgeMessageRole:()=>fp,LlmAsJudgeMessageWrite:()=>Ke,LlmAsJudgeMessageWriteRole:()=>vp,LlmAsJudgeModelParameters:()=>Ve,LlmAsJudgeModelParametersPublic:()=>$e,LlmAsJudgeModelParametersWrite:()=>Xe,LlmAsJudgeOutputSchema:()=>Je,LlmAsJudgeOutputSchemaPublic:()=>Ye,LlmAsJudgeOutputSchemaPublicType:()=>rc,LlmAsJudgeOutputSchemaType:()=>yp,LlmAsJudgeOutputSchemaWrite:()=>Ge,LlmAsJudgeOutputSchemaWriteType:()=>Up,LogItem:()=>dc,LogItemLevel:()=>mc,LogPage:()=>uc,ManualEvaluationRequest:()=>St,ManualEvaluationRequestEntityType:()=>Rm,ManualEvaluationResponse:()=>kt,Message:()=>Rs,MultipartUploadPart:()=>cp,NumericalFeedbackDefinition:()=>Wl,NumericalFeedbackDefinitionCreate:()=>Kl,NumericalFeedbackDefinitionPublic:()=>yt,NumericalFeedbackDefinitionUpdate:()=>cm,NumericalFeedbackDetail:()=>Ol,NumericalFeedbackDetailCreate:()=>Xl,NumericalFeedbackDetailPublic:()=>Zl,NumericalFeedbackDetailUpdate:()=>pm,Optimization:()=>Jh,OptimizationPagePublic:()=>sa,OptimizationPublic:()=>br,OptimizationPublicStatus:()=>Dm,OptimizationStatus:()=>bm,OptimizationStudioConfig:()=>Am,OptimizationStudioConfigPublic:()=>Lm,OptimizationStudioConfigWrite:()=>jm,OptimizationStudioLog:()=>Vm,OptimizationUpdate:()=>po,OptimizationUpdateStatus:()=>Ii,OptimizationWrite:()=>na,OptimizationWriteStatus:()=>Um,PageColumns:()=>cl,PercentageValueStatPublic:()=>qc,PercentageValues:()=>xe,PercentageValuesDetailed:()=>id,PercentageValuesPublic:()=>dt,Project:()=>Xh,ProjectDetailed:()=>nd,ProjectDetailedVisibility:()=>ad,ProjectMetricRequestPublic:()=>mo,ProjectMetricRequestPublicInterval:()=>Ni,ProjectMetricRequestPublicMetricType:()=>Mi,ProjectMetricResponsePublic:()=>qm,ProjectMetricResponsePublicInterval:()=>Ym,ProjectMetricResponsePublicMetricType:()=>Qm,ProjectPagePublic:()=>Xm,ProjectPublic:()=>_t,ProjectPublicVisibility:()=>Jm,ProjectRetrieveDetailed:()=>uo,ProjectStatItemObjectPublic:()=>rl,ProjectStatsPublic:()=>Pe,ProjectStatsSummary:()=>rd,ProjectStatsSummaryItem:()=>ed,ProjectUpdate:()=>lo,ProjectUpdateVisibility:()=>Di,ProjectVisibility:()=>Hm,ProjectWrite:()=>co,ProjectWriteVisibility:()=>Ui,Prompt:()=>Gh,PromptDetail:()=>ud,PromptDetailTemplateStructure:()=>dd,PromptPagePublic:()=>yd,PromptPublic:()=>bd,PromptPublicTemplateStructure:()=>Rd,PromptTemplateStructure:()=>pd,PromptTokensDetails:()=>_c,PromptType:()=>sd,PromptUpdatable:()=>ho,PromptVersion:()=>md,PromptVersionBatchUpdate:()=>fo,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>cs,PromptVersionDetailType:()=>ps,PromptVersionLink:()=>ia,PromptVersionLinkPublic:()=>aa,PromptVersionLinkWrite:()=>Ti,PromptVersionPagePublic:()=>hd,PromptVersionPublic:()=>fd,PromptVersionPublicTemplateStructure:()=>wd,PromptVersionPublicType:()=>gd,PromptVersionRetrieveDetail:()=>Ro,PromptVersionTemplateStructure:()=>ld,PromptVersionType:()=>cd,PromptVersionUpdate:()=>ls,PromptWrite:()=>go,PromptWriteTemplateStructure:()=>Wi,PromptWriteType:()=>Oi,ProviderApiKey:()=>Vh,ProviderApiKeyPagePublic:()=>fm,ProviderApiKeyProvider:()=>hm,ProviderApiKeyPublic:()=>zt,ProviderApiKeyPublicProvider:()=>wm,ProviderApiKeyUpdate:()=>so,ProviderApiKeyWrite:()=>no,ProviderApiKeyWriteProvider:()=>vi,ResponseFormat:()=>ks,ResponseFormatType:()=>ys,Result:()=>er,ResultsNumberPublic:()=>Zm,ScoreName:()=>Km,ServiceTogglesConfig:()=>zd,Span:()=>ft,SpanBatch:()=>Qh,SpanBatchUpdate:()=>So,SpanBatchWrite:()=>zo,SpanEnrichmentOptions:()=>Hn,SpanExperimentItemBulkWriteView:()=>qn,SpanExperimentItemBulkWriteViewType:()=>Zn,SpanFilter:()=>Se,SpanFilterOperator:()=>_p,SpanFilterPublic:()=>We,SpanFilterPublicOperator:()=>us,SpanFilterWrite:()=>ot,SpanFilterWriteOperator:()=>Np,SpanLlmAsJudgeCode:()=>qo,SpanLlmAsJudgeCodePublic:()=>nc,SpanLlmAsJudgeCodeWrite:()=>Fp,SpanPagePublic:()=>Ad,SpanPublic:()=>Et,SpanPublicType:()=>_d,SpanSearchStreamRequestPublic:()=>xo,SpanSearchStreamRequestPublicType:()=>Xi,SpanType:()=>zl,SpanUpdate:()=>ko,SpanUpdateType:()=>ds,SpanUserDefinedMetricPythonCode:()=>et,SpanUserDefinedMetricPythonCodePublic:()=>sc,SpanUserDefinedMetricPythonCodeWrite:()=>Wp,SpanWrite:()=>yo,SpanWriteType:()=>ms,SpansCountResponse:()=>Ps,StartMultipartUploadRequest:()=>jr,StartMultipartUploadRequestEntityType:()=>fi,StartMultipartUploadResponse:()=>mp,StreamOptions:()=>bs,StudioEvaluation:()=>xm,StudioEvaluationPublic:()=>Wm,StudioEvaluationWrite:()=>Cm,StudioLlmModel:()=>km,StudioLlmModelPublic:()=>Fm,StudioLlmModelWrite:()=>Pm,StudioMessage:()=>ym,StudioMessagePublic:()=>Mm,StudioMessageWrite:()=>Tm,StudioMetric:()=>Sm,StudioMetricPublic:()=>Om,StudioMetricWrite:()=>vm,StudioOptimizer:()=>_m,StudioOptimizerPublic:()=>Bm,StudioOptimizerWrite:()=>Im,StudioPrompt:()=>zm,StudioPromptPublic:()=>Nm,StudioPromptWrite:()=>Em,Tool:()=>Ss,ToolCall:()=>lt,Trace:()=>wt,TraceBatch:()=>Yh,TraceBatchUpdate:()=>Eo,TraceBatchWrite:()=>Ao,TraceCountResponse:()=>Cs,TraceEnrichmentOptions:()=>Jn,TraceExperimentItemBulkWriteView:()=>Yn,TraceFilter:()=>ke,TraceFilterOperator:()=>wp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>as,TraceFilterWrite:()=>rt,TraceFilterWriteOperator:()=>Pp,TracePagePublic:()=>Md,TracePublic:()=>vt,TracePublicVisibilityMode:()=>jd,TraceSearchStreamRequestPublic:()=>Mo,TraceThread:()=>Ct,TraceThreadBatchIdentifier:()=>Co,TraceThreadBatchUpdate:()=>vo,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>fs,TraceThreadFilterPublic:()=>Oe,TraceThreadFilterPublicOperator:()=>ns,TraceThreadFilterWrite:()=>tt,TraceThreadFilterWriteOperator:()=>Lp,TraceThreadIdentifier:()=>pa,TraceThreadLlmAsJudgeCode:()=>Yo,TraceThreadLlmAsJudgeCodePublic:()=>ic,TraceThreadLlmAsJudgeCodeWrite:()=>Vp,TraceThreadPage:()=>Dd,TraceThreadSearchStreamRequest:()=>Do,TraceThreadStatus:()=>Ud,TraceThreadUpdate:()=>Po,TraceThreadUserDefinedMetricPythonCode:()=>Zo,TraceThreadUserDefinedMetricPythonCodePublic:()=>ac,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Jp,TraceUpdate:()=>To,TraceVisibilityMode:()=>yl,TraceWrite:()=>_o,UploadAttachmentRequestEntityType:()=>hi,Usage:()=>Tc,UserDefinedMetricPythonCode:()=>Qo,UserDefinedMetricPythonCodePublic:()=>tc,UserDefinedMetricPythonCodeWrite:()=>Kp,ValueEntry:()=>$n,ValueEntryCompare:()=>Bc,ValueEntryCompareSource:()=>Wc,ValueEntryExperimentItemBulkWriteView:()=>os,ValueEntryExperimentItemBulkWriteViewSource:()=>rs,ValueEntryPublic:()=>xd,ValueEntryPublicSource:()=>Sd,ValueEntrySource:()=>Gn,VideoUrl:()=>Rp,VideoUrlPublic:()=>qp,VideoUrlWrite:()=>Ip,Webhook:()=>js,WebhookExamples:()=>Ys,WebhookPublic:()=>Js,WebhookTestResult:()=>qs,WebhookTestResultStatus:()=>Zs,WebhookWrite:()=>Vs,WelcomeWizardSubmission:()=>Jo,WelcomeWizardTracking:()=>Nd,WorkspaceConfiguration:()=>It,WorkspaceMetricRequest:()=>eR,WorkspaceMetricResponse:()=>ca,WorkspaceMetricsSummaryRequest:()=>zr,WorkspaceMetricsSummaryResponse:()=>Fd,WorkspaceNameHolder:()=>up,WorkspaceSpansCount:()=>Es,WorkspaceTraceCount:()=>vs,alerts:()=>ui,annotationQueues:()=>Qi,attachments:()=>sr,chatCompletions:()=>Yi,dashboards:()=>Zi,datasets:()=>zi,experiments:()=>pr,feedbackDefinitions:()=>Pi,guardrails:()=>qi,llmProviderKey:()=>Ci,optimizations:()=>ji,projects:()=>Fi,prompts:()=>Li,spans:()=>cr,traces:()=>Be,welcomeWizard:()=>ea});var ui={};c(ui,{GetWebhookExamplesRequestAlertType:()=>di});var di=e.enum_(["general","slack","pagerduty"]);var sr={};c(sr,{AttachmentListRequestEntityType:()=>gi,DownloadAttachmentRequestEntityType:()=>wi,StartMultipartUploadRequest:()=>jr,StartMultipartUploadRequestEntityType:()=>fi,UploadAttachmentRequestEntityType:()=>hi,uploadAttachment:()=>Ri});var gi=e.enum_(["trace","span"]);var wi=e.enum_(["trace","span"]);var fi=e.enum_(["trace","span"]);var hi=e.enum_(["trace","span"]);var Ri={};c(Ri,{Request:()=>Sh});var Sh=e.record(e.string(),e.unknown());var jr=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",fi),entityId:e.property("entity_id",e.string()),path:e.string()});var zi={};c(zi,{CreateDatasetItemsFromSpansRequest:()=>Fr,CreateDatasetItemsFromTracesRequest:()=>Or,DatasetExpansionWrite:()=>Vr,DatasetIdentifier:()=>Br,DatasetIdentifierPublic:()=>Hr,DatasetItemBatchUpdate:()=>Ur,DatasetItemBatchWrite:()=>Nr,DatasetItemStreamRequest:()=>Jr,DatasetItemsDelete:()=>Lr,DatasetUpdate:()=>Wr,DatasetUpdateVisibility:()=>yi,DatasetVersionCreatePublic:()=>Kr,DatasetVersionRestorePublic:()=>Gr,DatasetVersionTag:()=>Xr,DatasetVersionUpdatePublic:()=>$r,DatasetWrite:()=>Dr,DatasetWriteVisibility:()=>bi});var bi=e.enum_(["private","public"]);var yi=e.enum_(["private","public"]);var Wn=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Bn=e.object({field:e.string().optional(),operator:Wn.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Ln=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 Ur=e.object({ids:e.list(e.string()).optional(),filters:e.list(Bn).optional(),update:Ln,mergeTags:e.property("merge_tags",e.boolean().optional())});var Dr=e.object({id:e.string().optional(),name:e.string(),visibility:bi.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Vn=e.enum_(["manual","trace","span","sdk"]);var Mr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Vn,data:v,tags:e.list(e.string()).optional()});var Nr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Mr)});var Hn=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Fr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Hn)});var Jn=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 Or=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Jn)});var Wr=e.object({name:e.string(),description:e.string().optional(),visibility:yi.optional(),tags:e.list(e.string()).optional()});var Br=e.object({datasetName:e.property("dataset_name",e.string())});var Lr=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Vr=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 Hr=e.object({datasetName:e.property("dataset_name",e.string())});var Jr=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 Xr=e.object({tag:e.string()});var Kr=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 Gr=e.object({versionRef:e.property("version_ref",e.string())});var $r=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:()=>ro,ExperimentItemStreamRequest:()=>io,ExperimentItemsBatch:()=>Zr,ExperimentItemsDelete:()=>qr,ExperimentStreamRequestPublic:()=>ao,ExperimentUpdate:()=>to,ExperimentUpdateStatus:()=>_i,ExperimentUpdateType:()=>xi,ExperimentWrite:()=>Qr,ExperimentWriteStatus:()=>Si,ExperimentWriteType:()=>ki,findFeedbackScoreNames:()=>Ai});var ki=e.enum_(["regular","trial","mini-batch"]);var Si=e.enum_(["running","completed","cancelled"]);var xi=e.enum_(["regular","trial","mini-batch"]);var _i=e.enum_(["running","completed","cancelled"]);var Ai={};c(Ai,{Response:()=>xh});var xh=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 Xn=e.object({name:e.string(),value:e.number()});var Ti=e.object({id:e.string()});var Qr=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:ki.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:Si.optional(),experimentScores:e.property("experiment_scores",e.list(Xn).optional()),promptVersion:e.property("prompt_version",Ti.optional()),promptVersions:e.property("prompt_versions",e.list(Ti).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Kn=e.enum_(["ui","sdk","online_scoring"]);var Gn=e.enum_(["ui","sdk","online_scoring"]);var $n=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Gn.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:Kn,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(),$n).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 Qn=e.enum_(["default","hidden"]);var Yr=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",Qn.optional())});var Zr=e.object({experimentItems:e.property("experiment_items",e.list(Yr))});var qr=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 eo=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Yn=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",eo.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Zn=e.enum_(["general","tool","llm","guardrail"]);var qn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Zn.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",eo.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 es=e.enum_(["ui","sdk","online_scoring"]);var rs=e.enum_(["ui","sdk","online_scoring"]);var os=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:rs.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 ts=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:es,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(),os).optional())});var is=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Yn.optional(),spans:e.list(qn).optional(),feedbackScores:e.property("feedback_scores",e.list(ts).optional())});var ro=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(is)});var oo=e.object({name:e.string(),value:e.number()});var to=e.object({name:e.string().optional(),metadata:v.optional(),type:xi.optional(),status:_i.optional(),experimentScores:e.property("experiment_scores",e.list(oo).optional())});var io=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 ao=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var Pi={};c(Pi,{FindFeedbackDefinitionsRequestType:()=>Ei});var Ei=e.enum_(["numerical","categorical","boolean"]);var Ci={};c(Ci,{ProviderApiKeyUpdate:()=>so,ProviderApiKeyWrite:()=>no,ProviderApiKeyWriteProvider:()=>vi});var vi=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var no=e.object({provider:vi,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 so=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 ji={};c(ji,{OptimizationUpdate:()=>po,OptimizationUpdateStatus:()=>Ii});var Ii=e.enum_(["running","completed","cancelled","initialized","error"]);var po=e.object({name:e.string().optional(),status:Ii.optional()});var Fi={};c(Fi,{ProjectMetricRequestPublic:()=>mo,ProjectMetricRequestPublicInterval:()=>Ni,ProjectMetricRequestPublicMetricType:()=>Mi,ProjectRetrieveDetailed:()=>uo,ProjectUpdate:()=>lo,ProjectUpdateVisibility:()=>Di,ProjectWrite:()=>co,ProjectWriteVisibility:()=>Ui});var Ui=e.enum_(["private","public"]);var Di=e.enum_(["private","public"]);var Mi=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Ni=e.enum_(["HOURLY","DAILY","WEEKLY"]);var co=e.object({name:e.string(),visibility:Ui.optional(),description:e.string().optional()});var lo=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Di.optional()});var as=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:as.optional(),key:e.string().optional(),value:e.string().optional()});var ns=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Oe=e.object({field:e.string().optional(),operator:ns.optional(),key:e.string().optional(),value:e.string().optional()});var mo=e.object({metricType:e.property("metric_type",Mi.optional()),interval:Ni.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 uo=e.object({name:e.string()});var Li={};c(Li,{CreatePromptVersionDetail:()=>wo,CreatePromptVersionDetailTemplateStructure:()=>Bi,PromptUpdatable:()=>ho,PromptVersionBatchUpdate:()=>fo,PromptVersionRetrieveDetail:()=>Ro,PromptWrite:()=>go,PromptWriteTemplateStructure:()=>Wi,PromptWriteType:()=>Oi});var Oi=e.enum_(["mustache","jinja2"]);var Wi=e.enum_(["text","chat"]);var Bi=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var go=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:Oi.optional(),templateStructure:e.property("template_structure",Wi.optional()),tags:e.list(e.string()).optional()});var ss=e.record(e.string(),e.unknown());var ps=e.enum_(["mustache","jinja2"]);var cs=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:ss.optional(),type:ps.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",cs.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var wo=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",Bi.optional())});var ls=e.object({tags:e.list(e.string()).optional()});var fo=e.object({ids:e.list(e.string()),update:ls,mergeTags:e.property("merge_tags",e.boolean().optional())});var ho=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var Ro=e.object({name:e.string(),commit:e.string().optional()});var cr={};c(cr,{FindFeedbackScoreNames1RequestType:()=>Hi,GetSpanStatsRequestType:()=>Ji,GetSpansByProjectRequestType:()=>Vi,SpanBatchUpdate:()=>So,SpanBatchWrite:()=>zo,SpanSearchStreamRequestPublic:()=>xo,SpanSearchStreamRequestPublicType:()=>Xi,findFeedbackScoreNames1:()=>Ki});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=e.enum_(["general","tool","llm","guardrail"]);var Ki={};c(Ki,{Response:()=>_h});var _h=e.list(e.string());var ms=e.enum_(["general","tool","llm","guardrail"]);var bo=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var yo=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:ms.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",bo.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 zo=e.object({spans:e.list(yo)});var ds=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 ko=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:ds.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 So=e.object({ids:e.list(e.string()),update:ko,mergeTags:e.property("merge_tags",e.boolean().optional())});var us=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var We=e.object({field:e.string().optional(),operator:us.optional(),key:e.string().optional(),value:e.string().optional()});var xo=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:Xi.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:()=>Io,DeleteTraceThreads:()=>jo,FeedbackScoreBatchThread:()=>Uo,TraceBatchUpdate:()=>Eo,TraceBatchWrite:()=>Ao,TraceSearchStreamRequestPublic:()=>Mo,TraceThreadBatchIdentifier:()=>Co,TraceThreadBatchUpdate:()=>vo,TraceThreadSearchStreamRequest:()=>Do,findFeedbackScoreNames2:()=>Gi,findTraceThreadsFeedbackScoreNames:()=>$i});var Gi={};c(Gi,{Response:()=>Ah});var Ah=e.list(e.string());var $i={};c($i,{Response:()=>Th});var Th=e.list(e.string());var _o=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",bo.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Ao=e.object({traces:e.list(_o)});var To=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 Eo=e.object({ids:e.list(e.string()),update:To,mergeTags:e.property("merge_tags",e.boolean().optional())});var Po=e.object({tags:e.list(e.string()).optional()});var vo=e.object({ids:e.list(e.string()),update:Po,mergeTags:e.property("merge_tags",e.boolean().optional())});var Co=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 Io=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 jo=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 gs=e.enum_(["ui","sdk","online_scoring"]);var ws=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:gs,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var Uo=e.object({scores:e.list(ws)});var fs=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:fs.optional(),key:e.string().optional(),value:e.string().optional()});var Do=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 Mo=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 Qi={};c(Qi,{AnnotationQueueBatchWrite:()=>Fo,AnnotationQueueUpdate:()=>Oo});var hs=e.enum_(["trace","thread"]);var No=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:hs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Fo=e.object({annotationQueues:e.property("annotation_queues",e.list(No))});var Oo=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 Yi={};c(Yi,{ChatCompletionRequest:()=>Bo});var Rs=e.record(e.string(),e.unknown());var bs=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var ys=e.enum_(["text","json_object","json_schema"]);var zs=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ks=e.object({type:ys.optional(),jsonSchema:e.property("json_schema",zs.optional())});var Wo=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 Ss=e.object({type:e.stringLiteral("function").optional(),function:Wo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Bo=e.object({model:e.string().optional(),messages:e.list(Rs).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",bs.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",ks.optional()),seed:e.number().optional(),tools:e.list(Ss).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(Wo).optional(),functionCall:e.property("function_call",ze.optional())});var Zi={};c(Zi,{DashboardUpdatePublic:()=>Vo,DashboardWrite:()=>Lo});var Lo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Vo=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var qi={};c(qi,{GuardrailBatchWrite:()=>Ho});var xs=e.enum_(["TOPIC","PII"]);var _s=e.enum_(["passed","failed"]);var As=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:xs,result:_s,config:v,details:v});var Ho=e.object({guardrails:e.list(As)});var ea={};c(ea,{WelcomeWizardSubmission:()=>Jo});var Jo=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 Ts=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(Ts).optional())});var Es=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Ps=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Es).optional())});var vs=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Cs=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(vs).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Is=e.enum_(["general","slack","pagerduty"]);var js=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 Us=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 Ds=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ms=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ds,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 Ns=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Us),triggerConfigs:e.property("trigger_configs",e.list(Ms).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Eh=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Is.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:js,triggers:e.list(Ns).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 Fs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Os=e.object({id:e.string().optional(),type:Fs,configValue:e.property("config_value",e.record(e.string(),e.string()).optional())});var Ws=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 Bs=e.object({id:e.string().optional(),eventType:e.property("event_type",Ws),triggerConfigs:e.property("trigger_configs",e.list(Os).optional())});var Ls=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()});var Xo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ls.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Vs,triggers:e.list(Bs).optional()});var F=e.object({ids:e.list(e.string())});var Hs=e.enum_(["general","slack","pagerduty"]);var Js=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 Xs=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 Ks=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Gs=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ks,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 $s=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Xs),triggerConfigs:e.property("trigger_configs",e.list(Gs).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Ko=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Hs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Js,triggers:e.list($s).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 Qs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ko).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Ph=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Ys=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Zs=e.enum_(["success","failure"]);var qs=e.object({status:Zs.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 ra=e.object({ids:e.list(e.string())});var ep=e.enum_(["trace","thread"]);var rp=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var op=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(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 vh=e.object({annotationQueues:e.property("annotation_queues",e.list(op))});var tp=e.enum_(["trace","thread"]);var ip=e.object({username:e.string().optional(),status:e.number().optional()});var Le=e.object({name:e.string(),value:e.number()});var Go=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:tp,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(ip).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 ap=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Go).optional(),sortableBy:e.list(e.string()).optional()});var np=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 sp=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(np).optional(),sortableBy:e.list(e.string()).optional()});var pp=e.enum_(["trace","span"]);var cp=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var oa=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",pp),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(cp))});var lp=e.enum_(["trace","span"]);var Ch=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",lp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var mp=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var dp=e.record(e.string(),e.unknown());var up=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var gp=e.object({url:e.string()});var wp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:wp.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 fp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var hp=e.object({url:e.string(),detail:e.string().optional()});var Rp=e.object({url:e.string()});var bp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",hp.optional()),videoUrl:e.property("video_url",Rp.optional()),audioUrl:e.property("audio_url",gp.optional())});var He=e.object({role:fp,content:e.string().optional(),contentArray:e.property("content_array",e.list(bp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var yp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:yp,description:e.string()});var $o=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var zp=e.object({filters:e.list(ke).optional(),code:$o.optional()});var Qo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var kp=e.object({filters:e.list(ke).optional(),code:Qo.optional()});var Yo=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var Sp=e.object({filters:e.list(de).optional(),code:Yo.optional()});var Zo=e.object({metric:e.string()});var xp=e.object({filters:e.list(de).optional(),code:Zo.optional()});var _p=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Se=e.object({field:e.string().optional(),operator:_p.optional(),key:e.string().optional(),value:e.string().optional()});var qo=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var Ap=e.object({filters:e.list(Se).optional(),code:qo.optional()});var et=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Tp=e.object({filters:e.list(Se).optional(),code:et.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")}),Ih=e.union("type",{llm_as_judge:zp.extend(mr),user_defined_metric_python:kp.extend(mr),trace_thread_llm_as_judge:Sp.extend(mr),trace_thread_user_defined_metric_python:xp.extend(mr),span_llm_as_judge:Ap.extend(mr),span_user_defined_metric_python:Tp.extend(mr)}).transform({transform:s=>s,untransform:s=>s});var Ep=e.object({url:e.string()});var Pp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var rt=e.object({field:e.string().optional(),operator:Pp.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 vp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Cp=e.object({url:e.string(),detail:e.string().optional()});var Ip=e.object({url:e.string()});var jp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Cp.optional()),videoUrl:e.property("video_url",Ip.optional()),audioUrl:e.property("audio_url",Ep.optional())});var Ke=e.object({role:vp,content:e.string().optional(),contentArray:e.property("content_array",e.list(jp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Up=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:Up,description:e.string()});var Dp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Mp=e.object({filters:e.list(rt).optional(),code:Dp.optional()});var Np=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ot=e.object({field:e.string().optional(),operator:Np.optional(),key:e.string().optional(),value:e.string().optional()});var Fp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Op=e.object({filters:e.list(ot).optional(),code:Fp.optional()});var Wp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Bp=e.object({filters:e.list(ot).optional(),code:Wp.optional()});var Lp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var tt=e.object({field:e.string().optional(),operator:Lp.optional(),key:e.string().optional(),value:e.string().optional()});var Vp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var Hp=e.object({filters:e.list(tt).optional(),code:Vp.optional()});var Jp=e.object({metric:e.string()});var Xp=e.object({filters:e.list(tt).optional(),code:Jp.optional()});var Kp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Gp=e.object({filters:e.list(rt).optional(),code:Kp.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")}),$p=e.union("type",{llm_as_judge:Mp.extend(dr),user_defined_metric_python:Gp.extend(dr),trace_thread_llm_as_judge:Hp.extend(dr),trace_thread_user_defined_metric_python:Xp.extend(dr),span_llm_as_judge:Op.extend(dr),span_user_defined_metric_python:Bp.extend(dr)}).transform({transform:s=>s,untransform:s=>s});var Qp=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 Yp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Zp=e.object({url:e.string(),detail:e.string().optional()});var qp=e.object({url:e.string()});var ec=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Zp.optional()),videoUrl:e.property("video_url",qp.optional()),audioUrl:e.property("audio_url",Qp.optional())});var Qe=e.object({role:Yp,content:e.string().optional(),contentArray:e.property("content_array",e.list(ec).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var rc=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ye=e.object({name:e.string(),type:rc,description:e.string()});var oc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var it=e.object({filters:e.list(be).optional(),code:oc.optional()});var tc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var at=e.object({filters:e.list(be).optional(),code:tc.optional()});var ic=e.object({model:$e,messages:e.list(Qe),schema:e.list(Ye)});var nt=e.object({filters:e.list(Oe).optional(),code:ic.optional()});var ac=e.object({metric:e.string()});var st=e.object({filters:e.list(Oe).optional(),code:ac.optional()});var nc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var pt=e.object({filters:e.list(We).optional(),code:nc.optional()});var sc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var ct=e.object({filters:e.list(We).optional(),code:sc.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")}),pc=e.union("type",{llm_as_judge:it.extend(ur),user_defined_metric_python:at.extend(ur),trace_thread_llm_as_judge:nt.extend(ur),trace_thread_user_defined_metric_python:st.extend(ur),span_llm_as_judge:pt.extend(ur),span_user_defined_metric_python:ct.extend(ur)}).transform({transform:s=>s,untransform:s=>s});var cc=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(pc).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")}),lc=e.union("type",{llm_as_judge:it.extend(gr),user_defined_metric_python:at.extend(gr),trace_thread_llm_as_judge:nt.extend(gr),trace_thread_user_defined_metric_python:st.extend(gr),span_llm_as_judge:pt.extend(gr),span_user_defined_metric_python:ct.extend(gr)}).transform({transform:s=>s,untransform:s=>s});var mc=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var dc=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:mc.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var uc=e.object({content:e.list(dc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var gc=e.object({filters:e.list(ke).optional(),code:$o.optional()});var wc=e.object({filters:e.list(ke).optional(),code:Qo.optional()});var fc=e.object({filters:e.list(de).optional(),code:Yo.optional()});var hc=e.object({filters:e.list(de).optional(),code:Zo.optional()});var Rc=e.object({filters:e.list(Se).optional(),code:qo.optional()});var bc=e.object({filters:e.list(Se).optional(),code:et.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")}),yc=e.union("type",{llm_as_judge:gc.extend(wr),user_defined_metric_python:wc.extend(wr),trace_thread_llm_as_judge:fc.extend(wr),trace_thread_user_defined_metric_python:hc.extend(wr),span_llm_as_judge:Rc.extend(wr),span_user_defined_metric_python:bc.extend(wr)}).transform({transform:s=>s,untransform:s=>s});var zc=e.enum_(["system","user","assistant","tool","function"]);var lt=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var kc=e.object({role:zc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(lt).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var Sc=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(lt).optional()),functionCall:e.property("function_call",ze.optional())});var xc=e.object({index:e.number().optional(),message:kc.optional(),delta:Sc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var _c=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var Ac=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Tc=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",_c.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",Ac.optional())});var Ec=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(xc).optional(),usage:Tc.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 Pc=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 vc=e.enum_(["private","public"]);var Cc=e.enum_(["unknown","processing","completed","failed"]);var Ic=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 jh=e.object({id:e.string().optional(),name:e.string(),visibility:vc.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:Cc.optional(),latestVersion:e.property("latest_version",Ic.optional())});var jc=e.enum_(["manual","trace","span","sdk"]);var mt=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:jc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Yr).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 Uh=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(mt)});var Uc=e.object({generatedSamples:e.property("generated_samples",e.list(mt).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var Dh=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 Dc=e.enum_(["string","number","object","boolean","array","null"]);var Mc=e.object({name:e.string().optional(),types:e.list(Dc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Nc=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 Fc=e.enum_(["manual","trace","span","sdk"]);var ta=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Oc=e.enum_(["ui","sdk","online_scoring"]);var Wc=e.enum_(["ui","sdk","online_scoring"]);var Bc=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Wc.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 Lc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Oc,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(),Bc).optional())});var Vc=e.enum_(["default","hidden"]);var Hc=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:ta.optional(),output:ta.optional(),feedbackScores:e.property("feedback_scores",e.list(Lc).optional()),comments:e.list(Nc).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",Vc.optional())});var Jc=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:Fc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Hc).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 Xc=e.object({content:e.list(Jc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Mc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Kc=e.enum_(["private","public"]);var Gc=e.enum_(["unknown","processing","completed","failed"]);var $c=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:Kc.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:Gc.optional(),latestVersion:e.property("latest_version",$c.optional())});var Qc=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 Yc=e.object({value:e.number().optional()});var Zc=e.object({value:e.number().optional()});var dt=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var qc=e.object({value:dt.optional()});var el=e.object({name:e.string().optional()}),rl=e.union("type",{PERCENTAGE:qc.extend(el),COUNT:Zc.extend(el),AVG:Yc.extend(el)}).transform({transform:s=>s,untransform:s=>s});var Pe=e.object({stats:e.list(rl).optional()});var ol=e.enum_(["manual","trace","span","sdk"]);var tl=e.enum_(["default","hidden"]);var ut=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",tl.optional())});var gt=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:ol,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(ut).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 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({content:e.list(gt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(al).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var sl=e.enum_(["string","number","object","boolean","array","null"]);var pl=e.object({name:e.string().optional(),types:e.list(sl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var cl=e.object({columns:e.list(pl).optional()});var ll=e.object({typeName:e.string().optional()});var Mh=e.object({type:ll.optional(),closed:e.boolean().optional()});var ml=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var dl=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:ml.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 ul=e.object({content:e.list(hr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var gl=e.enum_(["regular","trial","mini-batch"]);var wl=e.enum_(["running","completed","cancelled"]);var xe=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});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 Nh=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:gl.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:wl.optional(),experimentScores:e.property("experiment_scores",e.list(oo).optional()),promptVersion:e.property("prompt_version",ia.optional()),promptVersions:e.property("prompt_versions",e.list(ia).optional())});var Rr=e.object({ids:e.list(e.string())});var fl=e.enum_(["TOPIC","PII"]);var hl=e.enum_(["passed","failed"]);var Rl=e.object({name:fl.optional(),result:hl.optional()});var bl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Rl).optional()});var yl=e.enum_(["default","hidden"]);var wt=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(bl).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",yl.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 zl=e.enum_(["general","tool","llm","guardrail"]);var ft=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:zl.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 kl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:wt.optional(),spans:e.list(ft).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var Fh=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(kl)});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 Sl=e.enum_(["regular","trial","mini-batch"]);var xl=e.enum_(["running","completed","cancelled"]);var _l=e.object({name:e.string(),value:e.number()});var aa=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 ht=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:Sl.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:dt.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:xl.optional(),experimentScores:e.property("experiment_scores",e.list(_l).optional()),promptVersion:e.property("prompt_version",aa.optional()),promptVersions:e.property("prompt_versions",e.list(aa).optional())});var Al=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ht).optional(),sortableBy:e.list(e.string()).optional()});var Tl=e.object({label:e.string().optional()});var El=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var Pl=e.object({groupsDetails:e.property("groups_details",e.list(El).optional())});var vl=e.object({content:e.record(e.string(),Tl).optional(),details:Pl.optional()});var Cl=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 Il=e.object({label:e.string().optional(),aggregations:Cl.optional()});var jl=e.object({content:e.record(e.string(),Il).optional()});var Oh=e.object({ids:e.list(e.string())});var Ul=e.object({typeName:e.string().optional()});var Wh=e.object({type:Ul.optional(),closed:e.boolean().optional()});var Dl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Ml=e.object({details:Dl.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 Nl=e.object({categories:e.record(e.string(),e.number())});var Fl=e.object({details:Nl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ol=e.object({max:e.number(),min:e.number()});var Wl=e.object({details:Ol.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 Bl=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()}),Bh=e.union("type",{numerical:Wl.extend(Bl),categorical:Fl.extend(Bl),boolean:Ml.extend(Bl)}).transform({transform:s=>s,untransform:s=>s});var Ll=e.object({trueLabel:e.string(),falseLabel:e.string()});var Vl=e.object({details:Ll.optional()});var Hl=e.object({categories:e.record(e.string(),e.number())});var Jl=e.object({details:Hl.optional()});var Xl=e.object({max:e.number(),min:e.number()});var Kl=e.object({details:Xl.optional()});var Gl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),$l=e.union("type",{numerical:Kl.extend(Gl),categorical:Jl.extend(Gl),boolean:Vl.extend(Gl)}).transform({transform:s=>s,untransform:s=>s});var Ql=e.object({trueLabel:e.string(),falseLabel:e.string()});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({categories:e.record(e.string(),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({max:e.number(),min:e.number()});var yt=e.object({details:Zl.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()}),em=e.union("type",{numerical:yt.extend(ql),categorical:bt.extend(ql),boolean:Rt.extend(ql)}).transform({transform:s=>s,untransform:s=>s});var rm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(em).optional()});var om=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()}),tm=e.union("type",{numerical:yt.extend(om),categorical:bt.extend(om),boolean:Rt.extend(om)}).transform({transform:s=>s,untransform:s=>s});var im=e.object({trueLabel:e.string(),falseLabel:e.string()});var am=e.object({details:im.optional()});var nm=e.object({categories:e.record(e.string(),e.number())});var sm=e.object({details:nm.optional()});var pm=e.object({max:e.number(),min:e.number()});var cm=e.object({details:pm.optional()});var lm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),mm=e.union("type",{numerical:cm.extend(lm),categorical:sm.extend(lm),boolean:am.extend(lm)}).transform({transform:s=>s,untransform:s=>s});var dm=e.enum_(["TOPIC","PII"]);var um=e.enum_(["passed","failed"]);var gm=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:dm,result:um,config:v,details:v});var Lh=e.object({guardrails:e.list(gm)});var wm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var zt=e.object({id:e.string().optional(),provider:wm,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 fm=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(zt).optional(),sortableBy:e.list(e.string()).optional()});var hm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var Vh=e.object({id:e.string().optional(),provider:hm,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 kt=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var Rm=e.enum_(["trace","thread","span"]);var St=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",Rm)});var Hh=v;var bm=e.enum_(["running","completed","cancelled","initialized","error"]);var ym=e.object({role:e.string(),content:e.string()});var zm=e.object({messages:e.list(ym)});var km=e.object({model:e.string(),parameters:v.optional()});var Sm=e.object({type:e.string(),parameters:v.optional()});var xm=e.object({metrics:e.list(Sm)});var _m=e.object({type:e.string(),parameters:v.optional()});var Am=e.object({datasetName:e.property("dataset_name",e.string()),prompt:zm,llmModel:e.property("llm_model",km),evaluation:xm,optimizer:_m});var Jh=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:bm,metadata:D.optional(),studioConfig:e.property("studio_config",Am.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 Tm=e.object({role:e.string(),content:e.string()});var Em=e.object({messages:e.list(Tm)});var Pm=e.object({model:e.string(),parameters:ie.optional()});var vm=e.object({type:e.string(),parameters:ie.optional()});var Cm=e.object({metrics:e.list(vm)});var Im=e.object({type:e.string(),parameters:ie.optional()});var jm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Em,llmModel:e.property("llm_model",Pm),evaluation:Cm,optimizer:Im});var Um=e.enum_(["running","completed","cancelled","initialized","error"]);var na=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:te.optional(),studioConfig:e.property("studio_config",jm.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Dm=e.enum_(["running","completed","cancelled","initialized","error"]);var Mm=e.object({role:e.string(),content:e.string()});var Nm=e.object({messages:e.list(Mm)});var Fm=e.object({model:e.string(),parameters:Z.optional()});var Om=e.object({type:e.string(),parameters:Z.optional()});var Wm=e.object({metrics:e.list(Om)});var Bm=e.object({type:e.string(),parameters:Z.optional()});var Lm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Nm,llmModel:e.property("llm_model",Fm),evaluation:Wm,optimizer:Bm});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:Dm,metadata:ae.optional(),studioConfig:e.property("studio_config",Lm.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 sa=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 Vm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var xt=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Hm=e.enum_(["private","public"]);var Xh=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()),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",xt.optional())});var Jm=e.enum_(["private","public"]);var _t=e.object({id:e.string().optional(),name:e.string(),visibility:Jm.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 Xm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(_t).optional(),sortableBy:e.list(e.string()).optional()});var Km=e.object({name:e.string().optional(),type:e.string().optional()});var Gm=e.object({scores:e.list(Km).optional()});var $m=e.object({time:e.date(),value:e.number().optional()});var Qm=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Ym=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Zm=e.object({name:e.string().optional(),data:e.list($m).optional()});var qm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Qm.optional()),interval:Ym.optional(),results:e.list(Zm).optional()});var ed=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",xt.optional())});var rd=e.object({content:e.list(ed).optional()});var od=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var td=e.object({name:e.string(),value:e.number()});var id=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ad=e.enum_(["private","public"]);var nd=e.object({id:e.string().optional(),name:e.string(),visibility:ad.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(td).optional()),duration:id.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",od.optional())});var Kh=e.object({errors:e.list(e.string()).optional()});var sd=e.enum_(["mustache","jinja2"]);var pd=e.enum_(["text","chat"]);var cd=e.enum_(["mustache","jinja2"]);var ld=e.enum_(["text","chat"]);var md=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:cd.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",ld.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Gh=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:sd.optional(),templateStructure:e.property("template_structure",pd.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",md.optional())});var $h=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var dd=e.enum_(["text","chat"]);var ud=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",dd.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 gd=e.enum_(["mustache","jinja2"]);var wd=e.enum_(["text","chat"]);var fd=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:gd.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),templateStructure:e.property("template_structure",wd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().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.enum_(["text","chat"]);var bd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",Rd.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 yd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(bd).optional(),sortableBy:e.list(e.string()).optional()});var zd=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 Qh=e.object({spans:e.list(ft)});var At=e.object({name:e.string(),author:e.string().optional()});var Tt=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var kd=e.enum_(["ui","sdk","online_scoring"]);var Sd=e.enum_(["ui","sdk","online_scoring"]);var xd=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Sd.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:kd,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(),xd).optional())});var _d=e.enum_(["general","tool","llm","guardrail"]);var Et=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:_d.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",Tt.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 Ad=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 Td=e.enum_(["ui","sdk","online_scoring"]);var Ed=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:Td,author:e.string().optional(),id:e.string()});var Pt=e.object({scores:e.list(Ed)});var Yh=e.object({traces:e.list(wt)});var Zh=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var Pd=e.enum_(["TOPIC","PII"]);var vd=e.enum_(["passed","failed"]);var Cd=e.object({name:Pd.optional(),result:vd.optional()});var Id=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Cd).optional()});var jd=e.enum_(["default","hidden"]);var vt=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",Tt.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(Id).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",jd.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 Ud=e.enum_(["active","inactive"]);var Ct=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:Ud.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 pa=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 Dd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ct).optional(),sortableBy:e.list(e.string()).optional()});var Md=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 Nd=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 ca=e.object({results:e.list(er).optional()});var eR=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 It=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var Fd=e.object({results:e.list(er).optional()});var la=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:Ps.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:Cs.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 ma=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:Qs.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: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")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: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/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:Xo.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=di.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:Ys.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: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: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 da=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:ra.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:ap.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: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 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: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: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:Go.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: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);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:ra.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 ua=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=gi.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:sp.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:oa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:oa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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=wi.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: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:mp.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=hi.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 ga=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:dp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:up.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 wa=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:cc.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:$p.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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}.");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:yc.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:uc.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 fa=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: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:Ec.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 ha=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:Pc.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: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: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:Vo.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 Ra=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: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")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:Qc.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:Dr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:Nr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling 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 Ju();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: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-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: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 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:Wr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)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: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/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:Lr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:Vr.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:Uc.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:Xc.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:Hr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:gt.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:Mr.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:nl.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:cl.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:Jr.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:dl.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:Xr.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:ul.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: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: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:Gr.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:$r.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 ba=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:Al.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:Qr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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.");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:qr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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 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: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 _(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:jl.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:ht.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: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 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:ut.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: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/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:ao.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 ya=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=Ei.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:rm.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:$l.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:tm.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:mm.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 za=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: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/guardrails.");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;}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:fm.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: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 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: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 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: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")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 Sa=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:St.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:kt.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:St.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:kt.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:St.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:kt.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 xa=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 _a=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:sa.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: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 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: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/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:sa.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:po.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:Vm.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 Aa=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:Xm.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: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")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:_t.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: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: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:Gm.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:mo.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 _(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:rd.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: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: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);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 Ta=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:yd.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: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: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: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: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: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: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:ud.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: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 _(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:hd.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: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: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 Ea=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:zd.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 Pa=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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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")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 eu,ru;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=Vi.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((ru=(eu=await n.get(this._options.baseUrl))!=null?eu:await n.get(this._options.environment))!=null?ru: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:Ad.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: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")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:Et.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:ko.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:At.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=Hi.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=Ji.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:Pt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:xo.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 va=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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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);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: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 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: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")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:Md.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:_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.");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:vt.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: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")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: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/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:At.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: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 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:pa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data: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 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:Dd.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:pa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new 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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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:Pt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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);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:Mo.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:Po.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 Ca=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:Nd.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: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 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 Ia=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:It.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:It.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:It.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:ca.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:ca.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:Fd.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 ja=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 jt=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new la(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new ma(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new da(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new ua(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new ga(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new wa(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new fa(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new ha(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new Ra(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new ba(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new ya(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new za(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new ka(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new Sa(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new xa(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new _a(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new Aa(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Ta(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Ea(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Pa(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new va(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new Ca(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new Ia(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new ja(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 kr=class{static serializePromptToInfoDict(t){return {name:t.name,...t.id&&{id:t.id},version:{...t.versionId&&{id:t.versionId},...t.commit&&{commit:t.commit},template:t.prompt}}}static normalizeMetadata(t){if(!t)return {};if(typeof t=="object"&&!Array.isArray(t))return t;if(typeof t=="string")try{let r=JSON.parse(t);if(typeof r=="object"&&!Array.isArray(r))return r}catch{}return {}}static mergePromptsIntoMetadata(t,r,o){let i=o.map(d=>this.serializePromptToInfoDict(d)),a=this.normalizeMetadata(t),l=this.normalizeMetadata(r);return {...a,...l,opik_prompts:i}}static processTraceUpdate(t,r){let{prompts:o,...i}=t;if(!o||o.length===0)return i;let a=this.mergePromptsIntoMetadata(r,i.metadata,o);return {...i,metadata:a}}static processSpanUpdate(t,r){let{prompts:o,...i}=t;if(!o||o.length===0)return i;let a=this.mergePromptsIntoMetadata(r,i.metadata,o);return {...i,metadata:a}}};var Ua=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 i;let r=kr.processSpanUpdate(t,this.data.metadata),o={parentSpanId:this.data.parentSpanId,projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,traceId:this.data.traceId,...r};return this.opik.spanBatchQueue.update(this.data.id,o),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 Da=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 Ua(o,this.opik);return this.spans.push(i),i};this.update=t=>{var i;let r=kr.processTraceUpdate(t,this.data.metadata),o={projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,...r};return this.opik.traceBatchQueue.update(this.data.id,o),this.data={...this.data,...o},this};}};var bg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Ma={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},oR=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,"="),tR=s=>s.replace(/\/api$/,""),iR=s=>Buffer.from(s).toString("base64"),yg=(s,t,r)=>{let o=oR(r),i=`${t}?${o}`;return new URL(i,s).toString()},zg=({datasetId:s,experimentId:t,baseUrl:r})=>yg(r,bg.EXPERIMENTS,{[Ma.EXPERIMENT_ID]:t,[Ma.DATASET_ID]:s,[Ma.PATH]:iR(r)});var kg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=tR(r),i=`${t}/${bg.PROJECT_BY_NAME}`;return yg(o,i,{[Ma.PROJECT_NAME]:s})};var aR=300,Na=100,Ut=class{constructor({action:t,batchSize:r=Na,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=aR,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Na,updateBatchSize:l=Na,deleteBatchSize:d=Na,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 Ut({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new Ut({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 Ut({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 Fa=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 Oa=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 Wa=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 Ba=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 La=class extends jt{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var Va=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 Od=null;async function Sg(){return Od||(Od=await nR()),Od}var Dt=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||En.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=sR(t);return (await Sg()).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
|
|
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 su from'fs';import fw from'ini';import'dotenv/config';import dh from'qs';import {v7}from'uuid';import sR from'fast-json-stable-stringify';import nR from'xxhash-wasm';import {TextDecoder}from'util';import dR from'mustache';import wR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import RR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import tn from'chalk';import PR from'boxen';import vR 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 gw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function $t(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),nu=s=>{z.settings.minLevel=gw[s];},ww=()=>{z.settings.minLevel=100;};nu(process.env.OPIK_LOG_LEVEL||"INFO");var hw="~/.opik.config",gn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function pu(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function Rw(){return pu({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 bw(){let s=process.env.OPIK_CONFIG_PATH||hw;if(!su.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=fw.parse(su.readFileSync(s,"utf8"));return t.opik?pu({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 cu(s){let t=Rw(),r=bw(),{headers:o,...i}=s||{};return yw({...gn,...r,...t,...i})}function yw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=zw(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 zw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>kw,AlertPublicAlertType:()=>vw,AlertTriggerConfigPublicType:()=>Ew,AlertTriggerConfigType:()=>xw,AlertTriggerConfigWriteType:()=>_w,AlertTriggerEventType:()=>Sw,AlertTriggerPublicEventType:()=>Pw,AlertTriggerWriteEventType:()=>Aw,AlertWriteAlertType:()=>Tw,AnnotationQueuePublicScope:()=>Uw,AnnotationQueueScope:()=>Iw,AnnotationQueueWriteScope:()=>jw,AssistantMessageRole:()=>qw,AttachmentListRequestEntityType:()=>mu,BadRequestError:()=>_,CheckName:()=>zf,CheckPublicName:()=>nh,CheckPublicResult:()=>sh,CheckResult:()=>kf,ColumnCompareTypesItem:()=>cf,ColumnPublicTypesItem:()=>Rf,ColumnTypesItem:()=>bf,CompleteMultipartUploadRequestEntityType:()=>Dw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>vu,DatasetItemCompareSource:()=>lf,DatasetItemFilterOperator:()=>rf,DatasetItemPublicSource:()=>ff,DatasetItemSource:()=>af,DatasetItemWriteSource:()=>Pn,DatasetPublicStatus:()=>wf,DatasetPublicVisibility:()=>gf,DatasetStatus:()=>tf,DatasetUpdateVisibility:()=>fu,DatasetVisibility:()=>of,DatasetWriteVisibility:()=>wu,DeleteAttachmentsRequestEntityType:()=>Mw,DownloadAttachmentRequestEntityType:()=>du,ExperimentItemCompareTraceVisibilityMode:()=>mf,ExperimentItemPublicTraceVisibilityMode:()=>hf,ExperimentItemTraceVisibilityMode:()=>nf,ExperimentPublicStatus:()=>Ef,ExperimentPublicType:()=>Tf,ExperimentStatus:()=>yf,ExperimentType:()=>vn,ExperimentUpdateStatus:()=>yu,ExperimentUpdateType:()=>bu,ExperimentWriteStatus:()=>Ru,ExperimentWriteType:()=>hu,FeedbackScoreBatchItemSource:()=>ah,FeedbackScoreBatchItemThreadSource:()=>lh,FeedbackScoreCompareSource:()=>df,FeedbackScoreExperimentItemBulkWriteViewSource:()=>xf,FeedbackScorePublicSource:()=>oh,FeedbackScoreSource:()=>sf,FindFeedbackDefinitionsRequestType:()=>zu,FindFeedbackScoreNames1RequestType:()=>Iu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>ju,GetSpansByProjectRequestType:()=>Cu,GetWebhookExamplesRequestAlertType:()=>lu,GuardrailName:()=>Pf,GuardrailResult:()=>vf,GuardrailWriteName:()=>Cf,GuardrailWriteResult:()=>If,LlmAsJudgeMessagePublicRole:()=>Kw,LlmAsJudgeMessageRole:()=>Nw,LlmAsJudgeMessageWriteRole:()=>Lw,LlmAsJudgeOutputSchemaPublicType:()=>Gw,LlmAsJudgeOutputSchemaType:()=>Fw,LlmAsJudgeOutputSchemaWriteType:()=>Vw,LogItemLevel:()=>Zw,ManualEvaluationRequestEntityType:()=>Df,NotFoundError:()=>A,NotImplementedError:()=>Ne,OptimizationPublicStatus:()=>Ff,OptimizationStatus:()=>Mf,OptimizationUpdateStatus:()=>Su,OptimizationWriteStatus:()=>Nf,ProjectDetailedVisibility:()=>Vf,ProjectMetricRequestPublicInterval:()=>Tu,ProjectMetricRequestPublicMetricType:()=>Au,ProjectMetricResponsePublicInterval:()=>Lf,ProjectMetricResponsePublicMetricType:()=>Bf,ProjectPublicVisibility:()=>Wf,ProjectUpdateVisibility:()=>_u,ProjectVisibility:()=>Of,ProjectWriteVisibility:()=>xu,PromptDetailTemplateStructure:()=>Qf,PromptPublicTemplateStructure:()=>qf,PromptTemplateStructure:()=>Jf,PromptType:()=>Hf,PromptVersionDetailTemplateStructure:()=>$f,PromptVersionDetailType:()=>Gf,PromptVersionPublicTemplateStructure:()=>Zf,PromptVersionPublicType:()=>Yf,PromptVersionTemplateStructure:()=>Kf,PromptVersionType:()=>Xf,PromptWriteTemplateStructure:()=>Pu,PromptWriteType:()=>Eu,ProviderApiKeyProvider:()=>Uf,ProviderApiKeyPublicProvider:()=>jf,ProviderApiKeyWriteProvider:()=>ku,ResponseFormatType:()=>ef,SpanExperimentItemBulkWriteViewType:()=>_f,SpanFilterOperator:()=>Ow,SpanFilterPublicOperator:()=>$w,SpanFilterWriteOperator:()=>Hw,SpanPublicType:()=>th,SpanSearchStreamRequestPublicType:()=>Uu,SpanType:()=>fe,SpanUpdateType:()=>eh,SpanWriteType:()=>rh,StartMultipartUploadRequestEntityType:()=>uu,TraceFilterOperator:()=>Ww,TraceFilterPublicOperator:()=>Qw,TraceFilterWriteOperator:()=>Jw,TracePublicVisibilityMode:()=>ph,TraceThreadFilterOperator:()=>Bw,TraceThreadFilterPublicOperator:()=>Yw,TraceThreadFilterWriteOperator:()=>Xw,TraceThreadStatus:()=>ch,TraceVisibilityMode:()=>Sf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>gu,ValueEntryCompareSource:()=>uf,ValueEntryExperimentItemBulkWriteViewSource:()=>Af,ValueEntryPublicSource:()=>ih,ValueEntrySource:()=>pf,WebhookTestResultStatus:()=>Cw,alerts:()=>Qt,annotationQueues:()=>fn,attachments:()=>Yt,automationRuleEvaluators:()=>Rn,chatCompletions:()=>bn,check:()=>hn,dashboards:()=>yn,datasets:()=>Zt,experiments:()=>qt,feedbackDefinitions:()=>ei,guardrails:()=>zn,llmProviderKey:()=>ri,manualEvaluation:()=>kn,openTelemetryIngestion:()=>Sn,optimizations:()=>oi,projects:()=>ti,prompts:()=>ii,redirect:()=>En,serviceToggles:()=>xn,spans:()=>ai,systemUsage:()=>wn,traces:()=>_n,welcomeWizard:()=>An,workspaces:()=>Tn});var Qt={};c(Qt,{GetWebhookExamplesRequestAlertType:()=>lu});var lu={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Yt={};c(Yt,{AttachmentListRequestEntityType:()=>mu,DownloadAttachmentRequestEntityType:()=>du,StartMultipartUploadRequestEntityType:()=>uu,UploadAttachmentRequestEntityType:()=>gu});var mu={Trace:"trace",Span:"span"};var du={Trace:"trace",Span:"span"};var uu={Trace:"trace",Span:"span"};var gu={Trace:"trace",Span:"span"};var Zt={};c(Zt,{DatasetUpdateVisibility:()=>fu,DatasetWriteVisibility:()=>wu});var wu={Private:"private",Public:"public"};var fu={Private:"private",Public:"public"};var qt={};c(qt,{ExperimentUpdateStatus:()=>yu,ExperimentUpdateType:()=>bu,ExperimentWriteStatus:()=>Ru,ExperimentWriteType:()=>hu});var hu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ru={Running:"running",Completed:"completed",Cancelled:"cancelled"};var bu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var yu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var ei={};c(ei,{FindFeedbackDefinitionsRequestType:()=>zu});var zu={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var ri={};c(ri,{ProviderApiKeyWriteProvider:()=>ku});var ku={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikFree:"opik-free"};var oi={};c(oi,{OptimizationUpdateStatus:()=>Su});var Su={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var ti={};c(ti,{ProjectMetricRequestPublicInterval:()=>Tu,ProjectMetricRequestPublicMetricType:()=>Au,ProjectUpdateVisibility:()=>_u,ProjectWriteVisibility:()=>xu});var xu={Private:"private",Public:"public"};var _u={Private:"private",Public:"public"};var Au={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 Tu={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var ii={};c(ii,{CreatePromptVersionDetailTemplateStructure:()=>vu,PromptWriteTemplateStructure:()=>Pu,PromptWriteType:()=>Eu});var Eu={Mustache:"mustache",Jinja2:"jinja2"};var Pu={Text:"text",Chat:"chat"};var vu={Text:"text",Chat:"chat"};var ai={};c(ai,{FindFeedbackScoreNames1RequestType:()=>Iu,GetSpanStatsRequestType:()=>ju,GetSpansByProjectRequestType:()=>Cu,SpanSearchStreamRequestPublicType:()=>Uu});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 Uu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};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 Tn={};var En={};var kw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};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={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};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={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Pw={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 vw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Cw={Success:"success",Failure:"failure"};var Iw={Trace:"trace",Thread:"thread"};var jw={Trace:"trace",Thread:"thread"};var Uw={Trace:"trace",Thread:"thread"};var Dw={Trace:"trace",Span:"span"};var Mw={Trace:"trace",Span:"span"};var Nw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Fw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Vw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Gw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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={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 Zw={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var qw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var ef={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var rf={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 of={Private:"private",Public:"public"};var tf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var af={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var nf={Default:"default",Hidden:"hidden"};var sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var pf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Pn={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var cf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var lf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var mf={Default:"default",Hidden:"hidden"};var df={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var uf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var gf={Private:"private",Public:"public"};var wf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var ff={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var hf={Default:"default",Hidden:"hidden"};var Rf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var bf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var vn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var yf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var zf={Topic:"TOPIC",Pii:"PII"};var kf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Sf={Default:"default",Hidden:"hidden"};var xf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var _f={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Af={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Tf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Ef={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Pf={Topic:"TOPIC",Pii:"PII"};var vf={Passed:"passed",Failed:"failed"};var Cf={Topic:"TOPIC",Pii:"PII"};var If={Passed:"passed",Failed:"failed"};var jf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikFree:"opik-free"};var Uf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikFree:"opik-free"};var Df={Trace:"trace",Thread:"thread",Span:"span"};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={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Of={Private:"private",Public:"public"};var Wf={Private:"private",Public:"public"};var Bf={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 Lf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Vf={Private:"private",Public:"public"};var Hf={Mustache:"mustache",Jinja2:"jinja2"};var Jf={Text:"text",Chat:"chat"};var Xf={Mustache:"mustache",Jinja2:"jinja2"};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={Mustache:"mustache",Jinja2:"jinja2"};var Zf={Text:"text",Chat:"chat"};var qf={Text:"text",Chat:"chat"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var oh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var th={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ih={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ah={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var nh={Topic:"TOPIC",Pii:"PII"};var sh={Passed:"passed",Failed:"failed"};var ph={Default:"default",Hidden:"hidden"};var ch={Active:"active",Inactive:"inactive"};var lh={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(mh({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function mh({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 Pr;typeof globalThis.Headers!="undefined"?Pr=globalThis.Headers:Pr=class Du{constructor(t){if(this.headers=new Map,t)if(t instanceof Du)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 ni={headers:new Pr,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},si={headers:new Pr,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function pi(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Mu(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${dh.stringify(t,{arrayFormat:"repeat"})}`:s}var m=uh();function uh(){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 Nu(){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 Fu({body:s,type:t}){return t.includes("json")?Ae(s):s}async function Ou(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 Wu(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 Ou(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 gh="timeout";function Bu(s){let t=new AbortController,r=setTimeout(()=>t.abort(gh),s);return {signal:t.signal,abortId:r}}function Lu(...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 Vu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:T}=Bu(a);w=T,g.push(x);}l!=null&&g.push(l);let k=Lu(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 wh(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Hu(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=wh(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function fh(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=Mu(s.url,s.queryParameters),o=await Fu({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await Nu();try{let a=await Hu(async()=>Vu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Wu(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:pi(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:pi(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ni}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:ni}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:si}:{ok:false,error:{reason:"unknown",errorMessage:Ae(a)},rawResponse:si}}}var b=fh;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 Un(s){return typeof s=="object"&&s!=null&&"name"in s}function Dn(s){return typeof s=="object"&&s!=null&&"path"in s}function Mn(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Ju(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new Cn:m.type==="node"?s=new In:s=new jn,await s.setup(),s}var Cn=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(Un(t))return t.name;if(Dn(t)&&t.path)return Mn(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"}}},In=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(Un(t))return t.name;if(Dn(t)&&t.path)return Mn(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():{}}}},jn=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(Un(t))return t.name;if(Dn(t)&&t.path)return Mn(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:()=>ng,bigint:()=>Ku,boolean:()=>sg,booleanLiteral:()=>ag,date:()=>Gu,discriminant:()=>fg,enum_:()=>li,getObjectLikeUtils:()=>le,getObjectUtils:()=>Fe,getSchemaUtils:()=>U,isProperty:()=>Ee,lazy:()=>$u,lazyObject:()=>og,list:()=>di,number:()=>pg,object:()=>mi,objectWithoutOptionalProperties:()=>rg,optional:()=>Nn,property:()=>Yu,record:()=>dg,set:()=>ug,string:()=>cg,stringLiteral:()=>ig,transform:()=>Fn,undiscriminatedUnion:()=>wg,union:()=>Rg,unknown:()=>lg,withParsedProperties:()=>Wn});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 ${hh(s)}.`}function hh(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:Xu(s.json),parse:Xu(s.parse)}}function Xu(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 ci(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ir=class s extends Error{constructor(r){super(r.map(ci).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var ar=class s extends Error{constructor(r){super(r.map(ci).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>Rh(s),optional:()=>Nn(s),optionalNullable:()=>bh(s),transform:t=>Fn(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 Rh(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 Nn(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 bh(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 Fn(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 Ku(){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 yh=/^([+-]?\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 Gu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:yh.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 li(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 $u(s){let t=On(s);return {...t,...U(t)}}function On(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 vr(s){return Object.entries(s)}function Cr(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 Ir(s){return Object.keys(s)}function Qu(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=>Wn(s,t)}}function Wn(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=Cr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Yu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Ee(s){return s.isProperty}function mi(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Ee(o)?o.rawKey:r),_getParsedProperties:()=>Ir(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of vr(s)){let u=Ee(d)?d.rawKey:l,g=Ee(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,eg(g)&&a.push(u);}return Zu({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 vr(s)){let d=Ee(l)?l.valueSchema:l;eg(d)&&i.push(a);}return Zu({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 Zu({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)=>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),...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 qu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=Qu(Ir(t),g=>i.has(g)),d=r(Cr(t,l)),u=o(Cr(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 eg(s){return !zh(s)}function zh(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function rg(s){return mi(s)}function og(s){let t={...On(s),_getRawProperties:()=>nr(s)._getRawProperties(),_getParsedProperties:()=>nr(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Fe(t)}}function di(s){let t={parse:(r,o)=>tg(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>tg(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 tg(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 ig(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 ag(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 ng=Q(E.ANY,s=>({ok:true,value:s}));var sg=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var pg=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var cg=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var lg=Q(E.UNKNOWN,s=>({ok:true,value:s}));function dg(s,t){let r={parse:(o,i)=>mg({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)=>mg({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 mg({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Te(s)?vr(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 ug(s){let t=di(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 wg(s){let t={parse:(r,o)=>gg((i,a)=>i.parse(r,a),s,o),json:(r,o)=>gg((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function gg(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 fg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function Rg(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=li(Ir(t)),a={parse:(l,d)=>hg({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)=>hg({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 hg({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 kh(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),kh(s)}var C={};c(C,{AggregationData:()=>Cl,Alert:()=>Eh,AlertAlertType:()=>Is,AlertPagePublic:()=>Qs,AlertPublic:()=>Go,AlertPublicAlertType:()=>Hs,AlertTrigger:()=>Ns,AlertTriggerConfig:()=>Ms,AlertTriggerConfigPublic:()=>Gs,AlertTriggerConfigPublicType:()=>Ks,AlertTriggerConfigType:()=>Ds,AlertTriggerConfigWrite:()=>Os,AlertTriggerConfigWriteType:()=>Fs,AlertTriggerEventType:()=>Us,AlertTriggerPublic:()=>$s,AlertTriggerPublicEventType:()=>Xs,AlertTriggerWrite:()=>Bs,AlertTriggerWriteEventType:()=>Ws,AlertWrite:()=>Ko,AlertWriteAlertType:()=>Ls,AnnotationQueue:()=>op,AnnotationQueueBatch:()=>vh,AnnotationQueueBatchWrite:()=>Oo,AnnotationQueueItemIds:()=>oa,AnnotationQueuePagePublic:()=>ap,AnnotationQueuePublic:()=>$o,AnnotationQueuePublicScope:()=>tp,AnnotationQueueReviewer:()=>rp,AnnotationQueueReviewerPublic:()=>ip,AnnotationQueueScope:()=>ep,AnnotationQueueUpdate:()=>Wo,AnnotationQueueWrite:()=>Fo,AnnotationQueueWriteScope:()=>hs,AssistantMessage:()=>kc,AssistantMessageRole:()=>zc,Attachment:()=>np,AttachmentListRequestEntityType:()=>wi,AttachmentPage:()=>sp,AudioUrl:()=>gp,AudioUrlPublic:()=>Qp,AudioUrlWrite:()=>Ep,AuthDetailsHolder:()=>dp,AutomationRuleEvaluator:()=>Ih,AutomationRuleEvaluatorLlmAsJudge:()=>zp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>at,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Mp,AutomationRuleEvaluatorObjectObjectPublic:()=>pc,AutomationRuleEvaluatorPagePublic:()=>cc,AutomationRuleEvaluatorPublic:()=>lc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Ap,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>ct,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Op,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Tp,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>lt,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>Bp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>Sp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>st,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Hp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>xp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>pt,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Xp,AutomationRuleEvaluatorUpdate:()=>yc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>gc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>Rc,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>bc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>fc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>hc,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>wc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>kp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>nt,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Gp,AutomationRuleEvaluatorWrite:()=>$p,AvgValueStatPublic:()=>Yc,BatchDelete:()=>F,BatchDeleteByProject:()=>Zh,BiInformation:()=>Ts,BiInformationResponse:()=>lr,BooleanFeedbackDefinition:()=>Ml,BooleanFeedbackDefinitionCreate:()=>Vl,BooleanFeedbackDefinitionPublic:()=>bt,BooleanFeedbackDefinitionUpdate:()=>am,BooleanFeedbackDetail:()=>Dl,BooleanFeedbackDetailCreate:()=>Ll,BooleanFeedbackDetailPublic:()=>Ql,BooleanFeedbackDetailUpdate:()=>im,CategoricalFeedbackDefinition:()=>Fl,CategoricalFeedbackDefinitionCreate:()=>Jl,CategoricalFeedbackDefinitionPublic:()=>yt,CategoricalFeedbackDefinitionUpdate:()=>sm,CategoricalFeedbackDetail:()=>Nl,CategoricalFeedbackDetailCreate:()=>Hl,CategoricalFeedbackDetailPublic:()=>Yl,CategoricalFeedbackDetailUpdate:()=>nm,ChatCompletionChoice:()=>xc,ChatCompletionRequest:()=>Lo,ChatCompletionResponse:()=>Ec,Check:()=>Rl,CheckName:()=>fl,CheckPublic:()=>Cd,CheckPublicName:()=>Pd,CheckPublicResult:()=>vd,CheckResult:()=>hl,ChunkedOutputJsonNode:()=>Mh,ChunkedOutputJsonNodePublic:()=>Wh,ChunkedOutputJsonNodePublicType:()=>Ul,ChunkedOutputJsonNodeType:()=>ll,Column:()=>pl,ColumnCompare:()=>Mc,ColumnCompareTypesItem:()=>Dc,ColumnPublic:()=>al,ColumnPublicTypesItem:()=>il,ColumnTypesItem:()=>sl,Comment:()=>L,CommentCompare:()=>Nc,CommentPublic:()=>qe,CompleteMultipartUploadRequest:()=>ta,CompleteMultipartUploadRequestEntityType:()=>pp,CompletionTokensDetails:()=>Ac,CountValueStatPublic:()=>Zc,CreateDatasetItemsFromSpansRequest:()=>Or,CreateDatasetItemsFromTracesRequest:()=>Wr,CreatePromptVersionDetail:()=>fo,CreatePromptVersionDetailTemplateStructure:()=>Li,DashboardPagePublic:()=>Pc,DashboardPublic:()=>Ze,DashboardUpdatePublic:()=>Ho,DashboardWrite:()=>Vo,DataPointDouble:()=>qh,DataPointNumberPublic:()=>$m,Dataset:()=>jh,DatasetExpansion:()=>Dh,DatasetExpansionResponse:()=>Uc,DatasetExpansionWrite:()=>Hr,DatasetIdentifier:()=>Lr,DatasetIdentifierPublic:()=>Jr,DatasetItem:()=>dt,DatasetItemBatch:()=>Uh,DatasetItemBatchUpdate:()=>Dr,DatasetItemBatchWrite:()=>Fr,DatasetItemCompare:()=>Jc,DatasetItemCompareSource:()=>Fc,DatasetItemFilter:()=>Ur,DatasetItemFilterOperator:()=>Bn,DatasetItemPageCompare:()=>Xc,DatasetItemPagePublic:()=>nl,DatasetItemPublic:()=>wt,DatasetItemPublicSource:()=>ol,DatasetItemSource:()=>jc,DatasetItemStreamRequest:()=>Xr,DatasetItemUpdate:()=>Ln,DatasetItemWrite:()=>Nr,DatasetItemWriteSource:()=>Vn,DatasetItemsDelete:()=>Vr,DatasetPagePublic:()=>Qc,DatasetPublic:()=>fr,DatasetPublicStatus:()=>Gc,DatasetPublicVisibility:()=>Kc,DatasetStatus:()=>Cc,DatasetUpdate:()=>Br,DatasetUpdateVisibility:()=>zi,DatasetVersionCreatePublic:()=>Gr,DatasetVersionDiff:()=>dl,DatasetVersionDiffStats:()=>ml,DatasetVersionPagePublic:()=>ul,DatasetVersionPublic:()=>hr,DatasetVersionRestorePublic:()=>$r,DatasetVersionSummary:()=>Ic,DatasetVersionSummaryPublic:()=>$c,DatasetVersionTag:()=>Kr,DatasetVersionUpdatePublic:()=>Qr,DatasetVisibility:()=>vc,DatasetWrite:()=>Mr,DatasetWriteVisibility:()=>yi,DeleteAttachmentsRequest:()=>Ch,DeleteAttachmentsRequestEntityType:()=>lp,DeleteFeedbackScore:()=>Tt,DeleteIdsHolder:()=>Rr,DeleteThreadFeedbackScores:()=>jo,DeleteTraceThreads:()=>Uo,Delta:()=>Sc,DownloadAttachmentRequestEntityType:()=>fi,ErrorCountWithDeviation:()=>_t,ErrorCountWithDeviationDetailed:()=>od,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>ro,ErrorInfoPublic:()=>Et,ErrorInfoWrite:()=>yo,ErrorMessage:()=>ee,ErrorMessageDetail:()=>$h,ErrorMessageDetailed:()=>Kh,ErrorMessagePublic:()=>Ph,Experiment:()=>Nh,ExperimentGroupAggregationsResponse:()=>jl,ExperimentGroupResponse:()=>vl,ExperimentItem:()=>Zr,ExperimentItemBulkRecord:()=>kl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>is,ExperimentItemBulkUpload:()=>Fh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>oo,ExperimentItemCompare:()=>Hc,ExperimentItemCompareTraceVisibilityMode:()=>Vc,ExperimentItemPublic:()=>gt,ExperimentItemPublicTraceVisibilityMode:()=>tl,ExperimentItemStreamRequest:()=>ao,ExperimentItemTraceVisibilityMode:()=>Qn,ExperimentItemsBatch:()=>qr,ExperimentItemsDelete:()=>eo,ExperimentPagePublic:()=>Al,ExperimentPublic:()=>Rt,ExperimentPublicStatus:()=>xl,ExperimentPublicType:()=>Sl,ExperimentScore:()=>to,ExperimentScorePublic:()=>_l,ExperimentScoreWrite:()=>Xn,ExperimentStatus:()=>wl,ExperimentStreamRequestPublic:()=>no,ExperimentType:()=>gl,ExperimentUpdate:()=>io,ExperimentUpdateStatus:()=>Ai,ExperimentUpdateType:()=>_i,ExperimentWrite:()=>Yr,ExperimentWriteStatus:()=>xi,ExperimentWriteType:()=>Si,ExportTraceServiceRequest:()=>Hh,Feedback:()=>Bh,FeedbackCreate:()=>$l,FeedbackDefinitionPagePublic:()=>rm,FeedbackObjectPublic:()=>em,FeedbackPublic:()=>tm,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>td,FeedbackScoreAveragePublic:()=>Le,FeedbackScoreBatch:()=>vt,FeedbackScoreBatchItem:()=>Ed,FeedbackScoreBatchItemSource:()=>Td,FeedbackScoreBatchItemThread:()=>ws,FeedbackScoreBatchItemThreadSource:()=>gs,FeedbackScoreBatchThread:()=>Do,FeedbackScoreCompare:()=>Lc,FeedbackScoreCompareSource:()=>Oc,FeedbackScoreExperimentItemBulkWriteView:()=>ts,FeedbackScoreExperimentItemBulkWriteViewSource:()=>es,FeedbackScoreNames:()=>Gm,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>kd,FeedbackScoreSource:()=>Kn,FeedbackUpdate:()=>mm,FindFeedbackDefinitionsRequestType:()=>Pi,FindFeedbackScoreNames1RequestType:()=>Ji,Function:()=>Bo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Xi,GetSpansByProjectRequestType:()=>Hi,GetWebhookExamplesRequestAlertType:()=>ui,GroupContent:()=>Tl,GroupContentWithAggregations:()=>Il,GroupDetail:()=>El,GroupDetails:()=>Pl,Guardrail:()=>gm,GuardrailBatch:()=>Lh,GuardrailBatchWrite:()=>Jo,GuardrailName:()=>dm,GuardrailResult:()=>um,GuardrailWrite:()=>As,GuardrailWriteName:()=>xs,GuardrailWriteResult:()=>_s,GuardrailsValidation:()=>bl,GuardrailsValidationPublic:()=>Id,IdsHolder:()=>Oh,ImageUrl:()=>hp,ImageUrlPublic:()=>Zp,ImageUrlWrite:()=>Cp,JsonListString:()=>D,JsonListStringCompare:()=>ia,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>ss,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>zs,LlmAsJudgeCode:()=>Qo,LlmAsJudgeCodePublic:()=>oc,LlmAsJudgeCodeWrite:()=>Dp,LlmAsJudgeMessage:()=>He,LlmAsJudgeMessageContent:()=>bp,LlmAsJudgeMessageContentPublic:()=>ec,LlmAsJudgeMessageContentWrite:()=>jp,LlmAsJudgeMessagePublic:()=>Qe,LlmAsJudgeMessagePublicRole:()=>Yp,LlmAsJudgeMessageRole:()=>fp,LlmAsJudgeMessageWrite:()=>Ke,LlmAsJudgeMessageWriteRole:()=>vp,LlmAsJudgeModelParameters:()=>Ve,LlmAsJudgeModelParametersPublic:()=>$e,LlmAsJudgeModelParametersWrite:()=>Xe,LlmAsJudgeOutputSchema:()=>Je,LlmAsJudgeOutputSchemaPublic:()=>Ye,LlmAsJudgeOutputSchemaPublicType:()=>rc,LlmAsJudgeOutputSchemaType:()=>yp,LlmAsJudgeOutputSchemaWrite:()=>Ge,LlmAsJudgeOutputSchemaWriteType:()=>Up,LogItem:()=>dc,LogItemLevel:()=>mc,LogPage:()=>uc,ManualEvaluationRequest:()=>xt,ManualEvaluationRequestEntityType:()=>Rm,ManualEvaluationResponse:()=>St,Message:()=>Rs,MultipartUploadPart:()=>cp,NumericalFeedbackDefinition:()=>Wl,NumericalFeedbackDefinitionCreate:()=>Kl,NumericalFeedbackDefinitionPublic:()=>zt,NumericalFeedbackDefinitionUpdate:()=>cm,NumericalFeedbackDetail:()=>Ol,NumericalFeedbackDetailCreate:()=>Xl,NumericalFeedbackDetailPublic:()=>Zl,NumericalFeedbackDetailUpdate:()=>pm,Optimization:()=>Jh,OptimizationPagePublic:()=>pa,OptimizationPublic:()=>br,OptimizationPublicStatus:()=>Dm,OptimizationStatus:()=>bm,OptimizationStudioConfig:()=>Am,OptimizationStudioConfigPublic:()=>Lm,OptimizationStudioConfigWrite:()=>jm,OptimizationStudioLog:()=>Vm,OptimizationUpdate:()=>co,OptimizationUpdateStatus:()=>ji,OptimizationWrite:()=>sa,OptimizationWriteStatus:()=>Um,PageColumns:()=>cl,PercentageValueStatPublic:()=>qc,PercentageValues:()=>xe,PercentageValuesDetailed:()=>id,PercentageValuesPublic:()=>ut,Project:()=>Xh,ProjectDetailed:()=>nd,ProjectDetailedVisibility:()=>ad,ProjectMetricRequestPublic:()=>uo,ProjectMetricRequestPublicInterval:()=>Fi,ProjectMetricRequestPublicMetricType:()=>Ni,ProjectMetricResponsePublic:()=>qm,ProjectMetricResponsePublicInterval:()=>Ym,ProjectMetricResponsePublicMetricType:()=>Qm,ProjectPagePublic:()=>Xm,ProjectPublic:()=>At,ProjectPublicVisibility:()=>Jm,ProjectRetrieveDetailed:()=>go,ProjectStatItemObjectPublic:()=>rl,ProjectStatsPublic:()=>Pe,ProjectStatsSummary:()=>rd,ProjectStatsSummaryItem:()=>ed,ProjectUpdate:()=>mo,ProjectUpdateVisibility:()=>Mi,ProjectVisibility:()=>Hm,ProjectWrite:()=>lo,ProjectWriteVisibility:()=>Di,Prompt:()=>Gh,PromptDetail:()=>ud,PromptDetailTemplateStructure:()=>dd,PromptPagePublic:()=>yd,PromptPublic:()=>bd,PromptPublicTemplateStructure:()=>Rd,PromptTemplateStructure:()=>pd,PromptTokensDetails:()=>_c,PromptType:()=>sd,PromptUpdatable:()=>Ro,PromptVersion:()=>md,PromptVersionBatchUpdate:()=>ho,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>cs,PromptVersionDetailType:()=>ps,PromptVersionLink:()=>aa,PromptVersionLinkPublic:()=>na,PromptVersionLinkWrite:()=>Ei,PromptVersionPagePublic:()=>hd,PromptVersionPublic:()=>fd,PromptVersionPublicTemplateStructure:()=>wd,PromptVersionPublicType:()=>gd,PromptVersionRetrieveDetail:()=>bo,PromptVersionTemplateStructure:()=>ld,PromptVersionType:()=>cd,PromptVersionUpdate:()=>ls,PromptWrite:()=>wo,PromptWriteTemplateStructure:()=>Bi,PromptWriteType:()=>Wi,ProviderApiKey:()=>Vh,ProviderApiKeyPagePublic:()=>fm,ProviderApiKeyProvider:()=>hm,ProviderApiKeyPublic:()=>kt,ProviderApiKeyPublicProvider:()=>wm,ProviderApiKeyUpdate:()=>po,ProviderApiKeyWrite:()=>so,ProviderApiKeyWriteProvider:()=>Ci,ResponseFormat:()=>ks,ResponseFormatType:()=>ys,Result:()=>er,ResultsNumberPublic:()=>Zm,ScoreName:()=>Km,ServiceTogglesConfig:()=>zd,Span:()=>ht,SpanBatch:()=>Qh,SpanBatchUpdate:()=>xo,SpanBatchWrite:()=>ko,SpanEnrichmentOptions:()=>Hn,SpanExperimentItemBulkWriteView:()=>qn,SpanExperimentItemBulkWriteViewType:()=>Zn,SpanFilter:()=>Se,SpanFilterOperator:()=>_p,SpanFilterPublic:()=>We,SpanFilterPublicOperator:()=>us,SpanFilterWrite:()=>tt,SpanFilterWriteOperator:()=>Np,SpanLlmAsJudgeCode:()=>et,SpanLlmAsJudgeCodePublic:()=>nc,SpanLlmAsJudgeCodeWrite:()=>Fp,SpanPagePublic:()=>Ad,SpanPublic:()=>Pt,SpanPublicType:()=>_d,SpanSearchStreamRequestPublic:()=>_o,SpanSearchStreamRequestPublicType:()=>Ki,SpanType:()=>zl,SpanUpdate:()=>So,SpanUpdateType:()=>ds,SpanUserDefinedMetricPythonCode:()=>rt,SpanUserDefinedMetricPythonCodePublic:()=>sc,SpanUserDefinedMetricPythonCodeWrite:()=>Wp,SpanWrite:()=>zo,SpanWriteType:()=>ms,SpansCountResponse:()=>Ps,StartMultipartUploadRequest:()=>jr,StartMultipartUploadRequestEntityType:()=>hi,StartMultipartUploadResponse:()=>mp,StreamOptions:()=>bs,StudioEvaluation:()=>xm,StudioEvaluationPublic:()=>Wm,StudioEvaluationWrite:()=>Cm,StudioLlmModel:()=>km,StudioLlmModelPublic:()=>Fm,StudioLlmModelWrite:()=>Pm,StudioMessage:()=>ym,StudioMessagePublic:()=>Mm,StudioMessageWrite:()=>Tm,StudioMetric:()=>Sm,StudioMetricPublic:()=>Om,StudioMetricWrite:()=>vm,StudioOptimizer:()=>_m,StudioOptimizerPublic:()=>Bm,StudioOptimizerWrite:()=>Im,StudioPrompt:()=>zm,StudioPromptPublic:()=>Nm,StudioPromptWrite:()=>Em,Tool:()=>Ss,ToolCall:()=>mt,Trace:()=>ft,TraceBatch:()=>Yh,TraceBatchUpdate:()=>Po,TraceBatchWrite:()=>To,TraceCountResponse:()=>Cs,TraceEnrichmentOptions:()=>Jn,TraceExperimentItemBulkWriteView:()=>Yn,TraceFilter:()=>ke,TraceFilterOperator:()=>wp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>as,TraceFilterWrite:()=>ot,TraceFilterWriteOperator:()=>Pp,TracePagePublic:()=>Md,TracePublic:()=>Ct,TracePublicVisibilityMode:()=>jd,TraceSearchStreamRequestPublic:()=>No,TraceThread:()=>It,TraceThreadBatchIdentifier:()=>Io,TraceThreadBatchUpdate:()=>Co,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>fs,TraceThreadFilterPublic:()=>Oe,TraceThreadFilterPublicOperator:()=>ns,TraceThreadFilterWrite:()=>it,TraceThreadFilterWriteOperator:()=>Lp,TraceThreadIdentifier:()=>ca,TraceThreadLlmAsJudgeCode:()=>Zo,TraceThreadLlmAsJudgeCodePublic:()=>ic,TraceThreadLlmAsJudgeCodeWrite:()=>Vp,TraceThreadPage:()=>Dd,TraceThreadSearchStreamRequest:()=>Mo,TraceThreadStatus:()=>Ud,TraceThreadUpdate:()=>vo,TraceThreadUserDefinedMetricPythonCode:()=>qo,TraceThreadUserDefinedMetricPythonCodePublic:()=>ac,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Jp,TraceUpdate:()=>Eo,TraceVisibilityMode:()=>yl,TraceWrite:()=>Ao,UploadAttachmentRequestEntityType:()=>Ri,Usage:()=>Tc,UserDefinedMetricPythonCode:()=>Yo,UserDefinedMetricPythonCodePublic:()=>tc,UserDefinedMetricPythonCodeWrite:()=>Kp,ValueEntry:()=>$n,ValueEntryCompare:()=>Bc,ValueEntryCompareSource:()=>Wc,ValueEntryExperimentItemBulkWriteView:()=>os,ValueEntryExperimentItemBulkWriteViewSource:()=>rs,ValueEntryPublic:()=>xd,ValueEntryPublicSource:()=>Sd,ValueEntrySource:()=>Gn,VideoUrl:()=>Rp,VideoUrlPublic:()=>qp,VideoUrlWrite:()=>Ip,Webhook:()=>js,WebhookExamples:()=>Ys,WebhookPublic:()=>Js,WebhookTestResult:()=>qs,WebhookTestResultStatus:()=>Zs,WebhookWrite:()=>Vs,WelcomeWizardSubmission:()=>Xo,WelcomeWizardTracking:()=>Nd,WorkspaceConfiguration:()=>jt,WorkspaceMetricRequest:()=>eR,WorkspaceMetricResponse:()=>la,WorkspaceMetricsSummaryRequest:()=>zr,WorkspaceMetricsSummaryResponse:()=>Fd,WorkspaceNameHolder:()=>up,WorkspaceSpansCount:()=>Es,WorkspaceTraceCount:()=>vs,alerts:()=>gi,annotationQueues:()=>Yi,attachments:()=>sr,chatCompletions:()=>Zi,dashboards:()=>qi,datasets:()=>ki,experiments:()=>pr,feedbackDefinitions:()=>vi,guardrails:()=>ea,llmProviderKey:()=>Ii,optimizations:()=>Ui,projects:()=>Oi,prompts:()=>Vi,spans:()=>cr,traces:()=>Be,welcomeWizard:()=>ra});var gi={};c(gi,{GetWebhookExamplesRequestAlertType:()=>ui});var ui=e.enum_(["general","slack","pagerduty"]);var sr={};c(sr,{AttachmentListRequestEntityType:()=>wi,DownloadAttachmentRequestEntityType:()=>fi,StartMultipartUploadRequest:()=>jr,StartMultipartUploadRequestEntityType:()=>hi,UploadAttachmentRequestEntityType:()=>Ri,uploadAttachment:()=>bi});var wi=e.enum_(["trace","span"]);var fi=e.enum_(["trace","span"]);var hi=e.enum_(["trace","span"]);var Ri=e.enum_(["trace","span"]);var bi={};c(bi,{Request:()=>Sh});var Sh=e.record(e.string(),e.unknown());var jr=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",hi),entityId:e.property("entity_id",e.string()),path:e.string()});var ki={};c(ki,{CreateDatasetItemsFromSpansRequest:()=>Or,CreateDatasetItemsFromTracesRequest:()=>Wr,DatasetExpansionWrite:()=>Hr,DatasetIdentifier:()=>Lr,DatasetIdentifierPublic:()=>Jr,DatasetItemBatchUpdate:()=>Dr,DatasetItemBatchWrite:()=>Fr,DatasetItemStreamRequest:()=>Xr,DatasetItemsDelete:()=>Vr,DatasetUpdate:()=>Br,DatasetUpdateVisibility:()=>zi,DatasetVersionCreatePublic:()=>Gr,DatasetVersionRestorePublic:()=>$r,DatasetVersionTag:()=>Kr,DatasetVersionUpdatePublic:()=>Qr,DatasetWrite:()=>Mr,DatasetWriteVisibility:()=>yi});var yi=e.enum_(["private","public"]);var zi=e.enum_(["private","public"]);var Bn=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ur=e.object({field:e.string().optional(),operator:Bn.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Ln=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 Dr=e.object({ids:e.list(e.string()).optional(),filters:e.list(Ur).optional(),update:Ln,mergeTags:e.property("merge_tags",e.boolean().optional())});var Mr=e.object({id:e.string().optional(),name:e.string(),visibility:yi.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Vn=e.enum_(["manual","trace","span","sdk"]);var Nr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Vn,data:v,tags:e.list(e.string()).optional()});var Fr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Nr)});var Hn=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Or=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Hn)});var Jn=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 Wr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Jn)});var Br=e.object({name:e.string(),description:e.string().optional(),visibility:zi.optional(),tags:e.list(e.string()).optional()});var Lr=e.object({datasetName:e.property("dataset_name",e.string())});var Vr=e.object({itemIds:e.property("item_ids",e.list(e.string()).optional()),datasetId:e.property("dataset_id",e.string().optional()),filters:e.list(Ur).optional()});var Hr=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 Jr=e.object({datasetName:e.property("dataset_name",e.string())});var Xr=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 Kr=e.object({tag:e.string()});var Gr=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 $r=e.object({versionRef:e.property("version_ref",e.string())});var Qr=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:()=>oo,ExperimentItemStreamRequest:()=>ao,ExperimentItemsBatch:()=>qr,ExperimentItemsDelete:()=>eo,ExperimentStreamRequestPublic:()=>no,ExperimentUpdate:()=>io,ExperimentUpdateStatus:()=>Ai,ExperimentUpdateType:()=>_i,ExperimentWrite:()=>Yr,ExperimentWriteStatus:()=>xi,ExperimentWriteType:()=>Si,findFeedbackScoreNames:()=>Ti});var Si=e.enum_(["regular","trial","mini-batch"]);var xi=e.enum_(["running","completed","cancelled"]);var _i=e.enum_(["regular","trial","mini-batch"]);var Ai=e.enum_(["running","completed","cancelled"]);var Ti={};c(Ti,{Response:()=>xh});var xh=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 Xn=e.object({name:e.string(),value:e.number()});var Ei=e.object({id:e.string()});var Yr=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:Si.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:xi.optional(),experimentScores:e.property("experiment_scores",e.list(Xn).optional()),promptVersion:e.property("prompt_version",Ei.optional()),promptVersions:e.property("prompt_versions",e.list(Ei).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Kn=e.enum_(["ui","sdk","online_scoring"]);var Gn=e.enum_(["ui","sdk","online_scoring"]);var $n=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Gn.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:Kn,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(),$n).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 Qn=e.enum_(["default","hidden"]);var Zr=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",Qn.optional())});var qr=e.object({experimentItems:e.property("experiment_items",e.list(Zr))});var eo=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 ro=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Yn=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",ro.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Zn=e.enum_(["general","tool","llm","guardrail"]);var qn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Zn.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",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 es=e.enum_(["ui","sdk","online_scoring"]);var rs=e.enum_(["ui","sdk","online_scoring"]);var os=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:rs.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 ts=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:es,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(),os).optional())});var is=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Yn.optional(),spans:e.list(qn).optional(),feedbackScores:e.property("feedback_scores",e.list(ts).optional())});var oo=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(is)});var to=e.object({name:e.string(),value:e.number()});var io=e.object({name:e.string().optional(),metadata:v.optional(),type:_i.optional(),status:Ai.optional(),experimentScores:e.property("experiment_scores",e.list(to).optional())});var ao=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 no=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var vi={};c(vi,{FindFeedbackDefinitionsRequestType:()=>Pi});var Pi=e.enum_(["numerical","categorical","boolean"]);var Ii={};c(Ii,{ProviderApiKeyUpdate:()=>po,ProviderApiKeyWrite:()=>so,ProviderApiKeyWriteProvider:()=>Ci});var Ci=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-free"]);var so=e.object({provider:Ci,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 po=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 Ui={};c(Ui,{OptimizationUpdate:()=>co,OptimizationUpdateStatus:()=>ji});var ji=e.enum_(["running","completed","cancelled","initialized","error"]);var co=e.object({name:e.string().optional(),status:ji.optional()});var Oi={};c(Oi,{ProjectMetricRequestPublic:()=>uo,ProjectMetricRequestPublicInterval:()=>Fi,ProjectMetricRequestPublicMetricType:()=>Ni,ProjectRetrieveDetailed:()=>go,ProjectUpdate:()=>mo,ProjectUpdateVisibility:()=>Mi,ProjectWrite:()=>lo,ProjectWriteVisibility:()=>Di});var Di=e.enum_(["private","public"]);var Mi=e.enum_(["private","public"]);var Ni=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Fi=e.enum_(["HOURLY","DAILY","WEEKLY"]);var lo=e.object({name:e.string(),visibility:Di.optional(),description:e.string().optional()});var mo=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Mi.optional()});var as=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:as.optional(),key:e.string().optional(),value:e.string().optional()});var ns=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Oe=e.object({field:e.string().optional(),operator:ns.optional(),key:e.string().optional(),value:e.string().optional()});var uo=e.object({metricType:e.property("metric_type",Ni.optional()),interval:Fi.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 go=e.object({name:e.string()});var Vi={};c(Vi,{CreatePromptVersionDetail:()=>fo,CreatePromptVersionDetailTemplateStructure:()=>Li,PromptUpdatable:()=>Ro,PromptVersionBatchUpdate:()=>ho,PromptVersionRetrieveDetail:()=>bo,PromptWrite:()=>wo,PromptWriteTemplateStructure:()=>Bi,PromptWriteType:()=>Wi});var Wi=e.enum_(["mustache","jinja2"]);var Bi=e.enum_(["text","chat"]);var Li=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var wo=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:Wi.optional(),templateStructure:e.property("template_structure",Bi.optional()),tags:e.list(e.string()).optional()});var ss=e.record(e.string(),e.unknown());var ps=e.enum_(["mustache","jinja2"]);var cs=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:ss.optional(),type:ps.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",cs.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var fo=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",Li.optional())});var ls=e.object({tags:e.list(e.string()).optional()});var ho=e.object({ids:e.list(e.string()),update:ls,mergeTags:e.property("merge_tags",e.boolean().optional())});var Ro=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var bo=e.object({name:e.string(),commit:e.string().optional()});var cr={};c(cr,{FindFeedbackScoreNames1RequestType:()=>Ji,GetSpanStatsRequestType:()=>Xi,GetSpansByProjectRequestType:()=>Hi,SpanBatchUpdate:()=>xo,SpanBatchWrite:()=>ko,SpanSearchStreamRequestPublic:()=>_o,SpanSearchStreamRequestPublicType:()=>Ki,findFeedbackScoreNames1:()=>Gi});var Hi=e.enum_(["general","tool","llm","guardrail"]);var Ji=e.enum_(["general","tool","llm","guardrail"]);var Xi=e.enum_(["general","tool","llm","guardrail"]);var Ki=e.enum_(["general","tool","llm","guardrail"]);var Gi={};c(Gi,{Response:()=>_h});var _h=e.list(e.string());var ms=e.enum_(["general","tool","llm","guardrail"]);var yo=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zo=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:ms.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",yo.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 ko=e.object({spans:e.list(zo)});var ds=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 So=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:ds.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 xo=e.object({ids:e.list(e.string()),update:So,mergeTags:e.property("merge_tags",e.boolean().optional())});var us=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var We=e.object({field:e.string().optional(),operator:us.optional(),key:e.string().optional(),value:e.string().optional()});var _o=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:Ki.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:()=>jo,DeleteTraceThreads:()=>Uo,FeedbackScoreBatchThread:()=>Do,TraceBatchUpdate:()=>Po,TraceBatchWrite:()=>To,TraceSearchStreamRequestPublic:()=>No,TraceThreadBatchIdentifier:()=>Io,TraceThreadBatchUpdate:()=>Co,TraceThreadSearchStreamRequest:()=>Mo,findFeedbackScoreNames2:()=>$i,findTraceThreadsFeedbackScoreNames:()=>Qi});var $i={};c($i,{Response:()=>Ah});var Ah=e.list(e.string());var Qi={};c(Qi,{Response:()=>Th});var Th=e.list(e.string());var Ao=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",yo.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var To=e.object({traces:e.list(Ao)});var Eo=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 Po=e.object({ids:e.list(e.string()),update:Eo,mergeTags:e.property("merge_tags",e.boolean().optional())});var vo=e.object({tags:e.list(e.string()).optional()});var Co=e.object({ids:e.list(e.string()),update:vo,mergeTags:e.property("merge_tags",e.boolean().optional())});var Io=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 jo=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 Uo=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 gs=e.enum_(["ui","sdk","online_scoring"]);var ws=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:gs,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var Do=e.object({scores:e.list(ws)});var fs=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:fs.optional(),key:e.string().optional(),value:e.string().optional()});var Mo=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 No=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 Yi={};c(Yi,{AnnotationQueueBatchWrite:()=>Oo,AnnotationQueueUpdate:()=>Wo});var hs=e.enum_(["trace","thread"]);var Fo=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:hs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Oo=e.object({annotationQueues:e.property("annotation_queues",e.list(Fo))});var Wo=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 Zi={};c(Zi,{ChatCompletionRequest:()=>Lo});var Rs=e.record(e.string(),e.unknown());var bs=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var ys=e.enum_(["text","json_object","json_schema"]);var zs=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ks=e.object({type:ys.optional(),jsonSchema:e.property("json_schema",zs.optional())});var Bo=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 Ss=e.object({type:e.stringLiteral("function").optional(),function:Bo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Lo=e.object({model:e.string().optional(),messages:e.list(Rs).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",bs.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",ks.optional()),seed:e.number().optional(),tools:e.list(Ss).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(Bo).optional(),functionCall:e.property("function_call",ze.optional())});var qi={};c(qi,{DashboardUpdatePublic:()=>Ho,DashboardWrite:()=>Vo});var Vo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Ho=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var ea={};c(ea,{GuardrailBatchWrite:()=>Jo});var xs=e.enum_(["TOPIC","PII"]);var _s=e.enum_(["passed","failed"]);var As=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:xs,result:_s,config:v,details:v});var Jo=e.object({guardrails:e.list(As)});var ra={};c(ra,{WelcomeWizardSubmission:()=>Xo});var Xo=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 Ts=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(Ts).optional())});var Es=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Ps=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Es).optional())});var vs=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Cs=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(vs).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Is=e.enum_(["general","slack","pagerduty"]);var js=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 Us=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 Ds=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ms=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ds,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 Ns=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Us),triggerConfigs:e.property("trigger_configs",e.list(Ms).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Eh=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Is.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:js,triggers:e.list(Ns).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 Fs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Os=e.object({id:e.string().optional(),type:Fs,configValue:e.property("config_value",e.record(e.string(),e.string()).optional())});var Ws=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 Bs=e.object({id:e.string().optional(),eventType:e.property("event_type",Ws),triggerConfigs:e.property("trigger_configs",e.list(Os).optional())});var Ls=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()});var Ko=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ls.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Vs,triggers:e.list(Bs).optional()});var F=e.object({ids:e.list(e.string())});var Hs=e.enum_(["general","slack","pagerduty"]);var Js=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 Xs=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 Ks=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Gs=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ks,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 $s=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Xs),triggerConfigs:e.property("trigger_configs",e.list(Gs).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Go=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Hs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Js,triggers:e.list($s).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 Qs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Go).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Ph=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Ys=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Zs=e.enum_(["success","failure"]);var qs=e.object({status:Zs.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 oa=e.object({ids:e.list(e.string())});var ep=e.enum_(["trace","thread"]);var rp=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var op=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(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 vh=e.object({annotationQueues:e.property("annotation_queues",e.list(op))});var tp=e.enum_(["trace","thread"]);var ip=e.object({username:e.string().optional(),status:e.number().optional()});var Le=e.object({name:e.string(),value:e.number()});var $o=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:tp,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(ip).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 ap=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list($o).optional(),sortableBy:e.list(e.string()).optional()});var np=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 sp=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(np).optional(),sortableBy:e.list(e.string()).optional()});var pp=e.enum_(["trace","span"]);var cp=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var ta=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",pp),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(cp))});var lp=e.enum_(["trace","span"]);var Ch=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",lp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var mp=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var dp=e.record(e.string(),e.unknown());var up=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var gp=e.object({url:e.string()});var wp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:wp.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 fp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var hp=e.object({url:e.string(),detail:e.string().optional()});var Rp=e.object({url:e.string()});var bp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",hp.optional()),videoUrl:e.property("video_url",Rp.optional()),audioUrl:e.property("audio_url",gp.optional())});var He=e.object({role:fp,content:e.string().optional(),contentArray:e.property("content_array",e.list(bp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var yp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:yp,description:e.string()});var Qo=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var zp=e.object({filters:e.list(ke).optional(),code:Qo.optional()});var Yo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var kp=e.object({filters:e.list(ke).optional(),code:Yo.optional()});var Zo=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var Sp=e.object({filters:e.list(de).optional(),code:Zo.optional()});var qo=e.object({metric:e.string()});var xp=e.object({filters:e.list(de).optional(),code:qo.optional()});var _p=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Se=e.object({field:e.string().optional(),operator:_p.optional(),key:e.string().optional(),value:e.string().optional()});var et=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var Ap=e.object({filters:e.list(Se).optional(),code:et.optional()});var rt=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Tp=e.object({filters:e.list(Se).optional(),code:rt.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")}),Ih=e.union("type",{llm_as_judge:zp.extend(mr),user_defined_metric_python:kp.extend(mr),trace_thread_llm_as_judge:Sp.extend(mr),trace_thread_user_defined_metric_python:xp.extend(mr),span_llm_as_judge:Ap.extend(mr),span_user_defined_metric_python:Tp.extend(mr)}).transform({transform:s=>s,untransform:s=>s});var Ep=e.object({url:e.string()});var Pp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ot=e.object({field:e.string().optional(),operator:Pp.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 vp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Cp=e.object({url:e.string(),detail:e.string().optional()});var Ip=e.object({url:e.string()});var jp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Cp.optional()),videoUrl:e.property("video_url",Ip.optional()),audioUrl:e.property("audio_url",Ep.optional())});var Ke=e.object({role:vp,content:e.string().optional(),contentArray:e.property("content_array",e.list(jp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Up=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:Up,description:e.string()});var Dp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Mp=e.object({filters:e.list(ot).optional(),code:Dp.optional()});var Np=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var tt=e.object({field:e.string().optional(),operator:Np.optional(),key:e.string().optional(),value:e.string().optional()});var Fp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Op=e.object({filters:e.list(tt).optional(),code:Fp.optional()});var Wp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Bp=e.object({filters:e.list(tt).optional(),code:Wp.optional()});var Lp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var it=e.object({field:e.string().optional(),operator:Lp.optional(),key:e.string().optional(),value:e.string().optional()});var Vp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var Hp=e.object({filters:e.list(it).optional(),code:Vp.optional()});var Jp=e.object({metric:e.string()});var Xp=e.object({filters:e.list(it).optional(),code:Jp.optional()});var Kp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Gp=e.object({filters:e.list(ot).optional(),code:Kp.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")}),$p=e.union("type",{llm_as_judge:Mp.extend(dr),user_defined_metric_python:Gp.extend(dr),trace_thread_llm_as_judge:Hp.extend(dr),trace_thread_user_defined_metric_python:Xp.extend(dr),span_llm_as_judge:Op.extend(dr),span_user_defined_metric_python:Bp.extend(dr)}).transform({transform:s=>s,untransform:s=>s});var Qp=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 Yp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Zp=e.object({url:e.string(),detail:e.string().optional()});var qp=e.object({url:e.string()});var ec=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Zp.optional()),videoUrl:e.property("video_url",qp.optional()),audioUrl:e.property("audio_url",Qp.optional())});var Qe=e.object({role:Yp,content:e.string().optional(),contentArray:e.property("content_array",e.list(ec).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var rc=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ye=e.object({name:e.string(),type:rc,description:e.string()});var oc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var at=e.object({filters:e.list(be).optional(),code:oc.optional()});var tc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var nt=e.object({filters:e.list(be).optional(),code:tc.optional()});var ic=e.object({model:$e,messages:e.list(Qe),schema:e.list(Ye)});var st=e.object({filters:e.list(Oe).optional(),code:ic.optional()});var ac=e.object({metric:e.string()});var pt=e.object({filters:e.list(Oe).optional(),code:ac.optional()});var nc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var ct=e.object({filters:e.list(We).optional(),code:nc.optional()});var sc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var lt=e.object({filters:e.list(We).optional(),code:sc.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")}),pc=e.union("type",{llm_as_judge:at.extend(ur),user_defined_metric_python:nt.extend(ur),trace_thread_llm_as_judge:st.extend(ur),trace_thread_user_defined_metric_python:pt.extend(ur),span_llm_as_judge:ct.extend(ur),span_user_defined_metric_python:lt.extend(ur)}).transform({transform:s=>s,untransform:s=>s});var cc=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(pc).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")}),lc=e.union("type",{llm_as_judge:at.extend(gr),user_defined_metric_python:nt.extend(gr),trace_thread_llm_as_judge:st.extend(gr),trace_thread_user_defined_metric_python:pt.extend(gr),span_llm_as_judge:ct.extend(gr),span_user_defined_metric_python:lt.extend(gr)}).transform({transform:s=>s,untransform:s=>s});var mc=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var dc=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:mc.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var uc=e.object({content:e.list(dc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var gc=e.object({filters:e.list(ke).optional(),code:Qo.optional()});var wc=e.object({filters:e.list(ke).optional(),code:Yo.optional()});var fc=e.object({filters:e.list(de).optional(),code:Zo.optional()});var hc=e.object({filters:e.list(de).optional(),code:qo.optional()});var Rc=e.object({filters:e.list(Se).optional(),code:et.optional()});var bc=e.object({filters:e.list(Se).optional(),code:rt.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")}),yc=e.union("type",{llm_as_judge:gc.extend(wr),user_defined_metric_python:wc.extend(wr),trace_thread_llm_as_judge:fc.extend(wr),trace_thread_user_defined_metric_python:hc.extend(wr),span_llm_as_judge:Rc.extend(wr),span_user_defined_metric_python:bc.extend(wr)}).transform({transform:s=>s,untransform:s=>s});var zc=e.enum_(["system","user","assistant","tool","function"]);var mt=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var kc=e.object({role:zc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(mt).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var Sc=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(mt).optional()),functionCall:e.property("function_call",ze.optional())});var xc=e.object({index:e.number().optional(),message:kc.optional(),delta:Sc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var _c=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var Ac=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Tc=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",_c.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",Ac.optional())});var Ec=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(xc).optional(),usage:Tc.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 Pc=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 vc=e.enum_(["private","public"]);var Cc=e.enum_(["unknown","processing","completed","failed"]);var Ic=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 jh=e.object({id:e.string().optional(),name:e.string(),visibility:vc.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:Cc.optional(),latestVersion:e.property("latest_version",Ic.optional())});var jc=e.enum_(["manual","trace","span","sdk"]);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:jc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Zr).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 Uh=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(dt)});var Uc=e.object({generatedSamples:e.property("generated_samples",e.list(dt).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var Dh=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 Dc=e.enum_(["string","number","object","boolean","array","null"]);var Mc=e.object({name:e.string().optional(),types:e.list(Dc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Nc=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 Fc=e.enum_(["manual","trace","span","sdk"]);var ia=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Oc=e.enum_(["ui","sdk","online_scoring"]);var Wc=e.enum_(["ui","sdk","online_scoring"]);var Bc=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Wc.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 Lc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Oc,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(),Bc).optional())});var Vc=e.enum_(["default","hidden"]);var Hc=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:ia.optional(),output:ia.optional(),feedbackScores:e.property("feedback_scores",e.list(Lc).optional()),comments:e.list(Nc).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",Vc.optional())});var Jc=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:Fc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Hc).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 Xc=e.object({content:e.list(Jc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Mc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Kc=e.enum_(["private","public"]);var Gc=e.enum_(["unknown","processing","completed","failed"]);var $c=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:Kc.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:Gc.optional(),latestVersion:e.property("latest_version",$c.optional())});var Qc=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 Yc=e.object({value:e.number().optional()});var Zc=e.object({value:e.number().optional()});var ut=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var qc=e.object({value:ut.optional()});var el=e.object({name:e.string().optional()}),rl=e.union("type",{PERCENTAGE:qc.extend(el),COUNT:Zc.extend(el),AVG:Yc.extend(el)}).transform({transform:s=>s,untransform:s=>s});var Pe=e.object({stats:e.list(rl).optional()});var ol=e.enum_(["manual","trace","span","sdk"]);var tl=e.enum_(["default","hidden"]);var gt=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",tl.optional())});var wt=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:ol,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(gt).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 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({content:e.list(wt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(al).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var sl=e.enum_(["string","number","object","boolean","array","null"]);var pl=e.object({name:e.string().optional(),types:e.list(sl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var cl=e.object({columns:e.list(pl).optional()});var ll=e.object({typeName:e.string().optional()});var Mh=e.object({type:ll.optional(),closed:e.boolean().optional()});var ml=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var dl=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:ml.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 ul=e.object({content:e.list(hr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var gl=e.enum_(["regular","trial","mini-batch"]);var wl=e.enum_(["running","completed","cancelled"]);var xe=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var aa=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 Nh=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:gl.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:wl.optional(),experimentScores:e.property("experiment_scores",e.list(to).optional()),promptVersion:e.property("prompt_version",aa.optional()),promptVersions:e.property("prompt_versions",e.list(aa).optional())});var Rr=e.object({ids:e.list(e.string())});var fl=e.enum_(["TOPIC","PII"]);var hl=e.enum_(["passed","failed"]);var Rl=e.object({name:fl.optional(),result:hl.optional()});var bl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Rl).optional()});var yl=e.enum_(["default","hidden"]);var ft=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(bl).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",yl.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 zl=e.enum_(["general","tool","llm","guardrail"]);var ht=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:zl.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 kl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:ft.optional(),spans:e.list(ht).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var Fh=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(kl)});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 Sl=e.enum_(["regular","trial","mini-batch"]);var xl=e.enum_(["running","completed","cancelled"]);var _l=e.object({name:e.string(),value:e.number()});var na=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 Rt=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:Sl.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:ut.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:xl.optional(),experimentScores:e.property("experiment_scores",e.list(_l).optional()),promptVersion:e.property("prompt_version",na.optional()),promptVersions:e.property("prompt_versions",e.list(na).optional())});var Al=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rt).optional(),sortableBy:e.list(e.string()).optional()});var Tl=e.object({label:e.string().optional()});var El=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var Pl=e.object({groupsDetails:e.property("groups_details",e.list(El).optional())});var vl=e.object({content:e.record(e.string(),Tl).optional(),details:Pl.optional()});var Cl=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 Il=e.object({label:e.string().optional(),aggregations:Cl.optional()});var jl=e.object({content:e.record(e.string(),Il).optional()});var Oh=e.object({ids:e.list(e.string())});var Ul=e.object({typeName:e.string().optional()});var Wh=e.object({type:Ul.optional(),closed:e.boolean().optional()});var Dl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Ml=e.object({details:Dl.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 Nl=e.object({categories:e.record(e.string(),e.number())});var Fl=e.object({details:Nl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ol=e.object({max:e.number(),min:e.number()});var Wl=e.object({details:Ol.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 Bl=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()}),Bh=e.union("type",{numerical:Wl.extend(Bl),categorical:Fl.extend(Bl),boolean:Ml.extend(Bl)}).transform({transform:s=>s,untransform:s=>s});var Ll=e.object({trueLabel:e.string(),falseLabel:e.string()});var Vl=e.object({details:Ll.optional()});var Hl=e.object({categories:e.record(e.string(),e.number())});var Jl=e.object({details:Hl.optional()});var Xl=e.object({max:e.number(),min:e.number()});var Kl=e.object({details:Xl.optional()});var Gl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),$l=e.union("type",{numerical:Kl.extend(Gl),categorical:Jl.extend(Gl),boolean:Vl.extend(Gl)}).transform({transform:s=>s,untransform:s=>s});var Ql=e.object({trueLabel:e.string(),falseLabel:e.string()});var bt=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({categories:e.record(e.string(),e.number())});var yt=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({max:e.number(),min:e.number()});var zt=e.object({details:Zl.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()}),em=e.union("type",{numerical:zt.extend(ql),categorical:yt.extend(ql),boolean:bt.extend(ql)}).transform({transform:s=>s,untransform:s=>s});var rm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(em).optional()});var om=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()}),tm=e.union("type",{numerical:zt.extend(om),categorical:yt.extend(om),boolean:bt.extend(om)}).transform({transform:s=>s,untransform:s=>s});var im=e.object({trueLabel:e.string(),falseLabel:e.string()});var am=e.object({details:im.optional()});var nm=e.object({categories:e.record(e.string(),e.number())});var sm=e.object({details:nm.optional()});var pm=e.object({max:e.number(),min:e.number()});var cm=e.object({details:pm.optional()});var lm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),mm=e.union("type",{numerical:cm.extend(lm),categorical:sm.extend(lm),boolean:am.extend(lm)}).transform({transform:s=>s,untransform:s=>s});var dm=e.enum_(["TOPIC","PII"]);var um=e.enum_(["passed","failed"]);var gm=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:dm,result:um,config:v,details:v});var Lh=e.object({guardrails:e.list(gm)});var wm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-free"]);var kt=e.object({id:e.string().optional(),provider:wm,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 fm=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(kt).optional(),sortableBy:e.list(e.string()).optional()});var hm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-free"]);var Vh=e.object({id:e.string().optional(),provider:hm,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 St=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var Rm=e.enum_(["trace","thread","span"]);var xt=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",Rm)});var Hh=v;var bm=e.enum_(["running","completed","cancelled","initialized","error"]);var ym=e.object({role:e.string(),content:e.string()});var zm=e.object({messages:e.list(ym)});var km=e.object({model:e.string(),parameters:v.optional()});var Sm=e.object({type:e.string(),parameters:v.optional()});var xm=e.object({metrics:e.list(Sm)});var _m=e.object({type:e.string(),parameters:v.optional()});var Am=e.object({datasetName:e.property("dataset_name",e.string()),prompt:zm,llmModel:e.property("llm_model",km),evaluation:xm,optimizer:_m});var Jh=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:bm,metadata:D.optional(),studioConfig:e.property("studio_config",Am.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 Tm=e.object({role:e.string(),content:e.string()});var Em=e.object({messages:e.list(Tm)});var Pm=e.object({model:e.string(),parameters:ie.optional()});var vm=e.object({type:e.string(),parameters:ie.optional()});var Cm=e.object({metrics:e.list(vm)});var Im=e.object({type:e.string(),parameters:ie.optional()});var jm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Em,llmModel:e.property("llm_model",Pm),evaluation:Cm,optimizer:Im});var Um=e.enum_(["running","completed","cancelled","initialized","error"]);var sa=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:te.optional(),studioConfig:e.property("studio_config",jm.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Dm=e.enum_(["running","completed","cancelled","initialized","error"]);var Mm=e.object({role:e.string(),content:e.string()});var Nm=e.object({messages:e.list(Mm)});var Fm=e.object({model:e.string(),parameters:Z.optional()});var Om=e.object({type:e.string(),parameters:Z.optional()});var Wm=e.object({metrics:e.list(Om)});var Bm=e.object({type:e.string(),parameters:Z.optional()});var Lm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Nm,llmModel:e.property("llm_model",Fm),evaluation:Wm,optimizer:Bm});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:Dm,metadata:ae.optional(),studioConfig:e.property("studio_config",Lm.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 pa=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 Vm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var _t=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Hm=e.enum_(["private","public"]);var Xh=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()),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()),threadCount:e.property("thread_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",_t.optional())});var Jm=e.enum_(["private","public"]);var At=e.object({id:e.string().optional(),name:e.string(),visibility:Jm.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 Xm=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 Km=e.object({name:e.string().optional(),type:e.string().optional()});var Gm=e.object({scores:e.list(Km).optional()});var $m=e.object({time:e.date(),value:e.number().optional()});var Qm=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Ym=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Zm=e.object({name:e.string().optional(),data:e.list($m).optional()});var qm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Qm.optional()),interval:Ym.optional(),results:e.list(Zm).optional()});var ed=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()),threadCount:e.property("thread_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",_t.optional())});var rd=e.object({content:e.list(ed).optional()});var od=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var td=e.object({name:e.string(),value:e.number()});var id=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ad=e.enum_(["private","public"]);var nd=e.object({id:e.string().optional(),name:e.string(),visibility:ad.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(td).optional()),duration:id.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()),threadCount:e.property("thread_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",od.optional())});var Kh=e.object({errors:e.list(e.string()).optional()});var sd=e.enum_(["mustache","jinja2"]);var pd=e.enum_(["text","chat"]);var cd=e.enum_(["mustache","jinja2"]);var ld=e.enum_(["text","chat"]);var md=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:cd.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",ld.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Gh=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:sd.optional(),templateStructure:e.property("template_structure",pd.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",md.optional())});var $h=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var dd=e.enum_(["text","chat"]);var ud=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",dd.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 gd=e.enum_(["mustache","jinja2"]);var wd=e.enum_(["text","chat"]);var fd=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:gd.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),templateStructure:e.property("template_structure",wd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().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.enum_(["text","chat"]);var bd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",Rd.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 yd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(bd).optional(),sortableBy:e.list(e.string()).optional()});var zd=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(),collaboratorsTabEnabled:e.boolean()});var Qh=e.object({spans:e.list(ht)});var Tt=e.object({name:e.string(),author:e.string().optional()});var Et=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var kd=e.enum_(["ui","sdk","online_scoring"]);var Sd=e.enum_(["ui","sdk","online_scoring"]);var xd=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Sd.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:kd,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(),xd).optional())});var _d=e.enum_(["general","tool","llm","guardrail"]);var Pt=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:_d.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",Et.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 Ad=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 Td=e.enum_(["ui","sdk","online_scoring"]);var Ed=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:Td,author:e.string().optional(),id:e.string()});var vt=e.object({scores:e.list(Ed)});var Yh=e.object({traces:e.list(ft)});var Zh=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var Pd=e.enum_(["TOPIC","PII"]);var vd=e.enum_(["passed","failed"]);var Cd=e.object({name:Pd.optional(),result:vd.optional()});var Id=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Cd).optional()});var jd=e.enum_(["default","hidden"]);var Ct=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",Et.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(Id).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",jd.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 Ud=e.enum_(["active","inactive"]);var It=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:Ud.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 ca=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 Dd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(It).optional(),sortableBy:e.list(e.string()).optional()});var Md=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ct).optional(),sortableBy:e.list(e.string()).optional()});var Nd=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 la=e.object({results:e.list(er).optional()});var eR=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 jt=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var Fd=e.object({results:e.list(er).optional()});var ma=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:Ps.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:Cs.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 da=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:Qs.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: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);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:Go.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:Ko.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=ui.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:Ys.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: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: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 ua=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:oa.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)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:ap.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: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: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: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: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:$o.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: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 _(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:oa.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)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 ga=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=wi.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:sp.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:ta.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:ta.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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=fi.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: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:mp.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=Ri.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 wa=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:dp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:up.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 fa=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:cc.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:$p.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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}.");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:yc.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:uc.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 ha=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: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:Ec.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 Ra=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:Pc.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: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: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: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: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 ba=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:Dr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:Qc.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: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 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:Fr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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 Ju();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: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 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:Wr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)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:Br.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)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:Lr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:Vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")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/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:Hr.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:Uc.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:Xc.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: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: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:wt.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: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")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:nl.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:cl.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:Xr.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:dl.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:Kr.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:ul.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:Gr.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:$r.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data: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:Qr.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 ya=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:Al.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: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.");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:qr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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: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: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 _(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:jl.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:Rt.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:io.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:gt.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:ao.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:no.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 za=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=Pi.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:rm.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:$l.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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:tm.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:mm.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 ka=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: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 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 Sa=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:fm.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: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")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:kt.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:po.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 xa=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:xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:St.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:xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:St.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:xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:St.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 _a=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 Aa=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:pa.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: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 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: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/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:pa.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: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")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:Vm.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 Ta=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:Xm.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: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")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:At.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:mo.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:Gm.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:uo.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 _(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:rd.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: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: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);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 Ea=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:yd.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: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);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: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 _(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: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 _(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:ud.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:Ro.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:hd.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: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: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 Pa=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:zd.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 va=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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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")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 eu,ru;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=Hi.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((ru=(eu=await n.get(this._options.baseUrl))!=null?eu:await n.get(this._options.environment))!=null?ru: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:Ad.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: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 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:Pt.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: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")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:Tt.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=Ji.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=Xi.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: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: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:_o.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 Ca=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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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/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: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")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: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")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:Md.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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:Ct.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: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")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: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 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:Tt.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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:ca.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:It.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:Dd.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:ca.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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: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:Mo.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:No.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:vo.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 Ia=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:Nd.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: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/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 ja=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:jt.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:jt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:jt.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:la.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:la.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:Fd.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 Ua=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 Ut=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new ma(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new da(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new ua(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new ga(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new wa(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new fa(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new ha(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new Ra(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new ba(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new ya(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new za(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new ka(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new Sa(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new xa(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new _a(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new Aa(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new Ta(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Ea(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Pa(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new va(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Ca(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new Ia(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new ja(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ua(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 kr=class{static serializePromptToInfoDict(t){return {name:t.name,...t.id&&{id:t.id},version:{...t.versionId&&{id:t.versionId},...t.commit&&{commit:t.commit},template:t.prompt}}}static normalizeMetadata(t){if(!t)return {};if(typeof t=="object"&&!Array.isArray(t))return t;if(typeof t=="string")try{let r=JSON.parse(t);if(typeof r=="object"&&!Array.isArray(r))return r}catch{}return {}}static mergePromptsIntoMetadata(t,r,o){let i=o.map(d=>this.serializePromptToInfoDict(d)),a=this.normalizeMetadata(t),l=this.normalizeMetadata(r);return {...a,...l,opik_prompts:i}}static processTraceUpdate(t,r){let{prompts:o,...i}=t;if(!o||o.length===0)return i;let a=this.mergePromptsIntoMetadata(r,i.metadata,o);return {...i,metadata:a}}static processSpanUpdate(t,r){let{prompts:o,...i}=t;if(!o||o.length===0)return i;let a=this.mergePromptsIntoMetadata(r,i.metadata,o);return {...i,metadata:a}}};var Da=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 i;let r=kr.processSpanUpdate(t,this.data.metadata),o={parentSpanId:this.data.parentSpanId,projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,traceId:this.data.traceId,...r};return this.opik.spanBatchQueue.update(this.data.id,o),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 Ma=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 Da(o,this.opik);return this.spans.push(i),i};this.update=t=>{var i;let r=kr.processTraceUpdate(t,this.data.metadata),o={projectName:(i=this.data.projectName)!=null?i:this.opik.config.projectName,...r};return this.opik.traceBatchQueue.update(this.data.id,o),this.data={...this.data,...o},this};}};var bg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Na={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},oR=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,"="),tR=s=>s.replace(/\/api$/,""),iR=s=>Buffer.from(s).toString("base64"),yg=(s,t,r)=>{let o=oR(r),i=`${t}?${o}`;return new URL(i,s).toString()},zg=({datasetId:s,experimentId:t,baseUrl:r})=>yg(r,bg.EXPERIMENTS,{[Na.EXPERIMENT_ID]:t,[Na.DATASET_ID]:s,[Na.PATH]:iR(r)});var kg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=tR(r),i=`${t}/${bg.PROJECT_BY_NAME}`;return yg(o,i,{[Na.PROJECT_NAME]:s})};var aR=300,Fa=100,Dt=class{constructor({action:t,batchSize:r=Fa,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=aR,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Fa,updateBatchSize:l=Fa,deleteBatchSize:d=Fa,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 Dt({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new Dt({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 Dt({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 Oa=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 Wa=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 Ba=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 La=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 Va=class extends Ut{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var Ha=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 Od=null;async function Sg(){return Od||(Od=await nR()),Od}var Mt=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||Pn.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=sR(t);return (await Sg()).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 Nt(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 xg={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 cR={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID"},Ja=class extends ne{constructor(t){super({message:xg.DATASET_ITEM_MISSING_ID(t),code:cR.DATASET_ITEM_MISSING_ID});}};var lR={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Xa=class extends ne{constructor(t){super({message:t,code:lR.SEARCH_TIMEOUT});}};var Ka={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 Wd={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},Ga=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Ka.JSON_PARSE_ERROR,code:Wd.JSON_PARSE_ERROR,originalError:r});}},$a=class extends ne{constructor(t){super({message:Ka.JSON_NOT_ARRAY(t),code:Wd.JSON_NOT_ARRAY});}},Qa=class extends ne{constructor(t,r){super({message:Ka.JSON_ITEM_NOT_OBJECT(t,r),code:Wd.JSON_ITEM_NOT_OBJECT});}};var Sr=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=Nt(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 Ja(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Nt(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=>Mt.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new Ga(l)}if(!Array.isArray(i))throw new $a(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 Qa(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 sR(o)}async getDeduplicatedItems(t){let r=[];for(let o of t){let i=new Mt(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 Bd=class extends Error{constructor(t){super(t),this.name="DatasetError";}},Ft=class extends Bd{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var Ya=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;}},Za=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=Nt(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=Za.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||gn.apiUrl;return zg({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:
|
|
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 Ld={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},
|
|
8
|
+
The prompts parameter is recommended for prompt version tracking.`};var Ld={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Ot=class extends ne{constructor(t){super({message:qa.EXPERIMENT_NOT_FOUND(t),code:Ld.EXPERIMENT_NOT_FOUND});}},Wt=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(qa.INVALID_CONFIG_TYPE(t),Ld.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(qa.CONFIG_PROMPTS_CONFLICT(),Ld.CONFIG_PROMPTS_CONFLICT)}};function _g(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw Wt.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw Wt.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 uR(s){try{let r=dR.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 Ag(s,t,r){if(r!=="mustache")return;let o=uR(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(Ag(s,t,r),r){case "mustache":return dR.render(s,t,{},{escape:o=>o});case "jinja2":return wR.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
|
|
10
|
+
`)}`)}}function Re(s,t,r){try{switch(Ag(s,t,r),r){case "mustache":return dR.render(s,t,{},{escape:o=>o});case "jinja2":return wR.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 Bt=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 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=>Wt.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 Tg(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(yR(o))return null;throw o}}function Eg(s,t,r){return t?t.template!==s.prompt||!bR(t.metadata,s.metadata)||t.type!==r:true}function bR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return RR(r,o)}function yR(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"},Pg={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},qa={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function vg(s){let t=qa.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 Cg(s,t){if(!qa.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"&&!qa.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 Vd(s,t){let r=Pg[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 Ig(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 en(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Bt=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return vg(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(Cg(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 en(a,o,l),i}};var Lt=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Vd(r,i),{operator:i};let a=this.parseWordOperator(t);return Vd(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 Vt=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();}en(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=Bt.parse(t),o=Lt.parse(t,this.getFieldName(r)),i=Vt.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 Ig(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 jg(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 Ug(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 Dg(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 Hd=[],or=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=kg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Gt(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 Da({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 Sr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Nt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new Sr({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 Nt)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 Sr(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=Pn.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]=_g(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 Ft(`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 Ft(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 Tg(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=Eg(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=Dg(o),g=r!=null?r:this.config.projectName,w=()=>jg(this.api,g,u,i,a);if(l===void 0)return await w();let k=await Ug(w,l,d*1e3,5e3);if(k.length<l)throw new Ja(`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=cu(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 La(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Fa(this.api,o),this.traceBatchQueue=new Wa(this.api,o),this.spanFeedbackScoresBatchQueue=new Oa(this.api,o),this.traceFeedbackScoresBatchQueue=new Ba(this.api,o),this.datasetBatchQueue=new Va(this.api,o),Hd.push(this);}};var kR="track.decorator",Ht=new AsyncLocalStorage,SR=()=>{let{span:s,trace:t}=Ht.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function xR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function _R({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=Xd().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 AR({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 Mg({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 Ng({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 rn({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Ht.getStore(),{span:u,trace:g}=_R({name:s!=null?s:i.name||kR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Ht.run({span:u,trace:g},()=>{let S=w?g:void 0;try{AR({args:l,span:u,trace:S});let x=i.apply(k,l);return xR(x)?x.then(T=>(Mg({span:u,result:T,trace:S,enrichSpan:o}),T),T=>{throw Ng({span:u,error:T,trace:S}),T}):(Mg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw Ng({span:u,error:x,trace:S}),x}})}}function _e(s,t){if(typeof s=="function")return rn({},s);let r=s;return t?rn(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 rn(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=rn(r,a),i}}var Jd=null;function Xd(){return Jd===null&&(Jd=new or),Jd}var TR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([Xd().flush(),...Hd.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 Fg(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(ER(s,t,l))}}function ER(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 tn=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=>Bt.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 Tg(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(yR(o))return null;throw o}}function Eg(s,t,r){return t?t.template!==s.prompt||!bR(t.metadata,s.metadata)||t.type!==r:true}function bR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return RR(r,o)}function yR(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"},Pg={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},en={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function vg(s){let t=en.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 Cg(s,t){if(!en.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"&&!en.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 Vd(s,t){let r=Pg[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 Ig(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 rn(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Lt=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return vg(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(Cg(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 rn(a,o,l),i}};var Vt=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Vd(r,i),{operator:i};let a=this.parseWordOperator(t);return Vd(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 Ht=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();}rn(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=Lt.parse(t),o=Vt.parse(t,this.getFieldName(r)),i=Ht.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 Ig(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 jg(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 Ug(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 Dg(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 Hd=[],or=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=kg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${$t(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 Ma({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 Sr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Ft(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new Sr({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 Ft)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 Sr(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=vn.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]=_g(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 Ot(`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 Ot(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 Tg(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=Eg(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=Dg(o),g=r!=null?r:this.config.projectName,w=()=>jg(this.api,g,u,i,a);if(l===void 0)return await w();let k=await Ug(w,l,d*1e3,5e3);if(k.length<l)throw new Xa(`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=cu(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 Va(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Oa(this.api,o),this.traceBatchQueue=new Ba(this.api,o),this.spanFeedbackScoresBatchQueue=new Wa(this.api,o),this.traceFeedbackScoresBatchQueue=new La(this.api,o),this.datasetBatchQueue=new Ha(this.api,o),Hd.push(this);}};var kR="track.decorator",Jt=new AsyncLocalStorage,SR=()=>{let{span:s,trace:t}=Jt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function xR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function _R({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=Xd().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 AR({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 Mg({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 Ng({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 on({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Jt.getStore(),{span:u,trace:g}=_R({name:s!=null?s:i.name||kR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Jt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{AR({args:l,span:u,trace:S});let x=i.apply(k,l);return xR(x)?x.then(T=>(Mg({span:u,result:T,trace:S,enrichSpan:o}),T),T=>{throw Ng({span:u,error:T,trace:S}),T}):(Mg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw Ng({span:u,error:x,trace:S}),x}})}}function _e(s,t){if(typeof s=="function")return on({},s);let r=s;return t?on(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 on(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=on(r,a),i}}var Jd=null;function Xd(){return Jd===null&&(Jd=new or),Jd}var TR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([Xd().flush(),...Hd.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 Fg(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(ER(s,t,l))}}function ER(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 an=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=[
|
|
14
|
+
No metrics available to display.`);return}let a=[...o.keys()].sort(),l=this.formatTime(i),d=[tn.bold(`Total time: ${l}`),tn.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return tn.green(`${w}: ${k} (avg)`)})].join(`
|
|
15
15
|
`),u=await r.ensureNameLoaded(),g=PR(d,{title:`${u} (${t.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});z.info(`
|
|
16
16
|
`+g+`
|
|
17
|
-
`),z.info(
|
|
17
|
+
`),z.info(tn.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${$t(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 Og(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 Wg,Kd;Wg=[_e({name:"metrics_calculation",type:fe.General})];var xr=class{constructor(t,r,o){f$1(Kd,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=vR({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}),Jt.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 Ya({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(),an.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{Fg(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=Og(o,l);d!==void 0&&(i[a]=d);}return i}};Kd=d(null),g(Kd,1,"calculateScores",Wg,xr),e$1(Kd,xr);var _r=class _r{static getInstance(t){return _r.instance||(_r.instance=new or(t)),_r.instance}};_r.instance=null;var nn=_r;async function Bg(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:nn.getInstance(),r=await t.createExperiment({name:s.experimentName,datasetName:s.dataset.name,experimentConfig:s.experimentConfig,prompts:s.prompts});try{let i=new xr(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 Xt=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ar=class s extends Xt{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ue=class s extends Xt{constructor(t){super(t),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function UR(s,t){return s.startsWith("gpt-")||s.startsWith("o1")||s.startsWith("o3")||s.startsWith("chatgpt-")}function DR(s,t){return s.startsWith("claude-")}function MR(s,t){return s.startsWith("gemini-")||s.startsWith("gemma-")}function Gd(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 $d(s,t){if(UR(s)){let r=(t==null?void 0:t.apiKey)||process.env.OPENAI_API_KEY;return Gd("OpenAI",r,"OPENAI_API_KEY"),createOpenAI({apiKey:r,...t})(s)}if(DR(s)){let r=(t==null?void 0:t.apiKey)||process.env.ANTHROPIC_API_KEY;return Gd("Anthropic",r,"ANTHROPIC_API_KEY"),createAnthropic({apiKey:r,...t})(s)}if(MR(s)){let r=(t==null?void 0:t.apiKey)||process.env.GOOGLE_API_KEY;return Gd("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 NR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens",reasoningTokens:"reasoning_tokens",cachedInputTokens:"cached_input_tokens"};function FR(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 Qd(s,t){if(!FR(s))return {model:t};let r={model:OR(s,t)},o=WR(s.usage);o&&(r.usage=o);let i=BR(s);i&&(r.provider=i);let a=VR(s);a&&(r.metadata=a);let l=HR(s);return l&&(r.output=l),r}function OR(s,t){var r,o;return (o=(r=s.response)==null?void 0:r.modelId)!=null?o:t}function WR(s){if(!s)return;let t={};for(let[r,o]of Object.entries(NR)){let i=s[r];i!==void 0&&(t[o]=i);}return Object.keys(t).length>0?t:void 0}function BR(s){if(!s.providerMetadata)return;let t=Object.keys(s.providerMetadata);return t.length>0?t[0]:void 0}function LR(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 VR(s){let t={};s.usage&&(t.usage=s.usage),s.warnings&&s.warnings.length>0&&(t.warnings=s.warnings);let r=LR(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 HR(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 Tr=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=$d(t,a),z.debug(`Initialized VercelAIChatModel with model ID: ${t}`)),i?(this._generateText=_e({name:"model.generateText",type:fe.Llm,enrichSpan:l=>Qd(l,this.modelName)},generateText),this._generateObject=_e({name:"model.generateObject",type:fe.Llm,enrichSpan:l=>Qd(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 Ar(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 Ar(i,o instanceof Error?o:new Error(String(o)))}}};var Hg="gpt-4o";function Yd(s,t){return new Tr(s,t)}function Jg(s,t){return new Tr(s,t)}function JR(s){return s instanceof tr}function XR(s){return typeof s=="object"&&s!==null&&"modelId"in s&&typeof s.modelId=="string"}function KR(s){return typeof s=="string"&&s.length>0}function GR(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
21
|
- undefined (uses default model: ${Hg})
|
|
22
22
|
|
|
23
|
-
Received: ${t} ${r}`)}function
|
|
23
|
+
Received: ${t} ${r}`)}function Kt(s,t){if(s==null)return Yd(Hg,t);if(KR(s))return Yd(s,t);if(JR(s))return s;if(XR(s))return Jg(s,t);throw GR(s)}function Xg(s){return s.map(t=>{let r=Array.isArray(t.content)?$R(t.content):t.content;return `${t.role}: ${r}`}).join(`
|
|
24
24
|
`)}function $R(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 QR(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 Kg(s,t,r){let o=QR(s.content,t,r);return {...s,content:o}}async function
|
|
25
|
+
`)}function QR(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 Kg(s,t,r){let o=QR(s.content,t,r);return {...s,content:o}}async function Fle(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=Kt(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=YR(t,s.messages,(i=s.templateType)!=null?i:ue.MUSTACHE,{temperature:s.temperature,seed:s.seed});return Bg({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 YR(s,t,r,o){return async i=>{let a=t.map(g=>Kg(g,i,r)),l=await s.generateProviderResponse(a,o),d=ZR(l);return {input:Xg(a),output:d}}}function ZR(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()}),Gg=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 eb=z$1.object({output:z$1.string(),substring:z$1.string()}),$g=class extends pe{constructor(r="contains",o=true,i=false){super(r,o);this.validationSchema=eb;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 rb=z$1.object({output:z$1.string(),pattern:z$1.string(),flags:z$1.string().optional()}),Qg=class extends pe{constructor(r="regex_match",o=true){super(r,o);this.validationSchema=rb;}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 ob=z$1.object({output:z$1.unknown()}),Zg=class extends pe{constructor(r="is_json_metric",o=true){super(r,o);this.validationSchema=ob;}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 Kt(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=`
|
|
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
|
|
87
|
+
`}var pn=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends pn{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},cn=class s extends pn{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 tb(s)}}function tb(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 cn(`Failed to extract JSON from content: ${r}`,t instanceof Error?t:void 0)}}function ew(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 ib=z$1.object({output:z$1.string()}),ab=z$1.object({score:z$1.number(),reason:z$1.string()}),ln=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=ib;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,ab,a);return ew(l,this.name)}};function rw(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 ow(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 nb=z$1.object({input:z$1.string(),output:z$1.string()}),sb=z$1.object({score:z$1.number(),reason:z$1.string()}),
|
|
123
|
+
`}function ow(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 nb=z$1.object({input:z$1.string(),output:z$1.string()}),sb=z$1.object({score:z$1.number(),reason:z$1.string()}),mn=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=nb;}async score(r){let{input:o,output:i}=r,a=rw(o,i),l=this.buildModelOptions(),d=await this.model.generateString(a,sb,l);return ow(d,this.name)}};var pb=`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.
|
|
@@ -198,7 +198,7 @@ ${i}Output: ${o.output}
|
|
|
198
198
|
{"score": "${o.score}", "reason": "${o.reason}"}
|
|
199
199
|
</example>`}).join(`
|
|
200
200
|
|
|
201
|
-
`)}`}function iw(s,t,r,o=[]){let i=tw(o,true);return pb.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function aw(s,t,r=[]){let o=tw(r,false);return cb.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function nw(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 lb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),mb=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),
|
|
201
|
+
`)}`}function iw(s,t,r,o=[]){let i=tw(o,true);return pb.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function aw(s,t,r=[]){let o=tw(r,false);return cb.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function nw(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 lb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),mb=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),dn=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=lb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{input:o,output:i,context:a}=r,l=a?iw(o,i,a,this.fewShotExamples):aw(o,i,this.fewShotExamples),d=this.buildModelOptions(),u=await this.model.generateString(l,mb,d);return nw(u,this.name)}};var sw=[{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."}],pw=[{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 db(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
|
|
202
202
|
|
|
203
203
|
- **Input:** "${t.input}"
|
|
204
204
|
- **Output:** "${t.output}"
|
|
@@ -337,4 +337,4 @@ ${i}Output: ${o.output}
|
|
|
337
337
|
Output:
|
|
338
338
|
${t}
|
|
339
339
|
***
|
|
340
|
-
`}function mw(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 gb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),wb=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),
|
|
340
|
+
`}function mw(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 gb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),wb=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),un=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=gb;this.fewShotExamplesWithContext=(a=r==null?void 0:r.fewShotExamples)!=null?a:sw,this.fewShotExamplesNoContext=(l=r==null?void 0:r.fewShotExamplesNoContext)!=null?l:pw,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?cw(o,i,a,this.fewShotExamplesWithContext):lw(o,i,this.fewShotExamplesNoContext),d=this.buildModelOptions(),u=await this.model.generateString(l,wb,d);return mw(u,this.name)}};export{un as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,$g as Contains,Gg as ExactMatch,dn as Hallucination,Zg as IsJson,Ue as ModelConfigurationError,Xt as ModelError,Ar as ModelGenerationError,ln as Moderation,or as Opik,tr as OpikBaseModel,je as OpikQueryLanguage,fe as OpikSpanType,Ce as Prompt,ue as PromptType,Qg as RegexMatch,mn as Usefulness,Tr as VercelAIChatModel,Yd as createModel,Jg as createModelFromInstance,$d as detectProvider,ww as disableLogger,Bg as evaluate,Fle as evaluatePrompt,TR as flushAll,q as generateId,SR as getTrackContext,z as logger,Kt as resolveModel,nu as setLoggerLevel,_e as track};
|