opik 1.9.50 → 1.9.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
- import {c,d,g,e as e$1,f as f$1}from'./chunk-LAR62UGW.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import nu from'fs';import ww from'ini';import'dotenv/config';import mh from'qs';import {v7}from'uuid';import nR from'fast-json-stable-stringify';import aR from'xxhash-wasm';import {TextDecoder}from'util';import mR from'mustache';import gR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import hR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import rn from'chalk';import ER from'boxen';import PR from'ora';import {generateText,generateObject}from'ai';import {createOpenAI}from'@ai-sdk/openai';import {createAnthropic}from'@ai-sdk/anthropic';import {createGoogleGenerativeAI}from'@ai-sdk/google';import {z as z$1}from'zod';export{z}from'zod';var uw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Kt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),au=s=>{z.settings.minLevel=uw[s];},gw=()=>{z.settings.minLevel=100;};au(process.env.OPIK_LOG_LEVEL||"INFO");var fw="~/.opik.config",dn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function su(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function hw(){return su({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE,batchDelayMs:process.env.OPIK_BATCH_DELAY_MS?Number(process.env.OPIK_BATCH_DELAY_MS):void 0,holdUntilFlush:process.env.OPIK_HOLD_UNTIL_FLUSH===void 0?void 0:["1","true","yes"].includes(String(process.env.OPIK_HOLD_UNTIL_FLUSH).toLowerCase())})}function Rw(){let s=process.env.OPIK_CONFIG_PATH||fw;if(!nu.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=ww.parse(nu.readFileSync(s,"utf8"));return t.opik?su({apiKey:t.opik.api_key,apiUrl:t.opik.url_override,projectName:t.opik.project_name,workspaceName:t.opik.workspace}):{}}catch(t){return z.error(`Error loading config file ${s}: ${t}`),{}}}function pu(s){let t=hw(),r=Rw(),{headers:o,...i}=s||{};return bw({...dn,...r,...t,...i})}function bw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=yw(s.apiUrl);if(t&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(t&&!s.workspaceName)throw new Error("OPIK_WORKSPACE is not set");return s}function yw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>zw,AlertPublicAlertType:()=>Pw,AlertTriggerConfigPublicType:()=>Tw,AlertTriggerConfigType:()=>Sw,AlertTriggerConfigWriteType:()=>xw,AlertTriggerEventType:()=>kw,AlertTriggerPublicEventType:()=>Ew,AlertTriggerWriteEventType:()=>_w,AlertWriteAlertType:()=>Aw,AnnotationQueuePublicScope:()=>jw,AnnotationQueueScope:()=>Cw,AnnotationQueueWriteScope:()=>Iw,AssistantMessageRole:()=>Zw,AttachmentListRequestEntityType:()=>lu,BadRequestError:()=>_,CheckName:()=>yf,CheckPublicName:()=>ah,CheckPublicResult:()=>nh,CheckResult:()=>zf,ColumnCompareTypesItem:()=>pf,ColumnPublicTypesItem:()=>hf,ColumnTypesItem:()=>Rf,CompleteMultipartUploadRequestEntityType:()=>Uw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>Pu,DatasetItemCompareSource:()=>cf,DatasetItemFilterOperator:()=>ef,DatasetItemPublicSource:()=>wf,DatasetItemSource:()=>tf,DatasetItemWriteSource:()=>Tn,DatasetPublicStatus:()=>gf,DatasetPublicVisibility:()=>uf,DatasetStatus:()=>of,DatasetUpdateVisibility:()=>wu,DatasetVisibility:()=>rf,DatasetWriteVisibility:()=>gu,DeleteAttachmentsRequestEntityType:()=>Dw,DownloadAttachmentRequestEntityType:()=>mu,ExperimentItemCompareTraceVisibilityMode:()=>lf,ExperimentItemPublicTraceVisibilityMode:()=>ff,ExperimentItemTraceVisibilityMode:()=>af,ExperimentPublicStatus:()=>Tf,ExperimentPublicType:()=>Af,ExperimentStatus:()=>bf,ExperimentType:()=>En,ExperimentUpdateStatus:()=>bu,ExperimentUpdateType:()=>Ru,ExperimentWriteStatus:()=>hu,ExperimentWriteType:()=>fu,FeedbackScoreBatchItemSource:()=>ih,FeedbackScoreBatchItemThreadSource:()=>ch,FeedbackScoreCompareSource:()=>mf,FeedbackScoreExperimentItemBulkWriteViewSource:()=>Sf,FeedbackScorePublicSource:()=>rh,FeedbackScoreSource:()=>nf,FindFeedbackDefinitionsRequestType:()=>yu,FindFeedbackScoreNames1RequestType:()=>Cu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>Iu,GetSpansByProjectRequestType:()=>vu,GetWebhookExamplesRequestAlertType:()=>cu,GuardrailName:()=>Ef,GuardrailResult:()=>Pf,GuardrailWriteName:()=>vf,GuardrailWriteResult:()=>Cf,LlmAsJudgeMessagePublicRole:()=>Xw,LlmAsJudgeMessageRole:()=>Mw,LlmAsJudgeMessageWriteRole:()=>Bw,LlmAsJudgeOutputSchemaPublicType:()=>Kw,LlmAsJudgeOutputSchemaType:()=>Nw,LlmAsJudgeOutputSchemaWriteType:()=>Lw,LogItemLevel:()=>Yw,ManualEvaluationRequestEntityType:()=>Uf,NotFoundError:()=>A,NotImplementedError:()=>Ne,OptimizationPublicStatus:()=>Nf,OptimizationStatus:()=>Df,OptimizationUpdateStatus:()=>ku,OptimizationWriteStatus:()=>Mf,ProjectDetailedVisibility:()=>Lf,ProjectMetricRequestPublicInterval:()=>Au,ProjectMetricRequestPublicMetricType:()=>_u,ProjectMetricResponsePublicInterval:()=>Bf,ProjectMetricResponsePublicMetricType:()=>Wf,ProjectPublicVisibility:()=>Of,ProjectUpdateVisibility:()=>xu,ProjectVisibility:()=>Ff,ProjectWriteVisibility:()=>Su,PromptDetailTemplateStructure:()=>$f,PromptPublicTemplateStructure:()=>Zf,PromptTemplateStructure:()=>Hf,PromptType:()=>Vf,PromptVersionDetailTemplateStructure:()=>Gf,PromptVersionDetailType:()=>Kf,PromptVersionPublicTemplateStructure:()=>Yf,PromptVersionPublicType:()=>Qf,PromptVersionTemplateStructure:()=>Xf,PromptVersionType:()=>Jf,PromptWriteTemplateStructure:()=>Eu,PromptWriteType:()=>Tu,ProviderApiKeyProvider:()=>jf,ProviderApiKeyPublicProvider:()=>If,ProviderApiKeyWriteProvider:()=>zu,ResponseFormatType:()=>qw,SpanExperimentItemBulkWriteViewType:()=>xf,SpanFilterOperator:()=>Fw,SpanFilterPublicOperator:()=>Gw,SpanFilterWriteOperator:()=>Vw,SpanPublicType:()=>oh,SpanSearchStreamRequestPublicType:()=>ju,SpanType:()=>fe,SpanUpdateType:()=>qf,SpanWriteType:()=>eh,StartMultipartUploadRequestEntityType:()=>du,TraceFilterOperator:()=>Ow,TraceFilterPublicOperator:()=>$w,TraceFilterWriteOperator:()=>Hw,TracePublicVisibilityMode:()=>sh,TraceThreadFilterOperator:()=>Ww,TraceThreadFilterPublicOperator:()=>Qw,TraceThreadFilterWriteOperator:()=>Jw,TraceThreadStatus:()=>ph,TraceVisibilityMode:()=>kf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>uu,ValueEntryCompareSource:()=>df,ValueEntryExperimentItemBulkWriteViewSource:()=>_f,ValueEntryPublicSource:()=>th,ValueEntrySource:()=>sf,WebhookTestResultStatus:()=>vw,alerts:()=>Gt,annotationQueues:()=>gn,attachments:()=>$t,automationRuleEvaluators:()=>fn,chatCompletions:()=>hn,check:()=>wn,dashboards:()=>Rn,datasets:()=>Qt,experiments:()=>Yt,feedbackDefinitions:()=>Zt,guardrails:()=>bn,llmProviderKey:()=>qt,manualEvaluation:()=>yn,openTelemetryIngestion:()=>zn,optimizations:()=>ei,projects:()=>ri,prompts:()=>oi,redirect:()=>An,serviceToggles:()=>kn,spans:()=>ti,systemUsage:()=>un,traces:()=>Sn,welcomeWizard:()=>xn,workspaces:()=>_n});var Gt={};c(Gt,{GetWebhookExamplesRequestAlertType:()=>cu});var cu={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var $t={};c($t,{AttachmentListRequestEntityType:()=>lu,DownloadAttachmentRequestEntityType:()=>mu,StartMultipartUploadRequestEntityType:()=>du,UploadAttachmentRequestEntityType:()=>uu});var lu={Trace:"trace",Span:"span"};var mu={Trace:"trace",Span:"span"};var du={Trace:"trace",Span:"span"};var uu={Trace:"trace",Span:"span"};var Qt={};c(Qt,{DatasetUpdateVisibility:()=>wu,DatasetWriteVisibility:()=>gu});var gu={Private:"private",Public:"public"};var wu={Private:"private",Public:"public"};var Yt={};c(Yt,{ExperimentUpdateStatus:()=>bu,ExperimentUpdateType:()=>Ru,ExperimentWriteStatus:()=>hu,ExperimentWriteType:()=>fu});var fu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var hu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Ru={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var bu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Zt={};c(Zt,{FindFeedbackDefinitionsRequestType:()=>yu});var yu={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var qt={};c(qt,{ProviderApiKeyWriteProvider:()=>zu});var zu={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var ei={};c(ei,{OptimizationUpdateStatus:()=>ku});var ku={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var ri={};c(ri,{ProjectMetricRequestPublicInterval:()=>Au,ProjectMetricRequestPublicMetricType:()=>_u,ProjectUpdateVisibility:()=>xu,ProjectWriteVisibility:()=>Su});var Su={Private:"private",Public:"public"};var xu={Private:"private",Public:"public"};var _u={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES"};var Au={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var oi={};c(oi,{CreatePromptVersionDetailTemplateStructure:()=>Pu,PromptWriteTemplateStructure:()=>Eu,PromptWriteType:()=>Tu});var Tu={Mustache:"mustache",Jinja2:"jinja2"};var Eu={Text:"text",Chat:"chat"};var Pu={Text:"text",Chat:"chat"};var ti={};c(ti,{FindFeedbackScoreNames1RequestType:()=>Cu,GetSpanStatsRequestType:()=>Iu,GetSpansByProjectRequestType:()=>vu,SpanSearchStreamRequestPublicType:()=>ju});var vu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Cu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Iu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ju={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var un={};var gn={};var wn={};var fn={};var hn={};var Rn={};var bn={};var yn={};var zn={};var kn={};var Sn={};var xn={};var _n={};var An={};var zw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var kw={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Sw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var xw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var _w={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Aw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Tw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var Ew={TraceErrors:"trace:errors",TraceFeedbackScore:"trace:feedback_score",TraceThreadFeedbackScore:"trace_thread:feedback_score",PromptCreated:"prompt:created",PromptCommitted:"prompt:committed",TraceGuardrailsTriggered:"trace:guardrails_triggered",PromptDeleted:"prompt:deleted",ExperimentFinished:"experiment:finished",TraceCost:"trace:cost",TraceLatency:"trace:latency"};var Pw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var vw={Success:"success",Failure:"failure"};var Cw={Trace:"trace",Thread:"thread"};var Iw={Trace:"trace",Thread:"thread"};var jw={Trace:"trace",Thread:"thread"};var Uw={Trace:"trace",Span:"span"};var Dw={Trace:"trace",Span:"span"};var Mw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Nw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Fw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Ow={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Ww={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Bw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Lw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Vw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Hw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Jw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Xw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Kw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Gw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var $w={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Qw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Yw={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Zw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var qw={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var ef={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var rf={Private:"private",Public:"public"};var of={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var tf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var af={Default:"default",Hidden:"hidden"};var nf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Tn={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var pf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var cf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var lf={Default:"default",Hidden:"hidden"};var mf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var df={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var uf={Private:"private",Public:"public"};var gf={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var wf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var ff={Default:"default",Hidden:"hidden"};var hf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Rf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var En={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var bf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var yf={Topic:"TOPIC",Pii:"PII"};var zf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var kf={Default:"default",Hidden:"hidden"};var Sf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var xf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var _f={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Af={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Tf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Ef={Topic:"TOPIC",Pii:"PII"};var Pf={Passed:"passed",Failed:"failed"};var vf={Topic:"TOPIC",Pii:"PII"};var Cf={Passed:"passed",Failed:"failed"};var If={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var jf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm",OpikBuiltin:"opik-builtin"};var Uf={Trace:"trace",Thread:"thread",Span:"span"};var Df={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Mf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Nf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Ff={Private:"private",Public:"public"};var Of={Private:"private",Public:"public"};var Wf={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES"};var Bf={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Lf={Private:"private",Public:"public"};var Vf={Mustache:"mustache",Jinja2:"jinja2"};var Hf={Text:"text",Chat:"chat"};var Jf={Mustache:"mustache",Jinja2:"jinja2"};var Xf={Text:"text",Chat:"chat"};var Kf={Mustache:"mustache",Jinja2:"jinja2"};var Gf={Text:"text",Chat:"chat"};var $f={Text:"text",Chat:"chat"};var Qf={Mustache:"mustache",Jinja2:"jinja2"};var Yf={Text:"text",Chat:"chat"};var Zf={Text:"text",Chat:"chat"};var qf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var eh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var rh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var oh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var th={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ih={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var ah={Topic:"TOPIC",Pii:"PII"};var nh={Passed:"passed",Failed:"failed"};var sh={Default:"default",Hidden:"hidden"};var ph={Active:"active",Inactive:"inactive"};var ch={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ae=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(lh({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function lh({message:s,statusCode:t,body:r}){let o=[];return s!=null&&o.push(s),t!=null&&o.push(`Status code: ${t.toString()}`),r!=null&&o.push(`Body: ${Ae(r,void 0,2)}`),o.join(`
2
- `)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var _=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var M=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var W=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var A=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var $=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var Ne=class s extends p{constructor(t,r){super({message:"NotImplementedError",statusCode:501,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var R={Default:"http://localhost:5173/api"};var Er;typeof globalThis.Headers!="undefined"?Er=globalThis.Headers:Er=class Uu{constructor(t){if(this.headers=new Map,t)if(t instanceof Uu)t.forEach((r,o)=>this.append(o,r));else if(Array.isArray(t))for(let[r,o]of t)if(typeof r=="string"&&typeof o=="string")this.append(r,o);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,o]of Object.entries(t))if(typeof o=="string")this.append(r,o);else throw new TypeError("Header values must be strings")}append(t,r){let o=t.toLowerCase(),i=this.headers.get(o)||[];this.headers.set(o,[...i,r]);}delete(t){let r=t.toLowerCase();this.headers.delete(r);}get(t){let r=t.toLowerCase(),o=this.headers.get(r);return o?o.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let o=t.toLowerCase();this.headers.set(o,[r]);}forEach(t,r){let o=r?t.bind(r):t;this.headers.forEach((i,a)=>o(i.join(", "),a,this));}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield [t,r.join(", ")];}*keys(){yield*this.headers.keys();}*values(){for(let t of this.headers.values())yield t.join(", ");}[Symbol.iterator](){return this.entries()}};var ii={headers:new Er,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},ai={headers:new Er,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function ni(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Du(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${mh.stringify(t,{arrayFormat:"repeat"})}`:s}var m=dh();function dh(){var u,g,w,k,S;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((u=globalThis==null?void 0:globalThis.navigator)==null?void 0:u.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((g=self.constructor)==null?void 0:g.name)==="DedicatedWorkerGlobalScope"||((w=self.constructor)==null?void 0:w.name)==="ServiceWorkerGlobalScope"||((k=self.constructor)==null?void 0:k.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((S=process.versions)!=null&&S.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Mu(){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?fetch:m.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function Nu({body:s,type:t}){return t.includes("json")?Ae(s):s}async function Fu(s){return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?new(await import('./Node18UniversalStreamWrapper-B4QPIQXU.js')).Node18UniversalStreamWrapper(s):m.type!=="node"&&typeof fetch=="function"?new(await import('./UndiciStreamWrapper-U3LH5M6P.js')).UndiciStreamWrapper(s):new(await import('./NodePre18StreamWrapper-ZXNXS6Y3.js')).NodePre18StreamWrapper(s)}async function Ou(s,t){if(s.body!=null&&t==="blob")return await s.blob();if(s.body!=null&&t==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&t==="sse")return s.body;if(s.body!=null&&t==="streaming")return Fu(s.body);if(s.body!=null&&t==="text")return await s.text();{let r=await s.text();if(r.length>0)try{return JSON.parse(r)}catch{return {ok:false,error:{reason:"non-json",statusCode:s.status,rawBody:r}}}else return}}var uh="timeout";function Wu(s){let t=new AbortController,r=setTimeout(()=>t.abort(uh),s);return {signal:t.signal,abortId:r}}function Bu(...s){let t=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of t){if(o.aborted){r.abort(o==null?void 0:o.reason);break}o.addEventListener("abort",()=>r.abort(o==null?void 0:o.reason),{signal:r.signal});}return r.signal}var Lu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:T}=Wu(a);w=T,g.push(x);}l!=null&&g.push(l);let k=Bu(g),S=await s(t,{method:r,headers:o,body:i,signal:k,credentials:d?"include":void 0,duplex:u});return w!=null&&clearTimeout(w),S};function gh(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Vu(s,t=2){let r=await s();for(let o=0;o<t&&([408,429].includes(r.status)||r.status>=500);++o){let i=Math.min(1e3*Math.pow(2,o),6e4),a=gh(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function wh(s){let t={};if(s.body!==void 0&&s.contentType!=null&&(t["Content-Type"]=s.contentType),s.headers!=null)for(let[a,l]of Object.entries(s.headers))l!=null&&(t[a]=l);let r=Du(s.url,s.queryParameters),o=await Nu({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await Mu();try{let a=await Vu(async()=>Lu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Ou(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:ni(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:ni(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:ii}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:ii}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:ai}:{ok:false,error:{reason:"unknown",errorMessage:Ae(a)},rawResponse:ai}}}var b=wh;var n={get:async s=>typeof s=="function"?s():s};var h=class s extends Promise{constructor(t){super(r=>{r(void 0);}),this.innerPromise=t;}static fromFunction(t,...r){return new s(t(...r))}static interceptFunction(t){return (...r)=>s.fromPromise(t(...r))}static fromPromise(t){return new s(t)}static fromExecutor(t){let r=new Promise(t);return new s(r)}static fromResult(t){let r=Promise.resolve(t);return new s(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};function In(s){return typeof s=="object"&&s!=null&&"name"in s}function jn(s){return typeof s=="object"&&s!=null&&"path"in s}function Un(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Hu(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new Pn:m.type==="node"?s=new vn:s=new Cn,await s.setup(),s}var Pn=class{async setup(){this.fd=new(await import('formdata-node')).FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var i,a;o=this.getFileName(r,o),r instanceof Blob?(i=this.fd)==null||i.append(t,r,o):(a=this.fd)==null||a.append(t,{type:void 0,name:o,[Symbol.toStringTag]:"File",stream(){return r}});}async getRequest(){let t=new(await import('form-data-encoder')).FormDataEncoder(this.fd);return {body:(await import('readable-stream')).Readable.from(t),headers:t.headers,duplex:"half"}}},vn=class{async setup(){this.fd=new(await import('./form_data-PYZPT4AA.js')).default;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var a,l;o=this.getFileName(r,o);let i;r instanceof Blob?i=Buffer.from(await r.arrayBuffer()):i=r,o==null?(a=this.fd)==null||a.append(t,i):(l=this.fd)==null||l.append(t,i,{filename:o});}getRequest(){return {body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}},Cn=class{async setup(){this.fd=new FormData;}append(t,r){var o;(o=this.fd)==null||o.append(t,r);}getFileName(t,r){if(r!=null)return r;if(In(t))return t.name;if(jn(t)&&t.path)return Un(t.path.toString())}async appendFile(t,r,o){var i,a;if(o=this.getFileName(r,o),r instanceof Blob){(i=this.fd)==null||i.append(t,r,o);return}(a=this.fd)==null||a.append(t,new Blob([r]),o);}getRequest(){return {body:this.fd,headers:{}}}};var e={};c(e,{JsonError:()=>ir,ParseError:()=>ar,any:()=>ag,bigint:()=>Xu,boolean:()=>ng,booleanLiteral:()=>ig,date:()=>Ku,discriminant:()=>wg,enum_:()=>pi,getObjectLikeUtils:()=>le,getObjectUtils:()=>Fe,getSchemaUtils:()=>U,isProperty:()=>Ee,lazy:()=>Gu,lazyObject:()=>rg,list:()=>li,number:()=>sg,object:()=>ci,objectWithoutOptionalProperties:()=>eg,optional:()=>Dn,property:()=>Qu,record:()=>mg,set:()=>dg,string:()=>pg,stringLiteral:()=>tg,transform:()=>Mn,undiscriminatedUnion:()=>gg,union:()=>hg,unknown:()=>cg,withParsedProperties:()=>Fn});var E={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function j(s,t){return `Expected ${t}. Received ${fh(s)}.`}function fh(s){if(Array.isArray(s))return "list";if(s===null)return "null";if(s instanceof BigInt)return "BigInt";switch(typeof s){case "string":return `"${s}"`;case "bigint":case "number":case "boolean":case "undefined":return `${s}`}return typeof s}function K(s){return {...s,json:Ju(s.json),parse:Ju(s.parse)}}function Ju(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
3
- `)),{ok:true,value:t}):o}}function si(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ir=class s extends Error{constructor(r){super(r.map(si).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var ar=class s extends Error{constructor(r){super(r.map(si).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>hh(s),optional:()=>Dn(s),optionalNullable:()=>Rh(s),transform:t=>Mn(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new ar(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new ir(o.errors)}}}function hh(s){let t={parse:(r,o)=>r==null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.NULLABLE};return {...t,...U(t)}}function Dn(s){let t={parse:(r,o)=>r==null?{ok:true,value:void 0}:s.parse(r,o),json:(r,o)=>o!=null&&o.omitUndefined&&r===void 0?{ok:true,value:void 0}:r==null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL};return {...t,...U(t)}}function Rh(s){let t={parse:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.parse(r,o),json:(r,o)=>r===void 0?{ok:true,value:void 0}:r===null?{ok:true,value:null}:s.json(r,o),getType:()=>E.OPTIONAL_NULLABLE};return {...t,...U(t)}}function Mn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);return a.ok?{ok:true,value:t.transform(a.value)}:a},json:(o,i)=>{let a=t.untransform(o);return s.json(a,i)},getType:()=>s.getType()};return {...r,...U(r)}}function Xu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:true,value:t}:typeof t=="number"?{ok:true,value:BigInt(t)}:{ok:false,errors:[{path:r,message:j(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:false,errors:[{path:r,message:j(t,"bigint")}]}:{ok:true,value:t},getType:()=>E.BIGINT};return {...K(s),...U(s)}}var bh=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Ku(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:bh.test(t)?{ok:true,value:new Date(t)}:{ok:false,errors:[{path:r,message:j(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:true,value:t.toISOString()}:{ok:false,errors:[{path:r,message:j(t,"Date object")}]},getType:()=>E.DATE};return {...K(s),...U(s)}}function Q(s,t){return ()=>{let r={parse:t,json:t,getType:()=>s};return {...K(r),...U(r)}}}function pi(s){let t=new Set(s);return Q(E.ENUM,(o,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:a,message:j(o,"string")}]}:!t.has(o)&&!i?{ok:false,errors:[{path:a,message:j(o,"enum")}]}:{ok:true,value:o})()}function Gu(s){let t=Nn(s);return {...t,...U(t)}}function Nn(s){return {parse:(t,r)=>nr(s).parse(t,r),json:(t,r)=>nr(s).json(t,r),getType:()=>nr(s).getType()}}function nr(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function Pr(s){return Object.entries(s)}function vr(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,a])=>(r.has(i)&&(o[i]=a),o),{})}function Te(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t}function Cr(s){return Object.keys(s)}function $u(s,t){let r=[],o=[];for(let i of s)t(i)?r.push(i):o.push(i);return [r,o]}function le(s){return {withParsedProperties:t=>Fn(s,t)}}function Fn(s,t){let r={parse:(o,i)=>{let a=s.parse(o,i);if(!a.ok)return a;let l=Object.entries(t).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(a.value):g}),{});return {ok:true,value:{...a.value,...l}}},json:(o,i)=>{var d;if(!Te(o))return {ok:false,errors:[{path:(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],message:j(o,"object")}]};let a=new Set(Object.keys(t)),l=vr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Qu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Ee(s){return s.isProperty}function ci(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Ee(o)?o.rawKey:r),_getParsedProperties:()=>Cr(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of Pr(s)){let u=Ee(d)?d.rawKey:l,g=Ee(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,qu(g)&&a.push(u);}return Yu({value:r,requiredKeys:a,getProperty:l=>{let d=i[l];if(d!=null)return {transformedKey:d.parsedKey,transform:u=>{var g;return d.valueSchema.parse(u,{...o,breadcrumbsPrefix:[...(g=o==null?void 0:o.breadcrumbsPrefix)!=null?g:[],l]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},json:(r,o)=>{let i=[];for(let[a,l]of Pr(s)){let d=Ee(l)?l.valueSchema:l;qu(d)&&i.push(a);}return Yu({value:r,requiredKeys:i,getProperty:a=>{let l=s[a];if(l!=null)return Ee(l)?{transformedKey:l.rawKey,transform:d=>{var u;return l.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}:{transformedKey:a,transform:d=>{var u;return l.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],a]})}}},unrecognizedObjectKeys:o==null?void 0:o.unrecognizedObjectKeys,skipValidation:o==null?void 0:o.skipValidation,breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix,omitUndefined:o==null?void 0:o.omitUndefined})},getType:()=>E.OBJECT};return {...K(t),...U(t),...le(t),...Fe(t)}}function Yu({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Te(s))return {ok:false,errors:[{path:a,message:j(s,"object")}]};let l=new Set(t),d=[],u={};for(let[g,w]of Object.entries(s)){let k=r(g);if(k!=null){l.delete(g);let S=k.transform(w);S.ok?u[k.transformedKey]=S.value:(u[g]=w,d.push(...S.errors));}else switch(o){case "fail":d.push({path:[...a,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=w;break}}return d.push(...t.filter(g=>l.has(g)).map(g=>({path:a,message:`Missing required key "${g}"`}))),d.length===0||i?{ok:true,value:u}:{ok:false,errors:d}}function Fe(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Zu({extensionKeys:t._getRawProperties(),value:o,transformBase:a=>s.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(o,i)=>Zu({extensionKeys:t._getParsedProperties(),value:o,transformBase:a=>s.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>E.OBJECT};return {...r,...U(r),...le(r),...Fe(r)}},passthrough:()=>{let t={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let i=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},json:(r,o)=>{let i=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:true,value:{...r,...i.value}}:i},getType:()=>E.OBJECT};return {...t,...U(t),...le(t),...Fe(t)}}}}function Zu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=$u(Cr(t),g=>i.has(g)),d=r(vr(t,l)),u=o(vr(t,a));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function qu(s){return !yh(s)}function yh(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function eg(s){return ci(s)}function rg(s){let t={...Nn(s),_getRawProperties:()=>nr(s)._getRawProperties(),_getParsedProperties:()=>nr(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Fe(t)}}function li(s){let t={parse:(r,o)=>og(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>og(r,(i,a)=>{var l;return s.json(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),getType:()=>E.LIST};return {...K(t),...U(t)}}function og(s,t){return Array.isArray(s)?s.map((o,i)=>t(o,i)).reduce((o,i)=>{if(o.ok&&i.ok)return {ok:true,value:[...o.value,i.value]};let a=[];return o.ok||a.push(...o.errors),i.ok||a.push(...i.errors),{ok:false,errors:a}},{ok:true,value:[]}):{ok:false,errors:[{message:j(s,"list"),path:[]}]}}function tg(s){return Q(E.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`"${s}"`)}]})()}function ig(s){return Q(E.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:j(r,`${s.toString()}`)}]})()}var ag=Q(E.ANY,s=>({ok:true,value:s}));var ng=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var sg=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var pg=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var cg=Q(E.UNKNOWN,s=>({ok:true,value:s}));function mg(s,t){let r={parse:(o,i)=>lg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.parse(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.parse(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),json:(o,i)=>lg({value:o,isKeyNumeric:s.getType()===E.NUMBER,transformKey:a=>{var l;return s.json(a,{...i,breadcrumbsPrefix:[...(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],`${a} (key)`]})},transformValue:(a,l)=>{var d;return t.json(a,{...i,breadcrumbsPrefix:[...(d=i==null?void 0:i.breadcrumbsPrefix)!=null?d:[],`${l}`]})},breadcrumbsPrefix:i==null?void 0:i.breadcrumbsPrefix}),getType:()=>E.RECORD};return {...K(r),...U(r)}}function lg({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Te(s)?Pr(s).reduce((a,[l,d])=>{if(d===void 0)return a;let u=a,g=l;if(t){let x=l.length>0?Number(l):NaN;isNaN(x)||(g=x);}let w=r(g),k=o(d,g);if(u.ok&&w.ok&&k.ok)return {ok:true,value:{...u.value,[w.value]:k.value}};let S=[];return u.ok||S.push(...u.errors),w.ok||S.push(...w.errors),k.ok||S.push(...k.errors),{ok:false,errors:S}},{ok:true,value:{}}):{ok:false,errors:[{path:i,message:j(s,"object")}]}}function dg(s){let t=li(s),r={parse:(o,i)=>{let a=t.parse(o,i);return a.ok?{ok:true,value:new Set(a.value)}:a},json:(o,i)=>{var l;return o instanceof Set?t.json([...o],i):{ok:false,errors:[{path:(l=i==null?void 0:i.breadcrumbsPrefix)!=null?l:[],message:j(o,"Set")}]}},getType:()=>E.SET};return {...K(r),...U(r)}}function gg(s){let t={parse:(r,o)=>ug((i,a)=>i.parse(r,a),s,o),json:(r,o)=>ug((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function ug(s,t,r){let o=[];for(let[i,a]of t.entries()){let l=s(a,{...r,skipValidation:false});if(l.ok)return l;for(let d of l.errors)o.push({path:d.path,message:`[Variant ${i}] ${d.message}`});}return {ok:false,errors:o}}function wg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function hg(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=pi(Cr(t)),a={parse:(l,d)=>fg({value:l,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return i.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(l,d)=>fg({value:l,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return i.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>E.UNION};return {...K(a),...U(a),...le(a)}}function fg({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!Te(s))return {ok:false,errors:[{path:d,message:j(s,"object")}]};let{[t]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${t}")`}]};let w=o(u);if(!w.ok)return {ok:false,errors:w.errors};let k=i(w.value);if(k==null)return a?{ok:true,value:{[r]:w.value,...g}}:{ok:false,errors:[{path:[...d,t],message:"Unexpected discriminant value"}]};let S=l(g,k);return S.ok?{ok:true,value:{[r]:u,...S.value}}:S}function zh(s){var t=[];if(s.length===0)return "";if(typeof s[0]!="string")throw new TypeError("Url must be a string. Received "+s[0]);if(s[0].match(/^[^/:]+:\/*$/)&&s.length>1){var r=s.shift();s[0]=r+s[0];}s[0].match(/^file:\/\/\//)?s[0]=s[0].replace(/^([^/:]+):\/*/,"$1:///"):s[0]=s[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<s.length;o++){var i=s[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<s.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i));}var a=t.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var l=a.split("?");return a=l.shift()+(l.length>0?"?":"")+l.join("&"),a}function y(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),zh(s)}var C={};c(C,{AggregationData:()=>vl,Alert:()=>Th,AlertAlertType:()=>Cs,AlertPagePublic:()=>$s,AlertPublic:()=>Xo,AlertPublicAlertType:()=>Vs,AlertTrigger:()=>Ms,AlertTriggerConfig:()=>Ds,AlertTriggerConfigPublic:()=>Ks,AlertTriggerConfigPublicType:()=>Xs,AlertTriggerConfigType:()=>Us,AlertTriggerConfigWrite:()=>Fs,AlertTriggerConfigWriteType:()=>Ns,AlertTriggerEventType:()=>js,AlertTriggerPublic:()=>Gs,AlertTriggerPublicEventType:()=>Js,AlertTriggerWrite:()=>Ws,AlertTriggerWriteEventType:()=>Os,AlertWrite:()=>Jo,AlertWriteAlertType:()=>Bs,AnnotationQueue:()=>rp,AnnotationQueueBatch:()=>Ph,AnnotationQueueBatchWrite:()=>No,AnnotationQueueItemIds:()=>ea,AnnotationQueuePagePublic:()=>ip,AnnotationQueuePublic:()=>Ko,AnnotationQueuePublicScope:()=>op,AnnotationQueueReviewer:()=>ep,AnnotationQueueReviewerPublic:()=>tp,AnnotationQueueScope:()=>qs,AnnotationQueueUpdate:()=>Fo,AnnotationQueueWrite:()=>Mo,AnnotationQueueWriteScope:()=>fs,AssistantMessage:()=>zc,AssistantMessageRole:()=>yc,Attachment:()=>ap,AttachmentListRequestEntityType:()=>ui,AttachmentPage:()=>np,AudioUrl:()=>up,AudioUrlPublic:()=>$p,AudioUrlWrite:()=>Tp,AuthDetailsHolder:()=>mp,AutomationRuleEvaluator:()=>Ch,AutomationRuleEvaluatorLlmAsJudge:()=>yp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>tt,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Dp,AutomationRuleEvaluatorObjectObjectPublic:()=>sc,AutomationRuleEvaluatorPagePublic:()=>pc,AutomationRuleEvaluatorPublic:()=>cc,AutomationRuleEvaluatorSpanLlmAsJudge:()=>_p,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>st,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Fp,AutomationRuleEvaluatorSpanUserDefinedMetricPython:()=>Ap,AutomationRuleEvaluatorSpanUserDefinedMetricPythonPublic:()=>pt,AutomationRuleEvaluatorSpanUserDefinedMetricPythonWrite:()=>Wp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>kp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>at,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Vp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>Sp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>nt,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Jp,AutomationRuleEvaluatorUpdate:()=>bc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>uc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>hc,AutomationRuleEvaluatorUpdateSpanUserDefinedMetricPython:()=>Rc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>wc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>fc,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>gc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>zp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>it,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Kp,AutomationRuleEvaluatorWrite:()=>Gp,AvgValueStatPublic:()=>Qc,BatchDelete:()=>F,BatchDeleteByProject:()=>Yh,BiInformation:()=>As,BiInformationResponse:()=>lr,BooleanFeedbackDefinition:()=>Dl,BooleanFeedbackDefinitionCreate:()=>Ll,BooleanFeedbackDefinitionPublic:()=>ht,BooleanFeedbackDefinitionUpdate:()=>im,BooleanFeedbackDetail:()=>Ul,BooleanFeedbackDetailCreate:()=>Bl,BooleanFeedbackDetailPublic:()=>$l,BooleanFeedbackDetailUpdate:()=>tm,CategoricalFeedbackDefinition:()=>Nl,CategoricalFeedbackDefinitionCreate:()=>Hl,CategoricalFeedbackDefinitionPublic:()=>Rt,CategoricalFeedbackDefinitionUpdate:()=>nm,CategoricalFeedbackDetail:()=>Ml,CategoricalFeedbackDetailCreate:()=>Vl,CategoricalFeedbackDetailPublic:()=>Ql,CategoricalFeedbackDetailUpdate:()=>am,ChatCompletionChoice:()=>Sc,ChatCompletionRequest:()=>Wo,ChatCompletionResponse:()=>Tc,Check:()=>hl,CheckName:()=>wl,CheckPublic:()=>vd,CheckPublicName:()=>Ed,CheckPublicResult:()=>Pd,CheckResult:()=>fl,ChunkedOutputJsonNode:()=>Dh,ChunkedOutputJsonNodePublic:()=>Oh,ChunkedOutputJsonNodePublicType:()=>jl,ChunkedOutputJsonNodeType:()=>cl,Column:()=>sl,ColumnCompare:()=>Dc,ColumnCompareTypesItem:()=>Uc,ColumnPublic:()=>il,ColumnPublicTypesItem:()=>tl,ColumnTypesItem:()=>nl,Comment:()=>L,CommentCompare:()=>Mc,CommentPublic:()=>qe,CompleteMultipartUploadRequest:()=>ra,CompleteMultipartUploadRequestEntityType:()=>sp,CompletionTokensDetails:()=>_c,CountValueStatPublic:()=>Yc,CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Wi,DashboardPagePublic:()=>Ec,DashboardPublic:()=>Ze,DashboardUpdatePublic:()=>Lo,DashboardWrite:()=>Bo,DataPointDouble:()=>Zh,DataPointNumberPublic:()=>Gm,Dataset:()=>Ih,DatasetExpansion:()=>Uh,DatasetExpansionResponse:()=>jc,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItem:()=>lt,DatasetItemBatch:()=>jh,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemCompare:()=>Hc,DatasetItemCompareSource:()=>Nc,DatasetItemFilter:()=>Wn,DatasetItemFilterOperator:()=>On,DatasetItemPageCompare:()=>Jc,DatasetItemPagePublic:()=>al,DatasetItemPublic:()=>ut,DatasetItemPublicSource:()=>rl,DatasetItemSource:()=>Ic,DatasetItemStreamRequest:()=>Hr,DatasetItemUpdate:()=>Bn,DatasetItemWrite:()=>Dr,DatasetItemWriteSource:()=>Ln,DatasetItemsDelete:()=>Br,DatasetPagePublic:()=>$c,DatasetPublic:()=>fr,DatasetPublicStatus:()=>Kc,DatasetPublicVisibility:()=>Xc,DatasetStatus:()=>vc,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>bi,DatasetVersionCreatePublic:()=>Xr,DatasetVersionDiff:()=>ml,DatasetVersionDiffStats:()=>ll,DatasetVersionPagePublic:()=>dl,DatasetVersionPublic:()=>hr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionSummary:()=>Cc,DatasetVersionSummaryPublic:()=>Gc,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetVisibility:()=>Pc,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>Ri,DeleteAttachmentsRequest:()=>vh,DeleteAttachmentsRequestEntityType:()=>cp,DeleteFeedbackScore:()=>_t,DeleteIdsHolder:()=>Rr,DeleteThreadFeedbackScores:()=>Co,DeleteTraceThreads:()=>Io,Delta:()=>kc,DownloadAttachmentRequestEntityType:()=>gi,ErrorCountWithDeviation:()=>St,ErrorCountWithDeviationDetailed:()=>rd,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>qr,ErrorInfoPublic:()=>At,ErrorInfoWrite:()=>Ro,ErrorMessage:()=>ee,ErrorMessageDetail:()=>Gh,ErrorMessageDetailed:()=>Xh,ErrorMessagePublic:()=>Eh,Experiment:()=>Mh,ExperimentGroupAggregationsResponse:()=>Il,ExperimentGroupResponse:()=>Pl,ExperimentItem:()=>Qr,ExperimentItemBulkRecord:()=>zl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>ts,ExperimentItemBulkUpload:()=>Nh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemCompare:()=>Vc,ExperimentItemCompareTraceVisibilityMode:()=>Lc,ExperimentItemPublic:()=>dt,ExperimentItemPublicTraceVisibilityMode:()=>ol,ExperimentItemStreamRequest:()=>to,ExperimentItemTraceVisibilityMode:()=>$n,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentPagePublic:()=>_l,ExperimentPublic:()=>ft,ExperimentPublicStatus:()=>Sl,ExperimentPublicType:()=>kl,ExperimentScore:()=>ro,ExperimentScorePublic:()=>xl,ExperimentScoreWrite:()=>Jn,ExperimentStatus:()=>gl,ExperimentStreamRequestPublic:()=>io,ExperimentType:()=>ul,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>xi,ExperimentUpdateType:()=>Si,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>ki,ExperimentWriteType:()=>zi,ExportTraceServiceRequest:()=>Vh,Feedback:()=>Wh,FeedbackCreate:()=>Gl,FeedbackDefinitionPagePublic:()=>em,FeedbackObjectPublic:()=>ql,FeedbackPublic:()=>om,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>od,FeedbackScoreAveragePublic:()=>Le,FeedbackScoreBatch:()=>Et,FeedbackScoreBatchItem:()=>Td,FeedbackScoreBatchItemSource:()=>Ad,FeedbackScoreBatchItemThread:()=>gs,FeedbackScoreBatchItemThreadSource:()=>us,FeedbackScoreBatchThread:()=>jo,FeedbackScoreCompare:()=>Bc,FeedbackScoreCompareSource:()=>Fc,FeedbackScoreExperimentItemBulkWriteView:()=>os,FeedbackScoreExperimentItemBulkWriteViewSource:()=>qn,FeedbackScoreNames:()=>Km,FeedbackScorePublic:()=>yr,FeedbackScorePublicSource:()=>zd,FeedbackScoreSource:()=>Xn,FeedbackUpdate:()=>lm,FindFeedbackDefinitionsRequestType:()=>Ti,FindFeedbackScoreNames1RequestType:()=>Vi,Function:()=>Oo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Hi,GetSpansByProjectRequestType:()=>Li,GetWebhookExamplesRequestAlertType:()=>mi,GroupContent:()=>Al,GroupContentWithAggregations:()=>Cl,GroupDetail:()=>Tl,GroupDetails:()=>El,Guardrail:()=>um,GuardrailBatch:()=>Bh,GuardrailBatchWrite:()=>Vo,GuardrailName:()=>mm,GuardrailResult:()=>dm,GuardrailWrite:()=>_s,GuardrailWriteName:()=>Ss,GuardrailWriteResult:()=>xs,GuardrailsValidation:()=>Rl,GuardrailsValidationPublic:()=>Cd,IdsHolder:()=>Fh,ImageUrl:()=>fp,ImageUrlPublic:()=>Yp,ImageUrlWrite:()=>vp,JsonListString:()=>D,JsonListStringCompare:()=>oa,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>ns,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>ys,LlmAsJudgeCode:()=>Go,LlmAsJudgeCodePublic:()=>rc,LlmAsJudgeCodeWrite:()=>Up,LlmAsJudgeMessage:()=>He,LlmAsJudgeMessageContent:()=>Rp,LlmAsJudgeMessageContentPublic:()=>qp,LlmAsJudgeMessageContentWrite:()=>Ip,LlmAsJudgeMessagePublic:()=>Qe,LlmAsJudgeMessagePublicRole:()=>Qp,LlmAsJudgeMessageRole:()=>wp,LlmAsJudgeMessageWrite:()=>Ke,LlmAsJudgeMessageWriteRole:()=>Pp,LlmAsJudgeModelParameters:()=>Ve,LlmAsJudgeModelParametersPublic:()=>$e,LlmAsJudgeModelParametersWrite:()=>Xe,LlmAsJudgeOutputSchema:()=>Je,LlmAsJudgeOutputSchemaPublic:()=>Ye,LlmAsJudgeOutputSchemaPublicType:()=>ec,LlmAsJudgeOutputSchemaType:()=>bp,LlmAsJudgeOutputSchemaWrite:()=>Ge,LlmAsJudgeOutputSchemaWriteType:()=>jp,LogItem:()=>mc,LogItemLevel:()=>lc,LogPage:()=>dc,ManualEvaluationRequest:()=>kt,ManualEvaluationRequestEntityType:()=>hm,ManualEvaluationResponse:()=>zt,Message:()=>hs,MultipartUploadPart:()=>pp,NumericalFeedbackDefinition:()=>Ol,NumericalFeedbackDefinitionCreate:()=>Xl,NumericalFeedbackDefinitionPublic:()=>bt,NumericalFeedbackDefinitionUpdate:()=>pm,NumericalFeedbackDetail:()=>Fl,NumericalFeedbackDetailCreate:()=>Jl,NumericalFeedbackDetailPublic:()=>Yl,NumericalFeedbackDetailUpdate:()=>sm,Optimization:()=>Hh,OptimizationPagePublic:()=>na,OptimizationPublic:()=>br,OptimizationPublicStatus:()=>Um,OptimizationStatus:()=>Rm,OptimizationStudioConfig:()=>_m,OptimizationStudioConfigPublic:()=>Bm,OptimizationStudioConfigWrite:()=>Im,OptimizationStudioLog:()=>Lm,OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>Ci,OptimizationWrite:()=>aa,OptimizationWriteStatus:()=>jm,PageColumns:()=>pl,PercentageValueStatPublic:()=>Zc,PercentageValues:()=>xe,PercentageValuesDetailed:()=>td,PercentageValuesPublic:()=>mt,Project:()=>Jh,ProjectDetailed:()=>ad,ProjectDetailedVisibility:()=>id,ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Mi,ProjectMetricRequestPublicMetricType:()=>Di,ProjectMetricResponsePublic:()=>Zm,ProjectMetricResponsePublicInterval:()=>Qm,ProjectMetricResponsePublicMetricType:()=>$m,ProjectPagePublic:()=>Jm,ProjectPublic:()=>xt,ProjectPublicVisibility:()=>Hm,ProjectRetrieveDetailed:()=>mo,ProjectStatItemObjectPublic:()=>el,ProjectStatsPublic:()=>Pe,ProjectStatsSummary:()=>ed,ProjectStatsSummaryItem:()=>qm,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>Ui,ProjectVisibility:()=>Vm,ProjectWrite:()=>po,ProjectWriteVisibility:()=>ji,Prompt:()=>Kh,PromptDetail:()=>dd,PromptDetailTemplateStructure:()=>md,PromptPagePublic:()=>bd,PromptPublic:()=>Rd,PromptPublicTemplateStructure:()=>hd,PromptTemplateStructure:()=>sd,PromptTokensDetails:()=>xc,PromptType:()=>nd,PromptUpdatable:()=>fo,PromptVersion:()=>ld,PromptVersionBatchUpdate:()=>wo,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>ps,PromptVersionDetailType:()=>ss,PromptVersionLink:()=>ta,PromptVersionLinkPublic:()=>ia,PromptVersionLinkWrite:()=>Ai,PromptVersionPagePublic:()=>fd,PromptVersionPublic:()=>wd,PromptVersionPublicTemplateStructure:()=>gd,PromptVersionPublicType:()=>ud,PromptVersionRetrieveDetail:()=>ho,PromptVersionTemplateStructure:()=>cd,PromptVersionType:()=>pd,PromptVersionUpdate:()=>cs,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Oi,PromptWriteType:()=>Fi,ProviderApiKey:()=>Lh,ProviderApiKeyPagePublic:()=>wm,ProviderApiKeyProvider:()=>fm,ProviderApiKeyPublic:()=>yt,ProviderApiKeyPublicProvider:()=>gm,ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Pi,ResponseFormat:()=>zs,ResponseFormatType:()=>bs,Result:()=>er,ResultsNumberPublic:()=>Ym,ScoreName:()=>Xm,ServiceTogglesConfig:()=>yd,Span:()=>wt,SpanBatch:()=>$h,SpanBatchUpdate:()=>ko,SpanBatchWrite:()=>yo,SpanEnrichmentOptions:()=>Vn,SpanExperimentItemBulkWriteView:()=>Zn,SpanExperimentItemBulkWriteViewType:()=>Yn,SpanFilter:()=>Se,SpanFilterOperator:()=>xp,SpanFilterPublic:()=>We,SpanFilterPublicOperator:()=>ds,SpanFilterWrite:()=>rt,SpanFilterWriteOperator:()=>Mp,SpanLlmAsJudgeCode:()=>Zo,SpanLlmAsJudgeCodePublic:()=>ac,SpanLlmAsJudgeCodeWrite:()=>Np,SpanPagePublic:()=>_d,SpanPublic:()=>Tt,SpanPublicType:()=>xd,SpanSearchStreamRequestPublic:()=>So,SpanSearchStreamRequestPublicType:()=>Ji,SpanType:()=>yl,SpanUpdate:()=>zo,SpanUpdateType:()=>ms,SpanUserDefinedMetricPythonCode:()=>qo,SpanUserDefinedMetricPythonCodePublic:()=>nc,SpanUserDefinedMetricPythonCodeWrite:()=>Op,SpanWrite:()=>bo,SpanWriteType:()=>ls,SpansCountResponse:()=>Es,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>wi,StartMultipartUploadResponse:()=>lp,StreamOptions:()=>Rs,StudioEvaluation:()=>Sm,StudioEvaluationPublic:()=>Om,StudioEvaluationWrite:()=>vm,StudioLlmModel:()=>zm,StudioLlmModelPublic:()=>Nm,StudioLlmModelWrite:()=>Em,StudioMessage:()=>bm,StudioMessagePublic:()=>Dm,StudioMessageWrite:()=>Am,StudioMetric:()=>km,StudioMetricPublic:()=>Fm,StudioMetricWrite:()=>Pm,StudioOptimizer:()=>xm,StudioOptimizerPublic:()=>Wm,StudioOptimizerWrite:()=>Cm,StudioPrompt:()=>ym,StudioPromptPublic:()=>Mm,StudioPromptWrite:()=>Tm,Tool:()=>ks,ToolCall:()=>ct,Trace:()=>gt,TraceBatch:()=>Qh,TraceBatchUpdate:()=>To,TraceBatchWrite:()=>_o,TraceCountResponse:()=>vs,TraceEnrichmentOptions:()=>Hn,TraceExperimentItemBulkWriteView:()=>Qn,TraceFilter:()=>ke,TraceFilterOperator:()=>gp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>is,TraceFilterWrite:()=>et,TraceFilterWriteOperator:()=>Ep,TracePagePublic:()=>Dd,TracePublic:()=>Pt,TracePublicVisibilityMode:()=>Id,TraceSearchStreamRequestPublic:()=>Do,TraceThread:()=>vt,TraceThreadBatchIdentifier:()=>vo,TraceThreadBatchUpdate:()=>Po,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>ws,TraceThreadFilterPublic:()=>Oe,TraceThreadFilterPublicOperator:()=>as,TraceThreadFilterWrite:()=>ot,TraceThreadFilterWriteOperator:()=>Bp,TraceThreadIdentifier:()=>sa,TraceThreadLlmAsJudgeCode:()=>Qo,TraceThreadLlmAsJudgeCodePublic:()=>tc,TraceThreadLlmAsJudgeCodeWrite:()=>Lp,TraceThreadPage:()=>Ud,TraceThreadSearchStreamRequest:()=>Uo,TraceThreadStatus:()=>jd,TraceThreadUpdate:()=>Eo,TraceThreadUserDefinedMetricPythonCode:()=>Yo,TraceThreadUserDefinedMetricPythonCodePublic:()=>ic,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Hp,TraceUpdate:()=>Ao,TraceVisibilityMode:()=>bl,TraceWrite:()=>xo,UploadAttachmentRequestEntityType:()=>fi,Usage:()=>Ac,UserDefinedMetricPythonCode:()=>$o,UserDefinedMetricPythonCodePublic:()=>oc,UserDefinedMetricPythonCodeWrite:()=>Xp,ValueEntry:()=>Gn,ValueEntryCompare:()=>Wc,ValueEntryCompareSource:()=>Oc,ValueEntryExperimentItemBulkWriteView:()=>rs,ValueEntryExperimentItemBulkWriteViewSource:()=>es,ValueEntryPublic:()=>Sd,ValueEntryPublicSource:()=>kd,ValueEntrySource:()=>Kn,VideoUrl:()=>hp,VideoUrlPublic:()=>Zp,VideoUrlWrite:()=>Cp,Webhook:()=>Is,WebhookExamples:()=>Qs,WebhookPublic:()=>Hs,WebhookTestResult:()=>Zs,WebhookTestResultStatus:()=>Ys,WebhookWrite:()=>Ls,WelcomeWizardSubmission:()=>Ho,WelcomeWizardTracking:()=>Md,WorkspaceConfiguration:()=>Ct,WorkspaceMetricRequest:()=>qh,WorkspaceMetricResponse:()=>pa,WorkspaceMetricsSummaryRequest:()=>zr,WorkspaceMetricsSummaryResponse:()=>Nd,WorkspaceNameHolder:()=>dp,WorkspaceSpansCount:()=>Ts,WorkspaceTraceCount:()=>Ps,alerts:()=>di,annotationQueues:()=>$i,attachments:()=>sr,chatCompletions:()=>Qi,dashboards:()=>Yi,datasets:()=>yi,experiments:()=>pr,feedbackDefinitions:()=>Ei,guardrails:()=>Zi,llmProviderKey:()=>vi,optimizations:()=>Ii,projects:()=>Ni,prompts:()=>Bi,spans:()=>cr,traces:()=>Be,welcomeWizard:()=>qi});var di={};c(di,{GetWebhookExamplesRequestAlertType:()=>mi});var mi=e.enum_(["general","slack","pagerduty"]);var sr={};c(sr,{AttachmentListRequestEntityType:()=>ui,DownloadAttachmentRequestEntityType:()=>gi,StartMultipartUploadRequest:()=>Ir,StartMultipartUploadRequestEntityType:()=>wi,UploadAttachmentRequestEntityType:()=>fi,uploadAttachment:()=>hi});var ui=e.enum_(["trace","span"]);var gi=e.enum_(["trace","span"]);var wi=e.enum_(["trace","span"]);var fi=e.enum_(["trace","span"]);var hi={};c(hi,{Request:()=>kh});var kh=e.record(e.string(),e.unknown());var Ir=e.object({fileName:e.property("file_name",e.string()),numOfFileParts:e.property("num_of_file_parts",e.number()),mimeType:e.property("mime_type",e.string().optional()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",wi),entityId:e.property("entity_id",e.string()),path:e.string()});var yi={};c(yi,{CreateDatasetItemsFromSpansRequest:()=>Nr,CreateDatasetItemsFromTracesRequest:()=>Fr,DatasetExpansionWrite:()=>Lr,DatasetIdentifier:()=>Wr,DatasetIdentifierPublic:()=>Vr,DatasetItemBatchUpdate:()=>jr,DatasetItemBatchWrite:()=>Mr,DatasetItemStreamRequest:()=>Hr,DatasetItemsDelete:()=>Br,DatasetUpdate:()=>Or,DatasetUpdateVisibility:()=>bi,DatasetVersionCreatePublic:()=>Xr,DatasetVersionRestorePublic:()=>Kr,DatasetVersionTag:()=>Jr,DatasetVersionUpdatePublic:()=>Gr,DatasetWrite:()=>Ur,DatasetWriteVisibility:()=>Ri});var Ri=e.enum_(["private","public"]);var bi=e.enum_(["private","public"]);var On=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Wn=e.object({field:e.string().optional(),operator:On.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Bn=e.object({input:e.string().optional(),expectedOutput:e.property("expected_output",e.string().optional()),metadata:v.optional(),data:v.optional(),tags:e.list(e.string()).optional()});var jr=e.object({ids:e.list(e.string()).optional(),filters:e.list(Wn).optional(),update:Bn,mergeTags:e.property("merge_tags",e.boolean().optional())});var Ur=e.object({id:e.string().optional(),name:e.string(),visibility:Ri.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Ln=e.enum_(["manual","trace","span","sdk"]);var Dr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ln,data:v,tags:e.list(e.string()).optional()});var Mr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Dr)});var Vn=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Nr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Vn)});var Hn=e.object({includeSpans:e.boolean().optional(),includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Fr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Hn)});var Or=e.object({name:e.string(),description:e.string().optional(),visibility:bi.optional(),tags:e.list(e.string()).optional()});var Wr=e.object({datasetName:e.property("dataset_name",e.string())});var Br=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Lr=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Vr=e.object({datasetName:e.property("dataset_name",e.string())});var Hr=e.object({datasetName:e.property("dataset_name",e.string()),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),steamLimit:e.property("steam_limit",e.number().optional())});var Jr=e.object({tag:e.string()});var Xr=e.object({tags:e.list(e.string()).optional(),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional()});var Kr=e.object({versionRef:e.property("version_ref",e.string())});var Gr=e.object({changeDescription:e.property("change_description",e.string().optional()),tagsToAdd:e.property("tags_to_add",e.list(e.string()).optional())});var pr={};c(pr,{ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>eo,ExperimentItemStreamRequest:()=>to,ExperimentItemsBatch:()=>Yr,ExperimentItemsDelete:()=>Zr,ExperimentStreamRequestPublic:()=>io,ExperimentUpdate:()=>oo,ExperimentUpdateStatus:()=>xi,ExperimentUpdateType:()=>Si,ExperimentWrite:()=>$r,ExperimentWriteStatus:()=>ki,ExperimentWriteType:()=>zi,findFeedbackScoreNames:()=>_i});var zi=e.enum_(["regular","trial","mini-batch"]);var ki=e.enum_(["running","completed","cancelled"]);var Si=e.enum_(["regular","trial","mini-batch"]);var xi=e.enum_(["running","completed","cancelled"]);var _i={};c(_i,{Response:()=>Sh});var Sh=e.list(e.string());var te=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Jn=e.object({name:e.string(),value:e.number()});var Ai=e.object({id:e.string()});var $r=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:zi.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:ki.optional(),experimentScores:e.property("experiment_scores",e.list(Jn).optional()),promptVersion:e.property("prompt_version",Ai.optional()),promptVersions:e.property("prompt_versions",e.list(Ai).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Xn=e.enum_(["ui","sdk","online_scoring"]);var Kn=e.enum_(["ui","sdk","online_scoring"]);var Gn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Kn.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Y=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Xn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Gn).optional())});var L=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $n=e.enum_(["default","hidden"]);var Qr=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:D.optional(),output:D.optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",$n.optional())});var Yr=e.object({experimentItems:e.property("experiment_items",e.list(Qr))});var Zr=e.object({ids:e.list(e.string())});var me=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var qr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Qn=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Yn=e.enum_(["general","tool","llm","guardrail"]);var Zn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Yn.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:me.optional(),output:me.optional(),metadata:me.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",qr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var qn=e.enum_(["ui","sdk","online_scoring"]);var es=e.enum_(["ui","sdk","online_scoring"]);var rs=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:es.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var os=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:qn,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),rs).optional())});var ts=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Qn.optional(),spans:e.list(Zn).optional(),feedbackScores:e.property("feedback_scores",e.list(os).optional())});var eo=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(ts)});var ro=e.object({name:e.string(),value:e.number()});var oo=e.object({name:e.string().optional(),metadata:v.optional(),type:Si.optional(),status:xi.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional())});var to=e.object({experimentName:e.property("experiment_name",e.string()),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var io=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var Ei={};c(Ei,{FindFeedbackDefinitionsRequestType:()=>Ti});var Ti=e.enum_(["numerical","categorical","boolean"]);var vi={};c(vi,{ProviderApiKeyUpdate:()=>no,ProviderApiKeyWrite:()=>ao,ProviderApiKeyWriteProvider:()=>Pi});var Pi=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var ao=e.object({provider:Pi,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var no=e.object({apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional())});var Ii={};c(Ii,{OptimizationUpdate:()=>so,OptimizationUpdateStatus:()=>Ci});var Ci=e.enum_(["running","completed","cancelled","initialized","error"]);var so=e.object({name:e.string().optional(),status:Ci.optional()});var Ni={};c(Ni,{ProjectMetricRequestPublic:()=>lo,ProjectMetricRequestPublicInterval:()=>Mi,ProjectMetricRequestPublicMetricType:()=>Di,ProjectRetrieveDetailed:()=>mo,ProjectUpdate:()=>co,ProjectUpdateVisibility:()=>Ui,ProjectWrite:()=>po,ProjectWriteVisibility:()=>ji});var ji=e.enum_(["private","public"]);var Ui=e.enum_(["private","public"]);var Di=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Mi=e.enum_(["HOURLY","DAILY","WEEKLY"]);var po=e.object({name:e.string(),visibility:ji.optional(),description:e.string().optional()});var co=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Ui.optional()});var is=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:is.optional(),key:e.string().optional(),value:e.string().optional()});var as=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Oe=e.object({field:e.string().optional(),operator:as.optional(),key:e.string().optional(),value:e.string().optional()});var lo=e.object({metricType:e.property("metric_type",Di.optional()),interval:Mi.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional()),traceFilters:e.property("trace_filters",e.list(be).optional()),threadFilters:e.property("thread_filters",e.list(Oe).optional())});var mo=e.object({name:e.string()});var Bi={};c(Bi,{CreatePromptVersionDetail:()=>go,CreatePromptVersionDetailTemplateStructure:()=>Wi,PromptUpdatable:()=>fo,PromptVersionBatchUpdate:()=>wo,PromptVersionRetrieveDetail:()=>ho,PromptWrite:()=>uo,PromptWriteTemplateStructure:()=>Oi,PromptWriteType:()=>Fi});var Fi=e.enum_(["mustache","jinja2"]);var Oi=e.enum_(["text","chat"]);var Wi=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var uo=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:ie.optional(),changeDescription:e.property("change_description",e.string().optional()),type:Fi.optional(),templateStructure:e.property("template_structure",Oi.optional()),tags:e.list(e.string()).optional()});var ns=e.record(e.string(),e.unknown());var ss=e.enum_(["mustache","jinja2"]);var ps=e.enum_(["text","chat"]);var he=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:ns.optional(),type:ss.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",ps.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var go=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",Wi.optional())});var cs=e.object({tags:e.list(e.string()).optional()});var wo=e.object({ids:e.list(e.string()),update:cs,mergeTags:e.property("merge_tags",e.boolean().optional())});var fo=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var ho=e.object({name:e.string(),commit:e.string().optional()});var cr={};c(cr,{FindFeedbackScoreNames1RequestType:()=>Vi,GetSpanStatsRequestType:()=>Hi,GetSpansByProjectRequestType:()=>Li,SpanBatchUpdate:()=>ko,SpanBatchWrite:()=>yo,SpanSearchStreamRequestPublic:()=>So,SpanSearchStreamRequestPublicType:()=>Ji,findFeedbackScoreNames1:()=>Xi});var Li=e.enum_(["general","tool","llm","guardrail"]);var Vi=e.enum_(["general","tool","llm","guardrail"]);var Hi=e.enum_(["general","tool","llm","guardrail"]);var Ji=e.enum_(["general","tool","llm","guardrail"]);var Xi={};c(Xi,{Response:()=>xh});var xh=e.list(e.string());var ls=e.enum_(["general","tool","llm","guardrail"]);var Ro=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var bo=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:ls.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",Ro.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var yo=e.object({spans:e.list(bo)});var ms=e.enum_(["general","tool","llm","guardrail"]);var ye=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:ms.optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),errorInfo:e.property("error_info",ye.optional())});var ko=e.object({ids:e.list(e.string()),update:zo,mergeTags:e.property("merge_tags",e.boolean().optional())});var ds=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var We=e.object({field:e.string().optional(),operator:ds.optional(),key:e.string().optional(),value:e.string().optional()});var So=e.object({traceId:e.property("trace_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),type:Ji.optional(),filters:e.list(We).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional(),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Be={};c(Be,{DeleteThreadFeedbackScores:()=>Co,DeleteTraceThreads:()=>Io,FeedbackScoreBatchThread:()=>jo,TraceBatchUpdate:()=>To,TraceBatchWrite:()=>_o,TraceSearchStreamRequestPublic:()=>Do,TraceThreadBatchIdentifier:()=>vo,TraceThreadBatchUpdate:()=>Po,TraceThreadSearchStreamRequest:()=>Uo,findFeedbackScoreNames2:()=>Ki,findTraceThreadsFeedbackScoreNames:()=>Gi});var Ki={};c(Ki,{Response:()=>_h});var _h=e.list(e.string());var Gi={};c(Gi,{Response:()=>Ah});var Ah=e.list(e.string());var xo=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:te.optional(),output:te.optional(),metadata:te.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Ro.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var _o=e.object({traces:e.list(xo)});var Ao=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),threadId:e.property("thread_id",e.string().optional())});var To=e.object({ids:e.list(e.string()),update:Ao,mergeTags:e.property("merge_tags",e.boolean().optional())});var Eo=e.object({tags:e.list(e.string()).optional()});var Po=e.object({ids:e.list(e.string()),update:Eo,mergeTags:e.property("merge_tags",e.boolean().optional())});var vo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()).optional())});var Co=e.object({projectName:e.property("project_name",e.string()),threadId:e.property("thread_id",e.string()),names:e.list(e.string()),author:e.string().optional()});var Io=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadIds:e.property("thread_ids",e.list(e.string()))});var us=e.enum_(["ui","sdk","online_scoring"]);var gs=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:us,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var jo=e.object({scores:e.list(gs)});var ws=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:ws.optional(),key:e.string().optional(),value:e.string().optional()});var Uo=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(de).optional(),lastRetrievedThreadModelId:e.property("last_retrieved_thread_model_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var Do=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(be).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional(),stripAttachments:e.property("strip_attachments",e.boolean().optional()),fromTime:e.property("from_time",e.date().optional()),toTime:e.property("to_time",e.date().optional())});var $i={};c($i,{AnnotationQueueBatchWrite:()=>No,AnnotationQueueUpdate:()=>Fo});var fs=e.enum_(["trace","thread"]);var Mo=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:fs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var No=e.object({annotationQueues:e.property("annotation_queues",e.list(Mo))});var Fo=e.object({name:e.string().optional(),description:e.string().optional(),instructions:e.string().optional(),commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Qi={};c(Qi,{ChatCompletionRequest:()=>Wo});var hs=e.record(e.string(),e.unknown());var Rs=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var bs=e.enum_(["text","json_object","json_schema"]);var ys=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var zs=e.object({type:bs.optional(),jsonSchema:e.property("json_schema",ys.optional())});var Oo=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ks=e.object({type:e.stringLiteral("function").optional(),function:Oo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Wo=e.object({model:e.string().optional(),messages:e.list(hs).optional(),temperature:e.number().optional(),topP:e.property("top_p",e.number().optional()),n:e.number().optional(),stream:e.boolean().optional(),streamOptions:e.property("stream_options",Rs.optional()),stop:e.list(e.string()).optional(),maxTokens:e.property("max_tokens",e.number().optional()),maxCompletionTokens:e.property("max_completion_tokens",e.number().optional()),presencePenalty:e.property("presence_penalty",e.number().optional()),frequencyPenalty:e.property("frequency_penalty",e.number().optional()),logitBias:e.property("logit_bias",e.record(e.string(),e.number()).optional()),user:e.string().optional(),responseFormat:e.property("response_format",zs.optional()),seed:e.number().optional(),tools:e.list(ks).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),store:e.boolean().optional(),metadata:e.record(e.string(),e.string()).optional(),reasoningEffort:e.property("reasoning_effort",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional()),functions:e.list(Oo).optional(),functionCall:e.property("function_call",ze.optional())});var Yi={};c(Yi,{DashboardUpdatePublic:()=>Lo,DashboardWrite:()=>Bo});var Bo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Lo=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var Zi={};c(Zi,{GuardrailBatchWrite:()=>Vo});var Ss=e.enum_(["TOPIC","PII"]);var xs=e.enum_(["passed","failed"]);var _s=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:Ss,result:xs,config:v,details:v});var Vo=e.object({guardrails:e.list(_s)});var qi={};c(qi,{WelcomeWizardSubmission:()=>Ho});var Ho=e.object({role:e.string().optional(),integrations:e.list(e.string()).optional(),email:e.string().optional(),joinBetaProgram:e.property("join_beta_program",e.boolean().optional())});var As=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var lr=e.object({biInformation:e.property("bi_information",e.list(As).optional())});var Ts=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Es=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Ts).optional())});var Ps=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var vs=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Ps).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Cs=e.enum_(["general","slack","pagerduty"]);var Is=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var js=e.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Us=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ds=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Us,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ms=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",js),triggerConfigs:e.property("trigger_configs",e.list(Ds).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Th=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Cs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Is,triggers:e.list(Ms).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ns=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Fs=e.object({id:e.string().optional(),type:Ns,configValue:e.property("config_value",e.record(e.string(),e.string()).optional())});var Os=e.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Ws=e.object({id:e.string().optional(),eventType:e.property("event_type",Os),triggerConfigs:e.property("trigger_configs",e.list(Fs).optional())});var Bs=e.enum_(["general","slack","pagerduty"]);var Ls=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional()});var Jo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Bs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ls,triggers:e.list(Ws).optional()});var F=e.object({ids:e.list(e.string())});var Vs=e.enum_(["general","slack","pagerduty"]);var Hs=e.object({id:e.string().optional(),name:e.string().optional(),url:e.string(),secretToken:e.property("secret_token",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Js=e.enum_(["trace:errors","trace:feedback_score","trace_thread:feedback_score","prompt:created","prompt:committed","trace:guardrails_triggered","prompt:deleted","experiment:finished","trace:cost","trace:latency"]);var Xs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ks=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Xs,configValue:e.property("config_value",e.record(e.string(),e.string()).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Gs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Js),triggerConfigs:e.property("trigger_configs",e.list(Ks).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Xo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Vs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Hs,triggers:e.list(Gs).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $s=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Xo).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Eh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Qs=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Ys=e.enum_(["success","failure"]);var Zs=e.object({status:Ys.optional(),statusCode:e.property("status_code",e.number().optional()),requestBody:e.property("request_body",e.string().optional()),errorMessage:e.property("error_message",e.string().optional())});var ea=e.object({ids:e.list(e.string())});var qs=e.enum_(["trace","thread"]);var ep=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var rp=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:qs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(ep).optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ph=e.object({annotationQueues:e.property("annotation_queues",e.list(rp))});var op=e.enum_(["trace","thread"]);var tp=e.object({username:e.string().optional(),status:e.number().optional()});var Le=e.object({name:e.string(),value:e.number()});var Ko=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:op,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(tp).optional(),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),itemsCount:e.property("items_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ip=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Ko).optional(),sortableBy:e.list(e.string()).optional()});var ap=e.object({link:e.string().optional(),fileName:e.property("file_name",e.string()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string())});var np=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ap).optional(),sortableBy:e.list(e.string()).optional()});var sp=e.enum_(["trace","span"]);var pp=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var ra=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",sp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string().optional()),fileSize:e.property("file_size",e.number()),mimeType:e.property("mime_type",e.string().optional()),uploadId:e.property("upload_id",e.string()),uploadedFileParts:e.property("uploaded_file_parts",e.list(pp))});var cp=e.enum_(["trace","span"]);var vh=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",cp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var lp=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var mp=e.record(e.string(),e.unknown());var dp=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var up=e.object({url:e.string()});var gp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:gp.optional(),key:e.string().optional(),value:e.string().optional()});var Ve=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",v.optional())});var wp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var fp=e.object({url:e.string(),detail:e.string().optional()});var hp=e.object({url:e.string()});var Rp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",fp.optional()),videoUrl:e.property("video_url",hp.optional()),audioUrl:e.property("audio_url",up.optional())});var He=e.object({role:wp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Rp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var bp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:bp,description:e.string()});var Go=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var yp=e.object({filters:e.list(ke).optional(),code:Go.optional()});var $o=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var zp=e.object({filters:e.list(ke).optional(),code:$o.optional()});var Qo=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var kp=e.object({filters:e.list(de).optional(),code:Qo.optional()});var Yo=e.object({metric:e.string()});var Sp=e.object({filters:e.list(de).optional(),code:Yo.optional()});var xp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Se=e.object({field:e.string().optional(),operator:xp.optional(),key:e.string().optional(),value:e.string().optional()});var Zo=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var _p=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var qo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Ap=e.object({filters:e.list(Se).optional(),code:qo.optional()});var mr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),Ch=e.union("type",{llm_as_judge:yp.extend(mr),user_defined_metric_python:zp.extend(mr),trace_thread_llm_as_judge:kp.extend(mr),trace_thread_user_defined_metric_python:Sp.extend(mr),span_llm_as_judge:_p.extend(mr),span_user_defined_metric_python:Ap.extend(mr)}).transform({transform:s=>s,untransform:s=>s});var Tp=e.object({url:e.string()});var Ep=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var et=e.object({field:e.string().optional(),operator:Ep.optional(),key:e.string().optional(),value:e.string().optional()});var Xe=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",ie.optional())});var Pp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var vp=e.object({url:e.string(),detail:e.string().optional()});var Cp=e.object({url:e.string()});var Ip=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",vp.optional()),videoUrl:e.property("video_url",Cp.optional()),audioUrl:e.property("audio_url",Tp.optional())});var Ke=e.object({role:Pp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Ip).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var jp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:jp,description:e.string()});var Up=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Dp=e.object({filters:e.list(et).optional(),code:Up.optional()});var Mp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var rt=e.object({field:e.string().optional(),operator:Mp.optional(),key:e.string().optional(),value:e.string().optional()});var Np=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Fp=e.object({filters:e.list(rt).optional(),code:Np.optional()});var Op=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Wp=e.object({filters:e.list(rt).optional(),code:Op.optional()});var Bp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ot=e.object({field:e.string().optional(),operator:Bp.optional(),key:e.string().optional(),value:e.string().optional()});var Lp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var Vp=e.object({filters:e.list(ot).optional(),code:Lp.optional()});var Hp=e.object({metric:e.string()});var Jp=e.object({filters:e.list(ot).optional(),code:Hp.optional()});var Xp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Kp=e.object({filters:e.list(et).optional(),code:Xp.optional()});var dr=e.object({projectId:e.property("project_id",e.string()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),action:e.stringLiteral("evaluator")}),Gp=e.union("type",{llm_as_judge:Dp.extend(dr),user_defined_metric_python:Kp.extend(dr),trace_thread_llm_as_judge:Vp.extend(dr),trace_thread_user_defined_metric_python:Jp.extend(dr),span_llm_as_judge:Fp.extend(dr),span_user_defined_metric_python:Wp.extend(dr)}).transform({transform:s=>s,untransform:s=>s});var $p=e.object({url:e.string()});var $e=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",Z.optional())});var Qp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Yp=e.object({url:e.string(),detail:e.string().optional()});var Zp=e.object({url:e.string()});var qp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Yp.optional()),videoUrl:e.property("video_url",Zp.optional()),audioUrl:e.property("audio_url",$p.optional())});var Qe=e.object({role:Qp,content:e.string().optional(),contentArray:e.property("content_array",e.list(qp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var ec=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ye=e.object({name:e.string(),type:ec,description:e.string()});var rc=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var tt=e.object({filters:e.list(be).optional(),code:rc.optional()});var oc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var it=e.object({filters:e.list(be).optional(),code:oc.optional()});var tc=e.object({model:$e,messages:e.list(Qe),schema:e.list(Ye)});var at=e.object({filters:e.list(Oe).optional(),code:tc.optional()});var ic=e.object({metric:e.string()});var nt=e.object({filters:e.list(Oe).optional(),code:ic.optional()});var ac=e.object({model:$e,messages:e.list(Qe),variables:e.record(e.string(),e.string()),schema:e.list(Ye)});var st=e.object({filters:e.list(We).optional(),code:ac.optional()});var nc=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var pt=e.object({filters:e.list(We).optional(),code:nc.optional()});var ur=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),sc=e.union("type",{llm_as_judge:tt.extend(ur),user_defined_metric_python:it.extend(ur),trace_thread_llm_as_judge:at.extend(ur),trace_thread_user_defined_metric_python:nt.extend(ur),span_llm_as_judge:st.extend(ur),span_user_defined_metric_python:pt.extend(ur)}).transform({transform:s=>s,untransform:s=>s});var pc=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(sc).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var gr=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),action:e.stringLiteral("evaluator")}),cc=e.union("type",{llm_as_judge:tt.extend(gr),user_defined_metric_python:it.extend(gr),trace_thread_llm_as_judge:at.extend(gr),trace_thread_user_defined_metric_python:nt.extend(gr),span_llm_as_judge:st.extend(gr),span_user_defined_metric_python:pt.extend(gr)}).transform({transform:s=>s,untransform:s=>s});var lc=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var mc=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:lc.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var dc=e.object({content:e.list(mc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var uc=e.object({filters:e.list(ke).optional(),code:Go.optional()});var gc=e.object({filters:e.list(ke).optional(),code:$o.optional()});var wc=e.object({filters:e.list(de).optional(),code:Qo.optional()});var fc=e.object({filters:e.list(de).optional(),code:Yo.optional()});var hc=e.object({filters:e.list(Se).optional(),code:Zo.optional()});var Rc=e.object({filters:e.list(Se).optional(),code:qo.optional()});var wr=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),enabled:e.boolean().optional(),projectId:e.property("project_id",e.string()),action:e.stringLiteral("evaluator")}),bc=e.union("type",{llm_as_judge:uc.extend(wr),user_defined_metric_python:gc.extend(wr),trace_thread_llm_as_judge:wc.extend(wr),trace_thread_user_defined_metric_python:fc.extend(wr),span_llm_as_judge:hc.extend(wr),span_user_defined_metric_python:Rc.extend(wr)}).transform({transform:s=>s,untransform:s=>s});var yc=e.enum_(["system","user","assistant","tool","function"]);var ct=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var zc=e.object({role:yc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(ct).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var kc=e.object({role:e.string().optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),toolCalls:e.property("tool_calls",e.list(ct).optional()),functionCall:e.property("function_call",ze.optional())});var Sc=e.object({index:e.number().optional(),message:zc.optional(),delta:kc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var xc=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var _c=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Ac=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",xc.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",_c.optional())});var Tc=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(Sc).optional(),usage:Ac.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var Ze=e.object({id:e.string().optional(),workspaceId:e.property("workspace_id",e.string().optional()),name:e.string(),slug:e.string().optional(),description:e.string().optional(),config:Z,createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Ec=e.object({content:e.list(Ze).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var Pc=e.enum_(["private","public"]);var vc=e.enum_(["unknown","processing","completed","failed"]);var Cc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var Ih=e.object({id:e.string().optional(),name:e.string(),visibility:Pc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:vc.optional(),latestVersion:e.property("latest_version",Cc.optional())});var Ic=e.enum_(["manual","trace","span","sdk"]);var lt=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Ic,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Qr).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var jh=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(lt)});var jc=e.object({generatedSamples:e.property("generated_samples",e.list(lt).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var Uh=e.object({model:e.string(),sampleCount:e.property("sample_count",e.number().optional()),preserveFields:e.property("preserve_fields",e.list(e.string()).optional()),variationInstructions:e.property("variation_instructions",e.string().optional()),customPrompt:e.property("custom_prompt",e.string().optional())});var Uc=e.enum_(["string","number","object","boolean","array","null"]);var Dc=e.object({name:e.string().optional(),types:e.list(Uc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Mc=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Nc=e.enum_(["manual","trace","span","sdk"]);var oa=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Fc=e.enum_(["ui","sdk","online_scoring"]);var Oc=e.enum_(["ui","sdk","online_scoring"]);var Wc=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Oc.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Bc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Fc,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Wc).optional())});var Lc=e.enum_(["default","hidden"]);var Vc=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),input:oa.optional(),output:oa.optional(),feedbackScores:e.property("feedback_scores",e.list(Bc).optional()),comments:e.list(Mc).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),duration:e.number().optional(),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",Lc.optional())});var Hc=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Nc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Vc).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Jc=e.object({content:e.list(Hc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Dc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Xc=e.enum_(["private","public"]);var Kc=e.enum_(["unknown","processing","completed","failed"]);var Gc=e.object({id:e.string().optional(),versionHash:e.property("version_hash",e.string().optional()),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional()});var fr=e.object({id:e.string().optional(),name:e.string(),visibility:Xc.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:Kc.optional(),latestVersion:e.property("latest_version",Gc.optional())});var $c=e.object({content:e.list(fr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.list(e.string()).optional()});var Qc=e.object({value:e.number().optional()});var Yc=e.object({value:e.number().optional()});var mt=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Zc=e.object({value:mt.optional()});var qc=e.object({name:e.string().optional()}),el=e.union("type",{PERCENTAGE:Zc.extend(qc),COUNT:Yc.extend(qc),AVG:Qc.extend(qc)}).transform({transform:s=>s,untransform:s=>s});var Pe=e.object({stats:e.list(el).optional()});var rl=e.enum_(["manual","trace","span","sdk"]);var ol=e.enum_(["default","hidden"]);var dt=e.object({id:e.string().optional(),experimentId:e.property("experiment_id",e.string()),datasetItemId:e.property("dataset_item_id",e.string()),traceId:e.property("trace_id",e.string()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),traceVisibilityMode:e.property("trace_visibility_mode",ol.optional())});var ut=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:rl,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(dt).optional()),datasetId:e.property("dataset_id",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var tl=e.enum_(["string","number","object","boolean","array","null"]);var il=e.object({name:e.string().optional(),types:e.list(tl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var al=e.object({content:e.list(ut).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(il).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var nl=e.enum_(["string","number","object","boolean","array","null"]);var sl=e.object({name:e.string().optional(),types:e.list(nl).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var pl=e.object({columns:e.list(sl).optional()});var cl=e.object({typeName:e.string().optional()});var Dh=e.object({type:cl.optional(),closed:e.boolean().optional()});var ll=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var ml=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:ll.optional()});var hr=e.object({id:e.string().optional(),datasetId:e.property("dataset_id",e.string().optional()),versionHash:e.property("version_hash",e.string().optional()),tags:e.list(e.string()).optional(),isLatest:e.property("is_latest",e.boolean().optional()),itemsTotal:e.property("items_total",e.number().optional()),itemsAdded:e.property("items_added",e.number().optional()),itemsModified:e.property("items_modified",e.number().optional()),itemsDeleted:e.property("items_deleted",e.number().optional()),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var dl=e.object({content:e.list(hr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var ul=e.enum_(["regular","trial","mini-batch"]);var gl=e.enum_(["running","completed","cancelled"]);var xe=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var ta=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var Mh=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:D.optional(),type:ul.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),comments:e.list(L).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:gl.optional(),experimentScores:e.property("experiment_scores",e.list(ro).optional()),promptVersion:e.property("prompt_version",ta.optional()),promptVersions:e.property("prompt_versions",e.list(ta).optional())});var Rr=e.object({ids:e.list(e.string())});var wl=e.enum_(["TOPIC","PII"]);var fl=e.enum_(["passed","failed"]);var hl=e.object({name:wl.optional(),result:fl.optional()});var Rl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(hl).optional()});var bl=e.enum_(["default","hidden"]);var gt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",ye.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Rl).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",bl.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var yl=e.enum_(["general","tool","llm","guardrail"]);var wt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:yl.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:D.optional(),output:D.optional(),metadata:D.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",ye.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),comments:e.list(L).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var zl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:gt.optional(),spans:e.list(wt).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var Nh=e.object({experimentName:e.property("experiment_name",e.string()),datasetName:e.property("dataset_name",e.string()),experimentId:e.property("experiment_id",e.string().optional()),items:e.list(zl)});var qe=e.object({id:e.string().optional(),text:e.string(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var ae=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var kl=e.enum_(["regular","trial","mini-batch"]);var Sl=e.enum_(["running","completed","cancelled"]);var xl=e.object({name:e.string(),value:e.number()});var ia=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),promptName:e.property("prompt_name",e.string().optional())});var ft=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),datasetId:e.property("dataset_id",e.string().optional()),name:e.string().optional(),metadata:ae.optional(),type:kl.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),comments:e.list(qe).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:mt.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),status:Sl.optional(),experimentScores:e.property("experiment_scores",e.list(xl).optional()),promptVersion:e.property("prompt_version",ia.optional()),promptVersions:e.property("prompt_versions",e.list(ia).optional())});var _l=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ft).optional(),sortableBy:e.list(e.string()).optional()});var Al=e.object({label:e.string().optional()});var Tl=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var El=e.object({groupsDetails:e.property("groups_details",e.list(Tl).optional())});var Pl=e.object({content:e.record(e.string(),Al).optional(),details:El.optional()});var vl=e.object({experimentCount:e.property("experiment_count",e.number().optional()),traceCount:e.property("trace_count",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostAvg:e.property("total_estimated_cost_avg",e.number().optional()),duration:xe.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),experimentScores:e.property("experiment_scores",e.list(re).optional())});var Cl=e.object({label:e.string().optional(),aggregations:vl.optional()});var Il=e.object({content:e.record(e.string(),Cl).optional()});var Fh=e.object({ids:e.list(e.string())});var jl=e.object({typeName:e.string().optional()});var Oh=e.object({type:jl.optional(),closed:e.boolean().optional()});var Ul=e.object({trueLabel:e.string(),falseLabel:e.string()});var Dl=e.object({details:Ul.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ml=e.object({categories:e.record(e.string(),e.number())});var Nl=e.object({details:Ml.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Fl=e.object({max:e.number(),min:e.number()});var Ol=e.object({details:Fl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Wl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Wh=e.union("type",{numerical:Ol.extend(Wl),categorical:Nl.extend(Wl),boolean:Dl.extend(Wl)}).transform({transform:s=>s,untransform:s=>s});var Bl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Ll=e.object({details:Bl.optional()});var Vl=e.object({categories:e.record(e.string(),e.number())});var Hl=e.object({details:Vl.optional()});var Jl=e.object({max:e.number(),min:e.number()});var Xl=e.object({details:Jl.optional()});var Kl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),Gl=e.union("type",{numerical:Xl.extend(Kl),categorical:Hl.extend(Kl),boolean:Ll.extend(Kl)}).transform({transform:s=>s,untransform:s=>s});var $l=e.object({trueLabel:e.string(),falseLabel:e.string()});var ht=e.object({details:$l.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Ql=e.object({categories:e.record(e.string(),e.number())});var Rt=e.object({details:Ql.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Yl=e.object({max:e.number(),min:e.number()});var bt=e.object({details:Yl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Zl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),ql=e.union("type",{numerical:bt.extend(Zl),categorical:Rt.extend(Zl),boolean:ht.extend(Zl)}).transform({transform:s=>s,untransform:s=>s});var em=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ql).optional()});var rm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),om=e.union("type",{numerical:bt.extend(rm),categorical:Rt.extend(rm),boolean:ht.extend(rm)}).transform({transform:s=>s,untransform:s=>s});var tm=e.object({trueLabel:e.string(),falseLabel:e.string()});var im=e.object({details:tm.optional()});var am=e.object({categories:e.record(e.string(),e.number())});var nm=e.object({details:am.optional()});var sm=e.object({max:e.number(),min:e.number()});var pm=e.object({details:sm.optional()});var cm=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),lm=e.union("type",{numerical:pm.extend(cm),categorical:nm.extend(cm),boolean:im.extend(cm)}).transform({transform:s=>s,untransform:s=>s});var mm=e.enum_(["TOPIC","PII"]);var dm=e.enum_(["passed","failed"]);var um=e.object({id:e.string().optional(),entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:mm,result:dm,config:v,details:v});var Bh=e.object({guardrails:e.list(um)});var gm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var yt=e.object({id:e.string().optional(),provider:gm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var wm=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(yt).optional(),sortableBy:e.list(e.string()).optional()});var fm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm","opik-builtin"]);var Lh=e.object({id:e.string().optional(),provider:fm,apiKey:e.property("api_key",e.string().optional()),name:e.string().optional(),providerName:e.property("provider_name",e.string().optional()),headers:e.record(e.string(),e.string()).optional(),configuration:e.record(e.string(),e.string()).optional(),baseUrl:e.property("base_url",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),readOnly:e.property("read_only",e.boolean().optional())});var zt=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var hm=e.enum_(["trace","thread","span"]);var kt=e.object({projectId:e.property("project_id",e.string()),entityIds:e.property("entity_ids",e.list(e.string())),ruleIds:e.property("rule_ids",e.list(e.string())),entityType:e.property("entity_type",hm)});var Vh=v;var Rm=e.enum_(["running","completed","cancelled","initialized","error"]);var bm=e.object({role:e.string(),content:e.string()});var ym=e.object({messages:e.list(bm)});var zm=e.object({model:e.string(),parameters:v.optional()});var km=e.object({type:e.string(),parameters:v.optional()});var Sm=e.object({metrics:e.list(km)});var xm=e.object({type:e.string(),parameters:v.optional()});var _m=e.object({datasetName:e.property("dataset_name",e.string()),prompt:ym,llmModel:e.property("llm_model",zm),evaluation:Sm,optimizer:xm});var Hh=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Rm,metadata:D.optional(),studioConfig:e.property("studio_config",_m.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Am=e.object({role:e.string(),content:e.string()});var Tm=e.object({messages:e.list(Am)});var Em=e.object({model:e.string(),parameters:ie.optional()});var Pm=e.object({type:e.string(),parameters:ie.optional()});var vm=e.object({metrics:e.list(Pm)});var Cm=e.object({type:e.string(),parameters:ie.optional()});var Im=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Tm,llmModel:e.property("llm_model",Em),evaluation:vm,optimizer:Cm});var jm=e.enum_(["running","completed","cancelled","initialized","error"]);var aa=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:jm,metadata:te.optional(),studioConfig:e.property("studio_config",Im.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var Um=e.enum_(["running","completed","cancelled","initialized","error"]);var Dm=e.object({role:e.string(),content:e.string()});var Mm=e.object({messages:e.list(Dm)});var Nm=e.object({model:e.string(),parameters:Z.optional()});var Fm=e.object({type:e.string(),parameters:Z.optional()});var Om=e.object({metrics:e.list(Fm)});var Wm=e.object({type:e.string(),parameters:Z.optional()});var Bm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:Mm,llmModel:e.property("llm_model",Nm),evaluation:Om,optimizer:Wm});var br=e.object({id:e.string().optional(),name:e.string().optional(),datasetName:e.property("dataset_name",e.string()),objectiveName:e.property("objective_name",e.string()),status:Um,metadata:ae.optional(),studioConfig:e.property("studio_config",Bm.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(Le).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(br).optional(),sortableBy:e.list(e.string()).optional()});var Lm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var St=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Vm=e.enum_(["private","public"]);var Jh=e.object({id:e.string().optional(),name:e.string(),visibility:Vm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",St.optional())});var Hm=e.enum_(["private","public"]);var xt=e.object({id:e.string().optional(),name:e.string(),visibility:Hm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var Jm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(xt).optional(),sortableBy:e.list(e.string()).optional()});var Xm=e.object({name:e.string().optional(),type:e.string().optional()});var Km=e.object({scores:e.list(Xm).optional()});var Gm=e.object({time:e.date(),value:e.number().optional()});var $m=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Qm=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Ym=e.object({name:e.string().optional(),data:e.list(Gm).optional()});var Zm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",$m.optional()),interval:Qm.optional(),results:e.list(Ym).optional()});var qm=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:xe.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",St.optional())});var ed=e.object({content:e.list(qm).optional()});var rd=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var od=e.object({name:e.string(),value:e.number()});var td=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var id=e.enum_(["private","public"]);var ad=e.object({id:e.string().optional(),name:e.string(),visibility:id.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional()),feedbackScores:e.property("feedback_scores",e.list(od).optional()),duration:td.optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostSum:e.property("total_estimated_cost_sum",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),traceCount:e.property("trace_count",e.number().optional()),guardrailsFailedCount:e.property("guardrails_failed_count",e.number().optional()),errorCount:e.property("error_count",rd.optional())});var Xh=e.object({errors:e.list(e.string()).optional()});var nd=e.enum_(["mustache","jinja2"]);var sd=e.enum_(["text","chat"]);var pd=e.enum_(["mustache","jinja2"]);var cd=e.enum_(["text","chat"]);var ld=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:v.optional(),type:pd.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",cd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Kh=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:v.optional(),changeDescription:e.property("change_description",e.string().optional()),type:nd.optional(),templateStructure:e.property("template_structure",sd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",ld.optional())});var Gh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var md=e.enum_(["text","chat"]);var dd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",md.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",he.optional())});var ud=e.enum_(["mustache","jinja2"]);var gd=e.enum_(["text","chat"]);var wd=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:Z.optional(),type:ud.optional(),changeDescription:e.property("change_description",e.string().optional()),tags:e.list(e.string()).optional(),templateStructure:e.property("template_structure",gd.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var fd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wd).optional(),sortableBy:e.list(e.string()).optional()});var hd=e.enum_(["text","chat"]);var Rd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",hd.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var bd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Rd).optional(),sortableBy:e.list(e.string()).optional()});var yd=e.object({pythonEvaluatorEnabled:e.boolean(),traceThreadPythonEvaluatorEnabled:e.boolean(),spanLlmAsJudgeEnabled:e.boolean(),spanUserDefinedMetricPythonEnabled:e.boolean(),guardrailsEnabled:e.boolean(),opikAiEnabled:e.property("opikAIEnabled",e.boolean()),alertsEnabled:e.boolean(),welcomeWizardEnabled:e.boolean(),csvUploadEnabled:e.boolean(),exportEnabled:e.boolean(),optimizationStudioEnabled:e.boolean(),dashboardsEnabled:e.boolean(),datasetVersioningEnabled:e.boolean(),openaiProviderEnabled:e.boolean(),anthropicProviderEnabled:e.boolean(),geminiProviderEnabled:e.boolean(),openrouterProviderEnabled:e.boolean(),vertexaiProviderEnabled:e.boolean(),customllmProviderEnabled:e.boolean(),opikbuiltinProviderEnabled:e.boolean(),collaboratorsTabEnabled:e.boolean()});var $h=e.object({spans:e.list(wt)});var _t=e.object({name:e.string(),author:e.string().optional()});var At=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var zd=e.enum_(["ui","sdk","online_scoring"]);var kd=e.enum_(["ui","sdk","online_scoring"]);var Sd=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:kd.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var yr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:zd,createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),valueByAuthor:e.property("value_by_author",e.record(e.string(),Sd).optional())});var xd=e.enum_(["general","tool","llm","guardrail"]);var Tt=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:xd.optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),model:e.string().optional(),provider:e.string().optional(),tags:e.list(e.string()).optional(),usage:e.record(e.string(),e.number()).optional(),errorInfo:e.property("error_info",At.optional()),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional()),duration:e.number().optional()});var _d=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Tt).optional(),sortableBy:e.list(e.string()).optional()});var Ad=e.enum_(["ui","sdk","online_scoring"]);var Td=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Ad,author:e.string().optional(),id:e.string()});var Et=e.object({scores:e.list(Td)});var Qh=e.object({traces:e.list(gt)});var Yh=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var Ed=e.enum_(["TOPIC","PII"]);var Pd=e.enum_(["passed","failed"]);var vd=e.object({name:Ed.optional(),result:Pd.optional()});var Cd=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(vd).optional()});var Id=e.enum_(["default","hidden"]);var Pt=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),name:e.string().optional(),startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:ae.optional(),output:ae.optional(),metadata:ae.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",At.optional()),usage:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(yr).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(yr).optional()),comments:e.list(qe).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Cd).optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),spanCount:e.property("span_count",e.number().optional()),duration:e.number().optional(),threadId:e.property("thread_id",e.string().optional()),visibilityMode:e.property("visibility_mode",Id.optional()),llmSpanCount:e.property("llm_span_count",e.number().optional()),hasToolSpans:e.property("has_tool_spans",e.boolean().optional()),providers:e.list(e.string()).optional()});var jd=e.enum_(["active","inactive"]);var vt=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),threadModelId:e.property("thread_model_id",e.string().optional()),startTime:e.property("start_time",e.date().optional()),endTime:e.property("end_time",e.date().optional()),duration:e.number().optional(),firstMessage:e.property("first_message",D.optional()),lastMessage:e.property("last_message",D.optional()),feedbackScores:e.property("feedback_scores",e.list(Y).optional()),status:jd.optional(),numberOfMessages:e.property("number_of_messages",e.number().optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),usage:e.record(e.string(),e.number()).optional(),comments:e.list(L).optional(),tags:e.list(e.string()).optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var sa=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),threadId:e.property("thread_id",e.string()),truncate:e.boolean().optional()});var Ud=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(vt).optional(),sortableBy:e.list(e.string()).optional()});var Dd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Pt).optional(),sortableBy:e.list(e.string()).optional()});var Md=e.object({completed:e.boolean().optional()});var er=e.object({name:e.string().optional(),current:e.number().optional(),previous:e.number().optional()});var zr=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var Zh=e.object({time:e.date(),value:e.number().optional()});var pa=e.object({results:e.list(er).optional()});var qh=e.object({projectIds:e.property("project_ids",e.list(e.string()).optional()),name:e.string().optional(),intervalStart:e.property("interval_start",e.date()),intervalEnd:e.property("interval_end",e.date()),startBeforeEnd:e.property("start_before_end",e.boolean().optional())});var Ct=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var Nd=e.object({results:e.list(er).optional()});var ca=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return h.fromPromise(this.__getDatasetBiInfo(t))}async __getDatasetBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExperimentBiInfo(t){return h.fromPromise(this.__getExperimentBiInfo(t))}async __getExperimentBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansBiInfo(t){return h.fromPromise(this.__getSpansBiInfo(t))}async __getSpansBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-spans.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSpansCountForWorkspaces(t){return h.fromPromise(this.__getSpansCountForWorkspaces(t))}async __getSpansCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Es.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesBiInfo(t){return h.fromPromise(this.__getTracesBiInfo(t))}async __getTracesBiInfo(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:lr.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTracesCountForWorkspaces(t){return h.fromPromise(this.__getTracesCountForWorkspaces(t))}async __getTracesCountForWorkspaces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:vs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var la=class{constructor(t={}){this._options=t;}findAlerts(t={},r){return h.fromPromise(this.__findAlerts(t,r))}async __findAlerts(t={},r){var g,w;let{page:o,size:i,sorting:a,filters:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.sorting=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/alerts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:$s.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAlert(t,r){return h.fromPromise(this.__createAlert(t,r))}async __createAlert(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAlertBatch(t,r){return h.fromPromise(this.__deleteAlertBatch(t,r))}async __deleteAlertBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAlertById(t,r){return h.fromPromise(this.__getAlertById(t,r))}async __getAlertById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Xo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAlert(t,r,o){return h.fromPromise(this.__updateAlert(t,r,o))}async __updateAlert(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/alerts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/alerts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getWebhookExamples(t={},r){return h.fromPromise(this.__getWebhookExamples(t,r))}async __getWebhookExamples(t={},r){var l,d;let{alertType:o}=t,i={};o!=null&&(i.alert_type=mi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}));let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/alerts/webhooks/examples"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Qs.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/alerts/webhooks/examples.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}testWebhook(t,r){return h.fromPromise(this.__testWebhook(t,r))}async __testWebhook(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/alerts/webhooks/tests"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Zs.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/alerts/webhooks/tests.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ma=class{constructor(t={}){this._options=t;}addItemsToAnnotationQueue(t,r,o){return h.fromPromise(this.__addItemsToAnnotationQueue(t,r,o))}async __addItemsToAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/add`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/add.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findAnnotationQueues(t={},r){return h.fromPromise(this.__findAnnotationQueues(t,r))}async __findAnnotationQueues(t={},r){var w,k;let{page:o,size:i,name:a,filters:l,sorting:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.filters=l),d!=null&&(u.sorting=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/annotation-queues"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:ip.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createAnnotationQueue(t,r){return h.fromPromise(this.__createAnnotationQueue(t,r))}async __createAnnotationQueue(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createAnnotationQueueBatch(t,r){return h.fromPromise(this.__createAnnotationQueueBatch(t,r))}async __createAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:No.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAnnotationQueueBatch(t,r){return h.fromPromise(this.__deleteAnnotationQueueBatch(t,r))}async __deleteAnnotationQueueBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/annotation-queues/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getAnnotationQueueById(t,r){return h.fromPromise(this.__getAnnotationQueueById(t,r))}async __getAnnotationQueueById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ko.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAnnotationQueue(t,r={},o){return h.fromPromise(this.__updateAnnotationQueue(t,r,o))}async __updateAnnotationQueue(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/annotation-queues/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}removeItemsFromAnnotationQueue(t,r,o){return h.fromPromise(this.__removeItemsFromAnnotationQueue(t,r,o))}async __removeItemsFromAnnotationQueue(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/annotation-queues/${encodeURIComponent(t)}/items/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:ea.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/annotation-queues/{id}/items/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var da=class{constructor(t={}){this._options=t;}attachmentList(t,r){return h.fromPromise(this.__attachmentList(t,r))}async __attachmentList(t,r){var k,S;let{page:o,size:i,projectId:a,entityType:l,entityId:d,path:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),g.project_id=a,g.entity_type=ui.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:np.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}completeMultiPartUpload(t,r){return h.fromPromise(this.__completeMultiPartUpload(t,r))}async __completeMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAttachments(t,r){return h.fromPromise(this.__deleteAttachments(t,r))}async __deleteAttachments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ra.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}downloadAttachment(t,r){return h.fromPromise(this.__downloadAttachment(t,r))}async __downloadAttachment(t,r){var k,S;let{workspaceName:o,containerId:i,entityType:a,entityId:l,fileName:d,mimeType:u}=t,g={};o!=null&&(g.workspace_name=o),g.container_id=i,g.entity_type=gi.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"}),g.entity_id=l,g.file_name=d,g.mime_type=u;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}startMultiPartUpload(t,r){return h.fromPromise(this.__startMultiPartUpload(t,r))}async __startMultiPartUpload(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ir.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:lp.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}uploadAttachment(t,r){return h.fromPromise(this.__uploadAttachment(t,r))}async __uploadAttachment(t,r){var k,S;let{fileName:o,projectName:i,mimeType:a,entityType:l,entityId:d,body:u}=t,g={};g.file_name=o,i!=null&&(g.project_name=i),a!=null&&(g.mime_type=a),g.entity_type=fi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",body:sr.uploadAttachment.Request.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:void 0,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new X(w.error.body,w.rawResponse);case 403:throw new $(ee.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ua=class{constructor(t={}){this._options=t;}access(t,r){return h.fromPromise(this.__access(t,r))}async __access(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return h.fromPromise(this.__getWorkspaceName(t))}async __getWorkspaceName(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:dp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new X(r.error.body,r.rawResponse);case 403:throw new $(ee.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ga=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return h.fromPromise(this.__findEvaluators(t,r))}async __findEvaluators(t={},r){var S,x;let{projectId:o,id:i,name:a,filters:l,sorting:d,page:u,size:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.id=i),a!=null&&(w.name=a),l!=null&&(w.filters=l),d!=null&&(w.sorting=d),u!=null&&(w.page=u.toString()),g!=null&&(w.size=g.toString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:pc.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}createAutomationRuleEvaluator(t,r){return h.fromPromise(this.__createAutomationRuleEvaluator(t,r))}async __createAutomationRuleEvaluator(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Gp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAutomationRuleEvaluatorBatch(t,r){return h.fromPromise(this.__deleteAutomationRuleEvaluatorBatch(t,r))}async __deleteAutomationRuleEvaluatorBatch(t,r){var d,u;let{projectId:o,body:i}=t,a={};o!=null&&(a.project_id=o);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",body:F.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:void 0,rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getEvaluatorById(t,r={},o){return h.fromPromise(this.__getEvaluatorById(t,r,o))}async __getEvaluatorById(t,r={},o){var d,u;let{projectId:i}=r,a={};i!=null&&(a.project_id=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:cc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}updateAutomationRuleEvaluator(t,r,o){return h.fromPromise(this.__updateAutomationRuleEvaluator(t,r,o))}async __updateAutomationRuleEvaluator(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:bc.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getEvaluatorLogsById(t,r={},o){return h.fromPromise(this.__getEvaluatorLogsById(t,r,o))}async __getEvaluatorLogsById(t,r={},o){var d,u;let{size:i}=r,a={};i!=null&&(a.size=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/automations/evaluators/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:dc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var wa=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return h.fromPromise(this.__createChatCompletions(t,r))}async __createChatCompletions(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Tc.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var fa=class{constructor(t={}){this._options=t;}findDashboards(t={},r){return h.fromPromise(this.__findDashboards(t,r))}async __findDashboards(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/dashboards"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Ec.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createDashboard(t,r){return h.fromPromise(this.__createDashboard(t,r))}async __createDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Bo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ze.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDashboardById(t,r){return h.fromPromise(this.__getDashboardById(t,r))}async __getDashboardById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ze.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDashboard(t,r){return h.fromPromise(this.__deleteDashboard(t,r))}async __deleteDashboard(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDashboard(t,r={},o){return h.fromPromise(this.__updateDashboard(t,r,o))}async __updateDashboard(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/dashboards/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Lo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Ze.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/dashboards/{dashboardId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDashboardsBatch(t,r){return h.fromPromise(this.__deleteDashboardsBatch(t,r))}async __deleteDashboardsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/dashboards/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/dashboards/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ha=class{constructor(t={}){this._options=t;}batchUpdateDatasetItems(t,r){return h.fromPromise(this.__batchUpdateDatasetItems(t,r))}async __batchUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findDatasets(t={},r){return h.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var x,T;let{page:o,size:i,withExperimentsOnly:a,withOptimizationsOnly:l,promptId:d,name:u,sorting:g,filters:w}=t,k={};o!=null&&(k.page=o.toString()),i!=null&&(k.size=i.toString()),a!=null&&(k.with_experiments_only=a.toString()),l!=null&&(k.with_optimizations_only=l.toString()),d!=null&&(k.prompt_id=d),u!=null&&(k.name=u),g!=null&&(k.sorting=g),w!=null&&(k.filters=w);let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(S.ok)return {data:$c.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}createDataset(t,r){return h.fromPromise(this.__createDataset(t,r))}async __createDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ur.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return h.fromPromise(this.__createOrUpdateDatasetItems(t,r))}async __createOrUpdateDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Mr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createDatasetItemsFromCsv(t,r){return h.fromPromise(this.__createDatasetItemsFromCsv(t,r))}async __createDatasetItemsFromCsv(t,r){var l,d;let o=await Hu();o.append("file",Ae(t.file)),o.append("dataset_id",t.datasetId);let i=await o.getRequest(),a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/datasets/items/from-csv"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i.headers,...r==null?void 0:r.headers},requestType:"file",duplex:i.duplex,body:i.body,timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/from-csv.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}createDatasetItemsFromSpans(t,r,o){return h.fromPromise(this.__createDatasetItemsFromSpans(t,r,o))}async __createDatasetItemsFromSpans(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-spans`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Nr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-spans.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createDatasetItemsFromTraces(t,r,o){return h.fromPromise(this.__createDatasetItemsFromTraces(t,r,o))}async __createDatasetItemsFromTraces(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/from-traces`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Fr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{dataset_id}/items/from-traces.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetById(t,r){return h.fromPromise(this.__getDatasetById(t,r))}async __getDatasetById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateDataset(t,r,o){return h.fromPromise(this.__updateDataset(t,r,o))}async __updateDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteDataset(t,r){return h.fromPromise(this.__deleteDataset(t,r))}async __deleteDataset(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetByName(t,r){return h.fromPromise(this.__deleteDatasetByName(t,r))}async __deleteDatasetByName(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Wr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetItems(t,r){return h.fromPromise(this.__deleteDatasetItems(t,r))}async __deleteDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Br.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteDatasetsBatch(t,r){return h.fromPromise(this.__deleteDatasetsBatch(t,r))}async __deleteDatasetsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}expandDataset(t,r,o){return h.fromPromise(this.__expandDataset(t,r,o))}async __expandDataset(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/expansions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Lr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:jc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/expansions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findDatasetItemsWithExperimentItems(t,r,o){return h.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var x,T;let{page:i,size:a,experimentIds:l,filters:d,sorting:u,search:g,truncate:w}=r,k={};i!=null&&(k.page=i.toString()),a!=null&&(k.size=a.toString()),k.experiment_ids=l,d!=null&&(k.filters=d),u!=null&&(k.sorting=u),g!=null&&(k.search=g),w!=null&&(k.truncate=w.toString());let S=await b({url:y((T=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?T:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:k,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(S.ok)return {data:Jc.parseOrThrow(S.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:S.rawResponse};if(S.error.reason==="status-code")throw new p({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse});switch(S.error.reason){case "non-json":throw new p({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}getDatasetByIdentifier(t,r){return h.fromPromise(this.__getDatasetByIdentifier(t,r))}async __getDatasetByIdentifier(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:fr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDatasetExperimentItemsStats(t,r,o){return h.fromPromise(this.__getDatasetExperimentItemsStats(t,r,o))}async __getDatasetExperimentItemsStats(t,r,o){var u,g;let{experimentIds:i,filters:a}=r,l={};l.experiment_ids=i,a!=null&&(l.filters=a);let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/stats`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:Pe.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/stats.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getDatasetItemById(t,r){return h.fromPromise(this.__getDatasetItemById(t,r))}async __getDatasetItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ut.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}patchDatasetItem(t,r,o){return h.fromPromise(this.__patchDatasetItem(t,r,o))}async __patchDatasetItem(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/items/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Dr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/items/{itemId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getDatasetItems(t,r={},o){return h.fromPromise(this.__getDatasetItems(t,r,o))}async __getDatasetItems(t,r={},o){var k,S;let{page:i,size:a,version:l,filters:d,truncate:u}=r,g={};i!=null&&(g.page=i.toString()),a!=null&&(g.size=a.toString()),l!=null&&(g.version=l),d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(w.ok)return {data:al.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getDatasetItemsOutputColumns(t,r={},o){return h.fromPromise(this.__getDatasetItemsOutputColumns(t,r,o))}async __getDatasetItemsOutputColumns(t,r={},o){var d,u;let{experimentIds:i}=r,a={};i!=null&&(a.experiment_ids=i);let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:pl.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}streamDatasetItems(t,r){return h.fromPromise(this.__streamDatasetItems(t,r))}async __streamDatasetItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Hr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}compareDatasetVersions(t,r){return h.fromPromise(this.__compareDatasetVersions(t,r))}async __compareDatasetVersions(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/diff`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ml.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions/diff.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createVersionTag(t,r,o,i){return h.fromPromise(this.__createVersionTag(t,r,o,i))}async __createVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}/tags`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Jr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/hash/{versionHash}/tags.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}listDatasetVersions(t,r={},o){return h.fromPromise(this.__listDatasetVersions(t,r,o))}async __listDatasetVersions(t,r={},o){var u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:dl.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createDatasetVersion(t,r={},o){return h.fromPromise(this.__createDatasetVersion(t,r,o))}async __createDatasetVersion(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Xr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteVersionTag(t,r,o,i){return h.fromPromise(this.__deleteVersionTag(t,r,o,i))}async __deleteVersionTag(t,r,o,i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(o)}/versions/${encodeURIComponent(t)}/tags/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}/versions/{versionHash}/tags/{tag}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}restoreDatasetVersion(t,r,o){return h.fromPromise(this.__restoreDatasetVersion(t,r,o))}async __restoreDatasetVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/datasets/${encodeURIComponent(t)}/versions/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Kr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:hr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/{id}/versions/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateDatasetVersion(t,r,o={},i){return h.fromPromise(this.__updateDatasetVersion(t,r,o,i))}async __updateDatasetVersion(t,r,o={},i){var l,d;let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,`v1/private/datasets/${encodeURIComponent(r)}/versions/hash/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...i==null?void 0:i.headers},contentType:"application/json",requestType:"json",body:Gr.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(i==null?void 0:i.timeoutInSeconds)!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i==null?void 0:i.maxRetries,withCredentials:true,abortSignal:i==null?void 0:i.abortSignal});if(a.ok)return {data:hr.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new _(a.error.body,a.rawResponse);case 404:throw new A(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/datasets/{id}/versions/hash/{versionHash}.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ra=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return h.fromPromise(this.__findExperiments(t,r))}async __findExperiments(t={},r){var B,O;let{page:o,size:i,datasetId:a,optimizationId:l,types:d,name:u,datasetDeleted:g,promptId:w,sorting:k,filters:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.datasetId=a),l!=null&&(x.optimization_id=l),d!=null&&(x.types=d),u!=null&&(x.name=u),g!=null&&(x.dataset_deleted=g.toString()),w!=null&&(x.prompt_id=w),k!=null&&(x.sorting=k),S!=null&&(x.filters=S);let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:_l.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new _(T.error.body,T.rawResponse);default:throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}createExperiment(t,r){return h.fromPromise(this.__createExperiment(t,r))}async __createExperiment(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$r.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return h.fromPromise(this.__createExperimentItems(t,r))}async __createExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Yr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentItems(t,r){return h.fromPromise(this.__deleteExperimentItems(t,r))}async __deleteExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteExperimentsById(t,r){return h.fromPromise(this.__deleteExperimentsById(t,r))}async __deleteExperimentsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}experimentItemsBulk(t,r){return h.fromPromise(this.__experimentItemsBulk(t,r))}async __experimentItemsBulk(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/bulk"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:eo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/experiments/items/bulk.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames(t={},r){return h.fromPromise(this.__findFeedbackScoreNames(t,r))}async __findFeedbackScoreNames(t={},r){var l,d;let{experimentIds:o}=t,i={};o!=null&&(i.experiment_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:pr.findFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findExperimentGroups(t={},r){return h.fromPromise(this.__findExperimentGroups(t,r))}async __findExperimentGroups(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Pl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}findExperimentGroupsAggregations(t={},r){return h.fromPromise(this.__findExperimentGroupsAggregations(t,r))}async __findExperimentGroupsAggregations(t={},r){var g,w;let{groups:o,types:i,name:a,filters:l}=t,d={};o!=null&&(d.groups=o),i!=null&&(d.types=i),a!=null&&(d.name=a),l!=null&&(d.filters=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/experiments/groups/aggregations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Il.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/groups/aggregations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}finishExperiments(t,r){return h.fromPromise(this.__finishExperiments(t,r))}async __finishExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/finish"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/finish.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getExperimentById(t,r){return h.fromPromise(this.__getExperimentById(t,r))}async __getExperimentById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ft.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateExperiment(t,r={},o){return h.fromPromise(this.__updateExperiment(t,r,o))}async __updateExperiment(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/experiments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:oo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/experiments/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getExperimentItemById(t,r){return h.fromPromise(this.__getExperimentItemById(t,r))}async __getExperimentItemById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/experiments/items/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperimentItems(t,r){return h.fromPromise(this.__streamExperimentItems(t,r))}async __streamExperimentItems(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:to.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}streamExperiments(t,r){return h.fromPromise(this.__streamExperiments(t,r))}async __streamExperiments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ba=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return h.fromPromise(this.__findFeedbackDefinitions(t,r))}async __findFeedbackDefinitions(t={},r){var g,w;let{page:o,size:i,name:a,type:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.type=Ti.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}));let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:em.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createFeedbackDefinition(t,r){return h.fromPromise(this.__createFeedbackDefinition(t,r))}async __createFeedbackDefinition(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Gl.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getFeedbackDefinitionById(t,r){return h.fromPromise(this.__getFeedbackDefinitionById(t,r))}async __getFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:om.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateFeedbackDefinition(t,r,o){return h.fromPromise(this.__updateFeedbackDefinition(t,r,o))}async __updateFeedbackDefinition(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:lm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeedbackDefinitionById(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionById(t,r))}async __deleteFeedbackDefinitionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/feedback-definitions/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteFeedbackDefinitionsBatch(t,r){return h.fromPromise(this.__deleteFeedbackDefinitionsBatch(t,r))}async __deleteFeedbackDefinitionsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ya=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return h.fromPromise(this.__createGuardrails(t,r))}async __createGuardrails(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var za=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return h.fromPromise(this.__deleteLlmProviderApiKeysBatch(t,r))}async __deleteLlmProviderApiKeysBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findLlmProviderKeys(t){return h.fromPromise(this.__findLlmProviderKeys(t))}async __findLlmProviderKeys(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:wm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}storeLlmProviderApiKey(t,r){return h.fromPromise(this.__storeLlmProviderApiKey(t,r))}async __storeLlmProviderApiKey(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new X(o.error.body,o.rawResponse);case 403:throw new $(ee.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getLlmProviderApiKeyById(t,r){return h.fromPromise(this.__getLlmProviderApiKeyById(t,r))}async __getLlmProviderApiKeyById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:yt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateLlmProviderApiKey(t,r={},o){return h.fromPromise(this.__updateLlmProviderApiKey(t,r,o))}async __updateLlmProviderApiKey(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/llm-provider-key/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:no.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new X(i.error.body,i.rawResponse);case 403:throw new $(ee.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ka=class{constructor(t={}){this._options=t;}evaluateSpans(t,r){return h.fromPromise(this.__evaluateSpans(t,r))}async __evaluateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateThreads(t,r){return h.fromPromise(this.__evaluateThreads(t,r))}async __evaluateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/threads"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/threads.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}evaluateTraces(t,r){return h.fromPromise(this.__evaluateTraces(t,r))}async __evaluateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/manual-evaluation/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:zt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/manual-evaluation/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Sa=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return h.fromPromise(this.__receiveProtobufTraces(t))}async __receiveProtobufTraces(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var xa=class{constructor(t={}){this._options=t;}cancelStudioOptimizations(t,r){return h.fromPromise(this.__cancelStudioOptimizations(t,r))}async __cancelStudioOptimizations(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/cancel`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Ne(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/cancel.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findOptimizations(t={},r){return h.fromPromise(this.__findOptimizations(t,r))}async __findOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:na.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return h.fromPromise(this.__createOptimization(t,r))}async __createOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:aa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}upsertOptimization(t,r){return h.fromPromise(this.__upsertOptimization(t,r))}async __upsertOptimization(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:aa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return h.fromPromise(this.__deleteOptimizationsById(t,r))}async __deleteOptimizationsById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Rr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findStudioOptimizations(t={},r){return h.fromPromise(this.__findStudioOptimizations(t,r))}async __findStudioOptimizations(t={},r){var k,S;let{page:o,size:i,datasetId:a,name:l,datasetDeleted:d,filters:u}=t,g={};o!=null&&(g.page=o.toString()),i!=null&&(g.size=i.toString()),a!=null&&(g.dataset_id=a),l!=null&&(g.name=l),d!=null&&(g.dataset_deleted=d.toString()),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,"v1/private/optimizations/studio"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(w.ok)return {data:na.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _(w.error.body,w.rawResponse);default:throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getOptimizationById(t,r){return h.fromPromise(this.__getOptimizationById(t,r))}async __getOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateOptimizationsById(t,r={},o){return h.fromPromise(this.__updateOptimizationsById(t,r,o))}async __updateOptimizationsById(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/optimizations/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:so.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getStudioOptimizationById(t,r){return h.fromPromise(this.__getStudioOptimizationById(t,r))}async __getStudioOptimizationById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:br.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getStudioOptimizationLogs(t,r){return h.fromPromise(this.__getStudioOptimizationLogs(t,r))}async __getStudioOptimizationLogs(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/optimizations/studio/${encodeURIComponent(t)}/logs`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Lm.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/studio/{id}/logs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var _a=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:Jm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return h.fromPromise(this.__getProjectById(t,r))}async __getProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:xt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteProjectById(t,r){return h.fromPromise(this.__deleteProjectById(t,r))}async __deleteProjectById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProject(t,r={},o){return h.fromPromise(this.__updateProject(t,r,o))}async __updateProject(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:co.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteProjectsBatch(t,r){return h.fromPromise(this.__deleteProjectsBatch(t,r))}async __deleteProjectsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNamesByProjectIds(t={},r){return h.fromPromise(this.__findFeedbackScoreNamesByProjectIds(t,r))}async __findFeedbackScoreNamesByProjectIds(t={},r){var l,d;let{projectIds:o}=t,i={};o!=null&&(i.project_ids=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Km.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getProjectMetrics(t,r={},o){return h.fromPromise(this.__getProjectMetrics(t,r,o))}async __getProjectMetrics(t,r={},o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/projects/${encodeURIComponent(t)}/metrics`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:lo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Zm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getProjectStats(t={},r){return h.fromPromise(this.__getProjectStats(t,r))}async __getProjectStats(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:ed.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}retrieveProject(t,r){return h.fromPromise(this.__retrieveProject(t,r))}async __retrieveProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ad.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Aa=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return h.fromPromise(this.__getPrompts(t,r))}async __getPrompts(t={},r){var w,k;let{page:o,size:i,name:a,sorting:l,filters:d}=t,u={};o!=null&&(u.page=o.toString()),i!=null&&(u.size=i.toString()),a!=null&&(u.name=a),l!=null&&(u.sorting=l),d!=null&&(u.filters=d);let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:bd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createPrompt(t,r){return h.fromPromise(this.__createPrompt(t,r))}async __createPrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return h.fromPromise(this.__createPromptVersion(t,r))}async __createPromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:go.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePromptVersions(t,r){return h.fromPromise(this.__updatePromptVersions(t,r))}async __updatePromptVersions(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:wo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:dd.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updatePrompt(t,r,o){return h.fromPromise(this.__updatePrompt(t,r,o))}async __updatePrompt(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:fo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePrompt(t,r){return h.fromPromise(this.__deletePrompt(t,r))}async __deletePrompt(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePromptsBatch(t,r){return h.fromPromise(this.__deletePromptsBatch(t,r))}async __deletePromptsBatch(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersionById(t,r){return h.fromPromise(this.__getPromptVersionById(t,r))}async __getPromptVersionById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/versions/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptVersions(t,r={},o){return h.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var k,S;let{page:i,size:a,search:l,sorting:d,filters:u}=r,g={};i!=null&&(g.page=i.toString()),a!=null&&(g.size=a.toString()),l!=null&&(g.search=l),d!=null&&(g.sorting=d),u!=null&&(g.filters=u);let w=await b({url:y((S=(k=await n.get(this._options.baseUrl))!=null?k:await n.get(this._options.environment))!=null?S:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(w.ok)return {data:fd.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")throw new p({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse});switch(w.error.reason){case "non-json":throw new p({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}restorePromptVersion(t,r,o){return h.fromPromise(this.__restorePromptVersion(t,r,o))}async __restorePromptVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions/${encodeURIComponent(r)}/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:he.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _(i.error.body,i.rawResponse);case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/{promptId}/versions/{versionId}/restore.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}retrievePromptVersion(t,r){return h.fromPromise(this.__retrievePromptVersion(t,r))}async __retrievePromptVersion(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:he.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 404:throw new A(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ta=class{constructor(t={}){this._options=t;}getServiceToggles(t){return h.fromPromise(this.__getServiceToggles(t))}async __getServiceToggles(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:yd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ea=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return h.fromPromise(this.__addSpanComment(t,r,o))}async __addSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addSpanFeedbackScore(t,r,o){return h.fromPromise(this.__addSpanFeedbackScore(t,r,o))}async __addSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createSpans(t,r){return h.fromPromise(this.__createSpans(t,r))}async __createSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:yo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateSpans(t,r){return h.fromPromise(this.__batchUpdateSpans(t,r))}async __batchUpdateSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ko.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpansByProject(t={},r){return h.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var qd,eu;let{page:o,size:i,projectName:a,projectId:l,traceId:d,type:u,filters:g,truncate:w,stripAttachments:k,sorting:S,exclude:x,fromTime:T,toTime:B}=t,O={};o!=null&&(O.page=o.toString()),i!=null&&(O.size=i.toString()),a!=null&&(O.project_name=a),l!=null&&(O.project_id=l),d!=null&&(O.trace_id=d),u!=null&&(O.type=Li.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(O.filters=g),w!=null&&(O.truncate=w.toString()),k!=null&&(O.strip_attachments=k.toString()),S!=null&&(O.sorting=S),x!=null&&(O.exclude=x),T!=null&&(O.from_time=T.toISOString()),B!=null&&(O.to_time=B.toISOString());let G=await b({url:y((eu=(qd=await n.get(this._options.baseUrl))!=null?qd:await n.get(this._options.environment))!=null?eu:R.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(G.ok)return {data:_d.parseOrThrow(G.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:G.rawResponse};if(G.error.reason==="status-code")throw new p({statusCode:G.error.statusCode,body:G.error.body,rawResponse:G.rawResponse});switch(G.error.reason){case "non-json":throw new p({statusCode:G.error.statusCode,body:G.error.rawBody,rawResponse:G.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:G.error.errorMessage,rawResponse:G.rawResponse})}}createSpan(t,r){return h.fromPromise(this.__createSpan(t,r))}async __createSpan(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:bo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new M(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getSpanById(t,r={},o){return h.fromPromise(this.__getSpanById(t,r,o))}async __getSpanById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Tt.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 404:throw new A(l.error.body,l.rawResponse);default:throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteSpanById(t,r){return h.fromPromise(this.__deleteSpanById(t,r))}async __deleteSpanById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new Ne(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpan(t,r,o){return h.fromPromise(this.__updateSpan(t,r,o))}async __updateSpan(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:zo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteSpanComments(t,r){return h.fromPromise(this.__deleteSpanComments(t,r))}async __deleteSpanComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteSpanFeedbackScore(t,r,o){return h.fromPromise(this.__deleteSpanFeedbackScore(t,r,o))}async __deleteSpanFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}findFeedbackScoreNames1(t={},r){return h.fromPromise(this.__findFeedbackScoreNames1(t,r))}async __findFeedbackScoreNames1(t={},r){var d,u;let{projectId:o,type:i}=t,a={};o!=null&&(a.project_id=o),i!=null&&(a.type=Vi.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"}));let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(l.ok)return {data:cr.findFeedbackScoreNames1.Response.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getSpanComment(t,r,o){return h.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getSpanStats(t={},r){return h.fromPromise(this.__getSpanStats(t,r))}async __getSpanStats(t={},r){var S,x;let{projectId:o,projectName:i,traceId:a,type:l,filters:d,fromTime:u,toTime:g}=t,w={};o!=null&&(w.project_id=o),i!=null&&(w.project_name=i),a!=null&&(w.trace_id=a),l!=null&&(w.type=Hi.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),d!=null&&(w.filters=d),u!=null&&(w.from_time=u.toISOString()),g!=null&&(w.to_time=g.toISOString());let k=await b({url:y((x=(S=await n.get(this._options.baseUrl))!=null?S:await n.get(this._options.environment))!=null?x:R.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(k.ok)return {data:Pe.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")throw new p({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse});switch(k.error.reason){case "non-json":throw new p({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new p({message:k.error.errorMessage,rawResponse:k.rawResponse})}}scoreBatchOfSpans(t,r){return h.fromPromise(this.__scoreBatchOfSpans(t,r))}async __scoreBatchOfSpans(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchSpans(t={},r){return h.fromPromise(this.__searchSpans(t,r))}async __searchSpans(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:So.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateSpanComment(t,r,o){return h.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Pa=class{constructor(t={}){this._options=t;}addThreadComment(t,r,o){return h.fromPromise(this.__addThreadComment(t,r,o))}async __addThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceComment(t,r,o){return h.fromPromise(this.__addTraceComment(t,r,o))}async __addTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/comments`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}addTraceFeedbackScore(t,r,o){return h.fromPromise(this.__addTraceFeedbackScore(t,r,o))}async __addTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Y.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}createTraces(t,r){return h.fromPromise(this.__createTraces(t,r))}async __createTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:_o.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateTraces(t,r){return h.fromPromise(this.__batchUpdateTraces(t,r))}async __batchUpdateTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:To.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}batchUpdateThreads(t,r){return h.fromPromise(this.__batchUpdateThreads(t,r))}async __batchUpdateThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/batch"),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Po.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/batch.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}closeTraceThread(t={},r){return h.fromPromise(this.__closeTraceThread(t,r))}async __closeTraceThread(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/close"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:vo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/close.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTracesByProject(t={},r){return h.fromPromise(this.__getTracesByProject(t,r))}async __getTracesByProject(t={},r){var O,G;let{page:o,size:i,projectName:a,projectId:l,filters:d,truncate:u,stripAttachments:g,sorting:w,exclude:k,fromTime:S,toTime:x}=t,T={};o!=null&&(T.page=o.toString()),i!=null&&(T.size=i.toString()),a!=null&&(T.project_name=a),l!=null&&(T.project_id=l),d!=null&&(T.filters=d),u!=null&&(T.truncate=u.toString()),g!=null&&(T.strip_attachments=g.toString()),w!=null&&(T.sorting=w),k!=null&&(T.exclude=k),S!=null&&(T.from_time=S.toISOString()),x!=null&&(T.to_time=x.toISOString());let B=await b({url:y((G=(O=await n.get(this._options.baseUrl))!=null?O:await n.get(this._options.environment))!=null?G:R.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(B.ok)return {data:Dd.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")throw new p({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse});switch(B.error.reason){case "non-json":throw new p({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createTrace(t,r){return h.fromPromise(this.__createTrace(t,r))}async __createTrace(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:xo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceById(t,r={},o){return h.fromPromise(this.__getTraceById(t,r,o))}async __getTraceById(t,r={},o){var d,u;let{stripAttachments:i}=r,a={};i!=null&&(a.strip_attachments=i.toString());let l=await b({url:y((u=(d=await n.get(this._options.baseUrl))!=null?d:await n.get(this._options.environment))!=null?u:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:a,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(l.ok)return {data:Pt.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse});switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new p({message:l.error.errorMessage,rawResponse:l.rawResponse})}}deleteTraceById(t,r){return h.fromPromise(this.__deleteTraceById(t,r))}async __deleteTraceById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateTrace(t,r,o){return h.fromPromise(this.__updateTrace(t,r,o))}async __updateTrace(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ao.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteThreadComments(t,r){return h.fromPromise(this.__deleteThreadComments(t,r))}async __deleteThreadComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteThreadFeedbackScores(t,r){return h.fromPromise(this.__deleteThreadFeedbackScores(t,r))}async __deleteThreadFeedbackScores(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Co.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/feedback-scores/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceComments(t,r){return h.fromPromise(this.__deleteTraceComments(t,r))}async __deleteTraceComments(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraceFeedbackScore(t,r,o){return h.fromPromise(this.__deleteTraceFeedbackScore(t,r,o))}async __deleteTraceFeedbackScore(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(t)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteTraceThreads(t,r){return h.fromPromise(this.__deleteTraceThreads(t,r))}async __deleteTraceThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Io.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteTraces(t,r){return h.fromPromise(this.__deleteTraces(t,r))}async __deleteTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:F.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}findFeedbackScoreNames2(t={},r){return h.fromPromise(this.__findFeedbackScoreNames2(t,r))}async __findFeedbackScoreNames2(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Be.findFeedbackScoreNames2.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}findTraceThreadsFeedbackScoreNames(t={},r){return h.fromPromise(this.__findTraceThreadsFeedbackScoreNames(t,r))}async __findTraceThreadsFeedbackScoreNames(t={},r){var l,d;let{projectId:o}=t,i={};o!=null&&(i.project_id=o);let a=await b({url:y((d=(l=await n.get(this._options.baseUrl))!=null?l:await n.get(this._options.environment))!=null?d:R.Default,"v1/private/traces/threads/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(a.ok)return {data:Be.findTraceThreadsFeedbackScoreNames.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse});switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/feedback-scores/names.");case "unknown":throw new p({message:a.error.errorMessage,rawResponse:a.rawResponse})}}getTraceStats(t={},r){return h.fromPromise(this.__getTraceStats(t,r))}async __getTraceStats(t={},r){var w,k;let{projectId:o,projectName:i,filters:a,fromTime:l,toTime:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),a!=null&&(u.filters=a),l!=null&&(u.from_time=l.toISOString()),d!=null&&(u.to_time=d.toISOString());let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Pe.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getThreadComment(t,r,o){return h.fromPromise(this.__getThreadComment(t,r,o))}async __getThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/{threadId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThreadStats(t={},r){return h.fromPromise(this.__getTraceThreadStats(t,r))}async __getTraceThreadStats(t={},r){var w,k;let{projectId:o,projectName:i,filters:a,fromTime:l,toTime:d}=t,u={};o!=null&&(u.project_id=o),i!=null&&(u.project_name=i),a!=null&&(u.filters=a),l!=null&&(u.from_time=l.toISOString()),d!=null&&(u.to_time=d.toISOString());let g=await b({url:y((k=(w=await n.get(this._options.baseUrl))!=null?w:await n.get(this._options.environment))!=null?k:R.Default,"v1/private/traces/threads/stats"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(g.ok)return {data:Pe.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads/stats.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}getTraceComment(t,r,o){return h.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceThread(t,r){return h.fromPromise(this.__getTraceThread(t,r))}async __getTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:sa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:vt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new A(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTraceThreads(t={},r){return h.fromPromise(this.__getTraceThreads(t,r))}async __getTraceThreads(t={},r){var B,O;let{page:o,size:i,projectName:a,projectId:l,truncate:d,stripAttachments:u,filters:g,sorting:w,fromTime:k,toTime:S}=t,x={};o!=null&&(x.page=o.toString()),i!=null&&(x.size=i.toString()),a!=null&&(x.project_name=a),l!=null&&(x.project_id=l),d!=null&&(x.truncate=d.toString()),u!=null&&(x.strip_attachments=u.toString()),g!=null&&(x.filters=g),w!=null&&(x.sorting=w),k!=null&&(x.from_time=k.toISOString()),S!=null&&(x.to_time=S.toISOString());let T=await b({url:y((O=(B=await n.get(this._options.baseUrl))!=null?B:await n.get(this._options.environment))!=null?O:R.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:x,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(T.ok)return {data:Ud.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")throw new p({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse});switch(T.error.reason){case "non-json":throw new p({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:T.error.errorMessage,rawResponse:T.rawResponse})}}openTraceThread(t,r){return h.fromPromise(this.__openTraceThread(t,r))}async __openTraceThread(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/open"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:sa.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/open.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfThreads(t,r){return h.fromPromise(this.__scoreBatchOfThreads(t,r))}async __scoreBatchOfThreads(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:jo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/threads/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}scoreBatchOfTraces(t,r){return h.fromPromise(this.__scoreBatchOfTraces(t,r))}async __scoreBatchOfTraces(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraceThreads(t={},r){return h.fromPromise(this.__searchTraceThreads(t,r))}async __searchTraceThreads(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/threads/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}searchTraces(t={},r){return h.fromPromise(this.__searchTraces(t,r))}async __searchTraces(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Do.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 401:throw new X(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateThread(t,r,o){return h.fromPromise(this.__updateThread(t,r,o))}async __updateThread(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Eo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/{threadModelId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateThreadComment(t,r,o){return h.fromPromise(this.__updateThreadComment(t,r,o))}async __updateThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/threads/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}updateTraceComment(t,r,o){return h.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new A(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var va=class{constructor(t={}){this._options=t;}getWelcomeWizardStatus(t){return h.fromPromise(this.__getWelcomeWizardStatus(t))}async __getWelcomeWizardStatus(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/welcome-wizard"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Md.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/welcome-wizard.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}submitWelcomeWizard(t={},r){return h.fromPromise(this.__submitWelcomeWizard(t,r))}async __submitWelcomeWizard(t={},r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/welcome-wizard"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ho.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/welcome-wizard.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ca=class{constructor(t={}){this._options=t;}costsSummary(t,r){return h.fromPromise(this.__costsSummary(t,r))}async __costsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:er.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceConfiguration(t){return h.fromPromise(this.__getWorkspaceConfiguration(t))}async __getWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:Ct.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new A(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertWorkspaceConfiguration(t,r){return h.fromPromise(this.__upsertWorkspaceConfiguration(t,r))}async __upsertWorkspaceConfiguration(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/configurations"),method:"PUT",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ct.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/workspaces/configurations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteWorkspaceConfiguration(t){return h.fromPromise(this.__deleteWorkspaceConfiguration(t))}async __deleteWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new A(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/workspaces/configurations.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCost(t,r){return h.fromPromise(this.__getCost(t,r))}async __getCost(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/costs"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/costs.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMetric(t,r){return h.fromPromise(this.__getMetric(t,r))}async __getMetric(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:pa.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}metricsSummary(t,r){return h.fromPromise(this.__metricsSummary(t,r))}async __metricsSummary(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/workspaces/metrics/summaries"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:zr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Nd.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/workspaces/metrics/summaries.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var Ia=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return h.fromPromise(this.__datasetsRedirect(t,r))}async __datasetsRedirect(t,r){var u,g;let{datasetId:o,workspaceName:i,path:a}=t,l={};l.dataset_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);case 404:throw new A(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}experimentsRedirect(t,r){return h.fromPromise(this.__experimentsRedirect(t,r))}async __experimentsRedirect(t,r){var g,w;let{datasetId:o,experimentId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.experiment_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);case 404:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}optimizationsRedirect(t,r){return h.fromPromise(this.__optimizationsRedirect(t,r))}async __optimizationsRedirect(t,r){var g,w;let{datasetId:o,optimizationId:i,workspaceName:a,path:l}=t,d={};d.dataset_id=o,d.optimization_id=i,a!=null&&(d.workspace_name=a),d.path=l;let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/session/redirect/optimizations"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:void 0,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new _(u.error.body,u.rawResponse);case 404:throw new A(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/optimizations.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}projectsRedirect(t,r){return h.fromPromise(this.__projectsRedirect(t,r))}async __projectsRedirect(t,r){var u,g;let{traceId:o,workspaceName:i,path:a}=t,l={};l.trace_id=o,i!=null&&(l.workspace_name=i),l.path=a;let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(d.ok)return {data:void 0,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new _(d.error.body,d.rawResponse);case 404:throw new A(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var It=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new ca(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new la(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new ma(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new da(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new ua(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ga(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new wa(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new fa(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new ha(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new Ra(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new ba(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new ya(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new za(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new ka(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Sa(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new xa(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new _a(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new Aa(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Ta(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Ea(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new Pa(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new va(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new Ca(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ia(this._options)}isAlive(t){return h.fromPromise(this.__isAlive(t))}async __isAlive(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return h.fromPromise(this.__version(t))}async __version(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var q=()=>v7();var ja=class s{constructor(t,r){this.data=t;this.opik=r;this.childSpans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=t=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...t};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...t},this};this.span=t=>{var a;let r=(a=this.data.projectName)!=null?a:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.traceId,parentSpanId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new s(o,this.opik);return this.childSpans.push(i),i};}};var Ua=class{constructor(t,r){this.data=t;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=t=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...t,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=t=>{var a,l;let r=(l=(a=this.data.projectName)!=null?a:t.projectName)!=null?l:this.opik.config.projectName,o={id:q(),startTime:new Date,...t,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let i=new ja(o,this.opik);return this.spans.push(i),i};this.update=t=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...t};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var Rg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Da={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},rR=s=>Object.entries(s).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%26/g,"&").replace(/%3F/g,"?").replace(/%3D/g,"="),oR=s=>s.replace(/\/api$/,""),tR=s=>Buffer.from(s).toString("base64"),bg=(s,t,r)=>{let o=rR(r),i=`${t}?${o}`;return new URL(i,s).toString()},yg=({datasetId:s,experimentId:t,baseUrl:r})=>bg(r,Rg.EXPERIMENTS,{[Da.EXPERIMENT_ID]:t,[Da.DATASET_ID]:s,[Da.PATH]:tR(r)});var zg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=oR(r),i=`${t}/${Rg.PROJECT_BY_NAME}`;return bg(o,i,{[Da.PROJECT_NAME]:s})};var iR=300,Ma=100,jt=class{constructor({action:t,batchSize:r=Ma,delay:o,enableBatch:i,name:a="ActionQueue"}){this.timerId=null;this.promise=Promise.resolve();this.queue=new Map;this.debounceFlush=()=>{this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>this.flush(),this.delay);};this.add=(t,r)=>{if(this.queue.set(t,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(t,r)=>{let o=this.queue.get(t);o&&(this.queue.set(t,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let t=new Map(this.queue);this.queue.clear(),z.debug(`Adding ${t.size} items to ${this.name} promise:`,t),this.promise=this.promise.finally(()=>(z.debug(`Flushing ${this.name}:`,t),this.action(t))).catch(r=>{z.error(`Failed to flush ${this.name}:`,r,t);}),await this.promise;};this.action=t,this.batchSize=r,this.delay=o,this.enableBatch=i,this.name=a;}},se=class{constructor({delay:t=iR,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Ma,updateBatchSize:l=Ma,deleteBatchSize:d=Ma,name:u="BatchQueue"}={}){this.create=t=>{let r=this.getId(t);this.createQueue.add(r,t);};this.get=async t=>{let r=this.createQueue.queue.get(t);return r||this.getEntity(t)};this.update=(t,r)=>{if(this.createQueue.queue.get(t)){this.createQueue.update(t,r);return}this.updateQueue.add(t,r);};this.delete=t=>{if(this.createQueue.queue.has(t)){this.createQueue.queue.delete(t);return}this.deleteQueue.add(t);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=u,this.createQueue=new jt({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new jt({action:async g=>{await this.createQueue.flush();let w=Array.from(g.entries());for(let[k,S]of w)await this.updateEntity(k,S);},delay:t,enableBatch:o,batchSize:l,name:`${u}:updateQueue`}),this.deleteQueue=new jt({action:async g=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(g.keys()));},delay:t,enableBatch:i,batchSize:d,name:`${u}:deleteQueue`});}};var Na=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r},this.api.requestOptions);}async getEntity(r){return await this.api.spans.getSpanById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o,this.api.requestOptions);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o,this.api.requestOptions);}};var Fa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Oa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r},this.api.requestOptions);}async getEntity(r){return await this.api.traces.getTraceById(r,{},this.api.requestOptions)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o,this.api.requestOptions);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r},this.api.requestOptions);}};var Wa=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r},this.api.requestOptions);}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(r){for(let o of r)await this.api.traces.deleteTraceFeedbackScore(o.id,{name:o.name},this.api.requestOptions);}};var Ba=class extends It{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var La=class extends se{constructor(r,o){super({delay:o,enableCreateBatch:true,enableUpdateBatch:true,enableDeleteBatch:true,name:"DatasetBatchQueue"});this.api=r;}getId(r){return r.id||""}async createEntities(r){for(let o of r)await this.api.datasets.createDataset(o,this.api.requestOptions);}async getEntity(r){try{return await this.api.datasets.getDatasetById(r,this.api.requestOptions)}catch{return}}async updateEntity(r,o){await this.api.datasets.updateDataset(r,{name:o.name||"",visibility:o.visibility,description:o.description},this.api.requestOptions);}async deleteEntities(r){await this.api.datasets.deleteDatasetsBatch({ids:r},this.api.requestOptions);}};var Fd=null;async function kg(){return Fd||(Fd=await aR()),Fd}var Ut=class s{constructor(t){let{id:r,traceId:o,spanId:i,source:a,...l}=t;this.id=r||q(),this.traceId=o,this.spanId=i,this.source=a||Tn.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=nR(t);return (await kg()).h32(r,43981).toString(16)}toApiModel(){return {id:this.id,traceId:this.traceId,spanId:this.spanId,source:this.source,data:this.getContent()}}static fromApiModel(t){return new s({id:t.id,traceId:t.traceId,spanId:t.spanId,source:t.source,...t.data})}};async function ve(s,t,r){var l;if(r===0)return [];let o=new TextDecoder("utf-8"),i=[],a="";try{for await(let d of s){a+=o.decode(d,{stream:!0});let u=a.split(`
4
- `);a=(l=u.pop())!=null?l:"";for(let g of u)if(!(!g.trim()||g==="{}"||g==="[]"||g==="null"))try{let w=JSON.parse(g),k=t.parse(w);if(k.ok){if(i.push(k.value),r!==void 0&&i.length>=r)return i}else z.error("Error parsing experiment item:",k.errors);}catch(w){z.error("Error parsing JSON line:",w instanceof Error?w.message:String(w));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let d=JSON.parse(a),u=t.parse(d);u.ok?i.push(u.value):z.error("Error parsing experiment item:",u.errors);}catch(d){z.error("Error parsing remaining buffer:",d instanceof Error?d.message:String(d));}}catch(d){z.error("Error processing stream:",d instanceof Error?d.message:String(d));}return i}function Dt(s,t){let r=[];for(let o=0;o<s.length;o+=t.maxBatchSize)r.push(s.slice(o,o+t.maxBatchSize));return r}var ne=class extends Error{constructor(t){var r;super(t.message),this.name=this.constructor.name,this.code=t.code,this.statusCode=t.statusCode,this.details=t.details,this.originalError=t.originalError,z.error(this.message),(r=Error.captureStackTrace)==null||r.call(Error,this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,details:this.details,originalError:this.originalError,stack:this.stack}}};var Sg={DATASET_NOT_FOUND:s=>`Dataset with name '${s}' not found`,DATASET_ITEM_NOT_FOUND:s=>`Dataset item with id '${s}' not found`,DATASET_ITEM_MISSING_ID:s=>`Item at index ${s} is missing an ID required for update`,INVALID_JSON_FORMAT:s=>`Invalid JSON format${s?": "+s:""}`,JSON_NOT_ARRAY:"JSON input must be an array of objects",ITEM_NOT_OBJECT:(s,t)=>`Item at position ${s} is not an object (${t})`,INSERTION_FAILED:s=>`Failed to insert items from JSON: ${s}`,DATASET_JSON_PARSE_ERROR:s=>`Failed to parse JSON input: ${s}`};var pR={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID"},Va=class extends ne{constructor(t){super({message:Sg.DATASET_ITEM_MISSING_ID(t),code:pR.DATASET_ITEM_MISSING_ID});}};var cR={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Ha=class extends ne{constructor(t){super({message:t,code:cR.SEARCH_TIMEOUT});}};var Ja={JSON_NOT_ARRAY:s=>`JSON input must be an array of objects${s?` (${s})`:""}`,JSON_PARSE_ERROR:"Failed to parse JSON input",JSON_ITEM_NOT_OBJECT:(s,t)=>`Item at position ${s} is not an object (${t})`};var Od={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},Xa=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Ja.JSON_PARSE_ERROR,code:Od.JSON_PARSE_ERROR,originalError:r});}},Ka=class extends ne{constructor(t){super({message:Ja.JSON_NOT_ARRAY(t),code:Od.JSON_NOT_ARRAY});}},Ga=class extends ne{constructor(t,r){super({message:Ja.JSON_ITEM_NOT_OBJECT(t,r),code:Od.JSON_ITEM_NOT_OBJECT});}};var kr=class{constructor({name:t,description:r,id:o},i){this.opik=i;this.idToHash=new Map;this.hashes=new Set;this.id=o||q(),this.name=t,this.description=r;}async insert(t){if(!t||t.length===0)return;await this.opik.datasetBatchQueue.flush(),await this.syncHashes();let r=await this.getDeduplicatedItems(t),o=Dt(r,{maxBatchSize:1e3});try{let i=0;for(let a of o)await this.opik.api.datasets.createOrUpdateDatasetItems({datasetId:this.id,items:a}),i+=a.length,z.info(`Inserted ${Math.min(i,r.length)} of ${r.length} items into dataset ${this.id}`);}catch(i){throw z.error(`Error inserting items into dataset: ${i instanceof Error?i.message:String(i)}`),i}}async update(t){if(!(!t||t.length===0)){for(let r=0;r<t.length;r++)if(!t[r].id)throw new Va(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Dt(t,{maxBatchSize:100});for await(let o of r){z.debug("Deleting dataset items batch",{batchSize:o.length,datasetId:this.id}),await this.opik.api.datasets.deleteDatasetItems({itemIds:o});for(let i of o)if(this.idToHash.has(i)){let a=this.idToHash.get(i);this.hashes.delete(a),this.idToHash.delete(i);}}}async clear(){let r=(await this.getItems()).map(o=>o.id).filter(Boolean);r.length!==0&&await this.delete(r);}async getItems(t,r){return (await this.getItemsAsDataclasses(t,r)).map(i=>i.getContent(true))}async getItemsAsDataclasses(t,r){let o=t?Math.min(t,2e3):2e3,i=await this.opik.api.datasets.streamDatasetItems({datasetName:this.name,lastRetrievedId:r,steamLimit:o});return (await ve(i,C.DatasetItemPublic,t)).map(l=>Ut.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new Xa(l)}if(!Array.isArray(i))throw new Ka(typeof i);if(i.length===0)return;for(let l=0;l<i.length;l++){let d=i[l];if(typeof d!="object"||d===null)throw new Ga(l,typeof d)}let a=i.map(l=>{let d=l,u={};for(let[g,w]of Object.entries(d)){if(o.includes(g))continue;let k=r[g]||g;u[k]=w;}return u});await this.insert(a);}async toJson(t={}){let o=(await this.getItems()).map(i=>{let a={...i};if(Object.keys(t).length>0){for(let[l,d]of Object.entries(t))if(l in a){let u=a[l];delete a[l],a[d]=u;}}return a});return nR(o)}async getDeduplicatedItems(t){let r=[];for(let o of t){let i=new Ut(o),a=await i.contentHash();if(this.hashes.has(a)){z.debug("Duplicate item found - skipping",{contentHash:a,datasetId:this.id});continue}r.push(i.toApiModel()),this.hashes.add(a),this.idToHash.set(i.id,a);}return r}clearHashState(){this.idToHash.clear(),this.hashes.clear();}async syncHashes(){z.debug("Syncing dataset hashes with backend",{datasetId:this.id});try{let t=await this.getItemsAsDataclasses();this.clearHashState();for(let r of t){let o=await r.contentHash();this.idToHash.set(r.id,o),this.hashes.add(o);}z.debug("Dataset hash sync completed",{datasetId:this.id,itemCount:t.length});}catch(t){if(t instanceof p&&t.statusCode===404){z.debug("Dataset not found - starting with empty hash state",{datasetId:this.id}),this.clearHashState();return}throw t}}};var Wd=class extends Error{constructor(t){super(t),this.name="DatasetError";}},Mt=class extends Wd{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var $a=class{constructor(t){if(!t.datasetItemId)throw new Error("datasetItemId is required");if(!t.traceId)throw new Error("traceId is required");this.datasetItemId=t.datasetItemId,this.traceId=t.traceId;}},Qa=class s{constructor(t){this.id=t.id,this.datasetItemId=t.datasetItemId,this.traceId=t.traceId,this.datasetItemData=t.datasetItemData,this.evaluationTaskOutput=t.evaluationTaskOutput,this.feedbackScores=[...t.feedbackScores];}static fromRestExperimentItemCompare(t){var o,i;let r=(i=(o=t.feedbackScores)==null?void 0:o.map(a=>({categoryName:a.categoryName,name:a.name,reason:a.reason,value:a.value,source:a.source})))!=null?i:[];return new s({id:t.id,traceId:t.traceId,datasetItemId:t.datasetItemId,datasetItemData:t.input,evaluationTaskOutput:t.output,feedbackScores:r})}};var rr=class{constructor({id:t,name:r,datasetName:o,prompts:i},a){this.opik=a;this.id=t||q(),this._name=r,this.datasetName=o,this.prompts=i;}get name(){return this._name}async ensureNameLoaded(){if(this._name!==void 0)return this._name;let t=await this.opik.api.experiments.getExperimentById(this.id);if(this._name=t.name,!this._name)throw new Error("Experiment name is not loaded");return this._name}async insert(t){if(t.length===0)return;let r=t.map(i=>({id:q(),experimentId:this.id,datasetItemId:i.datasetItemId,traceId:i.traceId})),o=Dt(r,{maxBatchSize:50});try{for(let i of o)await this.opik.api.experiments.createExperimentItems({experimentItems:i});z.debug(`Inserted ${t.length} items into experiment ${this.id}`);}catch(i){throw z.error(`Error inserting items into experiment: ${i instanceof Error?i.message:String(i)}`),i}}async getItems(t){let r=[],{maxResults:i,truncate:a=false}=t||{},l,d=true;try{for(;d&&!(i!==void 0&&r.length>=i);){let u=i?Math.min(i-r.length,2e3):2e3,g=await this.opik.api.experiments.streamExperimentItems({experimentName:this.name,limit:u,lastRetrievedId:l,truncate:a});try{let w=await ve(g,C.ExperimentItemCompare,u);if(w.length===0){d=!1;break}for(let k of w){let S=Qa.fromRestExperimentItemCompare(k);if(r.push(S),i!==void 0&&r.length>=i){d=!1;break}}l=w[w.length-1].id;}catch(w){z.error("Error parsing experiment item: "+(w instanceof Error?w.message:String(w))),d=!1;break}}}catch(u){throw z.error("Error retrieving experiment items: "+(u instanceof Error?u.message:String(u))),u}return z.info(`Retrieved ${r.length} items${i?` (limited by maxResults=${i})`:""}`),r}async getUrl(){let t=await this.opik.getDataset(this.datasetName),r=this.opik.config.apiUrl||dn.apiUrl;return yg({datasetId:t.id,experimentId:this.id,baseUrl:r})}};var Ya={EXPERIMENT_NOT_FOUND:s=>`Experiment with name '${s}' not found`,INVALID_CONFIG_TYPE:s=>`experimentConfig must be a plain object, but ${s} was provided. Please provide a valid configuration object like { model: 'gpt-4', temperature: 0.7 }`,CONFIG_PROMPTS_CONFLICT:()=>`Cannot specify both 'prompts' parameter and 'experimentConfig.prompts'. Choose one approach:
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 Mt(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"},Ha=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"},Ja=class extends ne{constructor(t){super({message:t,code:lR.SEARCH_TIMEOUT});}};var Xa={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"},Ka=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Xa.JSON_PARSE_ERROR,code:Wd.JSON_PARSE_ERROR,originalError:r});}},Ga=class extends ne{constructor(t){super({message:Xa.JSON_NOT_ARRAY(t),code:Wd.JSON_NOT_ARRAY});}},$a=class extends ne{constructor(t,r){super({message:Xa.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=Mt(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 Ha(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Mt(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=>Dt.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new Ka(l)}if(!Array.isArray(i))throw new Ga(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 $a(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 Dt(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";}},Nt=class extends Bd{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var Qa=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;}},Ya=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=Mt(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=Ya.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||un.apiUrl;return zg({datasetId:t.id,experimentId:this.id,baseUrl:r})}};var Za={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 Bd={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Nt=class extends ne{constructor(t){super({message:Ya.EXPERIMENT_NOT_FOUND(t),code:Bd.EXPERIMENT_NOT_FOUND});}},Ft=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(Ya.INVALID_CONFIG_TYPE(t),Bd.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(Ya.CONFIG_PROMPTS_CONFLICT(),Bd.CONFIG_PROMPTS_CONFLICT)}};function xg(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw Ft.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw Ft.promptsConflict();if(!s&&(!t||t.length===0))return [void 0,void 0];let r=s?structuredClone(s):{},o;if(t&&t.length>0){o=[];let i={};for(let a of t)o.push({id:a.versionId}),i[a.name]=a.prompt;r.prompts=i;}return Object.keys(r).length===0?[void 0,void 0]:[r,o]}var ue={MUSTACHE:"mustache",JINJA2:"jinja2"};var J=class s extends Error{constructor(t){super(t),this.name="PromptValidationError",Object.setPrototypeOf(this,s.prototype);}};function dR(s){try{let r=mR.parse(s).filter(o=>{let i=o[0];return i==="name"||i==="#"||i==="&"||i==="^"}).map(o=>o[1].split(".")[0]);return new Set(r)}catch(t){throw new J(`Invalid Mustache template syntax: ${t instanceof Error?t.message:String(t)}`)}}function _g(s,t,r){if(r!=="mustache")return;let o=dR(s),i=new Set(Object.keys(t)),a=new Set([...o].filter(l=>!i.has(l)));if(a.size>0){let l=[];throw l.push(`Missing required variables: ${[...a].join(", ")}`),l.push(`Template placeholders: {${[...o].join(", ")}}`),l.push(`Provided variables: {${[...i].join(", ")}}`),new J(`Template variables validation failed:
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"},Ft=class extends ne{constructor(t){super({message:Za.EXPERIMENT_NOT_FOUND(t),code:Ld.EXPERIMENT_NOT_FOUND});}},Ot=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(Za.INVALID_CONFIG_TYPE(t),Ld.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(Za.CONFIG_PROMPTS_CONFLICT(),Ld.CONFIG_PROMPTS_CONFLICT)}};function _g(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw Ot.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw Ot.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(_g(s,t,r),r){case "mustache":return mR.render(s,t,{},{escape:o=>o});case "jinja2":return gR.renderString(s,t);default:return s}}catch(o){if(o instanceof J)throw o;let i=o instanceof Error?o.message:String(o);throw new J(`Failed to format prompt template: ${i}`)}}var Ot=class s{constructor(t){this.id=t.versionId,this.name=t.name,this.prompt=t.prompt,this.commit=t.commit,this.type=t.type,this.metadata=t.metadata,this.changeDescription=t.changeDescription,this.createdAt=t.createdAt,this.createdBy=t.createdBy;}format(t){return Re(this.prompt,t,this.type)}getVersionAge(){return this.createdAt?formatDistanceToNow(new Date(this.createdAt),{addSuffix:true}):"Unknown"}getVersionInfo(){let t=[`[${this.commit}]`];if(this.createdAt){let r=new Date(this.createdAt);t.push(r.toISOString().split("T")[0]);}return this.createdBy&&t.push(`by ${this.createdBy}`),this.changeDescription&&t.push(`- ${this.changeDescription}`),t.join(" ")}compareTo(t){let r=`Current version [${this.commit}]`,o=`Other version [${t.commit}]`,i=diffStringsUnified(t.prompt,this.prompt,{aAnnotation:o,bAnnotation:r,includeChangeCounts:true,contextLines:3,expand:false});return z.info(`
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 Wt=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=>Ot.fromApiResponse(this.name,a))}catch(r){throw z.error("Failed to get prompt versions",{promptId:this.id,name:this.name,error:r}),r}}async useVersion(t){z.debug("Restoring prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit});try{let r=await this.opik.api.prompts.restorePromptVersion(this.id,t.id,this.opik.api.requestOptions);return z.debug("Successfully restored prompt version",{promptId:this.id,name:this.name,restoredVersionId:r.id,restoredCommit:r.commit}),s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){throw z.error("Failed to restore prompt version",{promptId:this.id,name:this.name,versionId:t.id,versionCommit:t.commit,error:r}),r}}async getVersion(t){try{let r=await this.opik.api.prompts.retrievePromptVersion({name:this.name,commit:t},this.opik.api.requestOptions);return s.fromApiResponse({name:this.name,description:this.description,tags:this._tags},r,this.opik)}catch(r){if(r&&typeof r=="object"&&"statusCode"in r&&r.statusCode===404)return null;throw z.error("Failed to retrieve prompt version",{promptName:this.name,commit:t,error:r}),r}}};async function Ag(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(bR(o))return null;throw o}}function Tg(s,t,r){return t?t.template!==s.prompt||!RR(t.metadata,s.metadata)||t.type!==r:true}function RR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return hR(r,o)}function bR(s){return typeof s=="object"&&s!==null&&"statusCode"in s&&s.statusCode===404}var oe=class{constructor(t){this.input=t;this.cursor=0;}getPosition(){return this.cursor}getRemainingInput(){return this.input.slice(this.cursor)}getFullInput(){return this.input}isAtEnd(){return this.cursor>=this.input.length}peekChar(){return this.input[this.cursor]}peekCharAt(t){return this.input[this.cursor+t]}consumeChar(){return this.input[this.cursor++]}advance(t=1){this.cursor+=t;}skipWhitespace(){for(;this.cursor<this.input.length&&/\s/.test(this.input[this.cursor]);)this.cursor++;}consumeWhile(t){let r=this.cursor;for(;this.cursor<this.input.length&&t(this.input[this.cursor]);)this.cursor++;return this.input.slice(r,this.cursor)}sliceFrom(t){return this.input.slice(t,this.cursor)}static isFieldChar(t){return /[a-zA-Z0-9_]/.test(t)}static isLetterChar(t){return /[a-zA-Z]/.test(t)}static isDigitChar(t){return /\d/.test(t)}static isWhitespaceChar(t){return /\s/.test(t)}static isQuoteChar(t){return t==='"'||t==="'"}};var V={STRING_OPS:["=","contains","not_contains","starts_with","ends_with","!=",">","<"],NUMERIC_OPS:["=","!=",">","<",">=","<="],DATETIME_OPS:["=",">","<",">=","<="],LIST_OPS:["contains"],DICT_OPS:["=","contains",">","<"],LIMITED_STRING_OPS:["=","contains","not_contains"]},Ie={id:"string",name:"string",status:"string",start_time:"date_time",end_time:"date_time",input:"string",output:"string",metadata:"dictionary",feedback_scores:"feedback_scores_number",tags:"list","usage.total_tokens":"number","usage.prompt_tokens":"number","usage.completion_tokens":"number",duration:"number",number_of_messages:"number",created_by:"string",thread_id:"string",total_estimated_cost:"number",type:"string",model:"string",provider:"string"},Eg={id:V.STRING_OPS,name:V.STRING_OPS,status:V.LIMITED_STRING_OPS,start_time:V.DATETIME_OPS,end_time:V.DATETIME_OPS,input:V.LIMITED_STRING_OPS,output:V.LIMITED_STRING_OPS,metadata:V.DICT_OPS,feedback_scores:V.NUMERIC_OPS,tags:V.LIST_OPS,"usage.total_tokens":V.NUMERIC_OPS,"usage.prompt_tokens":V.NUMERIC_OPS,"usage.completion_tokens":V.NUMERIC_OPS,duration:V.NUMERIC_OPS,number_of_messages:V.NUMERIC_OPS,created_by:V.STRING_OPS,thread_id:V.STRING_OPS,total_estimated_cost:V.NUMERIC_OPS,type:V.STRING_OPS,model:V.STRING_OPS,provider:V.STRING_OPS},Za={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function Pg(s){let t=Za.SPECIAL_FIELDS.includes(s),r=Object.keys(Ie).includes(s);if(!t&&!r){let o=Object.keys(Ie).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${o} are supported.`)}}function vg(s,t){if(!Za.SPECIAL_FIELDS.includes(s)){let r=Object.keys(Ie).join(", ");throw new Error(`Field ${s}.${t} is not supported, only the fields ${r} are supported.`)}if(s==="usage"&&!Za.USAGE_KEYS.includes(t))throw new Error(`When querying usage, ${t} is not supported, only usage.total_tokens, usage.prompt_tokens and usage.completion_tokens are supported.`)}function Ld(s,t){let r=Eg[s];if(!(r!=null&&r.includes(t))){let o=(r==null?void 0:r.join(", "))||"none";throw new Error(`Operator ${t} is not supported for field ${s}, only the operators ${o} are supported.`)}}function Cg(s){let t=s.toLowerCase();if(t==="and")return true;throw t==="or"?new Error("Invalid filter string, OR is not currently supported"):new Error(`Invalid filter string, trailing characters ${s}`)}function qa(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Wt=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return Pg(r),t.peekChar()==="."?this.parseFieldWithKey(t,r):{type:"simple",field:r,columnType:Ie[r]}}static parseFieldName(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseFieldWithKey(t,r){t.advance();let o=this.parseKey(t);if(vg(r,o),r==="usage"){let i=`usage.${o}`;return {type:"simple",field:i,columnType:Ie[i]}}return {type:"nested",field:r,key:o,columnType:Ie[r]}}static parseKey(t){let r=t.peekChar();return oe.isQuoteChar(r)?this.parseQuotedKey(t,r):this.parseUnquotedKey(t)}static parseUnquotedKey(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseQuotedKey(t,r){let o=t.getPosition();t.advance();let i="",a=false;for(;!t.isAtEnd();){let d=t.peekChar();if(d===r){if(t.peekCharAt(1)===r){i+=r,t.advance(2);continue}a=true,t.advance();break}i+=d,t.advance();}let l=t.getFullInput().slice(o);return qa(a,o,l),i}};var Bt=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Ld(r,i),{operator:i};let a=this.parseWordOperator(t);return Ld(r,a),{operator:a}}static tryParseSymbolicOperator(t,r){if(r==="=")return t.advance(),"=";if(r==="<"||r===">"){let o=r;return t.advance(),t.peekChar()==="="?(t.advance(),o+"="):o}return r==="!"&&t.peekCharAt(1)==="="?(t.advance(2),"!="):null}static parseWordOperator(t){return t.consumeWhile(r=>!oe.isWhitespaceChar(r))}};var Lt=class{static parse(t){t.skipWhitespace();let r=t.getPosition(),o=t.peekChar();if(o==='"')return this.parseQuotedString(t,r);if(oe.isDigitChar(o)||o==="-")return this.parseNumber(t);let i=t.getRemainingInput();throw new Error(`Invalid value ${i.slice(0,20)}, expected a string in double quotes("value") or a number`)}static parseQuotedString(t,r){t.advance();let o=t.getPosition(),i=false;for(;!t.isAtEnd();){if(t.peekChar()==='"'){i=true;break}t.advance();}qa(i,r,`value starting at position ${r}`);let a=t.sliceFrom(o);return t.advance(),{value:a}}static parseNumber(t){let r="";return t.peekChar()==="-"&&(r+=t.consumeChar()),r+=this.parseDigits(t),t.peekChar()==="."&&(r+=t.consumeChar(),r+=this.parseDigits(t)),{value:r}}static parseDigits(t){return t.consumeWhile(r=>oe.isDigitChar(r))}};var je=class{constructor(t){let r=t||"";this.filterExpressions=r?this.parse(r):null,this.parsedFilters=this.filterExpressions?JSON.stringify(this.filterExpressions):null;}getFilterExpressions(){return this.filterExpressions}parse(t){let r=new oe(t),o=[];for(;!r.isAtEnd();){let i=this.parseExpression(r);if(o.push(i),r.skipWhitespace(),!r.isAtEnd()&&!this.parseConnector(r))break}return o}parseExpression(t){let r=Wt.parse(t),o=Bt.parse(t,this.getFieldName(r)),i=Lt.parse(t);return this.buildExpression(r,o,i)}getFieldName(t){return t.field}buildExpression(t,r,o){let i={field:t.field,operator:r.operator,value:o.value,type:t.columnType};return t.type==="nested"&&(i.key=t.key),i}parseConnector(t){let r=t.getPosition(),o=t.consumeWhile(i=>oe.isLetterChar(i));try{return Cg(o)}catch(i){if(i instanceof Error&&i.message.includes("trailing characters")){let a=t.getFullInput().slice(r);throw new Error(`Invalid filter string, trailing characters ${a}`)}throw i}}};async function Ig(s,t,r,o,i){let a=await s.traces.searchTraces({projectName:t,filters:r!=null?r:void 0,limit:o,truncate:i});return await ve(a,C.TracePublic,o)}async function jg(s,t,r,o){let i=Date.now(),a=[];for(;;){if(a=await s(),a.length>=t||Date.now()-i>=r)return a;await new Promise(d=>setTimeout(d,o));}}function Ug(s){if(!s)return null;let r=new je(s).getFilterExpressions();return r?r.map(o=>{let i={field:o.field,operator:o.operator,value:o.value};return o.key&&(i.key=o.key),i}):null}var Vd=[],or=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=zg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Kt(r)}`),this.lastProjectNameLogged=t;};this.trace=t=>{var i;z.debug("Creating new trace with data:",t);let r=(i=t.projectName)!=null?i:this.config.projectName,o=new Ua({id:q(),startTime:new Date,...t,projectName:r},this);return this.traceBatchQueue.create(o.data),z.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.getDataset=async t=>{z.debug(`Getting dataset with name "${t}"`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.getDatasetByIdentifier({datasetName:t});return new kr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Mt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new kr({name:t,description:r},this);try{return this.datasetBatchQueue.create({name:o.name,description:o.description,id:o.id}),z.debug("Dataset added to the queue with name:",o.name),o}catch(i){throw z.error(`Failed to create dataset "${t}"`,{error:i}),new Error(`Error creating dataset "${t}": ${i}`)}};this.getOrCreateDataset=async(t,r)=>{z.debug(`Attempting to retrieve or create dataset with name: "${t}"`);try{return await this.getDataset(t)}catch(o){if(o instanceof Mt)return z.info(`Dataset "${t}" not found. Proceeding to create a new one.`),this.createDataset(t,r);throw z.error(`Error retrieving dataset "${t}":`,o),o}};this.getDatasets=async(t=100)=>{z.debug(`Getting all datasets (limit: ${t})`);try{await this.datasetBatchQueue.flush();let r=await this.api.datasets.findDatasets({size:t}),o=[];for(let i of r.content||[])o.push(new kr(i,this));return z.info(`Retrieved ${o.length} datasets`),o}catch(r){throw z.error("Failed to retrieve datasets",{error:r}),new Error("Failed to retrieve datasets")}};this.deleteDataset=async t=>{z.debug(`Deleting dataset with name "${t}"`);try{let r=await this.getDataset(t);if(!r.id)throw new Error(`Cannot delete dataset "${t}": ID not available`);this.datasetBatchQueue.delete(r.id);}catch(r){throw z.error(`Failed to delete dataset "${t}"`,{error:r}),new Error(`Failed to delete dataset "${t}": ${r}`)}};this.createExperiment=async({datasetName:t,name:r,experimentConfig:o,prompts:i,type:a=En.Regular,optimizationId:l})=>{if(z.debug(`Creating experiment for dataset "${t}"`),!t)throw new Error("Dataset name is required to create an experiment");let[d,u]=xg(o,i),g=q(),w=new rr({id:g,name:r,datasetName:t,prompts:i},this);try{return this.api.experiments.createExperiment({id:g,datasetName:t,name:r,metadata:d,promptVersions:u,type:a,optimizationId:l}),z.debug("Experiment added to the queue with id:",g),w}catch(k){throw z.error(`Failed to create experiment for dataset "${t}"`,{error:k}),new Error(`Error creating experiment: ${k}`)}};this.updateExperiment=async(t,r)=>{if(!t)throw new Error("id is required to update an experiment");let{name:o,experimentConfig:i}=r;if(!o&&!i)throw new Error("At least one of 'name' or 'experimentConfig' must be provided to update an experiment");z.debug(`Updating experiment with ID "${t}"`);let a={};o!==void 0&&(a.name=o),i!==void 0&&(a.metadata=i);try{await this.api.experiments.updateExperiment(t,a);}catch(l){throw z.error(`Failed to update experiment with ID "${t}"`,{error:l}),l}};this.getExperimentById=async t=>{z.debug(`Getting experiment with ID "${t}"`);try{let r=await this.api.experiments.getExperimentById(t);return new rr({id:r.id,name:r.name,datasetName:r.datasetName},this)}catch(r){throw r instanceof p&&r.statusCode===404?new Nt(`No experiment found with ID '${t}'`):(z.error(`Failed to get experiment with ID "${t}"`,{error:r}),r)}};this.getExperimentsByName=async t=>{z.debug(`Getting experiments with name "${t}"`);try{let r=await this.api.experiments.streamExperiments({name:t});return (await ve(r,C.ExperimentPublic)).map(i=>new rr({id:i.id,name:i.name,datasetName:i.datasetName},this))}catch(r){throw z.error(`Failed to get experiments with name "${t}"`,{error:r}),r}};this.getExperiment=async t=>{z.debug(`Getting experiment with name "${t}"`);let r=await this.getExperimentsByName(t);if(r.length===0)throw new Nt(t);return r[0]};this.getDatasetExperiments=async(t,r=100)=>{var l;z.debug(`Getting experiments for dataset "${t}"`);let o=await this.getDataset(t),i=Math.min(100,r),a=[];try{let d=1;for(;a.length<r;){let u=await this.api.experiments.findExperiments({page:d,size:i,datasetId:o.id}),g=(l=u==null?void 0:u.content)!=null?l:[];if(g.length===0)break;let w=r-a.length,k=Math.min(g.length,w);for(let S=0;S<k;S++){let x=g[S];a.push(new rr({id:x.id,name:x.name,datasetName:x.datasetName},this));}if(k<g.length)break;d+=1;}return a}catch(d){throw z.error(`Failed to get experiments for dataset "${t}"`,{error:d}),d}};this.deleteExperiment=async t=>{z.debug(`Deleting experiment with ID "${t}"`);try{await this.api.experiments.deleteExperimentsById({ids:[t]});}catch(r){throw z.error(`Failed to delete experiment with ID "${t}"`,{error:r}),r}};this.createPrompt=async t=>{var r;z.debug("Creating prompt",{name:t.name});try{let o=await Ag(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=Tg(t,o,i),l;if(a?(z.debug("Creating new prompt version",{name:t.name}),l=await this.api.prompts.createPromptVersion({name:t.name,version:{template:t.prompt,metadata:t.metadata,type:i}},this.api.requestOptions)):(z.debug("Returning existing prompt version",{name:t.name}),l=o),!l.promptId)throw new Error("Invalid API response: missing promptId");let d=await this.api.prompts.getPromptById(l.promptId,this.api.requestOptions),u=Ce.fromApiResponse(d,l,this);return z.debug("Prompt created",{name:t.name}),t.description||t.tags?await u.updateProperties({description:t.description,tags:t.tags}):u}catch(o){throw z.error("Failed to create prompt",{name:t.name,error:o}),o}};this.getPrompt=async t=>{var r;z.debug("Getting prompt",t);try{let i=(r=(await this.api.prompts.getPrompts({filters:JSON.stringify([{field:"name",operator:"=",value:t.name}]),size:1},this.api.requestOptions)).content)==null?void 0:r[0];if(!i)return z.debug("Prompt not found",{name:t.name}),null;let a=await this.api.prompts.retrievePromptVersion(t,this.api.requestOptions);return Ce.fromApiResponse(i,a,this)}catch(o){if(o instanceof p&&o.statusCode===404)return null;throw z.error("Failed to get prompt",{name:t.name,error:o}),o}};this.searchPrompts=async t=>{var r;z.debug("Searching prompts",{filterString:t});try{let o;if(t){let u=new je(t).getFilterExpressions();o=u?JSON.stringify(u):void 0;}let a=(r=(await this.api.prompts.getPrompts({filters:o,size:1e3},this.api.requestOptions)).content)!=null?r:[];return (await Promise.all(a.map(async d=>{if(!d.name)return null;try{let u=await this.api.prompts.retrievePromptVersion({name:d.name},this.api.requestOptions);return Ce.fromApiResponse(d,u,this)}catch(u){return z.debug("Failed to get version for prompt",{name:d.name,error:u}),null}}))).filter(d=>d!==null)}catch(o){throw z.error("Failed to search prompts",{error:o}),o}};this.deletePrompts=async t=>{z.debug("Deleting prompts in batch",{count:t.length});try{await this.api.prompts.deletePromptsBatch({ids:t},this.api.requestOptions),z.info("Successfully deleted prompts",{count:t.length});}catch(r){throw z.error("Failed to delete prompts",{count:t.length,error:r}),r}};this.searchTraces=async t=>{let{projectName:r,filterString:o,maxResults:i=1e3,truncate:a=true,waitForAtLeast:l,waitForTimeout:d=60}=t!=null?t:{};z.debug("Searching traces",{projectName:r,filterString:o,maxResults:i,truncate:a,waitForAtLeast:l,waitForTimeout:d});let u=Ug(o),g=r!=null?r:this.config.projectName,w=()=>Ig(this.api,g,u,i,a);if(l===void 0)return await w();let k=await jg(w,l,d*1e3,5e3);if(k.length<l)throw new Ha(`Timeout after ${d} seconds: expected ${l} traces, but only ${k.length} were found.`);return k};this.flush=async()=>{z.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),await this.datasetBatchQueue.flush(),z.info("Successfully flushed all data to Opik");}catch(t){z.error("Error during flush operation:",{error:t instanceof Error?t.message:t});}};z.debug("Initializing OpikClient with config:",t),this.config=pu(t);let r={apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName};t!=null&&t.headers&&(z.debug("Initializing OpikClient with additional headers:",t==null?void 0:t.headers),r.requestOptions={headers:t==null?void 0:t.headers}),this.api=new Ba(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Na(this.api,o),this.traceBatchQueue=new Oa(this.api,o),this.spanFeedbackScoresBatchQueue=new Fa(this.api,o),this.traceFeedbackScoresBatchQueue=new Wa(this.api,o),this.datasetBatchQueue=new La(this.api,o),Vd.push(this);}};var zR="track.decorator",Vt=new AsyncLocalStorage,kR=()=>{let{span:s,trace:t}=Vt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function SR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function xR({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){z.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let a=o;a||(a=Jd().trace({name:s,projectName:r}));let l=a.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return z.debug("Span created with ID:",l.data.id),{span:l,trace:a}}function _R({args:s,span:t,trace:r}){if(z.debug("Starting span execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};z.debug("Recording span input"),t.update({input:o}),r&&(z.debug("Recording trace input"),r.update({input:o}));}function Dg({result:s,span:t,trace:r,enrichSpan:o}){z.debug("Recording successful execution:",{spanId:t.data.id,traceId:r==null?void 0:r.data.id});let i=typeof s=="object"?s:{result:s},a=new Date,l={endTime:a,output:i};if(o){let d=o(s);Object.assign(l,d);}t.update(l),r&&r.update({endTime:a,output:i});}function Mg({span:s,error:t,trace:r}){var o,i;z.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function en({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Vt.getStore(),{span:u,trace:g}=xR({name:s!=null?s:i.name||zR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Vt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{_R({args:l,span:u,trace:S});let x=i.apply(k,l);return SR(x)?x.then(T=>(Dg({span:u,result:T,trace:S,enrichSpan:o}),T),T=>{throw Mg({span:u,error:T,trace:S}),T}):(Dg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw Mg({span:u,error:x,trace:S}),x}})}}function _e(s,t){if(typeof s=="function")return en({},s);let r=s;return t?en(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return en(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=en(r,a),i}}var Hd=null;function Jd(){return Hd===null&&(Hd=new or),Hd}var AR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([Jd().flush(),...Vd.map(s=>s.flush())]),z.debug("flushAll operation completed successfully");}catch(s){throw z.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};function Ng(s,t){if(!t||typeof t!="object")throw new Error("Arguments must be an object");let r=s.validationSchema,i=r.extend(Object.fromEntries(Object.entries(r.shape).map(([a,l])=>[a,l.refine(d=>d!==void 0,{message:`${a} cannot be undefined`,path:[a]})]))).safeParse(t);if(!i.success){let a=i.error.issues.map(d=>d.path[0]).filter(Boolean),l=[...new Set(a)];throw new Error(TR(s,t,l))}}function TR(s,t,r){let o=Object.keys(t),i=r.filter(a=>!(a in t));return `Metric '${s.name}' is skipped, missing required arguments: ${i.join(", ")}. Available arguments: ${o.join(", ")}.`}var on=class{static calculateAverageScores(t){if(!t||t.length===0)return new Map;let r=new Map;for(let i of t)if(!(!i||!i.scoreResults||i.scoreResults.length===0))for(let a of i.scoreResults){if(!a||a.scoringFailed||typeof a.value!="number")continue;let l=r.get(a.name)||{sum:0,count:0};l.sum+=a.value,l.count+=1,r.set(a.name,l);}let o=new Map;return r.forEach((i,a)=>{o.set(a,i.count>0?i.sum/i.count:0);}),o}static formatScore(t){return t.toFixed(4)}static formatTime(t){let r=Math.floor(t/3600),o=Math.floor(t%3600/60),i=Math.floor(t%60);return `${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}static async generateResultTable(t,r,o,i){if(t.length===0){z.info(`
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(`
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=[rn.bold(`Total time: ${l}`),rn.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return rn.green(`${w}: ${k} (avg)`)})].join(`
15
- `),u=await r.ensureNameLoaded(),g=ER(d,{title:`${u} (${t.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});z.info(`
14
+ No metrics available to display.`);return}let a=[...o.keys()].sort(),l=this.formatTime(i),d=[on.bold(`Total time: ${l}`),on.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return on.green(`${w}: ${k} (avg)`)})].join(`
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(rn.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${Kt(r,"in your Opik dashboard")}`);}static async processResults(t,r,o=0){let i=this.calculateAverageScores(t);await this.generateResultTable(t,r,i,o),await this.displayExperimentLink(r);let a=await r.ensureNameLoaded();return {experimentId:r.id,experimentName:a,testResults:t}}};function Fg(s,t,r){if(!s||typeof t!="string"||t.trim()==="")return r;let o=t.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=s;for(let a of o)if(typeof i=="object"&&i!==null&&a in i)i=i[a];else return r;return i===void 0?r:i}var Og,Xd;Og=[_e({name:"metrics_calculation",type:fe.General})];var Sr=class{constructor(t,r,o){f$1(Xd,5,this);this.client=void 0;this.dataset=void 0;this.task=void 0;this.scoringMetrics=void 0;this.projectName=void 0;this.nbSamples=void 0;this.scoringKeyMapping=void 0;this.experiment=void 0;this.rootTrace=void 0;this.client=r,this.dataset=t.dataset,this.experiment=o,this.task=t.task,this.scoringMetrics=t.scoringMetrics||[],this.projectName=t.projectName,this.nbSamples=t.nbSamples,this.scoringKeyMapping=t.scoringKeyMapping;}async execute(){var w;let t=performance.now(),r=[],o=await this.dataset.getItems(this.nbSamples),i=o.length,a=z.settings.minLevel;z.settings.minLevel=6;let l=PR({text:`Evaluating dataset (0/${i} items)`}).start(),d=[];for(let k=0;k<o.length;k++){let S=o[k];try{this.rootTrace=this.client.trace({projectName:this.projectName,name:"evaluation_task",createdBy:"evaluation",input:S}),Vt.enterWith({trace:this.rootTrace});let x=await this.executeTask(S);d.push(x),this.rootTrace.update({output:x.testCase.taskOutput,endTime:new Date});}catch(x){let T=x instanceof Error?x.message:String(x);z.error(`Error processing dataset item: ${S.id} - ${T}`),x instanceof Error&&this.rootTrace.update({errorInfo:{message:x.message,exceptionType:x.name,traceback:(w=x.stack)!=null?w:""},endTime:new Date});}r.push(new $a({datasetItemId:S.id,traceId:this.rootTrace.data.id})),l.text=`Evaluating dataset (${k+1}/${i} items, ${Math.round((k+1)/i*100)}%)`;}let g=(performance.now()-t)/1e3;return l.succeed(`Evaluation complete: ${i} items processed in ${g.toFixed(2)}s`),z.settings.minLevel=a,this.experiment.insert(r),await this.client.flush(),on.processResults(d,this.experiment,g)}async executeTask(t){let r={},o=[];z.debug(`Starting evaluation task on dataset item ${t.id}`),r=await _e({name:"llm_task",type:fe.General},this.task)(t),z.debug(`Finished evaluation task on dataset item ${t.id}`);let i=this.prepareScoringInputs(t,r),a={traceId:this.rootTrace.data.id,datasetItemId:t.id,scoringInputs:i,taskOutput:r};return this.scoringMetrics.length>0?this.calculateScores(a):{testCase:a,scoreResults:o}}async calculateScores(t){let r=[],{scoringInputs:o}=t;for(let i of this.scoringMetrics){z.debug(`Calculating score for metric ${i.name}`);try{Ng(i,o);let a=await i.score(o),l=Array.isArray(a)?a:[a];r.push(...l);}catch(a){let l=a instanceof Error?a.message:String(a);z.error(`Metric ${i.name} failed: ${l}`);}z.debug(`Finished calculating score for metric ${i.name}`);}return r.forEach(i=>{var a;return (a=this.rootTrace)==null?void 0:a.score({name:i.name,value:i.value,reason:i.reason})}),{testCase:t,scoreResults:r}}prepareScoringInputs(t,r){let o={...t,...r};if(!this.scoringKeyMapping)return o;let i={...o};for(let[a,l]of Object.entries(this.scoringKeyMapping)){let d=Fg(o,l);d!==void 0&&(i[a]=d);}return i}};Xd=d(null),g(Xd,1,"calculateScores",Og,Sr),e$1(Xd,Sr);var xr=class xr{static getInstance(t){return xr.instance||(xr.instance=new or(t)),xr.instance}};xr.instance=null;var tn=xr;async function Wg(s){var o;if(!s.dataset)throw new Error("Dataset is required for evaluation");if(!s.task)throw new Error("Task function is required for evaluation");let t=(o=s.client)!=null?o:tn.getInstance(),r=await t.createExperiment({name:s.experimentName,datasetName:s.dataset.name,experimentConfig:s.experimentConfig,prompts:s.prompts});try{let i=new Sr(s,t,r);return z.info("Starting evaluation"),i.execute()}catch(i){throw z.error(`Error during evaluation: ${i}`),i}}var tr=class{constructor(t){this.modelName=t;}};var Ht=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},_r=class s extends Ht{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ue=class s extends Ht{constructor(t){super(t),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function jR(s,t){return s.startsWith("gpt-")||s.startsWith("o1")||s.startsWith("o3")||s.startsWith("chatgpt-")}function UR(s,t){return s.startsWith("claude-")}function DR(s,t){return s.startsWith("gemini-")||s.startsWith("gemma-")}function Kd(s,t,r){if(!t)throw new Ue(`API key for ${s} is not configured. Please provide it via the 'apiKey' option or set the ${r} environment variable.`)}function Gd(s,t){if(jR(s)){let r=(t==null?void 0:t.apiKey)||process.env.OPENAI_API_KEY;return Kd("OpenAI",r,"OPENAI_API_KEY"),createOpenAI({apiKey:r,...t})(s)}if(UR(s)){let r=(t==null?void 0:t.apiKey)||process.env.ANTHROPIC_API_KEY;return Kd("Anthropic",r,"ANTHROPIC_API_KEY"),createAnthropic({apiKey:r,...t})(s)}if(DR(s)){let r=(t==null?void 0:t.apiKey)||process.env.GOOGLE_API_KEY;return Kd("Google Gemini",r,"GOOGLE_API_KEY"),createGoogleGenerativeAI({apiKey:r,...t})(s)}throw new Ue(`Unable to detect provider for model ID: ${s}. Supported providers are OpenAI (gpt-*, o1*, o3*, chatgpt-*), Anthropic (claude-*), and Google Gemini (gemini-*, gemma-*).`)}var MR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens",reasoningTokens:"reasoning_tokens",cachedInputTokens:"cached_input_tokens"};function NR(s){if(!s||typeof s!="object")return false;let t=s,r="usage"in t,o="response"in t,i="text"in t,a="object"in t;return r||o||i||a}function $d(s,t){if(!NR(s))return {model:t};let r={model:FR(s,t)},o=OR(s.usage);o&&(r.usage=o);let i=WR(s);i&&(r.provider=i);let a=LR(s);a&&(r.metadata=a);let l=VR(s);return l&&(r.output=l),r}function FR(s,t){var r,o;return (o=(r=s.response)==null?void 0:r.modelId)!=null?o:t}function OR(s){if(!s)return;let t={};for(let[r,o]of Object.entries(MR)){let i=s[r];i!==void 0&&(t[o]=i);}return Object.keys(t).length>0?t:void 0}function WR(s){if(!s.providerMetadata)return;let t=Object.keys(s.providerMetadata);return t.length>0?t[0]:void 0}function BR(s){if(!s)return;let t={};return s.id&&(t.id=s.id),s.timestamp&&(t.timestamp=s.timestamp.toISOString()),Object.keys(t).length>0?t:void 0}function LR(s){let t={};s.usage&&(t.usage=s.usage),s.warnings&&s.warnings.length>0&&(t.warnings=s.warnings);let r=BR(s.response);return r&&(t.response=r),s.providerMetadata&&(t.providerMetadata=s.providerMetadata),s.finishReason&&(t.finishReason=s.finishReason),Object.keys(t).length>0?t:void 0}function VR(s){let t={};return "text"in s&&s.text&&(t.text=s.text),"object"in s&&s.object!==void 0&&(t.object=s.object),"toolCalls"in s&&Array.isArray(s.toolCalls)&&(t.toolCalls=s.toolCalls),"toolResults"in s&&Array.isArray(s.toolResults)&&(t.toolResults=s.toolResults),"sources"in s&&Array.isArray(s.sources)&&(t.sources=s.sources),Object.keys(t).length>0?t:void 0}var Ar=class extends tr{constructor(t,r={trackGenerations:true}){let o=typeof t=="string"?t:t.modelId;super(o);let{trackGenerations:i,...a}=r;try{typeof t!="string"?(this.model=t,z.debug("Initialized VercelAIChatModel with custom LanguageModel")):(this.model=Gd(t,a),z.debug(`Initialized VercelAIChatModel with model ID: ${t}`)),i?(this._generateText=_e({name:"model.generateText",type:fe.Llm,enrichSpan:l=>$d(l,this.modelName)},generateText),this._generateObject=_e({name:"model.generateObject",type:fe.Llm,enrichSpan:l=>$d(l,this.modelName)},generateObject)):(this._generateText=generateText,this._generateObject=generateObject);}catch(l){throw new Ue(`Failed to initialize model ${o}: ${l instanceof Error?l.message:String(l)}`)}}async generateString(t,r,o){try{let i;if(r){z.debug(`Generating structured output with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateObject({model:this.model,prompt:t,schema:r,...o});z.debug(`Generated structured output with model ${this.modelName}`),i=JSON.stringify(a.object);}else {z.debug(`Generating text with model ${this.modelName}, input length: ${t.length}`);let a=await this._generateText({model:this.model,prompt:t,...o});z.debug(`Generated text with model ${this.modelName}, output length: ${a.text.length}`),i=a.text;}return i}catch(i){let a=r?`Failed to generate structured output with model ${this.modelName}`:`Failed to generate text with model ${this.modelName}`;throw z.error(a,{error:i}),new _r(a,i instanceof Error?i:new Error(String(i)))}}async generateProviderResponse(t,r){try{z.debug(`Generating provider response with model ${this.modelName}, messages count: ${t.length}`);let o=await this._generateText({model:this.model,messages:t,...r});return z.debug(`Generated provider response with model ${this.modelName}`),o}catch(o){let i=`Failed to generate provider response with model ${this.modelName}`;throw z.error(i,{error:o}),new _r(i,o instanceof Error?o:new Error(String(o)))}}};var Vg="gpt-4o";function Qd(s,t){return new Ar(s,t)}function Hg(s,t){return new Ar(s,t)}function HR(s){return s instanceof tr}function JR(s){return typeof s=="object"&&s!==null&&"modelId"in s&&typeof s.modelId=="string"}function XR(s){return typeof s=="string"&&s.length>0}function KR(s){let t=typeof s,r=t==="object"?JSON.stringify(s):String(s);return new Error(`Invalid model type. Expected one of:
17
+ `),z.info(on.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${Gt(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}),Ht.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 Qa({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(),tn.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 an=_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:an.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 Jt=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ar=class s extends Jt{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ue=class s extends Jt{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
- - undefined (uses default model: ${Vg})
21
+ - undefined (uses default model: ${Hg})
22
22
 
23
- Received: ${t} ${r}`)}function Jt(s,t){if(s==null)return Qd(Vg,t);if(XR(s))return Qd(s,t);if(HR(s))return s;if(JR(s))return Hg(s,t);throw KR(s)}function Jg(s){return s.map(t=>{let r=Array.isArray(t.content)?GR(t.content):t.content;return `${t.role}: ${r}`}).join(`
24
- `)}function GR(s){return s.map(t=>t.type==="text"?t.text:t.type==="file"?`[file: ${t.filename||"unknown"}]`:t.type==="tool-call"?`[tool-call: ${t.toolName}]`:t.type==="tool-result"?`[tool-result: ${t.toolName}]`:t.type==="reasoning"?`[reasoning: ${t.text}]`:"").filter(t=>t.length>0).join(`
25
- `)}function $R(s,t,r){return typeof s=="string"?Re(s,t,r):Array.isArray(s)?s.map(i=>i.type==="text"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i.type==="image"&&typeof i.image=="string"?{...i,image:Re(i.image,t,r)}:i.type==="file"&&typeof i.data=="string"?{...i,data:Re(i.data,t,r)}:i.type==="reasoning"&&typeof i.text=="string"?{...i,text:Re(i.text,t,r)}:i):s}function Xg(s,t,r){let o=$R(s.content,t,r);return {...s,content:o}}async function jle(s){var i;if(!s.dataset)throw new Error("Dataset is required for prompt evaluation");if(!s.messages||s.messages.length===0)throw new Error("Messages array is required and cannot be empty");if(s.experimentConfig!==void 0&&(typeof s.experimentConfig!="object"||s.experimentConfig===null||Array.isArray(s.experimentConfig)))throw new Error("experimentConfig must be a plain object, not an array or primitive value");let t=Jt(s.model),r={...s.experimentConfig,prompt_template:s.messages,model:t.modelName,...s.temperature!==void 0&&{temperature:s.temperature},...s.seed!==void 0&&{seed:s.seed}},o=QR(t,s.messages,(i=s.templateType)!=null?i:ue.MUSTACHE,{temperature:s.temperature,seed:s.seed});return Wg({dataset:s.dataset,task:o,scoringMetrics:s.scoringMetrics,experimentName:s.experimentName,projectName:s.projectName,experimentConfig:r,prompts:s.prompts,client:s.client,nbSamples:s.nbSamples,scoringKeyMapping:s.scoringKeyMapping})}function QR(s,t,r,o){return async i=>{let a=t.map(g=>Xg(g,i,r)),l=await s.generateProviderResponse(a,o),d=YR(l);return {input:Jg(a),output:d}}}function YR(s){return s&&typeof s=="object"?"text"in s&&typeof s.text=="string"?s.text:"content"in s&&typeof s.content=="string"?s.content:JSON.stringify(s):String(s)}var pe=class{constructor(t,r=true){if(this.name=t,this.trackMetric=r,r){let o=this.score.bind(this);this.score=_e({name:this.name,type:fe.General},o);}}};var ZR=z$1.object({output:z$1.unknown(),expected:z$1.unknown()}),Kg=class extends pe{constructor(r="exact_match",o=true){super(r,o);this.validationSchema=ZR;}async score(r){let{output:o,expected:i}=r,a=o===i?1:0;return {name:this.name,value:a,reason:`Exact match: ${a===1?"Match":"No match"}`}}};var qR=z$1.object({output:z$1.string(),substring:z$1.string()}),Gg=class extends pe{constructor(r="contains",o=true,i=false){super(r,o);this.validationSchema=qR;this.caseSensitive=i;}async score(r){let{output:o,substring:i}=r,a=this.caseSensitive?o:o.toLowerCase(),l=this.caseSensitive?i:i.toLowerCase();return a.includes(l)?{name:this.name,value:1,reason:`Contains: "${i}" found in output.`}:{name:this.name,value:0,reason:`Contains: "${i}" not found in output.`}}};var eb=z$1.object({output:z$1.string(),pattern:z$1.string(),flags:z$1.string().optional()}),$g=class extends pe{constructor(r="regex_match",o=true){super(r,o);this.validationSchema=eb;}async score(r){let{output:o,pattern:i,flags:a}=r,l;typeof i=="string"&&a?l=new RegExp(i,a):l=new RegExp(i);let d=l.test(o);return {name:this.name,value:d?1:0,reason:d?`Regex: Output matches the regex pattern: ${i}`:`Regex: Output does not match the regex pattern: ${i}`}}};var rb=z$1.object({output:z$1.unknown()}),Yg=class extends pe{constructor(r="is_json_metric",o=true){super(r,o);this.validationSchema=rb;}async score(r){let{output:o}=r;try{return JSON.parse(o),{name:this.name,value:1,reason:"IsJson: Output is valid JSON."}}catch{return {name:this.name,value:0,reason:"IsJson: Output is not valid JSON"}}}};var ge=class extends pe{constructor(t,r){var i;let o=(i=r==null?void 0:r.trackMetric)!=null?i:true;super(t,o),this.temperature=r==null?void 0:r.temperature,this.seed=r==null?void 0:r.seed,this.maxTokens=r==null?void 0:r.maxTokens,this.modelSettings=r==null?void 0:r.modelSettings,this.model=this.initModel(r==null?void 0:r.model,{trackGenerations:o});}initModel(t,r){return Jt(t,r)}buildModelOptions(){return {...this.modelSettings,...this.temperature!==void 0&&{temperature:this.temperature},...this.seed!==void 0&&{seed:this.seed},...this.maxTokens!==void 0&&{maxTokens:this.maxTokens}}}};function Zg(s,t=[]){let r="";return t.length>0&&(r=`
23
+ Received: ${t} ${r}`)}function Xt(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
+ `)}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 Nle(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=Xt(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 Xt(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 nn=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends nn{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},sn=class s extends nn{constructor(r,o){super(r);this.cause=o;this.name="JSONParsingError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function De(s){try{return JSON.parse(s)}catch{return ob(s)}}function ob(s){try{let t=s.indexOf("{"),r=s.lastIndexOf("}");if(t===-1||r===-1||t>=r)throw new Error("No valid JSON object found in content");let o=s.substring(t,r+1);return JSON.parse(o)}catch(t){let r=t instanceof Error?t.message:String(t);throw new sn(`Failed to extract JSON from content: ${r}`,t instanceof Error?t:void 0)}}function qg(s,t){try{let r=De(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Moderation score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate moderation score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var tb=z$1.object({output:z$1.string()}),ib=z$1.object({score:z$1.number(),reason:z$1.string()}),pn=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"moderation_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=tb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{output:o}=r,i=Zg(o,this.fewShotExamples),a=this.buildModelOptions(),l=await this.model.generateString(i,ib,a);return qg(l,this.name)}};function ew(s,t){return `
87
+ `}var sn=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends sn{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},pn=class s extends sn{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 pn(`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()}),cn=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 rw(s,t){try{let r=De(s),o=Number(r.score);if(isNaN(o)||o<0||o>1)throw new Error(`Usefulness score must be between 0.0 and 1.0, got ${o}`);return {name:t,value:o,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate usefulness score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var ab=z$1.object({input:z$1.string(),output:z$1.string()}),nb=z$1.object({score:z$1.number(),reason:z$1.string()}),cn=class extends ge{constructor(r){var i;let o=(i=r==null?void 0:r.name)!=null?i:"usefulness_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=ab;}async score(r){let{input:o,output:i}=r,a=ew(o,i),l=this.buildModelOptions(),d=await this.model.generateString(a,nb,l);return rw(d,this.name)}};var sb=`You are an expert judge tasked with evaluating the faithfulness of an AI-generated answer to the given context. Analyze the provided INPUT, CONTEXT, and OUTPUT to determine if the OUTPUT contains any hallucinations or unfaithful information.
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()}),ln=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.
@@ -155,7 +155,7 @@ It is crucial that you provide your answer in the following JSON format:
155
155
  "reason": ["reason 1", "reason 2"]
156
156
  }}
157
157
  Reasons amount is not restricted. Output must be JSON format only.
158
- `,pb=`You are an expert judge tasked with evaluating the factual accuracy and reliability of an AI-generated answer. Analyze the provided INPUT, and OUTPUT to determine if the OUTPUT contains any hallucinations or unfaithful information.
158
+ `,cb=`You are an expert judge tasked with evaluating the factual accuracy and reliability of an AI-generated answer. Analyze the provided INPUT, and OUTPUT to determine if the OUTPUT contains any hallucinations or unfaithful information.
159
159
 
160
160
  Guidelines:
161
161
  1. Evaluate the OUTPUT based on generally accepted facts and reliable information.
@@ -186,7 +186,7 @@ It is crucial that you provide your answer in the following JSON format:
186
186
  "reason": ["some reason 1", "some reason 2"]
187
187
  }}
188
188
  Reasons amount is not restricted. Output must be JSON format only.
189
- `;function ow(s,t){return s.length===0?"":`
189
+ `;function tw(s,t){return s.length===0?"":`
190
190
 
191
191
  EXAMPLES:
192
192
 
@@ -198,7 +198,7 @@ ${i}Output: ${o.output}
198
198
  {"score": "${o.score}", "reason": "${o.reason}"}
199
199
  </example>`}).join(`
200
200
 
201
- `)}`}function tw(s,t,r,o=[]){let i=ow(o,true);return sb.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function iw(s,t,r=[]){let o=ow(r,false);return pb.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function aw(s,t){try{let r=De(s),o=r.score;if(o==null)throw new Error(`Hallucination score is required but got ${o}`);let i=Number(o);if(isNaN(i)||i<0||i>1)throw new Error(`Hallucination score must be between 0.0 and 1.0, got ${i}`);let a="",l=r.reason;return Array.isArray(l)?a=l.map(d=>String(d)).join(" "):l&&(a=String(l)),{name:t,value:i,reason:a}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate hallucination score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var cb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),lb=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),ln=class extends ge{constructor(r){var i,a;let o=(i=r==null?void 0:r.name)!=null?i:"hallucination_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=cb;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{input:o,output:i,context:a}=r,l=a?tw(o,i,a,this.fewShotExamples):iw(o,i,this.fewShotExamples),d=this.buildModelOptions(),u=await this.model.generateString(l,lb,d);return aw(u,this.name)}};var nw=[{title:"Low Relevance Score",input:"What's the capital of France?",output:"The Eiffel Tower is a famous landmark.",context:["France is a country in Europe.","Paris is known for its iconic Eiffel Tower."],answer_relevance_score:.2,reason:"The answer provides information about the Eiffel Tower, which is related to France, but fails to address the specific question about the capital city. It doesn't directly answer the user's query, resulting in low relevance."},{title:"Medium Relevance Score",input:"What's the capital of France?",output:"France has many beautiful cities, including Paris.",context:["France is a country in Europe.","Paris is the capital and largest city of France."],answer_relevance_score:.6,reason:"The answer mentions Paris, which is the correct capital, but it's presented as just one of many cities rather than explicitly stating it's the capital. The response is partially relevant but lacks directness in addressing the specific question."},{title:"High Relevance Score",input:"What's the capital of France?",output:"The capital of France is Paris, a city known for its iconic Eiffel Tower.",context:["France is a country in Europe.","Paris is the capital and largest city of France."],answer_relevance_score:.9,reason:"The answer directly and correctly identifies Paris as the capital of France, which is highly relevant to the user's question. It also provides additional context about the Eiffel Tower, which aligns with the provided context. The response is comprehensive and relevant, though slightly more detailed than necessary, preventing a perfect score."}],sw=[{title:"Low Relevance Score",input:"What's the capital of France?",output:"The Eiffel Tower is a famous landmark.",answer_relevance_score:.2,reason:"The answer provides information about the Eiffel Tower, which is related to France, but fails to address the specific question about the capital city. It doesn't directly answer the user's query, resulting in low relevance."},{title:"Medium Relevance Score",input:"What's the capital of France?",output:"France has many beautiful cities, including Paris.",answer_relevance_score:.6,reason:"The answer mentions Paris, which is the correct capital, but it's presented as just one of many cities rather than explicitly stating it's the capital. The response is partially relevant but lacks directness in addressing the specific question."},{title:"High Relevance Score",input:"What's the capital of France?",output:"The capital of France is Paris, a city known for its iconic Eiffel Tower.",answer_relevance_score:.9,reason:"The answer directly and correctly identifies Paris as the capital of France, which is highly relevant to the user's question. It also provides additional context about the Eiffel Tower, which aligns with the provided context. The response is comprehensive and relevant, though slightly more detailed than necessary, preventing a perfect score."}];function mb(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
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())])}),mn=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}"
@@ -211,7 +211,7 @@ ${i}Output: ${o.output}
211
211
  }
212
212
  \`\`\``).join(`
213
213
 
214
- `)}function db(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
214
+ `)}function ub(s){return s.map((t,r)=>`#### Example ${r+1}: ${t.title}
215
215
 
216
216
  - **Input:** "${t.input}"
217
217
  - **Output:** "${t.output}"
@@ -223,7 +223,7 @@ ${i}Output: ${o.output}
223
223
  }
224
224
  \`\`\``).join(`
225
225
 
226
- `)}function pw(s,t,r,o){return `
226
+ `)}function cw(s,t,r,o){return `
227
227
  YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
228
228
  PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
229
229
  ANOTHER LLM BASED ON THE USER'S INPUT AND CONTEXT PROVIDED.
@@ -269,7 +269,7 @@ ${i}Output: ${o.output}
269
269
 
270
270
  ###FEW-SHOT EXAMPLES###
271
271
 
272
- ${mb(o)}
272
+ ${db(o)}
273
273
 
274
274
  ###INPUTS:###
275
275
  ***
@@ -282,7 +282,7 @@ ${i}Output: ${o.output}
282
282
  Context:
283
283
  ${JSON.stringify(r)}
284
284
  ***
285
- `}function cw(s,t,r){return `
285
+ `}function lw(s,t,r){return `
286
286
  YOU ARE AN EXPERT IN NLP EVALUATION METRICS, SPECIALLY TRAINED TO ASSESS ANSWER RELEVANCE IN RESPONSES
287
287
  PROVIDED BY LANGUAGE MODELS. YOUR TASK IS TO EVALUATE THE RELEVANCE OF A GIVEN ANSWER FROM
288
288
  ANOTHER LLM BASED ON THE USER'S INPUT.
@@ -327,7 +327,7 @@ ${i}Output: ${o.output}
327
327
 
328
328
  ###FEW-SHOT EXAMPLES###
329
329
 
330
- ${db(r)}
330
+ ${ub(r)}
331
331
 
332
332
  ###INPUTS:###
333
333
  ***
@@ -337,4 +337,4 @@ ${i}Output: ${o.output}
337
337
  Output:
338
338
  ${t}
339
339
  ***
340
- `}function lw(s,t){try{let r=De(s),o=r.answer_relevance_score;if(o==null)throw new Error(`Answer relevance score is required but got ${o}`);let i=Number(o);if(isNaN(i)||i<0||i>1)throw new Error(`Answer relevance score must be between 0.0 and 1.0, got ${i}`);return {name:t,value:i,reason:String(r.reason||"")}}catch(r){let o=r instanceof Error?r.message:String(r);throw z.error(`Failed to parse model output: ${o}`),new ce("Failed to calculate answer relevance score. The model output could not be parsed.",r instanceof Error?r:void 0)}}var ub=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),gb=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),mn=class extends ge{constructor(r){var i,a,l,d;let o=(i=r==null?void 0:r.name)!=null?i:"answer_relevance_metric";super(o,{model:r==null?void 0:r.model,trackMetric:r==null?void 0:r.trackMetric,temperature:r==null?void 0:r.temperature,seed:r==null?void 0:r.seed,maxTokens:r==null?void 0:r.maxTokens,modelSettings:r==null?void 0:r.modelSettings});this.validationSchema=ub;this.fewShotExamplesWithContext=(a=r==null?void 0:r.fewShotExamples)!=null?a:nw,this.fewShotExamplesNoContext=(l=r==null?void 0:r.fewShotExamplesNoContext)!=null?l:sw,this.requireContext=(d=r==null?void 0:r.requireContext)!=null?d:true;}async score(r){let{input:o,output:i,context:a}=r;if(!a&&this.requireContext)throw new ce(`${this.name} requires context by default. If you want to allow execution in no-context mode, enable it via 'new AnswerRelevance({ requireContext: false })'`);let l=a?pw(o,i,a,this.fewShotExamplesWithContext):cw(o,i,this.fewShotExamplesNoContext),d=this.buildModelOptions(),u=await this.model.generateString(l,gb,d);return lw(u,this.name)}};export{mn as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,Gg as Contains,Kg as ExactMatch,ln as Hallucination,Yg as IsJson,Ue as ModelConfigurationError,Ht as ModelError,_r as ModelGenerationError,pn as Moderation,or as Opik,tr as OpikBaseModel,je as OpikQueryLanguage,fe as OpikSpanType,Ce as Prompt,ue as PromptType,$g as RegexMatch,cn as Usefulness,Ar as VercelAIChatModel,Qd as createModel,Hg as createModelFromInstance,Gd as detectProvider,gw as disableLogger,Wg as evaluate,jle as evaluatePrompt,AR as flushAll,q as generateId,kR as getTrackContext,z as logger,Jt as resolveModel,au as setLoggerLevel,_e as track};
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()}),dn=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{dn as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,$g as Contains,Gg as ExactMatch,mn as Hallucination,Zg as IsJson,Ue as ModelConfigurationError,Jt as ModelError,Ar as ModelGenerationError,cn as Moderation,or as Opik,tr as OpikBaseModel,je as OpikQueryLanguage,fe as OpikSpanType,Ce as Prompt,ue as PromptType,Qg as RegexMatch,ln as Usefulness,Tr as VercelAIChatModel,Yd as createModel,Jg as createModelFromInstance,$d as detectProvider,ww as disableLogger,Bg as evaluate,Nle as evaluatePrompt,TR as flushAll,q as generateId,SR as getTrackContext,z as logger,Xt as resolveModel,nu as setLoggerLevel,_e as track};