opik 1.9.39 → 1.9.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +27 -27
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +25 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {c,d,g,e as e$1,f as f$1}from'./chunk-LAR62UGW.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import Jd from'fs';import ew from'ini';import'dotenv/config';import Qf from'qs';import {v7}from'uuid';import Jh from'fast-json-stable-stringify';import Hh from'xxhash-wasm';import {TextDecoder}from'util';import Qh from'mustache';import qh from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import oR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import Qa from'chalk';import uR from'boxen';import gR 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 Zg={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Wt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Hd=s=>{z.settings.minLevel=Zg[s];},qg=()=>{z.settings.minLevel=100;};Hd(process.env.OPIK_LOG_LEVEL||"INFO");var rw="~/.opik.config",sn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function Xd(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function ow(){return Xd({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 tw(){let s=process.env.OPIK_CONFIG_PATH||rw;if(!Jd.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=ew.parse(Jd.readFileSync(s,"utf8"));return t.opik?Xd({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 Kd(s){let t=ow(),r=tw(),{headers:o,...i}=s||{};return iw({...sn,...r,...t,...i})}function iw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=aw(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 aw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>nw,AlertPublicAlertType:()=>gw,AlertTriggerConfigPublicType:()=>dw,AlertTriggerConfigType:()=>pw,AlertTriggerConfigWriteType:()=>cw,AlertTriggerEventType:()=>sw,AlertTriggerPublicEventType:()=>uw,AlertTriggerWriteEventType:()=>lw,AlertWriteAlertType:()=>mw,AnnotationQueuePublicScope:()=>Rw,AnnotationQueueScope:()=>fw,AnnotationQueueWriteScope:()=>hw,AssistantMessageRole:()=>Nw,AttachmentListRequestEntityType:()=>$d,BadRequestError:()=>T,CheckName:()=>af,CheckPublicName:()=>Hf,CheckPublicResult:()=>Jf,CheckResult:()=>nf,ColumnCompareTypesItem:()=>Xw,ColumnPublicTypesItem:()=>rf,ColumnTypesItem:()=>of,CompleteMultipartUploadRequestEntityType:()=>bw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>gu,DatasetItemCompareSource:()=>Kw,DatasetItemFilterOperator:()=>Ow,DatasetItemPublicSource:()=>qw,DatasetItemSource:()=>Lw,DatasetItemWriteSource:()=>kn,DatasetPublicStatus:()=>Zw,DatasetPublicVisibility:()=>Yw,DatasetStatus:()=>Bw,DatasetUpdateVisibility:()=>eu,DatasetVisibility:()=>Ww,DatasetWriteVisibility:()=>qd,DeleteAttachmentsRequestEntityType:()=>yw,DownloadAttachmentRequestEntityType:()=>Qd,ExperimentItemCompareTraceVisibilityMode:()=>Gw,ExperimentItemPublicTraceVisibilityMode:()=>ef,ExperimentItemTraceVisibilityMode:()=>Vw,ExperimentPublicStatus:()=>df,ExperimentPublicType:()=>mf,ExperimentStatus:()=>tf,ExperimentType:()=>Sn,ExperimentUpdateStatus:()=>iu,ExperimentUpdateType:()=>tu,ExperimentWriteStatus:()=>ou,ExperimentWriteType:()=>ru,FeedbackScoreBatchItemSource:()=>Vf,FeedbackScoreBatchItemThreadSource:()=>Gf,FeedbackScoreCompareSource:()=>$w,FeedbackScoreExperimentItemBulkWriteViewSource:()=>pf,FeedbackScorePublicSource:()=>Wf,FeedbackScoreSource:()=>Hw,FindFeedbackDefinitionsRequestType:()=>au,FindFeedbackScoreNames1RequestType:()=>fu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>hu,GetSpansByProjectRequestType:()=>wu,GetWebhookExamplesRequestAlertType:()=>Gd,GuardrailName:()=>uf,GuardrailResult:()=>gf,GuardrailWriteName:()=>wf,GuardrailWriteResult:()=>ff,LlmAsJudgeMessagePublicRole:()=>Cw,LlmAsJudgeMessageRole:()=>zw,LlmAsJudgeMessageWriteRole:()=>Aw,LlmAsJudgeOutputSchemaPublicType:()=>Iw,LlmAsJudgeOutputSchemaType:()=>kw,LlmAsJudgeOutputSchemaWriteType:()=>Tw,LogItemLevel:()=>Mw,ManualEvaluationRequestEntityType:()=>bf,NotFoundError:()=>A,NotImplementedError:()=>De,OptimizationPublicStatus:()=>kf,OptimizationStatus:()=>yf,OptimizationUpdateStatus:()=>su,OptimizationWriteStatus:()=>zf,ProjectDetailedVisibility:()=>Tf,ProjectMetricRequestPublicInterval:()=>mu,ProjectMetricRequestPublicMetricType:()=>lu,ProjectMetricResponsePublicInterval:()=>Af,ProjectMetricResponsePublicMetricType:()=>_f,ProjectPublicVisibility:()=>xf,ProjectUpdateVisibility:()=>cu,ProjectVisibility:()=>Sf,ProjectWriteVisibility:()=>pu,PromptDetailTemplateStructure:()=>Uf,PromptPublicTemplateStructure:()=>Nf,PromptTemplateStructure:()=>Pf,PromptType:()=>Ef,PromptVersionDetailTemplateStructure:()=>jf,PromptVersionDetailType:()=>If,PromptVersionPublicTemplateStructure:()=>Mf,PromptVersionPublicType:()=>Df,PromptVersionTemplateStructure:()=>Cf,PromptVersionType:()=>vf,PromptWriteTemplateStructure:()=>uu,PromptWriteType:()=>du,ProviderApiKeyProvider:()=>Rf,ProviderApiKeyPublicProvider:()=>hf,ProviderApiKeyWriteProvider:()=>nu,ResponseFormatType:()=>Fw,SpanExperimentItemBulkWriteViewType:()=>cf,SpanFilterOperator:()=>Sw,SpanFilterPublicOperator:()=>jw,SpanFilterWriteOperator:()=>Ew,SpanPublicType:()=>Bf,SpanSearchStreamRequestPublicType:()=>Ru,SpanType:()=>fe,SpanUpdateType:()=>Ff,SpanWriteType:()=>Of,StartMultipartUploadRequestEntityType:()=>Yd,TraceFilterOperator:()=>xw,TraceFilterPublicOperator:()=>Uw,TraceFilterWriteOperator:()=>Pw,TracePublicVisibilityMode:()=>Xf,TraceThreadFilterOperator:()=>_w,TraceThreadFilterPublicOperator:()=>Dw,TraceThreadFilterWriteOperator:()=>vw,TraceThreadStatus:()=>Kf,TraceVisibilityMode:()=>sf,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>Zd,ValueEntryCompareSource:()=>Qw,ValueEntryExperimentItemBulkWriteViewSource:()=>lf,ValueEntryPublicSource:()=>Lf,ValueEntrySource:()=>Jw,WebhookTestResultStatus:()=>ww,alerts:()=>Bt,annotationQueues:()=>cn,attachments:()=>Lt,automationRuleEvaluators:()=>mn,chatCompletions:()=>dn,check:()=>ln,dashboards:()=>un,datasets:()=>Vt,experiments:()=>Ht,feedbackDefinitions:()=>Jt,guardrails:()=>gn,llmProviderKey:()=>Xt,manualEvaluation:()=>wn,openTelemetryIngestion:()=>fn,optimizations:()=>Kt,projects:()=>Gt,prompts:()=>$t,redirect:()=>zn,serviceToggles:()=>hn,spans:()=>Qt,systemUsage:()=>pn,traces:()=>Rn,welcomeWizard:()=>bn,workspaces:()=>yn});var Bt={};c(Bt,{GetWebhookExamplesRequestAlertType:()=>Gd});var Gd={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Lt={};c(Lt,{AttachmentListRequestEntityType:()=>$d,DownloadAttachmentRequestEntityType:()=>Qd,StartMultipartUploadRequestEntityType:()=>Yd,UploadAttachmentRequestEntityType:()=>Zd});var $d={Trace:"trace",Span:"span"};var Qd={Trace:"trace",Span:"span"};var Yd={Trace:"trace",Span:"span"};var Zd={Trace:"trace",Span:"span"};var Vt={};c(Vt,{DatasetUpdateVisibility:()=>eu,DatasetWriteVisibility:()=>qd});var qd={Private:"private",Public:"public"};var eu={Private:"private",Public:"public"};var Ht={};c(Ht,{ExperimentUpdateStatus:()=>iu,ExperimentUpdateType:()=>tu,ExperimentWriteStatus:()=>ou,ExperimentWriteType:()=>ru});var ru={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var ou={Running:"running",Completed:"completed",Cancelled:"cancelled"};var tu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var iu={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Jt={};c(Jt,{FindFeedbackDefinitionsRequestType:()=>au});var au={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var Xt={};c(Xt,{ProviderApiKeyWriteProvider:()=>nu});var nu={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var Kt={};c(Kt,{OptimizationUpdateStatus:()=>su});var su={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Gt={};c(Gt,{ProjectMetricRequestPublicInterval:()=>mu,ProjectMetricRequestPublicMetricType:()=>lu,ProjectUpdateVisibility:()=>cu,ProjectWriteVisibility:()=>pu});var pu={Private:"private",Public:"public"};var cu={Private:"private",Public:"public"};var lu={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 mu={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var $t={};c($t,{CreatePromptVersionDetailTemplateStructure:()=>gu,PromptWriteTemplateStructure:()=>uu,PromptWriteType:()=>du});var du={Mustache:"mustache",Jinja2:"jinja2"};var uu={Text:"text",Chat:"chat"};var gu={Text:"text",Chat:"chat"};var Qt={};c(Qt,{FindFeedbackScoreNames1RequestType:()=>fu,GetSpanStatsRequestType:()=>hu,GetSpansByProjectRequestType:()=>wu,SpanSearchStreamRequestPublicType:()=>Ru});var wu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var fu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var hu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Ru={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var pn={};var cn={};var ln={};var mn={};var dn={};var un={};var gn={};var wn={};var fn={};var hn={};var Rn={};var bn={};var yn={};var zn={};var nw={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 pw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var cw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var lw={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 mw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var dw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var uw={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 gw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var ww={Success:"success",Failure:"failure"};var fw={Trace:"trace",Thread:"thread"};var hw={Trace:"trace",Thread:"thread"};var Rw={Trace:"trace",Thread:"thread"};var bw={Trace:"trace",Span:"span"};var yw={Trace:"trace",Span:"span"};var zw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var kw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Sw={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 _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 Aw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Tw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Ew={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 Pw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var vw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Cw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Iw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};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 Uw={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 Dw={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 Mw={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Nw={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Fw={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};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={Private:"private",Public:"public"};var Bw={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var Lw={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Vw={Default:"default",Hidden:"hidden"};var Hw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Jw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var kn={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Xw={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Kw={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Gw={Default:"default",Hidden:"hidden"};var $w={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Qw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Yw={Private:"private",Public:"public"};var Zw={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var qw={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var ef={Default:"default",Hidden:"hidden"};var rf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var of={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Sn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var tf={Running:"running",Completed:"completed",Cancelled:"cancelled"};var af={Topic:"TOPIC",Pii:"PII"};var nf={Passed:"passed",Failed:"failed"};var fe={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var sf={Default:"default",Hidden:"hidden"};var pf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var cf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var lf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var mf={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var df={Running:"running",Completed:"completed",Cancelled:"cancelled"};var uf={Topic:"TOPIC",Pii:"PII"};var gf={Passed:"passed",Failed:"failed"};var wf={Topic:"TOPIC",Pii:"PII"};var ff={Passed:"passed",Failed:"failed"};var hf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var Rf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var bf={Trace:"trace",Thread:"thread"};var yf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var zf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var kf={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Sf={Private:"private",Public:"public"};var xf={Private:"private",Public:"public"};var _f={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT",ThreadCount:"THREAD_COUNT",ThreadDuration:"THREAD_DURATION",ThreadFeedbackScores:"THREAD_FEEDBACK_SCORES"};var Af={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Tf={Private:"private",Public:"public"};var Ef={Mustache:"mustache",Jinja2:"jinja2"};var Pf={Text:"text",Chat:"chat"};var vf={Mustache:"mustache",Jinja2:"jinja2"};var Cf={Text:"text",Chat:"chat"};var If={Mustache:"mustache",Jinja2:"jinja2"};var jf={Text:"text",Chat:"chat"};var Uf={Text:"text",Chat:"chat"};var Df={Mustache:"mustache",Jinja2:"jinja2"};var Mf={Text:"text",Chat:"chat"};var Nf={Text:"text",Chat:"chat"};var Ff={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Of={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Wf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Bf={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Lf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Vf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Hf={Topic:"TOPIC",Pii:"PII"};var Jf={Passed:"passed",Failed:"failed"};var Xf={Default:"default",Hidden:"hidden"};var Kf={Active:"active",Inactive:"inactive"};var Gf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var _e=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super($f({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function $f({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: ${_e(r,void 0,2)}`),o.join(`
|
|
2
|
-
`)}var f=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var T=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 De=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 yr;typeof globalThis.Headers!="undefined"?yr=globalThis.Headers:yr=class bu{constructor(t){if(this.headers=new Map,t)if(t instanceof bu)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 Yt={headers:new yr,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},Zt={headers:new yr,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function qt(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function yu(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${Qf.stringify(t,{arrayFormat:"repeat"})}`:s}var m=Yf();function Yf(){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 zu(){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 ku({body:s,type:t}){return t.includes("json")?_e(s):s}async function Su(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 xu(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 Su(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 Zf="timeout";function _u(s){let t=new AbortController,r=setTimeout(()=>t.abort(Zf),s);return {signal:t.signal,abortId:r}}function Au(...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 Tu=async(s,t,r,o,i,a,l,d,u)=>{let g=[],w;if(a!=null){let{signal:x,abortId:_}=_u(a);w=_,g.push(x);}l!=null&&g.push(l);let k=Au(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 qf(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Eu(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=qf(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function eh(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=yu(s.url,s.queryParameters),o=await ku({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await zu();try{let a=await Eu(async()=>Tu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await xu(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:qt(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:qt(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Yt}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:Yt}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:Zt}:{ok:false,error:{reason:"unknown",errorMessage:_e(a)},rawResponse:Zt}}}var b=eh;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 Tn(s){return typeof s=="object"&&s!=null&&"name"in s}function En(s){return typeof s=="object"&&s!=null&&"path"in s}function Pn(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Pu(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new xn:m.type==="node"?s=new _n:s=new An,await s.setup(),s}var xn=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(Tn(t))return t.name;if(En(t)&&t.path)return Pn(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"}}},_n=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(Tn(t))return t.name;if(En(t)&&t.path)return Pn(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():{}}}},An=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(Tn(t))return t.name;if(En(t)&&t.path)return Pn(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:()=>or,ParseError:()=>tr,any:()=>Hu,bigint:()=>Cu,boolean:()=>Ju,booleanLiteral:()=>Vu,date:()=>Iu,discriminant:()=>eg,enum_:()=>ri,getObjectLikeUtils:()=>le,getObjectUtils:()=>Me,getSchemaUtils:()=>U,isProperty:()=>Te,lazy:()=>ju,lazyObject:()=>Wu,list:()=>ti,number:()=>Xu,object:()=>oi,objectWithoutOptionalProperties:()=>Ou,optional:()=>vn,property:()=>Du,record:()=>Qu,set:()=>Yu,string:()=>Ku,stringLiteral:()=>Lu,transform:()=>Cn,undiscriminatedUnion:()=>qu,union:()=>og,unknown:()=>Gu,withParsedProperties:()=>jn});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 ${rh(s)}.`}function rh(s){if(Array.isArray(s))return "list";if(s===null)return "null";if(s instanceof BigInt)return "BigInt";switch(typeof s){case "string":return `"${s}"`;case "bigint":case "number":case "boolean":case "undefined":return `${s}`}return typeof s}function K(s){return {...s,json:vu(s.json),parse:vu(s.parse)}}function vu(s){return (t,r)=>{let o=s(t,r),{skipValidation:i=false}=r!=null?r:{};return !o.ok&&i?(console.warn(["Failed to validate.",...o.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
3
|
-
`)),{ok:true,value:t}):o}}function ei(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var or=class s extends Error{constructor(r){super(r.map(ei).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var tr=class s extends Error{constructor(r){super(r.map(ei).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>oh(s),optional:()=>vn(s),optionalNullable:()=>th(s),transform:t=>Cn(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new tr(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new or(o.errors)}}}function oh(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 vn(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 th(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 Cn(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 Cu(){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 ih=/^([+-]?\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 Iu(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:ih.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 ri(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 ju(s){let t=In(s);return {...t,...U(t)}}function In(s){return {parse:(t,r)=>ir(s).parse(t,r),json:(t,r)=>ir(s).json(t,r),getType:()=>ir(s).getType()}}function ir(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function zr(s){return Object.entries(s)}function kr(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,a])=>(r.has(i)&&(o[i]=a),o),{})}function Ae(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 Sr(s){return Object.keys(s)}function Uu(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=>jn(s,t)}}function jn(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(!Ae(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=kr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Du(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Te(s){return s.isProperty}function oi(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Te(o)?o.rawKey:r),_getParsedProperties:()=>Sr(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of zr(s)){let u=Te(d)?d.rawKey:l,g=Te(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,Fu(g)&&a.push(u);}return Mu({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 zr(s)){let d=Te(l)?l.valueSchema:l;Fu(d)&&i.push(a);}return Mu({value:r,requiredKeys:i,getProperty:a=>{let l=s[a];if(l!=null)return Te(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),...Me(t)}}function Mu({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Ae(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 Me(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Nu({extensionKeys:t._getRawProperties(),value:o,transformBase:a=>s.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(o,i)=>Nu({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),...Me(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),...Me(t)}}}}function Nu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=Uu(Sr(t),g=>i.has(g)),d=r(kr(t,l)),u=o(kr(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 Fu(s){return !ah(s)}function ah(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function Ou(s){return oi(s)}function Wu(s){let t={...In(s),_getRawProperties:()=>ir(s)._getRawProperties(),_getParsedProperties:()=>ir(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Me(t)}}function ti(s){let t={parse:(r,o)=>Bu(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>Bu(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 Bu(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 Lu(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 Vu(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 Hu=Q(E.ANY,s=>({ok:true,value:s}));var Ju=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var Xu=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var Ku=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var Gu=Q(E.UNKNOWN,s=>({ok:true,value:s}));function Qu(s,t){let r={parse:(o,i)=>$u({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)=>$u({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 $u({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Ae(s)?zr(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 Yu(s){let t=ti(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 qu(s){let t={parse:(r,o)=>Zu((i,a)=>i.parse(r,a),s,o),json:(r,o)=>Zu((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function Zu(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 eg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function og(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=ri(Sr(t)),a={parse:(l,d)=>rg({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)=>rg({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 rg({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!Ae(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 nh(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),nh(s)}var C={};c(C,{AggregationData:()=>wl,Alert:()=>dh,AlertAlertType:()=>_s,AlertPagePublic:()=>Vs,AlertPublic:()=>No,AlertPublicAlertType:()=>Ns,AlertTrigger:()=>vs,AlertTriggerConfig:()=>Ps,AlertTriggerConfigPublic:()=>Bs,AlertTriggerConfigPublicType:()=>Ws,AlertTriggerConfigType:()=>Es,AlertTriggerConfigWrite:()=>Is,AlertTriggerConfigWriteType:()=>Cs,AlertTriggerEventType:()=>Ts,AlertTriggerPublic:()=>Ls,AlertTriggerPublicEventType:()=>Os,AlertTriggerWrite:()=>Us,AlertTriggerWriteEventType:()=>js,AlertWrite:()=>Mo,AlertWriteAlertType:()=>Ds,AnnotationQueue:()=>$s,AnnotationQueueBatch:()=>gh,AnnotationQueueBatchWrite:()=>Eo,AnnotationQueueItemIds:()=>Ki,AnnotationQueuePagePublic:()=>Zs,AnnotationQueuePublic:()=>Fo,AnnotationQueuePublicScope:()=>Qs,AnnotationQueueReviewer:()=>Gs,AnnotationQueueReviewerPublic:()=>Ys,AnnotationQueueScope:()=>Ks,AnnotationQueueUpdate:()=>Po,AnnotationQueueWrite:()=>To,AnnotationQueueWriteScope:()=>ls,AssistantMessage:()=>pc,AssistantMessageRole:()=>sc,Attachment:()=>qs,AttachmentListRequestEntityType:()=>ni,AttachmentPage:()=>ep,AuthDetailsHolder:()=>ap,AutomationRuleEvaluator:()=>fh,AutomationRuleEvaluatorLlmAsJudge:()=>up,AutomationRuleEvaluatorLlmAsJudgePublic:()=>$o,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Ap,AutomationRuleEvaluatorObjectObjectPublic:()=>$p,AutomationRuleEvaluatorPagePublic:()=>Qp,AutomationRuleEvaluatorPublic:()=>Yp,AutomationRuleEvaluatorSpanLlmAsJudge:()=>Rp,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>qo,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>vp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>wp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>Yo,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>jp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>fp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>Zo,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Dp,AutomationRuleEvaluatorUpdate:()=>nc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>rc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>ac,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>tc,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>ic,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>oc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>gp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>Qo,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Np,AutomationRuleEvaluatorWrite:()=>Fp,AvgValueStatPublic:()=>Dc,BatchDelete:()=>F,BatchDeleteByProject:()=>Mh,BiInformation:()=>ys,BiInformationResponse:()=>pr,BooleanFeedbackDefinition:()=>yl,BooleanFeedbackDefinitionCreate:()=>Tl,BooleanFeedbackDefinitionPublic:()=>dt,BooleanFeedbackDefinitionUpdate:()=>Vl,BooleanFeedbackDetail:()=>bl,BooleanFeedbackDetailCreate:()=>Al,BooleanFeedbackDetailPublic:()=>Ul,BooleanFeedbackDetailUpdate:()=>Ll,CategoricalFeedbackDefinition:()=>kl,CategoricalFeedbackDefinitionCreate:()=>Pl,CategoricalFeedbackDefinitionPublic:()=>ut,CategoricalFeedbackDefinitionUpdate:()=>Jl,CategoricalFeedbackDetail:()=>zl,CategoricalFeedbackDetailCreate:()=>El,CategoricalFeedbackDetailPublic:()=>Dl,CategoricalFeedbackDetailUpdate:()=>Hl,ChatCompletionChoice:()=>lc,ChatCompletionRequest:()=>Co,ChatCompletionResponse:()=>gc,Check:()=>ol,CheckName:()=>el,CheckPublic:()=>wd,CheckPublicName:()=>ud,CheckPublicResult:()=>gd,CheckResult:()=>rl,ChunkedOutputJsonNode:()=>yh,ChunkedOutputJsonNodePublic:()=>xh,ChunkedOutputJsonNodePublicType:()=>Rl,ChunkedOutputJsonNodeType:()=>Gc,Column:()=>Xc,ColumnCompare:()=>zc,ColumnCompareTypesItem:()=>yc,ColumnPublic:()=>Vc,ColumnPublicTypesItem:()=>Lc,ColumnTypesItem:()=>Jc,Comment:()=>L,CommentCompare:()=>kc,CommentPublic:()=>Ye,CompleteMultipartUploadRequest:()=>Gi,CompleteMultipartUploadRequestEntityType:()=>rp,CompletionTokensDetails:()=>dc,CountValueStatPublic:()=>Mc,CreateDatasetItemsFromSpansRequest:()=>Pr,CreateDatasetItemsFromTracesRequest:()=>vr,CreatePromptVersionDetail:()=>io,CreatePromptVersionDetailTemplateStructure:()=>ji,DashboardPagePublic:()=>wc,DashboardPublic:()=>$e,DashboardUpdatePublic:()=>jo,DashboardWrite:()=>Io,DataPointDouble:()=>Nh,DataPointNumberPublic:()=>jm,Dataset:()=>hh,DatasetExpansion:()=>bh,DatasetExpansionResponse:()=>bc,DatasetExpansionWrite:()=>Ur,DatasetIdentifier:()=>Ir,DatasetIdentifierPublic:()=>Dr,DatasetItem:()=>it,DatasetItemBatch:()=>Rh,DatasetItemBatchUpdate:()=>_r,DatasetItemBatchWrite:()=>Er,DatasetItemCompare:()=>vc,DatasetItemCompareSource:()=>Sc,DatasetItemFilter:()=>Dn,DatasetItemFilterOperator:()=>Un,DatasetItemPageCompare:()=>Cc,DatasetItemPagePublic:()=>Hc,DatasetItemPublic:()=>st,DatasetItemPublicSource:()=>Wc,DatasetItemSource:()=>Rc,DatasetItemStreamRequest:()=>Mr,DatasetItemUpdate:()=>Mn,DatasetItemWrite:()=>Tr,DatasetItemWriteSource:()=>Nn,DatasetItemsDelete:()=>jr,DatasetPagePublic:()=>Uc,DatasetPublic:()=>cr,DatasetPublicStatus:()=>jc,DatasetPublicVisibility:()=>Ic,DatasetStatus:()=>hc,DatasetUpdate:()=>Cr,DatasetUpdateVisibility:()=>di,DatasetVersionCreatePublic:()=>Fr,DatasetVersionDiff:()=>Qc,DatasetVersionDiffStats:()=>$c,DatasetVersionPagePublic:()=>Yc,DatasetVersionPublic:()=>pt,DatasetVersionRestorePublic:()=>Or,DatasetVersionTag:()=>Nr,DatasetVisibility:()=>fc,DatasetWrite:()=>Ar,DatasetWriteVisibility:()=>mi,DeleteAttachmentsRequest:()=>wh,DeleteAttachmentsRequestEntityType:()=>tp,DeleteFeedbackScore:()=>Rt,DeleteIdsHolder:()=>lr,DeleteThreadFeedbackScores:()=>ko,DeleteTraceThreads:()=>So,Delta:()=>cc,DownloadAttachmentRequestEntityType:()=>si,ErrorCountWithDeviation:()=>ft,ErrorCountWithDeviationDetailed:()=>Wm,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>Hr,ErrorInfoPublic:()=>bt,ErrorInfoWrite:()=>so,ErrorMessage:()=>ee,ErrorMessageDetail:()=>jh,ErrorMessageDetailed:()=>Ch,ErrorMessagePublic:()=>uh,Experiment:()=>zh,ExperimentGroupAggregationsResponse:()=>hl,ExperimentGroupResponse:()=>gl,ExperimentItem:()=>Br,ExperimentItemBulkRecord:()=>nl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>Zn,ExperimentItemBulkUpload:()=>kh,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Jr,ExperimentItemCompare:()=>Pc,ExperimentItemCompareTraceVisibilityMode:()=>Ec,ExperimentItemPublic:()=>nt,ExperimentItemPublicTraceVisibilityMode:()=>Bc,ExperimentItemStreamRequest:()=>Gr,ExperimentItemTraceVisibilityMode:()=>Hn,ExperimentItemsBatch:()=>Lr,ExperimentItemsDelete:()=>Vr,ExperimentPagePublic:()=>ll,ExperimentPublic:()=>mt,ExperimentPublicStatus:()=>pl,ExperimentPublicType:()=>sl,ExperimentScore:()=>Xr,ExperimentScorePublic:()=>cl,ExperimentScoreWrite:()=>Wn,ExperimentStatus:()=>qc,ExperimentStreamRequestPublic:()=>$r,ExperimentType:()=>Zc,ExperimentUpdate:()=>Kr,ExperimentUpdateStatus:()=>hi,ExperimentUpdateType:()=>fi,ExperimentWrite:()=>Wr,ExperimentWriteStatus:()=>wi,ExperimentWriteType:()=>gi,ExportTraceServiceRequest:()=>Eh,Feedback:()=>_h,FeedbackCreate:()=>jl,FeedbackDefinitionPagePublic:()=>Ol,FeedbackObjectPublic:()=>Fl,FeedbackPublic:()=>Bl,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>Bm,FeedbackScoreAveragePublic:()=>Oe,FeedbackScoreBatch:()=>zt,FeedbackScoreBatchItem:()=>dd,FeedbackScoreBatchItemSource:()=>md,FeedbackScoreBatchItemThread:()=>ps,FeedbackScoreBatchItemThreadSource:()=>ss,FeedbackScoreBatchThread:()=>xo,FeedbackScoreCompare:()=>Tc,FeedbackScoreCompareSource:()=>xc,FeedbackScoreExperimentItemBulkWriteView:()=>Yn,FeedbackScoreExperimentItemBulkWriteViewSource:()=>Gn,FeedbackScoreNames:()=>Im,FeedbackScorePublic:()=>dr,FeedbackScorePublicSource:()=>nd,FeedbackScoreSource:()=>Bn,FeedbackUpdate:()=>$l,FindFeedbackDefinitionsRequestType:()=>yi,FindFeedbackScoreNames1RequestType:()=>Mi,Function:()=>vo,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Ni,GetSpansByProjectRequestType:()=>Di,GetWebhookExamplesRequestAlertType:()=>ii,GroupContent:()=>ml,GroupContentWithAggregations:()=>fl,GroupDetail:()=>dl,GroupDetails:()=>ul,Guardrail:()=>Zl,GuardrailBatch:()=>Ah,GuardrailBatchWrite:()=>Uo,GuardrailName:()=>Ql,GuardrailResult:()=>Yl,GuardrailWrite:()=>bs,GuardrailWriteName:()=>hs,GuardrailWriteResult:()=>Rs,GuardrailsValidation:()=>tl,GuardrailsValidationPublic:()=>fd,IdsHolder:()=>Sh,ImageUrl:()=>cp,ImageUrlPublic:()=>Wp,ImageUrlWrite:()=>zp,JsonListString:()=>D,JsonListStringCompare:()=>$i,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>rs,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>gs,LlmAsJudgeCode:()=>Oo,LlmAsJudgeCodePublic:()=>Hp,LlmAsJudgeCodeWrite:()=>_p,LlmAsJudgeMessage:()=>Be,LlmAsJudgeMessageContent:()=>mp,LlmAsJudgeMessageContentPublic:()=>Lp,LlmAsJudgeMessageContentWrite:()=>Sp,LlmAsJudgeMessagePublic:()=>Ke,LlmAsJudgeMessagePublicRole:()=>Op,LlmAsJudgeMessageRole:()=>pp,LlmAsJudgeMessageWrite:()=>He,LlmAsJudgeMessageWriteRole:()=>yp,LlmAsJudgeModelParameters:()=>We,LlmAsJudgeModelParametersPublic:()=>Xe,LlmAsJudgeModelParametersWrite:()=>Ve,LlmAsJudgeOutputSchema:()=>Le,LlmAsJudgeOutputSchemaPublic:()=>Ge,LlmAsJudgeOutputSchemaPublicType:()=>Vp,LlmAsJudgeOutputSchemaType:()=>dp,LlmAsJudgeOutputSchemaWrite:()=>Je,LlmAsJudgeOutputSchemaWriteType:()=>xp,LogItem:()=>qp,LogItemLevel:()=>Zp,LogPage:()=>ec,ManualEvaluationRequest:()=>qi,ManualEvaluationRequestEntityType:()=>om,ManualEvaluationResponse:()=>Zi,Message:()=>ms,MultipartUploadPart:()=>op,NumericalFeedbackDefinition:()=>xl,NumericalFeedbackDefinitionCreate:()=>Cl,NumericalFeedbackDefinitionPublic:()=>gt,NumericalFeedbackDefinitionUpdate:()=>Kl,NumericalFeedbackDetail:()=>Sl,NumericalFeedbackDetailCreate:()=>vl,NumericalFeedbackDetailPublic:()=>Ml,NumericalFeedbackDetailUpdate:()=>Xl,Optimization:()=>Ph,OptimizationPagePublic:()=>ra,OptimizationPublic:()=>mr,OptimizationPublicStatus:()=>bm,OptimizationStatus:()=>tm,OptimizationStudioConfig:()=>lm,OptimizationStudioConfigPublic:()=>Am,OptimizationStudioConfigWrite:()=>hm,OptimizationStudioLog:()=>Tm,OptimizationUpdate:()=>Zr,OptimizationUpdateStatus:()=>xi,OptimizationWrite:()=>ea,OptimizationWriteStatus:()=>Rm,PageColumns:()=>Kc,PercentageValueStatPublic:()=>Nc,PercentageValues:()=>Se,PercentageValuesDetailed:()=>Lm,PercentageValuesPublic:()=>at,Project:()=>vh,ProjectDetailed:()=>Hm,ProjectDetailedVisibility:()=>Vm,ProjectMetricRequestPublic:()=>ro,ProjectMetricRequestPublicInterval:()=>Pi,ProjectMetricRequestPublicMetricType:()=>Ei,ProjectMetricResponsePublic:()=>Nm,ProjectMetricResponsePublicInterval:()=>Dm,ProjectMetricResponsePublicMetricType:()=>Um,ProjectPagePublic:()=>vm,ProjectPublic:()=>ht,ProjectPublicVisibility:()=>Pm,ProjectRetrieveDetailed:()=>oo,ProjectStatItemObjectPublic:()=>Oc,ProjectStatsPublic:()=>Qe,ProjectStatsSummary:()=>Om,ProjectStatsSummaryItem:()=>Fm,ProjectUpdate:()=>eo,ProjectUpdateVisibility:()=>Ti,ProjectVisibility:()=>Em,ProjectWrite:()=>qr,ProjectWriteVisibility:()=>Ai,Prompt:()=>Ih,PromptDetail:()=>Ym,PromptDetailTemplateStructure:()=>Qm,PromptPagePublic:()=>id,PromptPublic:()=>td,PromptPublicTemplateStructure:()=>od,PromptTemplateStructure:()=>Xm,PromptTokensDetails:()=>mc,PromptType:()=>Jm,PromptUpdatable:()=>ao,PromptVersion:()=>$m,PromptVersionDetail:()=>he,PromptVersionDetailTemplateStructure:()=>ts,PromptVersionDetailType:()=>os,PromptVersionLink:()=>Qi,PromptVersionLinkPublic:()=>Yi,PromptVersionLinkWrite:()=>bi,PromptVersionPagePublic:()=>rd,PromptVersionPublic:()=>ed,PromptVersionPublicTemplateStructure:()=>qm,PromptVersionPublicType:()=>Zm,PromptVersionRetrieveDetail:()=>no,PromptVersionTemplateStructure:()=>Gm,PromptVersionType:()=>Km,PromptWrite:()=>to,PromptWriteTemplateStructure:()=>Ii,PromptWriteType:()=>Ci,ProviderApiKey:()=>Th,ProviderApiKeyPagePublic:()=>em,ProviderApiKeyProvider:()=>rm,ProviderApiKeyPublic:()=>wt,ProviderApiKeyPublicProvider:()=>ql,ProviderApiKeyUpdate:()=>Yr,ProviderApiKeyWrite:()=>Qr,ProviderApiKeyWriteProvider:()=>ki,ResponseFormat:()=>ws,ResponseFormatType:()=>us,Result:()=>Ze,ResultsNumberPublic:()=>Mm,ScoreName:()=>Cm,ServiceTogglesConfig:()=>ad,Span:()=>lt,SpanBatch:()=>Uh,SpanBatchUpdate:()=>mo,SpanBatchWrite:()=>co,SpanEnrichmentOptions:()=>Fn,SpanExperimentItemBulkWriteView:()=>Kn,SpanExperimentItemBulkWriteViewType:()=>Xn,SpanFilter:()=>Vo,SpanFilterOperator:()=>hp,SpanFilterPublic:()=>uo,SpanFilterPublicOperator:()=>ns,SpanFilterWrite:()=>Ep,SpanFilterWriteOperator:()=>Tp,SpanLlmAsJudgeCode:()=>Ho,SpanLlmAsJudgeCodePublic:()=>Gp,SpanLlmAsJudgeCodeWrite:()=>Pp,SpanPagePublic:()=>ld,SpanPublic:()=>yt,SpanPublicType:()=>cd,SpanSearchStreamRequestPublic:()=>go,SpanSearchStreamRequestPublicType:()=>Fi,SpanType:()=>al,SpanUpdate:()=>lo,SpanUpdateType:()=>as,SpanWrite:()=>po,SpanWriteType:()=>is,SpansCountResponse:()=>ks,StartMultipartUploadRequest:()=>xr,StartMultipartUploadRequestEntityType:()=>pi,StartMultipartUploadResponse:()=>ip,StreamOptions:()=>ds,StudioEvaluation:()=>pm,StudioEvaluationPublic:()=>xm,StudioEvaluationWrite:()=>wm,StudioLlmModel:()=>nm,StudioLlmModelPublic:()=>km,StudioLlmModelWrite:()=>um,StudioMessage:()=>im,StudioMessagePublic:()=>ym,StudioMessageWrite:()=>mm,StudioMetric:()=>sm,StudioMetricPublic:()=>Sm,StudioMetricWrite:()=>gm,StudioOptimizer:()=>cm,StudioOptimizerPublic:()=>_m,StudioOptimizerWrite:()=>fm,StudioPrompt:()=>am,StudioPromptPublic:()=>zm,StudioPromptWrite:()=>dm,Tool:()=>fs,ToolCall:()=>tt,Trace:()=>ct,TraceBatch:()=>Dh,TraceBatchUpdate:()=>Ro,TraceBatchWrite:()=>fo,TraceCountResponse:()=>xs,TraceEnrichmentOptions:()=>On,TraceExperimentItemBulkWriteView:()=>Jn,TraceFilter:()=>ke,TraceFilterOperator:()=>sp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>qn,TraceFilterWrite:()=>Xo,TraceFilterWriteOperator:()=>bp,TracePagePublic:()=>yd,TracePublic:()=>kt,TracePublicVisibilityMode:()=>hd,TraceSearchStreamRequestPublic:()=>Ao,TraceThread:()=>St,TraceThreadBatchIdentifier:()=>zo,TraceThreadBatchUpdate:()=>yo,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>cs,TraceThreadFilterPublic:()=>Ne,TraceThreadFilterPublicOperator:()=>es,TraceThreadFilterWrite:()=>Ko,TraceThreadFilterWriteOperator:()=>Cp,TraceThreadIdentifier:()=>oa,TraceThreadLlmAsJudgeCode:()=>Bo,TraceThreadLlmAsJudgeCodePublic:()=>Xp,TraceThreadLlmAsJudgeCodeWrite:()=>Ip,TraceThreadPage:()=>bd,TraceThreadSearchStreamRequest:()=>_o,TraceThreadStatus:()=>Rd,TraceThreadUpdate:()=>bo,TraceThreadUserDefinedMetricPythonCode:()=>Lo,TraceThreadUserDefinedMetricPythonCodePublic:()=>Kp,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Up,TraceUpdate:()=>ho,TraceVisibilityMode:()=>il,TraceWrite:()=>wo,UploadAttachmentRequestEntityType:()=>ci,Usage:()=>uc,UserDefinedMetricPythonCode:()=>Wo,UserDefinedMetricPythonCodePublic:()=>Jp,UserDefinedMetricPythonCodeWrite:()=>Mp,ValueEntry:()=>Vn,ValueEntryCompare:()=>Ac,ValueEntryCompareSource:()=>_c,ValueEntryExperimentItemBulkWriteView:()=>Qn,ValueEntryExperimentItemBulkWriteViewSource:()=>$n,ValueEntryPublic:()=>pd,ValueEntryPublicSource:()=>sd,ValueEntrySource:()=>Ln,VideoUrl:()=>lp,VideoUrlPublic:()=>Bp,VideoUrlWrite:()=>kp,Webhook:()=>As,WebhookExamples:()=>Hs,WebhookPublic:()=>Fs,WebhookTestResult:()=>Xs,WebhookTestResultStatus:()=>Js,WebhookWrite:()=>Ms,WelcomeWizardSubmission:()=>Do,WelcomeWizardTracking:()=>zd,WorkspaceConfiguration:()=>xt,WorkspaceMetricRequest:()=>Fh,WorkspaceMetricResponse:()=>ta,WorkspaceMetricsSummaryRequest:()=>ur,WorkspaceMetricsSummaryResponse:()=>kd,WorkspaceNameHolder:()=>np,WorkspaceSpansCount:()=>zs,WorkspaceTraceCount:()=>Ss,alerts:()=>ai,annotationQueues:()=>Li,attachments:()=>ar,chatCompletions:()=>Vi,dashboards:()=>Hi,datasets:()=>ui,experiments:()=>nr,feedbackDefinitions:()=>zi,guardrails:()=>Ji,llmProviderKey:()=>Si,optimizations:()=>_i,projects:()=>vi,prompts:()=>Ui,spans:()=>sr,traces:()=>Fe,welcomeWizard:()=>Xi});var ai={};c(ai,{GetWebhookExamplesRequestAlertType:()=>ii});var ii=e.enum_(["general","slack","pagerduty"]);var ar={};c(ar,{AttachmentListRequestEntityType:()=>ni,DownloadAttachmentRequestEntityType:()=>si,StartMultipartUploadRequest:()=>xr,StartMultipartUploadRequestEntityType:()=>pi,UploadAttachmentRequestEntityType:()=>ci,uploadAttachment:()=>li});var ni=e.enum_(["trace","span"]);var si=e.enum_(["trace","span"]);var pi=e.enum_(["trace","span"]);var ci=e.enum_(["trace","span"]);var li={};c(li,{Request:()=>sh});var sh=e.record(e.string(),e.unknown());var xr=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",pi),entityId:e.property("entity_id",e.string()),path:e.string()});var ui={};c(ui,{CreateDatasetItemsFromSpansRequest:()=>Pr,CreateDatasetItemsFromTracesRequest:()=>vr,DatasetExpansionWrite:()=>Ur,DatasetIdentifier:()=>Ir,DatasetIdentifierPublic:()=>Dr,DatasetItemBatchUpdate:()=>_r,DatasetItemBatchWrite:()=>Er,DatasetItemStreamRequest:()=>Mr,DatasetItemsDelete:()=>jr,DatasetUpdate:()=>Cr,DatasetUpdateVisibility:()=>di,DatasetVersionCreatePublic:()=>Fr,DatasetVersionRestorePublic:()=>Or,DatasetVersionTag:()=>Nr,DatasetWrite:()=>Ar,DatasetWriteVisibility:()=>mi});var mi=e.enum_(["private","public"]);var di=e.enum_(["private","public"]);var Un=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Dn=e.object({field:e.string().optional(),operator:Un.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Mn=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 _r=e.object({ids:e.list(e.string()).optional(),filters:e.list(Dn).optional(),update:Mn,mergeTags:e.property("merge_tags",e.boolean().optional())});var Ar=e.object({id:e.string().optional(),name:e.string(),visibility:mi.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Nn=e.enum_(["manual","trace","span","sdk"]);var Tr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Nn,data:v,tags:e.list(e.string()).optional()});var Er=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Tr)});var Fn=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var Pr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Fn)});var On=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 vr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",On)});var Cr=e.object({name:e.string(),description:e.string().optional(),visibility:di.optional(),tags:e.list(e.string()).optional()});var Ir=e.object({datasetName:e.property("dataset_name",e.string())});var jr=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Ur=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 Dr=e.object({datasetName:e.property("dataset_name",e.string())});var Mr=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 Nr=e.object({tag:e.string()});var Fr=e.object({tag:e.string().optional(),changeDescription:e.property("change_description",e.string().optional()),metadata:e.record(e.string(),e.string()).optional()});var Or=e.object({versionRef:e.property("version_ref",e.string())});var nr={};c(nr,{ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Jr,ExperimentItemStreamRequest:()=>Gr,ExperimentItemsBatch:()=>Lr,ExperimentItemsDelete:()=>Vr,ExperimentStreamRequestPublic:()=>$r,ExperimentUpdate:()=>Kr,ExperimentUpdateStatus:()=>hi,ExperimentUpdateType:()=>fi,ExperimentWrite:()=>Wr,ExperimentWriteStatus:()=>wi,ExperimentWriteType:()=>gi,findFeedbackScoreNames:()=>Ri});var gi=e.enum_(["regular","trial","mini-batch"]);var wi=e.enum_(["running","completed","cancelled"]);var fi=e.enum_(["regular","trial","mini-batch"]);var hi=e.enum_(["running","completed","cancelled"]);var Ri={};c(Ri,{Response:()=>ph});var ph=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 Wn=e.object({name:e.string(),value:e.number()});var bi=e.object({id:e.string()});var Wr=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:gi.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:wi.optional(),experimentScores:e.property("experiment_scores",e.list(Wn).optional()),promptVersion:e.property("prompt_version",bi.optional()),promptVersions:e.property("prompt_versions",e.list(bi).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Bn=e.enum_(["ui","sdk","online_scoring"]);var Ln=e.enum_(["ui","sdk","online_scoring"]);var Vn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Ln.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:Bn,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(),Vn).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 Hn=e.enum_(["default","hidden"]);var Br=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",Hn.optional())});var Lr=e.object({experimentItems:e.property("experiment_items",e.list(Br))});var Vr=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 Hr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Jn=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",Hr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Xn=e.enum_(["general","tool","llm","guardrail"]);var Kn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Xn.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",Hr.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 Gn=e.enum_(["ui","sdk","online_scoring"]);var $n=e.enum_(["ui","sdk","online_scoring"]);var Qn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:$n.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 Yn=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Gn,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(),Qn).optional())});var Zn=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Jn.optional(),spans:e.list(Kn).optional(),feedbackScores:e.property("feedback_scores",e.list(Yn).optional())});var Jr=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(Zn)});var Xr=e.object({name:e.string(),value:e.number()});var Kr=e.object({name:e.string().optional(),metadata:v.optional(),type:fi.optional(),status:hi.optional(),experimentScores:e.property("experiment_scores",e.list(Xr).optional())});var Gr=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 $r=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var zi={};c(zi,{FindFeedbackDefinitionsRequestType:()=>yi});var yi=e.enum_(["numerical","categorical","boolean"]);var Si={};c(Si,{ProviderApiKeyUpdate:()=>Yr,ProviderApiKeyWrite:()=>Qr,ProviderApiKeyWriteProvider:()=>ki});var ki=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var Qr=e.object({provider:ki,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 Yr=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 _i={};c(_i,{OptimizationUpdate:()=>Zr,OptimizationUpdateStatus:()=>xi});var xi=e.enum_(["running","completed","cancelled","initialized","error"]);var Zr=e.object({name:e.string().optional(),status:xi.optional()});var vi={};c(vi,{ProjectMetricRequestPublic:()=>ro,ProjectMetricRequestPublicInterval:()=>Pi,ProjectMetricRequestPublicMetricType:()=>Ei,ProjectRetrieveDetailed:()=>oo,ProjectUpdate:()=>eo,ProjectUpdateVisibility:()=>Ti,ProjectWrite:()=>qr,ProjectWriteVisibility:()=>Ai});var Ai=e.enum_(["private","public"]);var Ti=e.enum_(["private","public"]);var Ei=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Pi=e.enum_(["HOURLY","DAILY","WEEKLY"]);var qr=e.object({name:e.string(),visibility:Ai.optional(),description:e.string().optional()});var eo=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Ti.optional()});var qn=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:qn.optional(),key:e.string().optional(),value:e.string().optional()});var es=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ne=e.object({field:e.string().optional(),operator:es.optional(),key:e.string().optional(),value:e.string().optional()});var ro=e.object({metricType:e.property("metric_type",Ei.optional()),interval:Pi.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(Ne).optional())});var oo=e.object({name:e.string()});var Ui={};c(Ui,{CreatePromptVersionDetail:()=>io,CreatePromptVersionDetailTemplateStructure:()=>ji,PromptUpdatable:()=>ao,PromptVersionRetrieveDetail:()=>no,PromptWrite:()=>to,PromptWriteTemplateStructure:()=>Ii,PromptWriteType:()=>Ci});var Ci=e.enum_(["mustache","jinja2"]);var Ii=e.enum_(["text","chat"]);var ji=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var to=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:Ci.optional(),templateStructure:e.property("template_structure",Ii.optional()),tags:e.list(e.string()).optional()});var rs=e.record(e.string(),e.unknown());var os=e.enum_(["mustache","jinja2"]);var ts=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:rs.optional(),type:os.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",ts.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var io=e.object({name:e.string(),version:he,templateStructure:e.property("template_structure",ji.optional())});var ao=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var no=e.object({name:e.string(),commit:e.string().optional()});var sr={};c(sr,{FindFeedbackScoreNames1RequestType:()=>Mi,GetSpanStatsRequestType:()=>Ni,GetSpansByProjectRequestType:()=>Di,SpanBatchUpdate:()=>mo,SpanBatchWrite:()=>co,SpanSearchStreamRequestPublic:()=>go,SpanSearchStreamRequestPublicType:()=>Fi,findFeedbackScoreNames1:()=>Oi});var Di=e.enum_(["general","tool","llm","guardrail"]);var Mi=e.enum_(["general","tool","llm","guardrail"]);var Ni=e.enum_(["general","tool","llm","guardrail"]);var Fi=e.enum_(["general","tool","llm","guardrail"]);var Oi={};c(Oi,{Response:()=>ch});var ch=e.list(e.string());var is=e.enum_(["general","tool","llm","guardrail"]);var so=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var po=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:is.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",so.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 co=e.object({spans:e.list(po)});var as=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 lo=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:as.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 mo=e.object({ids:e.list(e.string()),update:lo,mergeTags:e.property("merge_tags",e.boolean().optional())});var ns=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var uo=e.object({field:e.string().optional(),operator:ns.optional(),key:e.string().optional(),value:e.string().optional()});var go=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:Fi.optional(),filters:e.list(uo).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 Fe={};c(Fe,{DeleteThreadFeedbackScores:()=>ko,DeleteTraceThreads:()=>So,FeedbackScoreBatchThread:()=>xo,TraceBatchUpdate:()=>Ro,TraceBatchWrite:()=>fo,TraceSearchStreamRequestPublic:()=>Ao,TraceThreadBatchIdentifier:()=>zo,TraceThreadBatchUpdate:()=>yo,TraceThreadSearchStreamRequest:()=>_o,findFeedbackScoreNames2:()=>Wi,findTraceThreadsFeedbackScoreNames:()=>Bi});var Wi={};c(Wi,{Response:()=>lh});var lh=e.list(e.string());var Bi={};c(Bi,{Response:()=>mh});var mh=e.list(e.string());var wo=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",so.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var fo=e.object({traces:e.list(wo)});var ho=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 Ro=e.object({ids:e.list(e.string()),update:ho,mergeTags:e.property("merge_tags",e.boolean().optional())});var bo=e.object({tags:e.list(e.string()).optional()});var yo=e.object({ids:e.list(e.string()),update:bo,mergeTags:e.property("merge_tags",e.boolean().optional())});var zo=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 ko=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 So=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 ss=e.enum_(["ui","sdk","online_scoring"]);var ps=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:ss,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var xo=e.object({scores:e.list(ps)});var cs=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:cs.optional(),key:e.string().optional(),value:e.string().optional()});var _o=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 Ao=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 Li={};c(Li,{AnnotationQueueBatchWrite:()=>Eo,AnnotationQueueUpdate:()=>Po});var ls=e.enum_(["trace","thread"]);var To=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:ls,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var Eo=e.object({annotationQueues:e.property("annotation_queues",e.list(To))});var Po=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 Vi={};c(Vi,{ChatCompletionRequest:()=>Co});var ms=e.record(e.string(),e.unknown());var ds=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var us=e.enum_(["text","json_object","json_schema"]);var gs=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var ws=e.object({type:us.optional(),jsonSchema:e.property("json_schema",gs.optional())});var vo=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 fs=e.object({type:e.stringLiteral("function").optional(),function:vo.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var Co=e.object({model:e.string().optional(),messages:e.list(ms).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",ds.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",ws.optional()),seed:e.number().optional(),tools:e.list(fs).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(vo).optional(),functionCall:e.property("function_call",ze.optional())});var Hi={};c(Hi,{DashboardUpdatePublic:()=>jo,DashboardWrite:()=>Io});var Io=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var jo=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var Ji={};c(Ji,{GuardrailBatchWrite:()=>Uo});var hs=e.enum_(["TOPIC","PII"]);var Rs=e.enum_(["passed","failed"]);var bs=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:hs,result:Rs,config:v,details:v});var Uo=e.object({guardrails:e.list(bs)});var Xi={};c(Xi,{WelcomeWizardSubmission:()=>Do});var Do=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 ys=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var pr=e.object({biInformation:e.property("bi_information",e.list(ys).optional())});var zs=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var ks=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(zs).optional())});var Ss=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var xs=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Ss).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var _s=e.enum_(["general","slack","pagerduty"]);var As=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 Ts=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 Es=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ps=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Es,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 vs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Ts),triggerConfigs:e.property("trigger_configs",e.list(Ps).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var dh=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",_s.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:As,triggers:e.list(vs).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Cs=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Is=e.object({id:e.string().optional(),type:Cs,configValue:e.property("config_value",e.record(e.string(),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.object({id:e.string().optional(),eventType:e.property("event_type",js),triggerConfigs:e.property("trigger_configs",e.list(Is).optional())});var Ds=e.enum_(["general","slack","pagerduty"]);var Ms=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 Mo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ds.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ms,triggers:e.list(Us).optional()});var F=e.object({ids:e.list(e.string())});var Ns=e.enum_(["general","slack","pagerduty"]);var Fs=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 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.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Bs=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ws,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 Ls=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Os),triggerConfigs:e.property("trigger_configs",e.list(Bs).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var No=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ns.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Fs,triggers:e.list(Ls).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Vs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(No).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var uh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Hs=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Js=e.enum_(["success","failure"]);var Xs=e.object({status:Js.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 Ki=e.object({ids:e.list(e.string())});var Ks=e.enum_(["trace","thread"]);var Gs=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var $s=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:Ks,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(Gs).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 gh=e.object({annotationQueues:e.property("annotation_queues",e.list($s))});var Qs=e.enum_(["trace","thread"]);var Ys=e.object({username:e.string().optional(),status:e.number().optional()});var Oe=e.object({name:e.string(),value:e.number()});var Fo=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(Ys).optional(),feedbackScores:e.property("feedback_scores",e.list(Oe).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 Zs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Fo).optional(),sortableBy:e.list(e.string()).optional()});var qs=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 ep=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(qs).optional(),sortableBy:e.list(e.string()).optional()});var rp=e.enum_(["trace","span"]);var op=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var Gi=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",rp),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(op))});var tp=e.enum_(["trace","span"]);var wh=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",tp),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var ip=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var ap=e.record(e.string(),e.unknown());var np=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var sp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:sp.optional(),key:e.string().optional(),value:e.string().optional()});var We=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",v.optional())});var pp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var cp=e.object({url:e.string(),detail:e.string().optional()});var lp=e.object({url:e.string()});var mp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",cp.optional()),videoUrl:e.property("video_url",lp.optional())});var Be=e.object({role:pp,content:e.string().optional(),contentArray:e.property("content_array",e.list(mp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var dp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Le=e.object({name:e.string(),type:dp,description:e.string()});var Oo=e.object({model:We,messages:e.list(Be),variables:e.record(e.string(),e.string()),schema:e.list(Le)});var up=e.object({filters:e.list(ke).optional(),code:Oo.optional()});var Wo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var gp=e.object({filters:e.list(ke).optional(),code:Wo.optional()});var Bo=e.object({model:We,messages:e.list(Be),schema:e.list(Le)});var wp=e.object({filters:e.list(de).optional(),code:Bo.optional()});var Lo=e.object({metric:e.string()});var fp=e.object({filters:e.list(de).optional(),code:Lo.optional()});var hp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Vo=e.object({field:e.string().optional(),operator:hp.optional(),key:e.string().optional(),value:e.string().optional()});var Ho=e.object({model:We,messages:e.list(Be),variables:e.record(e.string(),e.string()),schema:e.list(Le)});var Rp=e.object({filters:e.list(Vo).optional(),code:Ho.optional()});var Jo=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")}),fh=e.union("type",{llm_as_judge:up.extend(Jo),user_defined_metric_python:gp.extend(Jo),trace_thread_llm_as_judge:wp.extend(Jo),trace_thread_user_defined_metric_python:fp.extend(Jo),span_llm_as_judge:Rp.extend(Jo)}).transform({transform:s=>s,untransform:s=>s});var bp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Xo=e.object({field:e.string().optional(),operator:bp.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",ie.optional())});var yp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var zp=e.object({url:e.string(),detail:e.string().optional()});var kp=e.object({url:e.string()});var Sp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",zp.optional()),videoUrl:e.property("video_url",kp.optional())});var He=e.object({role:yp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Sp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var xp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:xp,description:e.string()});var _p=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(Xo).optional(),code:_p.optional()});var Tp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ep=e.object({field:e.string().optional(),operator:Tp.optional(),key:e.string().optional(),value:e.string().optional()});var Pp=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var vp=e.object({filters:e.list(Ep).optional(),code:Pp.optional()});var Cp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ko=e.object({field:e.string().optional(),operator:Cp.optional(),key:e.string().optional(),value:e.string().optional()});var Ip=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var jp=e.object({filters:e.list(Ko).optional(),code:Ip.optional()});var Up=e.object({metric:e.string()});var Dp=e.object({filters:e.list(Ko).optional(),code:Up.optional()});var Mp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Np=e.object({filters:e.list(Xo).optional(),code:Mp.optional()});var Go=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")}),Fp=e.union("type",{llm_as_judge:Ap.extend(Go),user_defined_metric_python:Np.extend(Go),trace_thread_llm_as_judge:jp.extend(Go),trace_thread_user_defined_metric_python:Dp.extend(Go),span_llm_as_judge:vp.extend(Go)}).transform({transform:s=>s,untransform:s=>s});var Xe=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",Z.optional())});var Op=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Wp=e.object({url:e.string(),detail:e.string().optional()});var Bp=e.object({url:e.string()});var Lp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Wp.optional()),videoUrl:e.property("video_url",Bp.optional())});var Ke=e.object({role:Op,content:e.string().optional(),contentArray:e.property("content_array",e.list(Lp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Vp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:Vp,description:e.string()});var Hp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var $o=e.object({filters:e.list(be).optional(),code:Hp.optional()});var Jp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Qo=e.object({filters:e.list(be).optional(),code:Jp.optional()});var Xp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var Yo=e.object({filters:e.list(Ne).optional(),code:Xp.optional()});var Kp=e.object({metric:e.string()});var Zo=e.object({filters:e.list(Ne).optional(),code:Kp.optional()});var Gp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var qo=e.object({filters:e.list(uo).optional(),code:Gp.optional()});var et=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")}),$p=e.union("type",{llm_as_judge:$o.extend(et),user_defined_metric_python:Qo.extend(et),trace_thread_llm_as_judge:Yo.extend(et),trace_thread_user_defined_metric_python:Zo.extend(et),span_llm_as_judge:qo.extend(et)}).transform({transform:s=>s,untransform:s=>s});var Qp=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list($p).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var rt=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")}),Yp=e.union("type",{llm_as_judge:$o.extend(rt),user_defined_metric_python:Qo.extend(rt),trace_thread_llm_as_judge:Yo.extend(rt),trace_thread_user_defined_metric_python:Zo.extend(rt),span_llm_as_judge:qo.extend(rt)}).transform({transform:s=>s,untransform:s=>s});var Zp=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var qp=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:Zp.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var ec=e.object({content:e.list(qp).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var rc=e.object({filters:e.list(ke).optional(),code:Oo.optional()});var oc=e.object({filters:e.list(ke).optional(),code:Wo.optional()});var tc=e.object({filters:e.list(de).optional(),code:Bo.optional()});var ic=e.object({filters:e.list(de).optional(),code:Lo.optional()});var ac=e.object({filters:e.list(Vo).optional(),code:Ho.optional()});var ot=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")}),nc=e.union("type",{llm_as_judge:rc.extend(ot),user_defined_metric_python:oc.extend(ot),trace_thread_llm_as_judge:tc.extend(ot),trace_thread_user_defined_metric_python:ic.extend(ot),span_llm_as_judge:ac.extend(ot)}).transform({transform:s=>s,untransform:s=>s});var sc=e.enum_(["system","user","assistant","tool","function"]);var tt=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var pc=e.object({role:sc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(tt).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var cc=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(tt).optional()),functionCall:e.property("function_call",ze.optional())});var lc=e.object({index:e.number().optional(),message:pc.optional(),delta:cc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var mc=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var dc=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var uc=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",mc.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",dc.optional())});var gc=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(lc).optional(),usage:uc.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var $e=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 wc=e.object({content:e.list($e).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var fc=e.enum_(["private","public"]);var hc=e.enum_(["unknown","processing","completed","failed"]);var hh=e.object({id:e.string().optional(),name:e.string(),visibility:fc.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:hc.optional()});var Rc=e.enum_(["manual","trace","span","sdk"]);var it=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:Rc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Br).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 Rh=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(it)});var bc=e.object({generatedSamples:e.property("generated_samples",e.list(it).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var bh=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 yc=e.enum_(["string","number","object","boolean","array","null"]);var zc=e.object({name:e.string().optional(),types:e.list(yc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var kc=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 Sc=e.enum_(["manual","trace","span","sdk"]);var $i=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var xc=e.enum_(["ui","sdk","online_scoring"]);var _c=e.enum_(["ui","sdk","online_scoring"]);var Ac=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:_c.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 Tc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:xc,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(),Ac).optional())});var Ec=e.enum_(["default","hidden"]);var Pc=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:$i.optional(),output:$i.optional(),feedbackScores:e.property("feedback_scores",e.list(Tc).optional()),comments:e.list(kc).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",Ec.optional())});var vc=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:Sc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Pc).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 Cc=e.object({content:e.list(vc).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(zc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Ic=e.enum_(["private","public"]);var jc=e.enum_(["unknown","processing","completed","failed"]);var cr=e.object({id:e.string().optional(),name:e.string(),visibility:Ic.optional(),tags:e.list(e.string()).optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),experimentCount:e.property("experiment_count",e.number().optional()),datasetItemsCount:e.property("dataset_items_count",e.number().optional()),optimizationCount:e.property("optimization_count",e.number().optional()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),mostRecentOptimizationAt:e.property("most_recent_optimization_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional()),status:jc.optional()});var Uc=e.object({content:e.list(cr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.list(e.string()).optional()});var Dc=e.object({value:e.number().optional()});var Mc=e.object({value:e.number().optional()});var at=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Nc=e.object({value:at.optional()});var Fc=e.object({name:e.string().optional()}),Oc=e.union("type",{PERCENTAGE:Nc.extend(Fc),COUNT:Mc.extend(Fc),AVG:Dc.extend(Fc)}).transform({transform:s=>s,untransform:s=>s});var Qe=e.object({stats:e.list(Oc).optional()});var Wc=e.enum_(["manual","trace","span","sdk"]);var Bc=e.enum_(["default","hidden"]);var nt=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",Bc.optional())});var st=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:Wc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(nt).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 Lc=e.enum_(["string","number","object","boolean","array","null"]);var Vc=e.object({name:e.string().optional(),types:e.list(Lc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Hc=e.object({content:e.list(st).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Vc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Jc=e.enum_(["string","number","object","boolean","array","null"]);var Xc=e.object({name:e.string().optional(),types:e.list(Jc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Kc=e.object({columns:e.list(Xc).optional()});var Gc=e.object({typeName:e.string().optional()});var yh=e.object({type:Gc.optional(),closed:e.boolean().optional()});var $c=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var Qc=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:$c.optional()});var pt=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(),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 Yc=e.object({content:e.list(pt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Zc=e.enum_(["regular","trial","mini-batch"]);var qc=e.enum_(["running","completed","cancelled"]);var Se=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Qi=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 zh=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:Zc.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:Se.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:qc.optional(),experimentScores:e.property("experiment_scores",e.list(Xr).optional()),promptVersion:e.property("prompt_version",Qi.optional()),promptVersions:e.property("prompt_versions",e.list(Qi).optional())});var lr=e.object({ids:e.list(e.string())});var el=e.enum_(["TOPIC","PII"]);var rl=e.enum_(["passed","failed"]);var ol=e.object({name:el.optional(),result:rl.optional()});var tl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(ol).optional()});var il=e.enum_(["default","hidden"]);var ct=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(tl).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",il.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 al=e.enum_(["general","tool","llm","guardrail"]);var lt=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:al.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 nl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:ct.optional(),spans:e.list(lt).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var kh=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(nl)});var Ye=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 pl=e.enum_(["running","completed","cancelled"]);var cl=e.object({name:e.string(),value:e.number()});var Yi=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 mt=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(Oe).optional()),comments:e.list(Ye).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:at.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:pl.optional(),experimentScores:e.property("experiment_scores",e.list(cl).optional()),promptVersion:e.property("prompt_version",Yi.optional()),promptVersions:e.property("prompt_versions",e.list(Yi).optional())});var ll=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(mt).optional(),sortableBy:e.list(e.string()).optional()});var ml=e.object({label:e.string().optional()});var dl=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var ul=e.object({groupsDetails:e.property("groups_details",e.list(dl).optional())});var gl=e.object({content:e.record(e.string(),ml).optional(),details:ul.optional()});var wl=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:Se.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),experimentScores:e.property("experiment_scores",e.list(re).optional())});var fl=e.object({aggregations:wl.optional()});var hl=e.object({content:e.record(e.string(),fl).optional()});var Sh=e.object({ids:e.list(e.string())});var Rl=e.object({typeName:e.string().optional()});var xh=e.object({type:Rl.optional(),closed:e.boolean().optional()});var bl=e.object({trueLabel:e.string(),falseLabel:e.string()});var yl=e.object({details:bl.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({categories:e.record(e.string(),e.number())});var kl=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 Sl=e.object({max:e.number(),min:e.number()});var xl=e.object({details:Sl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var _l=e.object({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()}),_h=e.union("type",{numerical:xl.extend(_l),categorical:kl.extend(_l),boolean:yl.extend(_l)}).transform({transform:s=>s,untransform:s=>s});var Al=e.object({trueLabel:e.string(),falseLabel:e.string()});var Tl=e.object({details:Al.optional()});var El=e.object({categories:e.record(e.string(),e.number())});var Pl=e.object({details:El.optional()});var vl=e.object({max:e.number(),min:e.number()});var Cl=e.object({details:vl.optional()});var Il=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),jl=e.union("type",{numerical:Cl.extend(Il),categorical:Pl.extend(Il),boolean:Tl.extend(Il)}).transform({transform:s=>s,untransform:s=>s});var Ul=e.object({trueLabel:e.string(),falseLabel:e.string()});var dt=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 Dl=e.object({categories:e.record(e.string(),e.number())});var ut=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 Ml=e.object({max:e.number(),min:e.number()});var gt=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 Nl=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()}),Fl=e.union("type",{numerical:gt.extend(Nl),categorical:ut.extend(Nl),boolean:dt.extend(Nl)}).transform({transform:s=>s,untransform:s=>s});var Ol=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Fl).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()}),Bl=e.union("type",{numerical:gt.extend(Wl),categorical:ut.extend(Wl),boolean:dt.extend(Wl)}).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.enum_(["TOPIC","PII"]);var Yl=e.enum_(["passed","failed"]);var Zl=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:Ql,result:Yl,config:v,details:v});var Ah=e.object({guardrails:e.list(Zl)});var ql=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var wt=e.object({id:e.string().optional(),provider:ql,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())});var em=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(wt).optional(),sortableBy:e.list(e.string()).optional()});var rm=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var Th=e.object({id:e.string().optional(),provider:rm,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())});var Zi=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var om=e.enum_(["trace","thread"]);var qi=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",om)});var Eh=v;var tm=e.enum_(["running","completed","cancelled","initialized","error"]);var im=e.object({role:e.string(),content:e.string()});var am=e.object({messages:e.list(im)});var nm=e.object({model:e.string(),parameters:v.optional()});var sm=e.object({type:e.string(),parameters:v.optional()});var pm=e.object({metrics:e.list(sm)});var cm=e.object({type:e.string(),parameters:v.optional()});var lm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:am,llmModel:e.property("llm_model",nm),evaluation:pm,optimizer:cm});var Ph=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:tm,metadata:D.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(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 mm=e.object({role:e.string(),content:e.string()});var dm=e.object({messages:e.list(mm)});var um=e.object({model:e.string(),parameters:ie.optional()});var gm=e.object({type:e.string(),parameters:ie.optional()});var wm=e.object({metrics:e.list(gm)});var fm=e.object({type:e.string(),parameters:ie.optional()});var hm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:dm,llmModel:e.property("llm_model",um),evaluation:wm,optimizer:fm});var Rm=e.enum_(["running","completed","cancelled","initialized","error"]);var ea=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:te.optional(),studioConfig:e.property("studio_config",hm.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});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:Z.optional()});var Sm=e.object({type:e.string(),parameters:Z.optional()});var xm=e.object({metrics:e.list(Sm)});var _m=e.object({type:e.string(),parameters:Z.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 mr=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:ae.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(Oe).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 ra=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(mr).optional(),sortableBy:e.list(e.string()).optional()});var Tm=e.object({url:e.string().optional(),lastModified:e.property("last_modified",e.date().optional()),expiresAt:e.property("expires_at",e.date().optional())});var ft=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Em=e.enum_(["private","public"]);var vh=e.object({id:e.string().optional(),name:e.string(),visibility:Em.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:Se.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",ft.optional())});var Pm=e.enum_(["private","public"]);var ht=e.object({id:e.string().optional(),name:e.string(),visibility:Pm.optional(),description:e.string().optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),lastUpdatedTraceAt:e.property("last_updated_trace_at",e.date().optional())});var vm=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ht).optional(),sortableBy:e.list(e.string()).optional()});var Cm=e.object({name:e.string().optional(),type:e.string().optional()});var Im=e.object({scores:e.list(Cm).optional()});var jm=e.object({time:e.date(),value:e.number().optional()});var Um=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Dm=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Mm=e.object({name:e.string().optional(),data:e.list(jm).optional()});var Nm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Um.optional()),interval:Dm.optional(),results:e.list(Mm).optional()});var Fm=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:Se.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",ft.optional())});var Om=e.object({content:e.list(Fm).optional()});var Wm=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Bm=e.object({name:e.string(),value:e.number()});var Lm=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Vm=e.enum_(["private","public"]);var Hm=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(Bm).optional()),duration:Lm.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",Wm.optional())});var Ch=e.object({errors:e.list(e.string()).optional()});var Jm=e.enum_(["mustache","jinja2"]);var Xm=e.enum_(["text","chat"]);var Km=e.enum_(["mustache","jinja2"]);var Gm=e.enum_(["text","chat"]);var $m=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:Km.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",Gm.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Ih=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:Jm.optional(),templateStructure:e.property("template_structure",Xm.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",$m.optional())});var jh=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Qm=e.enum_(["text","chat"]);var Ym=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",Qm.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 Zm=e.enum_(["mustache","jinja2"]);var qm=e.enum_(["text","chat"]);var ed=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:Zm.optional(),changeDescription:e.property("change_description",e.string().optional()),templateStructure:e.property("template_structure",qm.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var rd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ed).optional()});var od=e.enum_(["text","chat"]);var td=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",od.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 id=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(td).optional(),sortableBy:e.list(e.string()).optional()});var ad=e.object({pythonEvaluatorEnabled:e.boolean(),traceThreadPythonEvaluatorEnabled:e.boolean(),spanLlmAsJudgeEnabled: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()});var Uh=e.object({spans:e.list(lt)});var Rt=e.object({name:e.string(),author:e.string().optional()});var bt=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var nd=e.enum_(["ui","sdk","online_scoring"]);var sd=e.enum_(["ui","sdk","online_scoring"]);var pd=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 dr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:nd,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(),pd).optional())});var cd=e.enum_(["general","tool","llm","guardrail"]);var yt=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:cd.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",bt.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(dr).optional()),comments:e.list(Ye).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 ld=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(yt).optional(),sortableBy:e.list(e.string()).optional()});var md=e.enum_(["ui","sdk","online_scoring"]);var dd=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:md,author:e.string().optional(),id:e.string()});var zt=e.object({scores:e.list(dd)});var Dh=e.object({traces:e.list(ct)});var Mh=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var ud=e.enum_(["TOPIC","PII"]);var gd=e.enum_(["passed","failed"]);var wd=e.object({name:ud.optional(),result:gd.optional()});var fd=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(wd).optional()});var hd=e.enum_(["default","hidden"]);var kt=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",bt.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(dr).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(dr).optional()),comments:e.list(Ye).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(fd).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",hd.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 Rd=e.enum_(["active","inactive"]);var St=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:Rd.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 oa=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 bd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(St).optional(),sortableBy:e.list(e.string()).optional()});var yd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(kt).optional(),sortableBy:e.list(e.string()).optional()});var zd=e.object({completed:e.boolean().optional()});var Ze=e.object({name:e.string().optional(),current:e.number().optional(),previous:e.number().optional()});var ur=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 Nh=e.object({time:e.date(),value:e.number().optional()});var ta=e.object({results:e.list(Ze).optional()});var Fh=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 xt=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var kd=e.object({results:e.list(Ze).optional()});var ia=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:pr.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:pr.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:pr.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:ks.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:pr.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:xs.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 aa=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:Vs.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: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 T(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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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:No.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:Mo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new T(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=ii.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:Hs.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: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:Xs.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 na=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:Ki.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:Zs.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: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 T(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: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 T(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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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:Fo.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: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 400:throw new T(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:Ki.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 sa=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=ni.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:ep.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:Gi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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:Gi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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=si.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:xr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ip.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=ci.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:ar.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 pa=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:ap.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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:np.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 ca=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:Qp.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:Fp.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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:Yp.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:nc.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:ec.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 la=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: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:gc.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 ma=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:wc.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: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:$e.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:$e.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: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:$e.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 da=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:_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")switch(o.error.statusCode){case 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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,_;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((_=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?_: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:Uc.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:Ar.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)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 Pu();o.append("file",_e(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 T(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:Pr.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: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: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:cr.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:Cr.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: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: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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new 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:Ur.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:bc.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,_;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((_=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?_: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:Cc.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: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:cr.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:Qe.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:st.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/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:Tr.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:Hc.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:Kc.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:Mr.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:Qc.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:Nr.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 T(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:Yc.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 T(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: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")switch(i.error.statusCode){case 400:throw new T(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: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:pt.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})}}async _getCustomAuthorizationHeaders(){return {Authorization:await n.get(this._options.apiKey)}}};var ua=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 _=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(_.ok)return {data:ll.parseOrThrow(_.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new T(_.error.body,_.rawResponse);default:throw new p({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case "non-json":throw new p({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:_.error.errorMessage,rawResponse:_.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: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/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: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/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:Vr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new 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: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/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: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 T(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:nr.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:gl.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 T(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:hl.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 T(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: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")switch(o.error.statusCode){case 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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:mt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new 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: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 T(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:nt.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:Gr.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:$r.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 ga=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=yi.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:Ol.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:jl.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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:Bl.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:$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 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 wa=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:Uo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");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;}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:em.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: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")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:wt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new 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:Yr.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 ha=class{constructor(t={}){this._options=t;}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:qi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Zi.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 T(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:qi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Zi.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 T(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 Ra=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 ba=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 De(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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:ra.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 T(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:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new 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:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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/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:ra.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 T(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:mr.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:Zr.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:mr.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:Tm.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 ya=class{constructor(t={}){this._options=t;}findProjects(t={},r){return h.fromPromise(this.__findProjects(t,r))}async __findProjects(t={},r){var g,w;let{page:o,size:i,name:a,sorting:l}=t,d={};o!=null&&(d.page=o.toString()),i!=null&&(d.size=i.toString()),a!=null&&(d.name=a),l!=null&&(d.sorting=l);let u=await b({url:y((w=(g=await n.get(this._options.baseUrl))!=null?g:await n.get(this._options.environment))!=null?w:R.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(u.ok)return {data:vm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse});switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return h.fromPromise(this.__createProject(t,r))}async __createProject(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body: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")switch(o.error.statusCode){case 400:throw new T(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:ht.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: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 400:throw new T(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:Im.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:ro.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:Nm.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 T(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:Om.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:oo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Hm.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 T(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 za=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:id.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: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 T(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: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: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 T(o.error.body,o.rawResponse);case 409:throw new M(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return h.fromPromise(this.__getPromptById(t,r))}async __getPromptById(t,r){var i,a;let o=await b({url:y((a=(i=await n.get(this._options.baseUrl))!=null?i:await n.get(this._options.environment))!=null?a:R.Default,`v1/private/prompts/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:Ym.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: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")switch(i.error.statusCode){case 400:throw new T(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 u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:rd.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse});switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}restorePromptVersion(t,r,o){return h.fromPromise(this.__restorePromptVersion(t,r,o))}async __restorePromptVersion(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions/${encodeURIComponent(r)}/restore`),method:"POST",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:he.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new T(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: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: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 T(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 ka=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:ad.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 Sa=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: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/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: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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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 Fd,Od;let{page:o,size:i,projectName:a,projectId:l,traceId:d,type:u,filters:g,truncate:w,stripAttachments:k,sorting:S,exclude:x,fromTime:_,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=Di.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),_!=null&&(O.from_time=_.toISOString()),B!=null&&(O.to_time=B.toISOString());let G=await b({url:y((Od=(Fd=await n.get(this._options.baseUrl))!=null?Fd:await n.get(this._options.environment))!=null?Od: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:ld.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: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 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:yt.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 De(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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: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 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:Rt.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=Mi.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:sr.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=Ni.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:Qe.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:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data: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:go.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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 xa=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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new 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: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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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: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 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-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:zo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 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,_={};o!=null&&(_.page=o.toString()),i!=null&&(_.size=i.toString()),a!=null&&(_.project_name=a),l!=null&&(_.project_id=l),d!=null&&(_.filters=d),u!=null&&(_.truncate=u.toString()),g!=null&&(_.strip_attachments=g.toString()),w!=null&&(_.sorting=w),k!=null&&(_.exclude=k),S!=null&&(_.from_time=S.toISOString()),x!=null&&(_.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:_,requestType:"json",timeoutMs:(r==null?void 0: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:yd.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new 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:kt.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: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")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:ko.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/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:Rt.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:So.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/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:Fe.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:Fe.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:Qe.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})}}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: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:St.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 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 _=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(_.ok)return {data:bd.parseOrThrow(_.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:_.rawResponse};if(_.error.reason==="status-code")throw new p({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse});switch(_.error.reason){case "non-json":throw new p({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:_.error.errorMessage,rawResponse:_.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-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: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 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:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data: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:_o.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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: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")switch(o.error.statusCode){case 400:throw new T(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:bo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data: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 _a=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: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/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:Do.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new f("Timeout exceeded when calling 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 Aa=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: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: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 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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:xt.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:xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:xt.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 T(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: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:ta.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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: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:ta.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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: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:kd.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new 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 Ta=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 T(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 T(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 T(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 T(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 _t=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new ia(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new aa(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new na(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new sa(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new pa(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new ca(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new la(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new ma(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new da(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new ua(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new ga(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new wa(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new fa(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new ha(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new Ra(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new ba(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new ya(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new za(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new ka(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new Sa(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new xa(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new _a(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new Aa(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ta(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 Ea=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 Pa=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 Ea(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 tg={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},va={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},Wh=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,"="),Bh=s=>s.replace(/\/api$/,""),Lh=s=>Buffer.from(s).toString("base64"),ig=(s,t,r)=>{let o=Wh(r),i=`${t}?${o}`;return new URL(i,s).toString()},ag=({datasetId:s,experimentId:t,baseUrl:r})=>ig(r,tg.EXPERIMENTS,{[va.EXPERIMENT_ID]:t,[va.DATASET_ID]:s,[va.PATH]:Lh(r)});var ng=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=Bh(r),i=`${t}/${tg.PROJECT_BY_NAME}`;return ig(o,i,{[va.PROJECT_NAME]:s})};var Vh=300,Ca=100,At=class{constructor({action:t,batchSize:r=Ca,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=Vh,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Ca,updateBatchSize:l=Ca,deleteBatchSize:d=Ca,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 At({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new At({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 At({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 Ia=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 ja=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 Ua=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 Da=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 Ma=class extends _t{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var Na=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 Sd=null;async function sg(){return Sd||(Sd=await Hh()),Sd}var Tt=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||kn.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=Jh(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 Ee(s,t,r){var l;if(r===0)return [];let o=new TextDecoder("utf-8"),i=[],a="";try{for await(let d of s){a+=o.decode(d,{stream:!0});let u=a.split(`
|
|
4
|
-
`);a=(l=u.pop())!=null?l:"";for(let g of u)if(!(!g.trim()||g==="{}"||g==="[]"||g==="null"))try{let w=JSON.parse(g),k=t.parse(w);if(k.ok){if(i.push(k.value),r!==void 0&&i.length>=r)return i}else z.error("Error parsing experiment item:",k.errors);}catch(w){z.error("Error parsing JSON line:",w instanceof Error?w.message:String(w));}}if(a.trim()&&a!=="{}"&&a!=="[]"&&a!=="null")try{let d=JSON.parse(a),u=t.parse(d);u.ok?i.push(u.value):z.error("Error parsing experiment item:",u.errors);}catch(d){z.error("Error parsing remaining buffer:",d instanceof Error?d.message:String(d));}}catch(d){z.error("Error processing stream:",d instanceof Error?d.message:String(d));}return i}function
|
|
1
|
+
import {c,d,g,e as e$1,f as f$1}from'./chunk-LAR62UGW.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import Gd from'fs';import tw from'ini';import'dotenv/config';import Zh from'qs';import {v7}from'uuid';import Gf from'fast-json-stable-stringify';import Kf from'xxhash-wasm';import {TextDecoder}from'util';import qf from'mustache';import oR from'nunjucks';import {formatDistanceToNow}from'date-fns';import {diffStringsUnified}from'jest-diff';import aR from'fast-deep-equal';import {AsyncLocalStorage}from'node:async_hooks';import Ya from'chalk';import hR from'boxen';import fR 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 rw={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Bt(s,t=s){return link(t,s)}var z=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Kd=s=>{z.settings.minLevel=rw[s];},ow=()=>{z.settings.minLevel=100;};Kd(process.env.OPIK_LOG_LEVEL||"INFO");var iw="~/.opik.config",pn={apiKey:"",apiUrl:"https://www.comet.com/opik/api",projectName:"Default Project",workspaceName:"default",batchDelayMs:300,holdUntilFlush:false};function $d(s){return Object.fromEntries(Object.entries(s).filter(([,t])=>t!==void 0))}function aw(){return $d({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 nw(){let s=process.env.OPIK_CONFIG_PATH||iw;if(!Gd.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let t=tw.parse(Gd.readFileSync(s,"utf8"));return t.opik?$d({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 Qd(s){let t=aw(),r=nw(),{headers:o,...i}=s||{};return sw({...pn,...r,...t,...i})}function sw(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let t=pw(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 pw(s){return new URL(s).hostname.endsWith("comet.com")}var H={};c(H,{AlertAlertType:()=>cw,AlertPublicAlertType:()=>fw,AlertTriggerConfigPublicType:()=>ww,AlertTriggerConfigType:()=>mw,AlertTriggerConfigWriteType:()=>dw,AlertTriggerEventType:()=>lw,AlertTriggerPublicEventType:()=>hw,AlertTriggerWriteEventType:()=>uw,AlertWriteAlertType:()=>gw,AnnotationQueuePublicScope:()=>zw,AnnotationQueueScope:()=>bw,AnnotationQueueWriteScope:()=>yw,AssistantMessageRole:()=>Ww,AttachmentListRequestEntityType:()=>Zd,BadRequestError:()=>T,CheckName:()=>sh,CheckPublicName:()=>Xh,CheckPublicResult:()=>Kh,CheckResult:()=>ph,ColumnCompareTypesItem:()=>$w,ColumnPublicTypesItem:()=>ih,ColumnTypesItem:()=>ah,CompleteMultipartUploadRequestEntityType:()=>kw,ConflictError:()=>M,CreatePromptVersionDetailTemplateStructure:()=>fu,DatasetItemCompareSource:()=>Qw,DatasetItemFilterOperator:()=>Lw,DatasetItemPublicSource:()=>oh,DatasetItemSource:()=>Jw,DatasetItemWriteSource:()=>Sn,DatasetPublicStatus:()=>rh,DatasetPublicVisibility:()=>eh,DatasetStatus:()=>Hw,DatasetUpdateVisibility:()=>tu,DatasetVisibility:()=>Vw,DatasetWriteVisibility:()=>ou,DeleteAttachmentsRequestEntityType:()=>Sw,DownloadAttachmentRequestEntityType:()=>qd,ExperimentItemCompareTraceVisibilityMode:()=>Yw,ExperimentItemPublicTraceVisibilityMode:()=>th,ExperimentItemTraceVisibilityMode:()=>Xw,ExperimentPublicStatus:()=>gh,ExperimentPublicType:()=>uh,ExperimentStatus:()=>nh,ExperimentType:()=>xn,ExperimentUpdateStatus:()=>su,ExperimentUpdateType:()=>nu,ExperimentWriteStatus:()=>au,ExperimentWriteType:()=>iu,FeedbackScoreBatchItemSource:()=>Jh,FeedbackScoreBatchItemThreadSource:()=>Qh,FeedbackScoreCompareSource:()=>Zw,FeedbackScoreExperimentItemBulkWriteViewSource:()=>lh,FeedbackScorePublicSource:()=>Lh,FeedbackScoreSource:()=>Kw,FindFeedbackDefinitionsRequestType:()=>pu,FindFeedbackScoreNames1RequestType:()=>bu,ForbiddenError:()=>$,GetSpanStatsRequestType:()=>yu,GetSpansByProjectRequestType:()=>Ru,GetWebhookExamplesRequestAlertType:()=>Yd,GuardrailName:()=>wh,GuardrailResult:()=>hh,GuardrailWriteName:()=>fh,GuardrailWriteResult:()=>Rh,LlmAsJudgeMessagePublicRole:()=>Uw,LlmAsJudgeMessageRole:()=>xw,LlmAsJudgeMessageWriteRole:()=>Pw,LlmAsJudgeOutputSchemaPublicType:()=>Dw,LlmAsJudgeOutputSchemaType:()=>_w,LlmAsJudgeOutputSchemaWriteType:()=>vw,LogItemLevel:()=>Ow,ManualEvaluationRequestEntityType:()=>zh,NotFoundError:()=>_,NotImplementedError:()=>De,OptimizationPublicStatus:()=>xh,OptimizationStatus:()=>kh,OptimizationUpdateStatus:()=>lu,OptimizationWriteStatus:()=>Sh,ProjectDetailedVisibility:()=>Ph,ProjectMetricRequestPublicInterval:()=>gu,ProjectMetricRequestPublicMetricType:()=>uu,ProjectMetricResponsePublicInterval:()=>Eh,ProjectMetricResponsePublicMetricType:()=>Th,ProjectPublicVisibility:()=>Ah,ProjectUpdateVisibility:()=>du,ProjectVisibility:()=>_h,ProjectWriteVisibility:()=>mu,PromptDetailTemplateStructure:()=>Mh,PromptPublicTemplateStructure:()=>Oh,PromptTemplateStructure:()=>Ch,PromptType:()=>vh,PromptVersionDetailTemplateStructure:()=>Dh,PromptVersionDetailType:()=>Uh,PromptVersionPublicTemplateStructure:()=>Fh,PromptVersionPublicType:()=>Nh,PromptVersionTemplateStructure:()=>jh,PromptVersionType:()=>Ih,PromptWriteTemplateStructure:()=>hu,PromptWriteType:()=>wu,ProviderApiKeyProvider:()=>yh,ProviderApiKeyPublicProvider:()=>bh,ProviderApiKeyWriteProvider:()=>cu,ResponseFormatType:()=>Bw,SpanExperimentItemBulkWriteViewType:()=>mh,SpanFilterOperator:()=>Aw,SpanFilterPublicOperator:()=>Mw,SpanFilterWriteOperator:()=>Cw,SpanPublicType:()=>Vh,SpanSearchStreamRequestPublicType:()=>zu,SpanType:()=>he,SpanUpdateType:()=>Wh,SpanWriteType:()=>Bh,StartMultipartUploadRequestEntityType:()=>eu,TraceFilterOperator:()=>Tw,TraceFilterPublicOperator:()=>Nw,TraceFilterWriteOperator:()=>Iw,TracePublicVisibilityMode:()=>Gh,TraceThreadFilterOperator:()=>Ew,TraceThreadFilterPublicOperator:()=>Fw,TraceThreadFilterWriteOperator:()=>jw,TraceThreadStatus:()=>$h,TraceVisibilityMode:()=>ch,UnauthorizedError:()=>X,UnprocessableEntityError:()=>W,UploadAttachmentRequestEntityType:()=>ru,ValueEntryCompareSource:()=>qw,ValueEntryExperimentItemBulkWriteViewSource:()=>dh,ValueEntryPublicSource:()=>Hh,ValueEntrySource:()=>Gw,WebhookTestResultStatus:()=>Rw,alerts:()=>Lt,annotationQueues:()=>ln,attachments:()=>Vt,automationRuleEvaluators:()=>dn,chatCompletions:()=>un,check:()=>mn,dashboards:()=>gn,datasets:()=>Ht,experiments:()=>Jt,feedbackDefinitions:()=>Xt,guardrails:()=>wn,llmProviderKey:()=>Kt,manualEvaluation:()=>hn,openTelemetryIngestion:()=>fn,optimizations:()=>Gt,projects:()=>$t,prompts:()=>Qt,redirect:()=>kn,serviceToggles:()=>Rn,spans:()=>Yt,systemUsage:()=>cn,traces:()=>bn,welcomeWizard:()=>yn,workspaces:()=>zn});var Lt={};c(Lt,{GetWebhookExamplesRequestAlertType:()=>Yd});var Yd={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Vt={};c(Vt,{AttachmentListRequestEntityType:()=>Zd,DownloadAttachmentRequestEntityType:()=>qd,StartMultipartUploadRequestEntityType:()=>eu,UploadAttachmentRequestEntityType:()=>ru});var Zd={Trace:"trace",Span:"span"};var qd={Trace:"trace",Span:"span"};var eu={Trace:"trace",Span:"span"};var ru={Trace:"trace",Span:"span"};var Ht={};c(Ht,{DatasetUpdateVisibility:()=>tu,DatasetWriteVisibility:()=>ou});var ou={Private:"private",Public:"public"};var tu={Private:"private",Public:"public"};var Jt={};c(Jt,{ExperimentUpdateStatus:()=>su,ExperimentUpdateType:()=>nu,ExperimentWriteStatus:()=>au,ExperimentWriteType:()=>iu});var iu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var au={Running:"running",Completed:"completed",Cancelled:"cancelled"};var nu={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var su={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Xt={};c(Xt,{FindFeedbackDefinitionsRequestType:()=>pu});var pu={Numerical:"numerical",Categorical:"categorical",Boolean:"boolean"};var Kt={};c(Kt,{ProviderApiKeyWriteProvider:()=>cu});var cu={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var Gt={};c(Gt,{OptimizationUpdateStatus:()=>lu});var lu={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var $t={};c($t,{ProjectMetricRequestPublicInterval:()=>gu,ProjectMetricRequestPublicMetricType:()=>uu,ProjectUpdateVisibility:()=>du,ProjectWriteVisibility:()=>mu});var mu={Private:"private",Public:"public"};var du={Private:"private",Public:"public"};var uu={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 gu={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Qt={};c(Qt,{CreatePromptVersionDetailTemplateStructure:()=>fu,PromptWriteTemplateStructure:()=>hu,PromptWriteType:()=>wu});var wu={Mustache:"mustache",Jinja2:"jinja2"};var hu={Text:"text",Chat:"chat"};var fu={Text:"text",Chat:"chat"};var Yt={};c(Yt,{FindFeedbackScoreNames1RequestType:()=>bu,GetSpanStatsRequestType:()=>yu,GetSpansByProjectRequestType:()=>Ru,SpanSearchStreamRequestPublicType:()=>zu});var Ru={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var bu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var yu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var zu={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var cn={};var ln={};var mn={};var dn={};var un={};var gn={};var wn={};var hn={};var fn={};var Rn={};var bn={};var yn={};var zn={};var kn={};var cw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var lw={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 mw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var dw={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var uw={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 gw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var ww={ScopeProject:"scope:project",ThresholdFeedbackScore:"threshold:feedback_score",ThresholdCost:"threshold:cost",ThresholdLatency:"threshold:latency",ThresholdErrors:"threshold:errors"};var hw={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 fw={General:"general",Slack:"slack",Pagerduty:"pagerduty"};var Rw={Success:"success",Failure:"failure"};var bw={Trace:"trace",Thread:"thread"};var yw={Trace:"trace",Thread:"thread"};var zw={Trace:"trace",Thread:"thread"};var kw={Trace:"trace",Span:"span"};var Sw={Trace:"trace",Span:"span"};var xw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var _w={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Aw={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 Tw={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 Ew={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 Pw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var vw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Cw={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 Iw={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 Uw={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT",Custom:"CUSTOM"};var Dw={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Mw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Nw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Fw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Ow={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var Ww={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Bw={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Lw={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Vw={Private:"private",Public:"public"};var Hw={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var Jw={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Xw={Default:"default",Hidden:"hidden"};var Kw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Gw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Sn={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var $w={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Qw={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Yw={Default:"default",Hidden:"hidden"};var Zw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var qw={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var eh={Private:"private",Public:"public"};var rh={Unknown:"unknown",Processing:"processing",Completed:"completed",Failed:"failed"};var oh={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var th={Default:"default",Hidden:"hidden"};var ih={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var ah={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var xn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var nh={Running:"running",Completed:"completed",Cancelled:"cancelled"};var sh={Topic:"TOPIC",Pii:"PII"};var ph={Passed:"passed",Failed:"failed"};var he={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ch={Default:"default",Hidden:"hidden"};var lh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var mh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var dh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var uh={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var gh={Running:"running",Completed:"completed",Cancelled:"cancelled"};var wh={Topic:"TOPIC",Pii:"PII"};var hh={Passed:"passed",Failed:"failed"};var fh={Topic:"TOPIC",Pii:"PII"};var Rh={Passed:"passed",Failed:"failed"};var bh={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var yh={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter",VertexAi:"vertex-ai",CustomLlm:"custom-llm"};var zh={Trace:"trace",Thread:"thread"};var kh={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var Sh={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var xh={Running:"running",Completed:"completed",Cancelled:"cancelled",Initialized:"initialized",Error:"error"};var _h={Private:"private",Public:"public"};var Ah={Private:"private",Public:"public"};var Th={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 Eh={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Ph={Private:"private",Public:"public"};var vh={Mustache:"mustache",Jinja2:"jinja2"};var Ch={Text:"text",Chat:"chat"};var Ih={Mustache:"mustache",Jinja2:"jinja2"};var jh={Text:"text",Chat:"chat"};var Uh={Mustache:"mustache",Jinja2:"jinja2"};var Dh={Text:"text",Chat:"chat"};var Mh={Text:"text",Chat:"chat"};var Nh={Mustache:"mustache",Jinja2:"jinja2"};var Fh={Text:"text",Chat:"chat"};var Oh={Text:"text",Chat:"chat"};var Wh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Bh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Lh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Vh={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var Hh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Jh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Xh={Topic:"TOPIC",Pii:"PII"};var Kh={Passed:"passed",Failed:"failed"};var Gh={Default:"default",Hidden:"hidden"};var $h={Active:"active",Inactive:"inactive"};var Qh={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var _e=(s,t,r)=>JSON.stringify(s,t,r);var p=class s extends Error{constructor({message:t,statusCode:r,body:o,rawResponse:i}){super(Yh({message:t,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),this.statusCode=r,this.body=o,this.rawResponse=i;}};function Yh({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: ${_e(r,void 0,2)}`),o.join(`
|
|
2
|
+
`)}var h=class s extends Error{constructor(t){super(t),Object.setPrototypeOf(this,s.prototype);}};var T=class s extends p{constructor(t,r){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var M=class s extends p{constructor(t,r){super({message:"ConflictError",statusCode:409,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var W=class s extends p{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var _=class s extends p{constructor(t,r){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends p{constructor(t,r){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var $=class s extends p{constructor(t,r){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:r}),Object.setPrototypeOf(this,s.prototype);}};var De=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 zr;typeof globalThis.Headers!="undefined"?zr=globalThis.Headers:zr=class ku{constructor(t){if(this.headers=new Map,t)if(t instanceof ku)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 Zt={headers:new zr,redirected:false,status:499,statusText:"Client Closed Request",type:"error",url:""},qt={headers:new zr,redirected:false,status:0,statusText:"Unknown Error",type:"error",url:""};function ei(s){return {headers:s.headers,redirected:s.redirected,status:s.status,statusText:s.statusText,type:s.type,url:s.url}}function Su(s,t){return Object.keys(t!=null?t:{}).length>0?`${s}?${Zh.stringify(t,{arrayFormat:"repeat"})}`:s}var m=qh();function qh(){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 xu(){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 _u({body:s,type:t}){return t.includes("json")?_e(s):s}async function Au(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 Tu(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 Au(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 ef="timeout";function Eu(s){let t=new AbortController,r=setTimeout(()=>t.abort(ef),s);return {signal:t.signal,abortId:r}}function Pu(...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:A}=Eu(a);w=A,g.push(x);}l!=null&&g.push(l);let k=Pu(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 rf(s){let t=1+(Math.random()*2-1)*.2;return s*t}async function Cu(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=rf(i);await new Promise(l=>setTimeout(l,a)),r=await s();}return r}async function of(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=Su(s.url,s.queryParameters),o=await _u({body:s.body,type:s.requestType==="json"?"json":"other"}),i=await xu();try{let a=await Cu(async()=>vu(i,r,s.method,t,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),l=await Tu(a,s.responseType);return a.status>=200&&a.status<400?{ok:!0,body:l,headers:a.headers,rawResponse:ei(a)}:{ok:!1,error:{reason:"status-code",statusCode:a.status,body:l},rawResponse:ei(a)}}catch(a){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Zt}:a instanceof Error&&a.name==="AbortError"?{ok:false,error:{reason:"timeout"},rawResponse:Zt}:a instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:a.message},rawResponse:qt}:{ok:false,error:{reason:"unknown",errorMessage:_e(a)},rawResponse:qt}}}var b=of;var n={get:async s=>typeof s=="function"?s():s};var f=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 En(s){return typeof s=="object"&&s!=null&&"name"in s}function Pn(s){return typeof s=="object"&&s!=null&&"path"in s}function vn(s){let t=s.lastIndexOf("/"),r=s.lastIndexOf("\\"),o=Math.max(t,r);return o>=0?s.substring(o+1):s}async function Iu(){let s;return m.type==="node"&&m.parsedVersion!=null&&m.parsedVersion>=18?s=new _n:m.type==="node"?s=new An:s=new Tn,await s.setup(),s}var _n=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(En(t))return t.name;if(Pn(t)&&t.path)return vn(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"}}},An=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(En(t))return t.name;if(Pn(t)&&t.path)return vn(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():{}}}},Tn=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(En(t))return t.name;if(Pn(t)&&t.path)return vn(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:()=>or,ParseError:()=>tr,any:()=>Ku,bigint:()=>Uu,boolean:()=>Gu,booleanLiteral:()=>Xu,date:()=>Du,discriminant:()=>tg,enum_:()=>oi,getObjectLikeUtils:()=>le,getObjectUtils:()=>Me,getSchemaUtils:()=>U,isProperty:()=>Te,lazy:()=>Mu,lazyObject:()=>Vu,list:()=>ii,number:()=>$u,object:()=>ti,objectWithoutOptionalProperties:()=>Lu,optional:()=>Cn,property:()=>Fu,record:()=>qu,set:()=>eg,string:()=>Qu,stringLiteral:()=>Ju,transform:()=>In,undiscriminatedUnion:()=>og,union:()=>ag,unknown:()=>Yu,withParsedProperties:()=>Un});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 ${tf(s)}.`}function tf(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 ri(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var or=class s extends Error{constructor(r){super(r.map(ri).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var tr=class s extends Error{constructor(r){super(r.map(ri).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function U(s){return {nullable:()=>af(s),optional:()=>Cn(s),optionalNullable:()=>nf(s),transform:t=>In(s,t),parseOrThrow:(t,r)=>{let o=s.parse(t,r);if(o.ok)return o.value;throw new tr(o.errors)},jsonOrThrow:(t,r)=>{let o=s.json(t,r);if(o.ok)return o.value;throw new or(o.errors)}}}function af(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 Cn(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 nf(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 In(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 Uu(){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 sf=/^([+-]?\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 Du(){let s={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:r,message:j(t,"string")}]}:sf.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 oi(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 Mu(s){let t=jn(s);return {...t,...U(t)}}function jn(s){return {parse:(t,r)=>ir(s).parse(t,r),json:(t,r)=>ir(s).json(t,r),getType:()=>ir(s).getType()}}function ir(s){let t=s;return t.__zurg_memoized==null&&(t.__zurg_memoized=s()),t.__zurg_memoized}function kr(s){return Object.entries(s)}function Sr(s,t){let r=new Set(t);return Object.entries(s).reduce((o,[i,a])=>(r.has(i)&&(o[i]=a),o),{})}function Ae(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 xr(s){return Object.keys(s)}function Nu(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=>Un(s,t)}}function Un(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(!Ae(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=Sr(o,Object.keys(o).filter(u=>!a.has(u)));return s.json(l,i)},getType:()=>s.getType()};return {...r,...U(r),...le(r)}}function Fu(s,t){return {rawKey:s,valueSchema:t,isProperty:true}}function Te(s){return s.isProperty}function ti(s){let t={_getRawProperties:()=>Object.entries(s).map(([r,o])=>Te(o)?o.rawKey:r),_getParsedProperties:()=>xr(s),parse:(r,o)=>{let i={},a=[];for(let[l,d]of kr(s)){let u=Te(d)?d.rawKey:l,g=Te(d)?d.valueSchema:d,w={rawKey:u,parsedKey:l,valueSchema:g};i[u]=w,Bu(g)&&a.push(u);}return Ou({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 kr(s)){let d=Te(l)?l.valueSchema:l;Bu(d)&&i.push(a);}return Ou({value:r,requiredKeys:i,getProperty:a=>{let l=s[a];if(l!=null)return Te(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),...Me(t)}}function Ou({value:s,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:i=false,breadcrumbsPrefix:a=[]}){if(!Ae(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 Me(s){return {extend:t=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...t._getRawProperties()],parse:(o,i)=>Wu({extensionKeys:t._getRawProperties(),value:o,transformBase:a=>s.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(o,i)=>Wu({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),...Me(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),...Me(t)}}}}function Wu({extensionKeys:s,value:t,transformBase:r,transformExtension:o}){let i=new Set(s),[a,l]=Nu(xr(t),g=>i.has(g)),d=r(Sr(t,l)),u=o(Sr(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 Bu(s){return !pf(s)}function pf(s){switch(s.getType()){case E.ANY:case E.UNKNOWN:case E.OPTIONAL:case E.OPTIONAL_NULLABLE:return true;default:return false}}function Lu(s){return ti(s)}function Vu(s){let t={...jn(s),_getRawProperties:()=>ir(s)._getRawProperties(),_getParsedProperties:()=>ir(s)._getParsedProperties()};return {...t,...U(t),...le(t),...Me(t)}}function ii(s){let t={parse:(r,o)=>Hu(r,(i,a)=>{var l;return s.parse(i,{...o,breadcrumbsPrefix:[...(l=o==null?void 0:o.breadcrumbsPrefix)!=null?l:[],`[${a}]`]})}),json:(r,o)=>Hu(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 Hu(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 Ju(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 Xu(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 Ku=Q(E.ANY,s=>({ok:true,value:s}));var Gu=Q(E.BOOLEAN,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"boolean")}]});var $u=Q(E.NUMBER,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"number")}]});var Qu=Q(E.STRING,(s,{breadcrumbsPrefix:t=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:t,message:j(s,"string")}]});var Yu=Q(E.UNKNOWN,s=>({ok:true,value:s}));function qu(s,t){let r={parse:(o,i)=>Zu({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)=>Zu({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 Zu({value:s,isKeyNumeric:t,transformKey:r,transformValue:o,breadcrumbsPrefix:i=[]}){return Ae(s)?kr(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 eg(s){let t=ii(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 og(s){let t={parse:(r,o)=>rg((i,a)=>i.parse(r,a),s,o),json:(r,o)=>rg((i,a)=>i.json(r,a),s,o),getType:()=>E.UNDISCRIMINATED_UNION};return {...K(t),...U(t)}}function rg(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 tg(s,t){return {parsedDiscriminant:s,rawDiscriminant:t}}function ag(s,t){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,i=oi(xr(t)),a={parse:(l,d)=>ig({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)=>ig({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 ig({value:s,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=false,transformAdditionalProperties:l,breadcrumbsPrefix:d=[]}){if(!Ae(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 cf(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),cf(s)}var C={};c(C,{AggregationData:()=>Rl,Alert:()=>wf,AlertAlertType:()=>As,AlertPagePublic:()=>Hs,AlertPublic:()=>Oo,AlertPublicAlertType:()=>Fs,AlertTrigger:()=>Cs,AlertTriggerConfig:()=>vs,AlertTriggerConfigPublic:()=>Ls,AlertTriggerConfigPublicType:()=>Bs,AlertTriggerConfigType:()=>Ps,AlertTriggerConfigWrite:()=>js,AlertTriggerConfigWriteType:()=>Is,AlertTriggerEventType:()=>Es,AlertTriggerPublic:()=>Vs,AlertTriggerPublicEventType:()=>Ws,AlertTriggerWrite:()=>Ds,AlertTriggerWriteEventType:()=>Us,AlertWrite:()=>Fo,AlertWriteAlertType:()=>Ms,AnnotationQueue:()=>Qs,AnnotationQueueBatch:()=>ff,AnnotationQueueBatchWrite:()=>vo,AnnotationQueueItemIds:()=>Gi,AnnotationQueuePagePublic:()=>qs,AnnotationQueuePublic:()=>Wo,AnnotationQueuePublicScope:()=>Ys,AnnotationQueueReviewer:()=>$s,AnnotationQueueReviewerPublic:()=>Zs,AnnotationQueueScope:()=>Gs,AnnotationQueueUpdate:()=>Co,AnnotationQueueWrite:()=>Po,AnnotationQueueWriteScope:()=>ms,AssistantMessage:()=>cc,AssistantMessageRole:()=>pc,Attachment:()=>ep,AttachmentListRequestEntityType:()=>si,AttachmentPage:()=>rp,AuthDetailsHolder:()=>np,AutomationRuleEvaluator:()=>bf,AutomationRuleEvaluatorLlmAsJudge:()=>gp,AutomationRuleEvaluatorLlmAsJudgePublic:()=>Yo,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>Tp,AutomationRuleEvaluatorObjectObjectPublic:()=>Qp,AutomationRuleEvaluatorPagePublic:()=>Yp,AutomationRuleEvaluatorPublic:()=>Zp,AutomationRuleEvaluatorSpanLlmAsJudge:()=>bp,AutomationRuleEvaluatorSpanLlmAsJudgePublic:()=>rt,AutomationRuleEvaluatorSpanLlmAsJudgeWrite:()=>Cp,AutomationRuleEvaluatorTraceThreadLlmAsJudge:()=>hp,AutomationRuleEvaluatorTraceThreadLlmAsJudgePublic:()=>qo,AutomationRuleEvaluatorTraceThreadLlmAsJudgeWrite:()=>Up,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPython:()=>fp,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonPublic:()=>et,AutomationRuleEvaluatorTraceThreadUserDefinedMetricPythonWrite:()=>Mp,AutomationRuleEvaluatorUpdate:()=>sc,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>oc,AutomationRuleEvaluatorUpdateSpanLlmAsJudge:()=>nc,AutomationRuleEvaluatorUpdateTraceThreadLlmAsJudge:()=>ic,AutomationRuleEvaluatorUpdateTraceThreadUserDefinedMetricPython:()=>ac,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>tc,AutomationRuleEvaluatorUserDefinedMetricPython:()=>wp,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>Zo,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>Fp,AutomationRuleEvaluatorWrite:()=>Op,AvgValueStatPublic:()=>Fc,BatchDelete:()=>F,BatchDeleteByProject:()=>Of,BiInformation:()=>zs,BiInformationResponse:()=>pr,BooleanFeedbackDefinition:()=>Sl,BooleanFeedbackDefinitionCreate:()=>vl,BooleanFeedbackDefinitionPublic:()=>ut,BooleanFeedbackDefinitionUpdate:()=>Xl,BooleanFeedbackDetail:()=>kl,BooleanFeedbackDetailCreate:()=>Pl,BooleanFeedbackDetailPublic:()=>Nl,BooleanFeedbackDetailUpdate:()=>Jl,CategoricalFeedbackDefinition:()=>_l,CategoricalFeedbackDefinitionCreate:()=>Il,CategoricalFeedbackDefinitionPublic:()=>gt,CategoricalFeedbackDefinitionUpdate:()=>Gl,CategoricalFeedbackDetail:()=>xl,CategoricalFeedbackDetailCreate:()=>Cl,CategoricalFeedbackDetailPublic:()=>Fl,CategoricalFeedbackDetailUpdate:()=>Kl,ChatCompletionChoice:()=>mc,ChatCompletionRequest:()=>jo,ChatCompletionResponse:()=>wc,Check:()=>al,CheckName:()=>tl,CheckPublic:()=>Rd,CheckPublicName:()=>hd,CheckPublicResult:()=>fd,CheckResult:()=>il,ChunkedOutputJsonNode:()=>Sf,ChunkedOutputJsonNodePublic:()=>Tf,ChunkedOutputJsonNodePublicType:()=>zl,ChunkedOutputJsonNodeType:()=>Yc,Column:()=>$c,ColumnCompare:()=>Sc,ColumnCompareTypesItem:()=>kc,ColumnPublic:()=>Xc,ColumnPublicTypesItem:()=>Jc,ColumnTypesItem:()=>Gc,Comment:()=>L,CommentCompare:()=>xc,CommentPublic:()=>Ye,CompleteMultipartUploadRequest:()=>$i,CompleteMultipartUploadRequestEntityType:()=>op,CompletionTokensDetails:()=>uc,CountValueStatPublic:()=>Oc,CreateDatasetItemsFromSpansRequest:()=>vr,CreateDatasetItemsFromTracesRequest:()=>Cr,CreatePromptVersionDetail:()=>no,CreatePromptVersionDetailTemplateStructure:()=>Ui,DashboardPagePublic:()=>hc,DashboardPublic:()=>$e,DashboardUpdatePublic:()=>Do,DashboardWrite:()=>Uo,DataPointDouble:()=>Wf,DataPointNumberPublic:()=>Mm,Dataset:()=>yf,DatasetExpansion:()=>kf,DatasetExpansionResponse:()=>zc,DatasetExpansionWrite:()=>Dr,DatasetIdentifier:()=>jr,DatasetIdentifierPublic:()=>Mr,DatasetItem:()=>nt,DatasetItemBatch:()=>zf,DatasetItemBatchUpdate:()=>Ar,DatasetItemBatchWrite:()=>Pr,DatasetItemCompare:()=>Ic,DatasetItemCompareSource:()=>_c,DatasetItemFilter:()=>Mn,DatasetItemFilterOperator:()=>Dn,DatasetItemPageCompare:()=>jc,DatasetItemPagePublic:()=>Kc,DatasetItemPublic:()=>ct,DatasetItemPublicSource:()=>Vc,DatasetItemSource:()=>yc,DatasetItemStreamRequest:()=>Nr,DatasetItemUpdate:()=>Nn,DatasetItemWrite:()=>Er,DatasetItemWriteSource:()=>Fn,DatasetItemsDelete:()=>Ur,DatasetPagePublic:()=>Nc,DatasetPublic:()=>cr,DatasetPublicStatus:()=>Dc,DatasetPublicVisibility:()=>Uc,DatasetStatus:()=>Rc,DatasetUpdate:()=>Ir,DatasetUpdateVisibility:()=>ui,DatasetVersionCreatePublic:()=>Or,DatasetVersionDiff:()=>qc,DatasetVersionDiffStats:()=>Zc,DatasetVersionPagePublic:()=>el,DatasetVersionPublic:()=>lr,DatasetVersionRestorePublic:()=>Wr,DatasetVersionSummary:()=>bc,DatasetVersionSummaryPublic:()=>Mc,DatasetVersionTag:()=>Fr,DatasetVersionUpdatePublic:()=>Br,DatasetVisibility:()=>fc,DatasetWrite:()=>Tr,DatasetWriteVisibility:()=>di,DeleteAttachmentsRequest:()=>Rf,DeleteAttachmentsRequestEntityType:()=>ip,DeleteFeedbackScore:()=>bt,DeleteIdsHolder:()=>mr,DeleteThreadFeedbackScores:()=>xo,DeleteTraceThreads:()=>_o,Delta:()=>lc,DownloadAttachmentRequestEntityType:()=>pi,ErrorCountWithDeviation:()=>ft,ErrorCountWithDeviationDetailed:()=>Vm,ErrorInfo:()=>ye,ErrorInfoExperimentItemBulkWriteView:()=>Xr,ErrorInfoPublic:()=>yt,ErrorInfoWrite:()=>co,ErrorMessage:()=>ee,ErrorMessageDetail:()=>Mf,ErrorMessageDetailed:()=>Uf,ErrorMessagePublic:()=>hf,Experiment:()=>xf,ExperimentGroupAggregationsResponse:()=>yl,ExperimentGroupResponse:()=>fl,ExperimentItem:()=>Vr,ExperimentItemBulkRecord:()=>cl,ExperimentItemBulkRecordExperimentItemBulkWriteView:()=>qn,ExperimentItemBulkUpload:()=>_f,ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Kr,ExperimentItemCompare:()=>Cc,ExperimentItemCompareTraceVisibilityMode:()=>vc,ExperimentItemPublic:()=>pt,ExperimentItemPublicTraceVisibilityMode:()=>Hc,ExperimentItemStreamRequest:()=>Qr,ExperimentItemTraceVisibilityMode:()=>Jn,ExperimentItemsBatch:()=>Hr,ExperimentItemsDelete:()=>Jr,ExperimentPagePublic:()=>ul,ExperimentPublic:()=>dt,ExperimentPublicStatus:()=>ml,ExperimentPublicType:()=>ll,ExperimentScore:()=>Gr,ExperimentScorePublic:()=>dl,ExperimentScoreWrite:()=>Bn,ExperimentStatus:()=>ol,ExperimentStreamRequestPublic:()=>Yr,ExperimentType:()=>rl,ExperimentUpdate:()=>$r,ExperimentUpdateStatus:()=>Ri,ExperimentUpdateType:()=>fi,ExperimentWrite:()=>Lr,ExperimentWriteStatus:()=>hi,ExperimentWriteType:()=>wi,ExportTraceServiceRequest:()=>Cf,Feedback:()=>Ef,FeedbackCreate:()=>Ml,FeedbackDefinitionPagePublic:()=>Ll,FeedbackObjectPublic:()=>Bl,FeedbackPublic:()=>Hl,FeedbackScore:()=>Y,FeedbackScoreAverage:()=>re,FeedbackScoreAverageDetailed:()=>Hm,FeedbackScoreAveragePublic:()=>Oe,FeedbackScoreBatch:()=>kt,FeedbackScoreBatchItem:()=>wd,FeedbackScoreBatchItemSource:()=>gd,FeedbackScoreBatchItemThread:()=>cs,FeedbackScoreBatchItemThreadSource:()=>ps,FeedbackScoreBatchThread:()=>Ao,FeedbackScoreCompare:()=>Pc,FeedbackScoreCompareSource:()=>Ac,FeedbackScoreExperimentItemBulkWriteView:()=>Zn,FeedbackScoreExperimentItemBulkWriteViewSource:()=>$n,FeedbackScoreNames:()=>Dm,FeedbackScorePublic:()=>ur,FeedbackScorePublicSource:()=>cd,FeedbackScoreSource:()=>Ln,FeedbackUpdate:()=>Zl,FindFeedbackDefinitionsRequestType:()=>zi,FindFeedbackScoreNames1RequestType:()=>Ni,Function:()=>Io,FunctionCall:()=>ze,GetSpanStatsRequestType:()=>Fi,GetSpansByProjectRequestType:()=>Mi,GetWebhookExamplesRequestAlertType:()=>ai,GroupContent:()=>gl,GroupContentWithAggregations:()=>bl,GroupDetail:()=>wl,GroupDetails:()=>hl,Guardrail:()=>rm,GuardrailBatch:()=>Pf,GuardrailBatchWrite:()=>Mo,GuardrailName:()=>ql,GuardrailResult:()=>em,GuardrailWrite:()=>ys,GuardrailWriteName:()=>Rs,GuardrailWriteResult:()=>bs,GuardrailsValidation:()=>nl,GuardrailsValidationPublic:()=>bd,IdsHolder:()=>Af,ImageUrl:()=>lp,ImageUrlPublic:()=>Bp,ImageUrlWrite:()=>kp,JsonListString:()=>D,JsonListStringCompare:()=>Qi,JsonListStringExperimentItemBulkWriteView:()=>me,JsonListStringPublic:()=>ae,JsonListStringWrite:()=>te,JsonNode:()=>v,JsonNodeDetail:()=>os,JsonNodePublic:()=>Z,JsonNodeWrite:()=>ie,JsonSchema:()=>ws,LlmAsJudgeCode:()=>Bo,LlmAsJudgeCodePublic:()=>Jp,LlmAsJudgeCodeWrite:()=>Ap,LlmAsJudgeMessage:()=>Be,LlmAsJudgeMessageContent:()=>dp,LlmAsJudgeMessageContentPublic:()=>Vp,LlmAsJudgeMessageContentWrite:()=>xp,LlmAsJudgeMessagePublic:()=>Ke,LlmAsJudgeMessagePublicRole:()=>Wp,LlmAsJudgeMessageRole:()=>cp,LlmAsJudgeMessageWrite:()=>He,LlmAsJudgeMessageWriteRole:()=>zp,LlmAsJudgeModelParameters:()=>We,LlmAsJudgeModelParametersPublic:()=>Xe,LlmAsJudgeModelParametersWrite:()=>Ve,LlmAsJudgeOutputSchema:()=>Le,LlmAsJudgeOutputSchemaPublic:()=>Ge,LlmAsJudgeOutputSchemaPublicType:()=>Hp,LlmAsJudgeOutputSchemaType:()=>up,LlmAsJudgeOutputSchemaWrite:()=>Je,LlmAsJudgeOutputSchemaWriteType:()=>_p,LogItem:()=>ec,LogItemLevel:()=>qp,LogPage:()=>rc,ManualEvaluationRequest:()=>ea,ManualEvaluationRequestEntityType:()=>am,ManualEvaluationResponse:()=>qi,Message:()=>ds,MultipartUploadPart:()=>tp,NumericalFeedbackDefinition:()=>Tl,NumericalFeedbackDefinitionCreate:()=>Ul,NumericalFeedbackDefinitionPublic:()=>wt,NumericalFeedbackDefinitionUpdate:()=>Ql,NumericalFeedbackDetail:()=>Al,NumericalFeedbackDetailCreate:()=>jl,NumericalFeedbackDetailPublic:()=>Ol,NumericalFeedbackDetailUpdate:()=>$l,Optimization:()=>If,OptimizationPagePublic:()=>oa,OptimizationPublic:()=>dr,OptimizationPublicStatus:()=>km,OptimizationStatus:()=>nm,OptimizationStudioConfig:()=>um,OptimizationStudioConfigPublic:()=>Pm,OptimizationStudioConfigWrite:()=>ym,OptimizationStudioLog:()=>vm,OptimizationUpdate:()=>eo,OptimizationUpdateStatus:()=>_i,OptimizationWrite:()=>ra,OptimizationWriteStatus:()=>zm,PageColumns:()=>Qc,PercentageValueStatPublic:()=>Wc,PercentageValues:()=>Se,PercentageValuesDetailed:()=>Jm,PercentageValuesPublic:()=>st,Project:()=>jf,ProjectDetailed:()=>Km,ProjectDetailedVisibility:()=>Xm,ProjectMetricRequestPublic:()=>to,ProjectMetricRequestPublicInterval:()=>vi,ProjectMetricRequestPublicMetricType:()=>Pi,ProjectMetricResponsePublic:()=>Wm,ProjectMetricResponsePublicInterval:()=>Fm,ProjectMetricResponsePublicMetricType:()=>Nm,ProjectPagePublic:()=>jm,ProjectPublic:()=>Rt,ProjectPublicVisibility:()=>Im,ProjectRetrieveDetailed:()=>io,ProjectStatItemObjectPublic:()=>Lc,ProjectStatsPublic:()=>Qe,ProjectStatsSummary:()=>Lm,ProjectStatsSummaryItem:()=>Bm,ProjectUpdate:()=>oo,ProjectUpdateVisibility:()=>Ei,ProjectVisibility:()=>Cm,ProjectWrite:()=>ro,ProjectWriteVisibility:()=>Ti,Prompt:()=>Df,PromptDetail:()=>ed,PromptDetailTemplateStructure:()=>qm,PromptPagePublic:()=>sd,PromptPublic:()=>nd,PromptPublicTemplateStructure:()=>ad,PromptTemplateStructure:()=>$m,PromptTokensDetails:()=>dc,PromptType:()=>Gm,PromptUpdatable:()=>so,PromptVersion:()=>Zm,PromptVersionDetail:()=>fe,PromptVersionDetailTemplateStructure:()=>is,PromptVersionDetailType:()=>ts,PromptVersionLink:()=>Yi,PromptVersionLinkPublic:()=>Zi,PromptVersionLinkWrite:()=>yi,PromptVersionPagePublic:()=>id,PromptVersionPublic:()=>td,PromptVersionPublicTemplateStructure:()=>od,PromptVersionPublicType:()=>rd,PromptVersionRetrieveDetail:()=>po,PromptVersionTemplateStructure:()=>Ym,PromptVersionType:()=>Qm,PromptWrite:()=>ao,PromptWriteTemplateStructure:()=>ji,PromptWriteType:()=>Ii,ProviderApiKey:()=>vf,ProviderApiKeyPagePublic:()=>tm,ProviderApiKeyProvider:()=>im,ProviderApiKeyPublic:()=>ht,ProviderApiKeyPublicProvider:()=>om,ProviderApiKeyUpdate:()=>qr,ProviderApiKeyWrite:()=>Zr,ProviderApiKeyWriteProvider:()=>Si,ResponseFormat:()=>hs,ResponseFormatType:()=>gs,Result:()=>Ze,ResultsNumberPublic:()=>Om,ScoreName:()=>Um,ServiceTogglesConfig:()=>pd,Span:()=>mt,SpanBatch:()=>Nf,SpanBatchUpdate:()=>go,SpanBatchWrite:()=>mo,SpanEnrichmentOptions:()=>On,SpanExperimentItemBulkWriteView:()=>Gn,SpanExperimentItemBulkWriteViewType:()=>Kn,SpanFilter:()=>Jo,SpanFilterOperator:()=>Rp,SpanFilterPublic:()=>wo,SpanFilterPublicOperator:()=>ss,SpanFilterWrite:()=>Pp,SpanFilterWriteOperator:()=>Ep,SpanLlmAsJudgeCode:()=>Xo,SpanLlmAsJudgeCodePublic:()=>$p,SpanLlmAsJudgeCodeWrite:()=>vp,SpanPagePublic:()=>ud,SpanPublic:()=>zt,SpanPublicType:()=>dd,SpanSearchStreamRequestPublic:()=>ho,SpanSearchStreamRequestPublicType:()=>Oi,SpanType:()=>pl,SpanUpdate:()=>uo,SpanUpdateType:()=>ns,SpanWrite:()=>lo,SpanWriteType:()=>as,SpansCountResponse:()=>Ss,StartMultipartUploadRequest:()=>_r,StartMultipartUploadRequestEntityType:()=>ci,StartMultipartUploadResponse:()=>ap,StreamOptions:()=>us,StudioEvaluation:()=>mm,StudioEvaluationPublic:()=>Tm,StudioEvaluationWrite:()=>Rm,StudioLlmModel:()=>cm,StudioLlmModelPublic:()=>_m,StudioLlmModelWrite:()=>hm,StudioMessage:()=>sm,StudioMessagePublic:()=>Sm,StudioMessageWrite:()=>gm,StudioMetric:()=>lm,StudioMetricPublic:()=>Am,StudioMetricWrite:()=>fm,StudioOptimizer:()=>dm,StudioOptimizerPublic:()=>Em,StudioOptimizerWrite:()=>bm,StudioPrompt:()=>pm,StudioPromptPublic:()=>xm,StudioPromptWrite:()=>wm,Tool:()=>fs,ToolCall:()=>at,Trace:()=>lt,TraceBatch:()=>Ff,TraceBatchUpdate:()=>yo,TraceBatchWrite:()=>Ro,TraceCountResponse:()=>_s,TraceEnrichmentOptions:()=>Wn,TraceExperimentItemBulkWriteView:()=>Xn,TraceFilter:()=>ke,TraceFilterOperator:()=>pp,TraceFilterPublic:()=>be,TraceFilterPublicOperator:()=>es,TraceFilterWrite:()=>Go,TraceFilterWriteOperator:()=>yp,TracePagePublic:()=>Sd,TracePublic:()=>St,TracePublicVisibilityMode:()=>yd,TraceSearchStreamRequestPublic:()=>Eo,TraceThread:()=>xt,TraceThreadBatchIdentifier:()=>So,TraceThreadBatchUpdate:()=>ko,TraceThreadFilter:()=>de,TraceThreadFilterOperator:()=>ls,TraceThreadFilterPublic:()=>Ne,TraceThreadFilterPublicOperator:()=>rs,TraceThreadFilterWrite:()=>$o,TraceThreadFilterWriteOperator:()=>Ip,TraceThreadIdentifier:()=>ta,TraceThreadLlmAsJudgeCode:()=>Vo,TraceThreadLlmAsJudgeCodePublic:()=>Kp,TraceThreadLlmAsJudgeCodeWrite:()=>jp,TraceThreadPage:()=>kd,TraceThreadSearchStreamRequest:()=>To,TraceThreadStatus:()=>zd,TraceThreadUpdate:()=>zo,TraceThreadUserDefinedMetricPythonCode:()=>Ho,TraceThreadUserDefinedMetricPythonCodePublic:()=>Gp,TraceThreadUserDefinedMetricPythonCodeWrite:()=>Dp,TraceUpdate:()=>bo,TraceVisibilityMode:()=>sl,TraceWrite:()=>fo,UploadAttachmentRequestEntityType:()=>li,Usage:()=>gc,UserDefinedMetricPythonCode:()=>Lo,UserDefinedMetricPythonCodePublic:()=>Xp,UserDefinedMetricPythonCodeWrite:()=>Np,ValueEntry:()=>Hn,ValueEntryCompare:()=>Ec,ValueEntryCompareSource:()=>Tc,ValueEntryExperimentItemBulkWriteView:()=>Yn,ValueEntryExperimentItemBulkWriteViewSource:()=>Qn,ValueEntryPublic:()=>md,ValueEntryPublicSource:()=>ld,ValueEntrySource:()=>Vn,VideoUrl:()=>mp,VideoUrlPublic:()=>Lp,VideoUrlWrite:()=>Sp,Webhook:()=>Ts,WebhookExamples:()=>Js,WebhookPublic:()=>Os,WebhookTestResult:()=>Ks,WebhookTestResultStatus:()=>Xs,WebhookWrite:()=>Ns,WelcomeWizardSubmission:()=>No,WelcomeWizardTracking:()=>xd,WorkspaceConfiguration:()=>_t,WorkspaceMetricRequest:()=>Bf,WorkspaceMetricResponse:()=>ia,WorkspaceMetricsSummaryRequest:()=>gr,WorkspaceMetricsSummaryResponse:()=>_d,WorkspaceNameHolder:()=>sp,WorkspaceSpansCount:()=>ks,WorkspaceTraceCount:()=>xs,alerts:()=>ni,annotationQueues:()=>Vi,attachments:()=>ar,chatCompletions:()=>Hi,dashboards:()=>Ji,datasets:()=>gi,experiments:()=>nr,feedbackDefinitions:()=>ki,guardrails:()=>Xi,llmProviderKey:()=>xi,optimizations:()=>Ai,projects:()=>Ci,prompts:()=>Di,spans:()=>sr,traces:()=>Fe,welcomeWizard:()=>Ki});var ni={};c(ni,{GetWebhookExamplesRequestAlertType:()=>ai});var ai=e.enum_(["general","slack","pagerduty"]);var ar={};c(ar,{AttachmentListRequestEntityType:()=>si,DownloadAttachmentRequestEntityType:()=>pi,StartMultipartUploadRequest:()=>_r,StartMultipartUploadRequestEntityType:()=>ci,UploadAttachmentRequestEntityType:()=>li,uploadAttachment:()=>mi});var si=e.enum_(["trace","span"]);var pi=e.enum_(["trace","span"]);var ci=e.enum_(["trace","span"]);var li=e.enum_(["trace","span"]);var mi={};c(mi,{Request:()=>lf});var lf=e.record(e.string(),e.unknown());var _r=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",ci),entityId:e.property("entity_id",e.string()),path:e.string()});var gi={};c(gi,{CreateDatasetItemsFromSpansRequest:()=>vr,CreateDatasetItemsFromTracesRequest:()=>Cr,DatasetExpansionWrite:()=>Dr,DatasetIdentifier:()=>jr,DatasetIdentifierPublic:()=>Mr,DatasetItemBatchUpdate:()=>Ar,DatasetItemBatchWrite:()=>Pr,DatasetItemStreamRequest:()=>Nr,DatasetItemsDelete:()=>Ur,DatasetUpdate:()=>Ir,DatasetUpdateVisibility:()=>ui,DatasetVersionCreatePublic:()=>Or,DatasetVersionRestorePublic:()=>Wr,DatasetVersionTag:()=>Fr,DatasetVersionUpdatePublic:()=>Br,DatasetWrite:()=>Tr,DatasetWriteVisibility:()=>di});var di=e.enum_(["private","public"]);var ui=e.enum_(["private","public"]);var Dn=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Mn=e.object({field:e.string().optional(),operator:Dn.optional(),key:e.string().optional(),value:e.string().optional()});var v=e.record(e.string(),e.unknown());var Nn=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 Ar=e.object({ids:e.list(e.string()).optional(),filters:e.list(Mn).optional(),update:Nn,mergeTags:e.property("merge_tags",e.boolean().optional())});var Tr=e.object({id:e.string().optional(),name:e.string(),visibility:di.optional(),tags:e.list(e.string()).optional(),description:e.string().optional()});var Fn=e.enum_(["manual","trace","span","sdk"]);var Er=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Fn,data:v,tags:e.list(e.string()).optional()});var Pr=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Er)});var On=e.object({includeTags:e.boolean().optional(),includeFeedbackScores:e.boolean().optional(),includeComments:e.boolean().optional(),includeUsage:e.boolean().optional(),includeMetadata:e.boolean().optional()});var vr=e.object({spanIds:e.property("span_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",On)});var Wn=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 Cr=e.object({traceIds:e.property("trace_ids",e.list(e.string())),enrichmentOptions:e.property("enrichment_options",Wn)});var Ir=e.object({name:e.string(),description:e.string().optional(),visibility:ui.optional(),tags:e.list(e.string()).optional()});var jr=e.object({datasetName:e.property("dataset_name",e.string())});var Ur=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Dr=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 Mr=e.object({datasetName:e.property("dataset_name",e.string())});var Nr=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 Fr=e.object({tag:e.string()});var Or=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 Wr=e.object({versionRef:e.property("version_ref",e.string())});var Br=e.object({changeDescription:e.property("change_description",e.string().optional()),tagsToAdd:e.property("tags_to_add",e.list(e.string()).optional())});var nr={};c(nr,{ExperimentItemBulkUploadExperimentItemBulkWriteView:()=>Kr,ExperimentItemStreamRequest:()=>Qr,ExperimentItemsBatch:()=>Hr,ExperimentItemsDelete:()=>Jr,ExperimentStreamRequestPublic:()=>Yr,ExperimentUpdate:()=>$r,ExperimentUpdateStatus:()=>Ri,ExperimentUpdateType:()=>fi,ExperimentWrite:()=>Lr,ExperimentWriteStatus:()=>hi,ExperimentWriteType:()=>wi,findFeedbackScoreNames:()=>bi});var wi=e.enum_(["regular","trial","mini-batch"]);var hi=e.enum_(["running","completed","cancelled"]);var fi=e.enum_(["regular","trial","mini-batch"]);var Ri=e.enum_(["running","completed","cancelled"]);var bi={};c(bi,{Response:()=>mf});var mf=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 Bn=e.object({name:e.string(),value:e.number()});var yi=e.object({id:e.string()});var Lr=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:te.optional(),type:wi.optional(),optimizationId:e.property("optimization_id",e.string().optional()),status:hi.optional(),experimentScores:e.property("experiment_scores",e.list(Bn).optional()),promptVersion:e.property("prompt_version",yi.optional()),promptVersions:e.property("prompt_versions",e.list(yi).optional())});var D=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Ln=e.enum_(["ui","sdk","online_scoring"]);var Vn=e.enum_(["ui","sdk","online_scoring"]);var Hn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Vn.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:Ln,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(),Hn).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 Jn=e.enum_(["default","hidden"]);var Vr=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",Jn.optional())});var Hr=e.object({experimentItems:e.property("experiment_items",e.list(Vr))});var Jr=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 Xr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Xn=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",Xr.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Kn=e.enum_(["general","tool","llm","guardrail"]);var Gn=e.object({id:e.string().optional(),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string().optional(),type:Kn.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",Xr.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 $n=e.enum_(["ui","sdk","online_scoring"]);var Qn=e.enum_(["ui","sdk","online_scoring"]);var Yn=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Qn.optional(),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),spanType:e.property("span_type",e.string().optional()),spanId:e.property("span_id",e.string().optional())});var Zn=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:$n,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(),Yn).optional())});var qn=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",me.optional()),trace:Xn.optional(),spans:e.list(Gn).optional(),feedbackScores:e.property("feedback_scores",e.list(Zn).optional())});var Kr=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(qn)});var Gr=e.object({name:e.string(),value:e.number()});var $r=e.object({name:e.string().optional(),metadata:v.optional(),type:fi.optional(),status:Ri.optional(),experimentScores:e.property("experiment_scores",e.list(Gr).optional())});var Qr=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 Yr=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var ki={};c(ki,{FindFeedbackDefinitionsRequestType:()=>zi});var zi=e.enum_(["numerical","categorical","boolean"]);var xi={};c(xi,{ProviderApiKeyUpdate:()=>qr,ProviderApiKeyWrite:()=>Zr,ProviderApiKeyWriteProvider:()=>Si});var Si=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var Zr=e.object({provider:Si,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 qr=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 Ai={};c(Ai,{OptimizationUpdate:()=>eo,OptimizationUpdateStatus:()=>_i});var _i=e.enum_(["running","completed","cancelled","initialized","error"]);var eo=e.object({name:e.string().optional(),status:_i.optional()});var Ci={};c(Ci,{ProjectMetricRequestPublic:()=>to,ProjectMetricRequestPublicInterval:()=>vi,ProjectMetricRequestPublicMetricType:()=>Pi,ProjectRetrieveDetailed:()=>io,ProjectUpdate:()=>oo,ProjectUpdateVisibility:()=>Ei,ProjectWrite:()=>ro,ProjectWriteVisibility:()=>Ti});var Ti=e.enum_(["private","public"]);var Ei=e.enum_(["private","public"]);var Pi=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var vi=e.enum_(["HOURLY","DAILY","WEEKLY"]);var ro=e.object({name:e.string(),visibility:Ti.optional(),description:e.string().optional()});var oo=e.object({name:e.string().optional(),description:e.string().optional(),visibility:Ei.optional()});var es=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var be=e.object({field:e.string().optional(),operator:es.optional(),key:e.string().optional(),value:e.string().optional()});var rs=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ne=e.object({field:e.string().optional(),operator:rs.optional(),key:e.string().optional(),value:e.string().optional()});var to=e.object({metricType:e.property("metric_type",Pi.optional()),interval:vi.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(Ne).optional())});var io=e.object({name:e.string()});var Di={};c(Di,{CreatePromptVersionDetail:()=>no,CreatePromptVersionDetailTemplateStructure:()=>Ui,PromptUpdatable:()=>so,PromptVersionRetrieveDetail:()=>po,PromptWrite:()=>ao,PromptWriteTemplateStructure:()=>ji,PromptWriteType:()=>Ii});var Ii=e.enum_(["mustache","jinja2"]);var ji=e.enum_(["text","chat"]);var Ui=e.enum_(["text","chat"]);var ie=e.record(e.string(),e.unknown());var ao=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:Ii.optional(),templateStructure:e.property("template_structure",ji.optional()),tags:e.list(e.string()).optional()});var os=e.record(e.string(),e.unknown());var ts=e.enum_(["mustache","jinja2"]);var is=e.enum_(["text","chat"]);var fe=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:os.optional(),type:ts.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",is.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var no=e.object({name:e.string(),version:fe,templateStructure:e.property("template_structure",Ui.optional())});var so=e.object({name:e.string(),description:e.string().optional(),tags:e.list(e.string()).optional()});var po=e.object({name:e.string(),commit:e.string().optional()});var sr={};c(sr,{FindFeedbackScoreNames1RequestType:()=>Ni,GetSpanStatsRequestType:()=>Fi,GetSpansByProjectRequestType:()=>Mi,SpanBatchUpdate:()=>go,SpanBatchWrite:()=>mo,SpanSearchStreamRequestPublic:()=>ho,SpanSearchStreamRequestPublicType:()=>Oi,findFeedbackScoreNames1:()=>Wi});var Mi=e.enum_(["general","tool","llm","guardrail"]);var Ni=e.enum_(["general","tool","llm","guardrail"]);var Fi=e.enum_(["general","tool","llm","guardrail"]);var Oi=e.enum_(["general","tool","llm","guardrail"]);var Wi={};c(Wi,{Response:()=>df});var df=e.list(e.string());var as=e.enum_(["general","tool","llm","guardrail"]);var co=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var lo=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:as.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",co.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 mo=e.object({spans:e.list(lo)});var ns=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 uo=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:ns.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 go=e.object({ids:e.list(e.string()),update:uo,mergeTags:e.property("merge_tags",e.boolean().optional())});var ss=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var wo=e.object({field:e.string().optional(),operator:ss.optional(),key:e.string().optional(),value:e.string().optional()});var ho=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:Oi.optional(),filters:e.list(wo).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 Fe={};c(Fe,{DeleteThreadFeedbackScores:()=>xo,DeleteTraceThreads:()=>_o,FeedbackScoreBatchThread:()=>Ao,TraceBatchUpdate:()=>yo,TraceBatchWrite:()=>Ro,TraceSearchStreamRequestPublic:()=>Eo,TraceThreadBatchIdentifier:()=>So,TraceThreadBatchUpdate:()=>ko,TraceThreadSearchStreamRequest:()=>To,findFeedbackScoreNames2:()=>Bi,findTraceThreadsFeedbackScoreNames:()=>Li});var Bi={};c(Bi,{Response:()=>uf});var uf=e.list(e.string());var Li={};c(Li,{Response:()=>gf});var gf=e.list(e.string());var fo=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",co.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Ro=e.object({traces:e.list(fo)});var bo=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 yo=e.object({ids:e.list(e.string()),update:bo,mergeTags:e.property("merge_tags",e.boolean().optional())});var zo=e.object({tags:e.list(e.string()).optional()});var ko=e.object({ids:e.list(e.string()),update:zo,mergeTags:e.property("merge_tags",e.boolean().optional())});var So=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 xo=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 _o=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 ps=e.enum_(["ui","sdk","online_scoring"]);var cs=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:ps,author:e.string().optional(),threadId:e.property("thread_id",e.string())});var Ao=e.object({scores:e.list(cs)});var ls=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var de=e.object({field:e.string().optional(),operator:ls.optional(),key:e.string().optional(),value:e.string().optional()});var To=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 Eo=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 Vi={};c(Vi,{AnnotationQueueBatchWrite:()=>vo,AnnotationQueueUpdate:()=>Co});var ms=e.enum_(["trace","thread"]);var Po=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:ms,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional())});var vo=e.object({annotationQueues:e.property("annotation_queues",e.list(Po))});var Co=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 Hi={};c(Hi,{ChatCompletionRequest:()=>jo});var ds=e.record(e.string(),e.unknown());var us=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var gs=e.enum_(["text","json_object","json_schema"]);var ws=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:e.record(e.string(),e.record(e.string(),e.unknown())).optional()});var hs=e.object({type:gs.optional(),jsonSchema:e.property("json_schema",ws.optional())});var Io=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 fs=e.object({type:e.stringLiteral("function").optional(),function:Io.optional()});var ze=e.object({name:e.string().optional(),arguments:e.string().optional()});var jo=e.object({model:e.string().optional(),messages:e.list(ds).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",us.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",hs.optional()),seed:e.number().optional(),tools:e.list(fs).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(Io).optional(),functionCall:e.property("function_call",ze.optional())});var Ji={};c(Ji,{DashboardUpdatePublic:()=>Do,DashboardWrite:()=>Uo});var Uo=e.object({name:e.string(),description:e.string().optional(),config:ie});var Z=e.record(e.string(),e.unknown());var Do=e.object({name:e.string().optional(),description:e.string().optional(),config:Z.optional()});var Xi={};c(Xi,{GuardrailBatchWrite:()=>Mo});var Rs=e.enum_(["TOPIC","PII"]);var bs=e.enum_(["passed","failed"]);var ys=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:Rs,result:bs,config:v,details:v});var Mo=e.object({guardrails:e.list(ys)});var Ki={};c(Ki,{WelcomeWizardSubmission:()=>No});var No=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 zs=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var pr=e.object({biInformation:e.property("bi_information",e.list(zs).optional())});var ks=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Ss=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(ks).optional())});var xs=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var _s=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(xs).optional())});var ee=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var As=e.enum_(["general","slack","pagerduty"]);var Ts=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 Es=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 Ps=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var vs=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Ps,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 Cs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Es),triggerConfigs:e.property("trigger_configs",e.list(vs).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var wf=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",As.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ts,triggers:e.list(Cs).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 Is=e.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var js=e.object({id:e.string().optional(),type:Is,configValue:e.property("config_value",e.record(e.string(),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.object({id:e.string().optional(),eventType:e.property("event_type",Us),triggerConfigs:e.property("trigger_configs",e.list(js).optional())});var Ms=e.enum_(["general","slack","pagerduty"]);var Ns=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 Fo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Ms.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Ns,triggers:e.list(Ds).optional()});var F=e.object({ids:e.list(e.string())});var Fs=e.enum_(["general","slack","pagerduty"]);var Os=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 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.enum_(["scope:project","threshold:feedback_score","threshold:cost","threshold:latency","threshold:errors"]);var Ls=e.object({id:e.string().optional(),alertTriggerId:e.property("alert_trigger_id",e.string().optional()),type:Bs,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 Vs=e.object({id:e.string().optional(),alertId:e.property("alert_id",e.string().optional()),eventType:e.property("event_type",Ws),triggerConfigs:e.property("trigger_configs",e.list(Ls).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Oo=e.object({id:e.string().optional(),name:e.string().optional(),enabled:e.boolean().optional(),alertType:e.property("alert_type",Fs.optional()),metadata:e.record(e.string(),e.string()).optional(),webhook:Os,triggers:e.list(Vs).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 Hs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Oo).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var hf=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Js=e.object({responseExamples:e.property("response_examples",e.record(e.string(),e.record(e.string(),e.unknown())).optional())});var Xs=e.enum_(["success","failure"]);var Ks=e.object({status:Xs.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 Gi=e.object({ids:e.list(e.string())});var Gs=e.enum_(["trace","thread"]);var $s=e.object({username:e.string().optional(),status:e.number().optional()});var re=e.object({name:e.string(),value:e.number()});var Qs=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:Gs,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list($s).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 ff=e.object({annotationQueues:e.property("annotation_queues",e.list(Qs))});var Ys=e.enum_(["trace","thread"]);var Zs=e.object({username:e.string().optional(),status:e.number().optional()});var Oe=e.object({name:e.string(),value:e.number()});var Wo=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:e.string(),description:e.string().optional(),instructions:e.string().optional(),scope:Ys,commentsEnabled:e.property("comments_enabled",e.boolean().optional()),feedbackDefinitionNames:e.property("feedback_definition_names",e.list(e.string()).optional()),reviewers:e.list(Zs).optional(),feedbackScores:e.property("feedback_scores",e.list(Oe).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 qs=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Wo).optional(),sortableBy:e.list(e.string()).optional()});var ep=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 rp=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ep).optional(),sortableBy:e.list(e.string()).optional()});var op=e.enum_(["trace","span"]);var tp=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var $i=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",op),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(tp))});var ip=e.enum_(["trace","span"]);var Rf=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",ip),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var ap=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var np=e.record(e.string(),e.unknown());var sp=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var pp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var ke=e.object({field:e.string().optional(),operator:pp.optional(),key:e.string().optional(),value:e.string().optional()});var We=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",v.optional())});var cp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var lp=e.object({url:e.string(),detail:e.string().optional()});var mp=e.object({url:e.string()});var dp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",lp.optional()),videoUrl:e.property("video_url",mp.optional())});var Be=e.object({role:cp,content:e.string().optional(),contentArray:e.property("content_array",e.list(dp).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 Le=e.object({name:e.string(),type:up,description:e.string()});var Bo=e.object({model:We,messages:e.list(Be),variables:e.record(e.string(),e.string()),schema:e.list(Le)});var gp=e.object({filters:e.list(ke).optional(),code:Bo.optional()});var Lo=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var wp=e.object({filters:e.list(ke).optional(),code:Lo.optional()});var Vo=e.object({model:We,messages:e.list(Be),schema:e.list(Le)});var hp=e.object({filters:e.list(de).optional(),code:Vo.optional()});var Ho=e.object({metric:e.string()});var fp=e.object({filters:e.list(de).optional(),code:Ho.optional()});var Rp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Jo=e.object({field:e.string().optional(),operator:Rp.optional(),key:e.string().optional(),value:e.string().optional()});var Xo=e.object({model:We,messages:e.list(Be),variables:e.record(e.string(),e.string()),schema:e.list(Le)});var bp=e.object({filters:e.list(Jo).optional(),code:Xo.optional()});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(),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")}),bf=e.union("type",{llm_as_judge:gp.extend(Ko),user_defined_metric_python:wp.extend(Ko),trace_thread_llm_as_judge:hp.extend(Ko),trace_thread_user_defined_metric_python:fp.extend(Ko),span_llm_as_judge:bp.extend(Ko)}).transform({transform:s=>s,untransform:s=>s});var yp=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Go=e.object({field:e.string().optional(),operator:yp.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",ie.optional())});var zp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var kp=e.object({url:e.string(),detail:e.string().optional()});var Sp=e.object({url:e.string()});var xp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",kp.optional()),videoUrl:e.property("video_url",Sp.optional())});var He=e.object({role:zp,content:e.string().optional(),contentArray:e.property("content_array",e.list(xp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var _p=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Je=e.object({name:e.string(),type:_p,description:e.string()});var Ap=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var Tp=e.object({filters:e.list(Go).optional(),code:Ap.optional()});var Ep=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Pp=e.object({field:e.string().optional(),operator:Ep.optional(),key:e.string().optional(),value:e.string().optional()});var vp=e.object({model:Ve,messages:e.list(He),variables:e.record(e.string(),e.string()),schema:e.list(Je)});var Cp=e.object({filters:e.list(Pp).optional(),code:vp.optional()});var Ip=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var $o=e.object({field:e.string().optional(),operator:Ip.optional(),key:e.string().optional(),value:e.string().optional()});var jp=e.object({model:Ve,messages:e.list(He),schema:e.list(Je)});var Up=e.object({filters:e.list($o).optional(),code:jp.optional()});var Dp=e.object({metric:e.string()});var Mp=e.object({filters:e.list($o).optional(),code:Dp.optional()});var Np=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Fp=e.object({filters:e.list(Go).optional(),code:Np.optional()});var Qo=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")}),Op=e.union("type",{llm_as_judge:Tp.extend(Qo),user_defined_metric_python:Fp.extend(Qo),trace_thread_llm_as_judge:Up.extend(Qo),trace_thread_user_defined_metric_python:Mp.extend(Qo),span_llm_as_judge:Cp.extend(Qo)}).transform({transform:s=>s,untransform:s=>s});var Xe=e.object({name:e.string(),temperature:e.number(),seed:e.number().optional(),customParameters:e.property("custom_parameters",Z.optional())});var Wp=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT","CUSTOM"]);var Bp=e.object({url:e.string(),detail:e.string().optional()});var Lp=e.object({url:e.string()});var Vp=e.object({type:e.string(),text:e.string().optional(),imageUrl:e.property("image_url",Bp.optional()),videoUrl:e.property("video_url",Lp.optional())});var Ke=e.object({role:Wp,content:e.string().optional(),contentArray:e.property("content_array",e.list(Vp).optional()),stringContent:e.property("string_content",e.boolean().optional()),structuredContent:e.property("structured_content",e.boolean().optional())});var Hp=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var Ge=e.object({name:e.string(),type:Hp,description:e.string()});var Jp=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var Yo=e.object({filters:e.list(be).optional(),code:Jp.optional()});var Xp=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var Zo=e.object({filters:e.list(be).optional(),code:Xp.optional()});var Kp=e.object({model:Xe,messages:e.list(Ke),schema:e.list(Ge)});var qo=e.object({filters:e.list(Ne).optional(),code:Kp.optional()});var Gp=e.object({metric:e.string()});var et=e.object({filters:e.list(Ne).optional(),code:Gp.optional()});var $p=e.object({model:Xe,messages:e.list(Ke),variables:e.record(e.string(),e.string()),schema:e.list(Ge)});var rt=e.object({filters:e.list(wo).optional(),code:$p.optional()});var ot=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")}),Qp=e.union("type",{llm_as_judge:Yo.extend(ot),user_defined_metric_python:Zo.extend(ot),trace_thread_llm_as_judge:qo.extend(ot),trace_thread_user_defined_metric_python:et.extend(ot),span_llm_as_judge:rt.extend(ot)}).transform({transform:s=>s,untransform:s=>s});var Yp=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Qp).optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var tt=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")}),Zp=e.union("type",{llm_as_judge:Yo.extend(tt),user_defined_metric_python:Zo.extend(tt),trace_thread_llm_as_judge:qo.extend(tt),trace_thread_user_defined_metric_python:et.extend(tt),span_llm_as_judge:rt.extend(tt)}).transform({transform:s=>s,untransform:s=>s});var qp=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var ec=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:qp.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var rc=e.object({content:e.list(ec).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var oc=e.object({filters:e.list(ke).optional(),code:Bo.optional()});var tc=e.object({filters:e.list(ke).optional(),code:Lo.optional()});var ic=e.object({filters:e.list(de).optional(),code:Vo.optional()});var ac=e.object({filters:e.list(de).optional(),code:Ho.optional()});var nc=e.object({filters:e.list(Jo).optional(),code:Xo.optional()});var it=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")}),sc=e.union("type",{llm_as_judge:oc.extend(it),user_defined_metric_python:tc.extend(it),trace_thread_llm_as_judge:ic.extend(it),trace_thread_user_defined_metric_python:ac.extend(it),span_llm_as_judge:nc.extend(it)}).transform({transform:s=>s,untransform:s=>s});var pc=e.enum_(["system","user","assistant","tool","function"]);var at=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:ze.optional()});var cc=e.object({role:pc.optional(),content:e.string().optional(),reasoningContent:e.property("reasoning_content",e.string().optional()),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(at).optional()),refusal:e.string().optional(),functionCall:e.property("function_call",ze.optional())});var lc=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(at).optional()),functionCall:e.property("function_call",ze.optional())});var mc=e.object({index:e.number().optional(),message:cc.optional(),delta:lc.optional(),finishReason:e.property("finish_reason",e.string().optional())});var dc=e.object({cachedTokens:e.property("cached_tokens",e.number().optional())});var uc=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var gc=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),promptTokensDetails:e.property("prompt_tokens_details",dc.optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",uc.optional())});var wc=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(mc).optional(),usage:gc.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional()),serviceTier:e.property("service_tier",e.string().optional())});var $e=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 hc=e.object({content:e.list($e).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.property("sortable_by",e.list(e.string()).optional())});var fc=e.enum_(["private","public"]);var Rc=e.enum_(["unknown","processing","completed","failed"]);var bc=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 yf=e.object({id:e.string().optional(),name:e.string(),visibility:fc.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:Rc.optional(),latestVersion:e.property("latest_version",bc.optional())});var yc=e.enum_(["manual","trace","span","sdk"]);var nt=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:yc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Vr).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 zf=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(nt)});var zc=e.object({generatedSamples:e.property("generated_samples",e.list(nt).optional()),model:e.string().optional(),totalGenerated:e.property("total_generated",e.number().optional()),generationTime:e.property("generation_time",e.date().optional())});var kf=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 kc=e.enum_(["string","number","object","boolean","array","null"]);var Sc=e.object({name:e.string().optional(),types:e.list(kc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var xc=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 _c=e.enum_(["manual","trace","span","sdk"]);var Qi=e.undiscriminatedUnion([e.record(e.string(),e.unknown()),e.list(e.record(e.string(),e.unknown())),e.string()]);var Ac=e.enum_(["ui","sdk","online_scoring"]);var Tc=e.enum_(["ui","sdk","online_scoring"]);var Ec=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:Tc.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 Pc=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Ac,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(),Ec).optional())});var vc=e.enum_(["default","hidden"]);var Cc=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:Qi.optional(),output:Qi.optional(),feedbackScores:e.property("feedback_scores",e.list(Pc).optional()),comments:e.list(xc).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 Ic=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:_c,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(Cc).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(Ic).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Sc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Uc=e.enum_(["private","public"]);var Dc=e.enum_(["unknown","processing","completed","failed"]);var Mc=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 cr=e.object({id:e.string().optional(),name:e.string(),visibility:Uc.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:Dc.optional(),latestVersion:e.property("latest_version",Mc.optional())});var Nc=e.object({content:e.list(cr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),sortableBy:e.list(e.string()).optional()});var Fc=e.object({value:e.number().optional()});var Oc=e.object({value:e.number().optional()});var st=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Wc=e.object({value:st.optional()});var Bc=e.object({name:e.string().optional()}),Lc=e.union("type",{PERCENTAGE:Wc.extend(Bc),COUNT:Oc.extend(Bc),AVG:Fc.extend(Bc)}).transform({transform:s=>s,untransform:s=>s});var Qe=e.object({stats:e.list(Lc).optional()});var Vc=e.enum_(["manual","trace","span","sdk"]);var Hc=e.enum_(["default","hidden"]);var pt=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",Hc.optional())});var ct=e.object({id:e.string().optional(),draftItemId:e.property("draft_item_id",e.string().optional()),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Vc,data:v,tags:e.list(e.string()).optional(),experimentItems:e.property("experiment_items",e.list(pt).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.enum_(["string","number","object","boolean","array","null"]);var Xc=e.object({name:e.string().optional(),types:e.list(Jc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Kc=e.object({content:e.list(ct).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Xc).optional(),sortableBy:e.list(e.string()).optional(),hasDraft:e.boolean().optional()});var Gc=e.enum_(["string","number","object","boolean","array","null"]);var $c=e.object({name:e.string().optional(),types:e.list(Gc).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Qc=e.object({columns:e.list($c).optional()});var Yc=e.object({typeName:e.string().optional()});var Sf=e.object({type:Yc.optional(),closed:e.boolean().optional()});var Zc=e.object({itemsAdded:e.number().optional(),itemsModified:e.number().optional(),itemsDeleted:e.number().optional(),itemsUnchanged:e.number().optional()});var qc=e.object({fromVersion:e.property("from_version",e.string().optional()),toVersion:e.property("to_version",e.string().optional()),statistics:Zc.optional()});var lr=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 el=e.object({content:e.list(lr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var rl=e.enum_(["regular","trial","mini-batch"]);var ol=e.enum_(["running","completed","cancelled"]);var Se=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Yi=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 xf=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:rl.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:Se.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:ol.optional(),experimentScores:e.property("experiment_scores",e.list(Gr).optional()),promptVersion:e.property("prompt_version",Yi.optional()),promptVersions:e.property("prompt_versions",e.list(Yi).optional())});var mr=e.object({ids:e.list(e.string())});var tl=e.enum_(["TOPIC","PII"]);var il=e.enum_(["passed","failed"]);var al=e.object({name:tl.optional(),result:il.optional()});var nl=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(al).optional()});var sl=e.enum_(["default","hidden"]);var lt=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(nl).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",sl.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 pl=e.enum_(["general","tool","llm","guardrail"]);var mt=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:pl.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 cl=e.object({datasetItemId:e.property("dataset_item_id",e.string()),evaluateTaskResult:e.property("evaluate_task_result",D.optional()),trace:lt.optional(),spans:e.list(mt).optional(),feedbackScores:e.property("feedback_scores",e.list(Y).optional())});var _f=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(cl)});var Ye=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 ll=e.enum_(["regular","trial","mini-batch"]);var ml=e.enum_(["running","completed","cancelled"]);var dl=e.object({name:e.string(),value:e.number()});var Zi=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 dt=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:ll.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(Oe).optional()),comments:e.list(Ye).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:st.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:ml.optional(),experimentScores:e.property("experiment_scores",e.list(dl).optional()),promptVersion:e.property("prompt_version",Zi.optional()),promptVersions:e.property("prompt_versions",e.list(Zi).optional())});var ul=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(dt).optional(),sortableBy:e.list(e.string()).optional()});var gl=e.object({label:e.string().optional()});var wl=e.object({groupSorting:e.property("group_sorting",e.list(e.string()).optional())});var hl=e.object({groupsDetails:e.property("groups_details",e.list(wl).optional())});var fl=e.object({content:e.record(e.string(),gl).optional(),details:hl.optional()});var Rl=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:Se.optional(),feedbackScores:e.property("feedback_scores",e.list(re).optional()),experimentScores:e.property("experiment_scores",e.list(re).optional())});var bl=e.object({label:e.string().optional(),aggregations:Rl.optional()});var yl=e.object({content:e.record(e.string(),bl).optional()});var Af=e.object({ids:e.list(e.string())});var zl=e.object({typeName:e.string().optional()});var Tf=e.object({type:zl.optional(),closed:e.boolean().optional()});var kl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Sl=e.object({details:kl.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var xl=e.object({categories:e.record(e.string(),e.number())});var _l=e.object({details:xl.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 Al=e.object({max:e.number(),min:e.number()});var Tl=e.object({details:Al.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 El=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()}),Ef=e.union("type",{numerical:Tl.extend(El),categorical:_l.extend(El),boolean:Sl.extend(El)}).transform({transform:s=>s,untransform:s=>s});var Pl=e.object({trueLabel:e.string(),falseLabel:e.string()});var vl=e.object({details:Pl.optional()});var Cl=e.object({categories:e.record(e.string(),e.number())});var Il=e.object({details:Cl.optional()});var jl=e.object({max:e.number(),min:e.number()});var Ul=e.object({details:jl.optional()});var Dl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),Ml=e.union("type",{numerical:Ul.extend(Dl),categorical:Il.extend(Dl),boolean:vl.extend(Dl)}).transform({transform:s=>s,untransform:s=>s});var Nl=e.object({trueLabel:e.string(),falseLabel:e.string()});var ut=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 Fl=e.object({categories:e.record(e.string(),e.number())});var gt=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 Ol=e.object({max:e.number(),min:e.number()});var wt=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 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()}),Bl=e.union("type",{numerical:wt.extend(Wl),categorical:gt.extend(Wl),boolean:ut.extend(Wl)}).transform({transform:s=>s,untransform:s=>s});var Ll=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Bl).optional()});var Vl=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()}),Hl=e.union("type",{numerical:wt.extend(Vl),categorical:gt.extend(Vl),boolean:ut.extend(Vl)}).transform({transform:s=>s,untransform:s=>s});var Jl=e.object({trueLabel:e.string(),falseLabel:e.string()});var Xl=e.object({details:Jl.optional()});var Kl=e.object({categories:e.record(e.string(),e.number())});var Gl=e.object({details:Kl.optional()});var $l=e.object({max:e.number(),min:e.number()});var Ql=e.object({details:$l.optional()});var Yl=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional()}),Zl=e.union("type",{numerical:Ql.extend(Yl),categorical:Gl.extend(Yl),boolean:Xl.extend(Yl)}).transform({transform:s=>s,untransform:s=>s});var ql=e.enum_(["TOPIC","PII"]);var em=e.enum_(["passed","failed"]);var rm=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:ql,result:em,config:v,details:v});var Pf=e.object({guardrails:e.list(rm)});var om=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var ht=e.object({id:e.string().optional(),provider:om,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())});var tm=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(ht).optional(),sortableBy:e.list(e.string()).optional()});var im=e.enum_(["openai","anthropic","gemini","openrouter","vertex-ai","custom-llm"]);var vf=e.object({id:e.string().optional(),provider:im,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())});var qi=e.object({entitiesQueued:e.property("entities_queued",e.number().optional()),rulesApplied:e.property("rules_applied",e.number().optional())});var am=e.enum_(["trace","thread"]);var ea=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",am)});var Cf=v;var nm=e.enum_(["running","completed","cancelled","initialized","error"]);var sm=e.object({role:e.string(),content:e.string()});var pm=e.object({messages:e.list(sm)});var cm=e.object({model:e.string(),parameters:v.optional()});var lm=e.object({type:e.string(),parameters:v.optional()});var mm=e.object({metrics:e.list(lm)});var dm=e.object({type:e.string(),parameters:v.optional()});var um=e.object({datasetName:e.property("dataset_name",e.string()),prompt:pm,llmModel:e.property("llm_model",cm),evaluation:mm,optimizer:dm});var If=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:nm,metadata:D.optional(),studioConfig:e.property("studio_config",um.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 gm=e.object({role:e.string(),content:e.string()});var wm=e.object({messages:e.list(gm)});var hm=e.object({model:e.string(),parameters:ie.optional()});var fm=e.object({type:e.string(),parameters:ie.optional()});var Rm=e.object({metrics:e.list(fm)});var bm=e.object({type:e.string(),parameters:ie.optional()});var ym=e.object({datasetName:e.property("dataset_name",e.string()),prompt:wm,llmModel:e.property("llm_model",hm),evaluation:Rm,optimizer:bm});var zm=e.enum_(["running","completed","cancelled","initialized","error"]);var ra=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:zm,metadata:te.optional(),studioConfig:e.property("studio_config",ym.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional())});var km=e.enum_(["running","completed","cancelled","initialized","error"]);var Sm=e.object({role:e.string(),content:e.string()});var xm=e.object({messages:e.list(Sm)});var _m=e.object({model:e.string(),parameters:Z.optional()});var Am=e.object({type:e.string(),parameters:Z.optional()});var Tm=e.object({metrics:e.list(Am)});var Em=e.object({type:e.string(),parameters:Z.optional()});var Pm=e.object({datasetName:e.property("dataset_name",e.string()),prompt:xm,llmModel:e.property("llm_model",_m),evaluation:Tm,optimizer:Em});var dr=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:km,metadata:ae.optional(),studioConfig:e.property("studio_config",Pm.optional()),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(Oe).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 oa=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(dr).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 ft=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Cm=e.enum_(["private","public"]);var jf=e.object({id:e.string().optional(),name:e.string(),visibility:Cm.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:Se.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",ft.optional())});var Im=e.enum_(["private","public"]);var Rt=e.object({id:e.string().optional(),name:e.string(),visibility:Im.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(Rt).optional(),sortableBy:e.list(e.string()).optional()});var Um=e.object({name:e.string().optional(),type:e.string().optional()});var Dm=e.object({scores:e.list(Um).optional()});var Mm=e.object({time:e.date(),value:e.number().optional()});var Nm=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT","THREAD_COUNT","THREAD_DURATION","THREAD_FEEDBACK_SCORES"]);var Fm=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Om=e.object({name:e.string().optional(),data:e.list(Mm).optional()});var Wm=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Nm.optional()),interval:Fm.optional(),results:e.list(Om).optional()});var Bm=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(re).optional()),duration:Se.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",ft.optional())});var Lm=e.object({content:e.list(Bm).optional()});var Vm=e.object({count:e.number().optional(),deviation:e.number().optional(),deviationPercentage:e.property("deviation_percentage",e.number().optional())});var Hm=e.object({name:e.string(),value:e.number()});var Jm=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Xm=e.enum_(["private","public"]);var Km=e.object({id:e.string().optional(),name:e.string(),visibility:Xm.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(Hm).optional()),duration:Jm.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",Vm.optional())});var Uf=e.object({errors:e.list(e.string()).optional()});var Gm=e.enum_(["mustache","jinja2"]);var $m=e.enum_(["text","chat"]);var Qm=e.enum_(["mustache","jinja2"]);var Ym=e.enum_(["text","chat"]);var Zm=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:Qm.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),templateStructure:e.property("template_structure",Ym.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Df=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:Gm.optional(),templateStructure:e.property("template_structure",$m.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",Zm.optional())});var Mf=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var qm=e.enum_(["text","chat"]);var ed=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",qm.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",fe.optional())});var rd=e.enum_(["mustache","jinja2"]);var od=e.enum_(["text","chat"]);var td=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:rd.optional(),changeDescription:e.property("change_description",e.string().optional()),templateStructure:e.property("template_structure",od.optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var id=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(td).optional()});var ad=e.enum_(["text","chat"]);var nd=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),templateStructure:e.property("template_structure",ad.optional()),tags:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional()),versionCount:e.property("version_count",e.number().optional())});var sd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(nd).optional(),sortableBy:e.list(e.string()).optional()});var pd=e.object({pythonEvaluatorEnabled:e.boolean(),traceThreadPythonEvaluatorEnabled:e.boolean(),spanLlmAsJudgeEnabled: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()});var Nf=e.object({spans:e.list(mt)});var bt=e.object({name:e.string(),author:e.string().optional()});var yt=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var cd=e.enum_(["ui","sdk","online_scoring"]);var ld=e.enum_(["ui","sdk","online_scoring"]);var md=e.object({value:e.number().optional(),reason:e.string().optional(),categoryName:e.property("category_name",e.string().optional()),source:ld.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 ur=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:cd,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(),md).optional())});var dd=e.enum_(["general","tool","llm","guardrail"]);var zt=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:dd.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",yt.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(ur).optional()),comments:e.list(Ye).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 ud=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(zt).optional(),sortableBy:e.list(e.string()).optional()});var gd=e.enum_(["ui","sdk","online_scoring"]);var wd=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:gd,author:e.string().optional(),id:e.string()});var kt=e.object({scores:e.list(wd)});var Ff=e.object({traces:e.list(lt)});var Of=e.object({ids:e.list(e.string()),projectId:e.property("project_id",e.string().optional())});var hd=e.enum_(["TOPIC","PII"]);var fd=e.enum_(["passed","failed"]);var Rd=e.object({name:hd.optional(),result:fd.optional()});var bd=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Rd).optional()});var yd=e.enum_(["default","hidden"]);var St=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",yt.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(ur).optional()),spanFeedbackScores:e.property("span_feedback_scores",e.list(ur).optional()),comments:e.list(Ye).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(bd).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",yd.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 zd=e.enum_(["active","inactive"]);var xt=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:zd.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 ta=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 kd=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 Sd=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(St).optional(),sortableBy:e.list(e.string()).optional()});var xd=e.object({completed:e.boolean().optional()});var Ze=e.object({name:e.string().optional(),current:e.number().optional(),previous:e.number().optional()});var gr=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 Wf=e.object({time:e.date(),value:e.number().optional()});var ia=e.object({results:e.list(Ze).optional()});var Bf=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 _t=e.object({timeoutToMarkThreadAsInactive:e.property("timeout_to_mark_thread_as_inactive",e.string().optional()),truncationOnTables:e.property("truncation_on_tables",e.boolean().optional())});var _d=e.object({results:e.list(Ze).optional()});var aa=class{constructor(t={}){this._options=t;}getDatasetBiInfo(t){return f.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:pr.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 h("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 f.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:pr.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 h("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 f.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:pr.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 h("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 f.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:Ss.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 h("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 f.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:pr.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 h("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 f.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:_s.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 h("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 na=class{constructor(t={}){this._options=t;}findAlerts(t={},r){return f.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:Hs.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 h("Timeout exceeded when calling GET /v1/private/alerts.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createAlert(t,r){return f.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: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 T(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 h("Timeout exceeded when calling POST /v1/private/alerts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteAlertBatch(t,r){return f.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:Oo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 T(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 h("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 f.fromPromise(this.__getWebhookExamples(t,r))}async __getWebhookExamples(t={},r){var l,d;let{alertType:o}=t,i={};o!=null&&(i.alert_type=ai.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:Js.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 h("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 f.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: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:Ks.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 h("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 sa=class{constructor(t={}){this._options=t;}addItemsToAnnotationQueue(t,r,o){return f.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:Gi.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:qs.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 h("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 f.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: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 T(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 h("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 f.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: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 T(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 h("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 f.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:Wo.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 T(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 h("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 f.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:Gi.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 pa=class{constructor(t={}){this._options=t;}attachmentList(t,r){return f.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=si.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:rp.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 h("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 f.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:$i.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("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 f.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:$i.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("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 f.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=pi.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 h("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 f.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:_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:ap.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 h("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 f.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=li.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:ar.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 h("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 ca=class{constructor(t={}){this._options=t;}access(t,r){return f.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:np.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getWorkspaceName(t){return f.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:sp.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 h("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 la=class{constructor(t={}){this._options=t;}findEvaluators(t={},r){return f.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:Yp.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 h("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 f.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:Op.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("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 f.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 h("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 f.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:Zp.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 h("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 f.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:sc.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 h("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 f.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:rc.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 h("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 ma=class{constructor(t={}){this._options=t;}createChatCompletions(t={},r){return f.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: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:wc.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 h("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 da=class{constructor(t={}){this._options=t;}findDashboards(t={},r){return f.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:hc.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 h("Timeout exceeded when calling GET /v1/private/dashboards.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createDashboard(t,r){return f.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: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:$e.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 h("Timeout exceeded when calling POST /v1/private/dashboards.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDashboardById(t,r){return f.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:$e.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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 h("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 f.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:Do.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:$e.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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 h("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 ua=class{constructor(t={}){this._options=t;}batchUpdateDatasetItems(t,r){return f.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:Ar.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.fromPromise(this.__findDatasets(t,r))}async __findDatasets(t={},r){var x,A;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((A=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?A: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:Nc.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 h("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new p({message:S.error.errorMessage,rawResponse:S.rawResponse})}}createDataset(t,r){return f.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:Tr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createOrUpdateDatasetItems(t,r){return f.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:Pr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("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 f.fromPromise(this.__createDatasetItemsFromCsv(t,r))}async __createDatasetItemsFromCsv(t,r){var l,d;let o=await Iu();o.append("file",_e(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 T(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new h("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 f.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: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: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 h("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 f.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:Cr.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 h("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 f.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:cr.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 h("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 f.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:Ir.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 h("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 f.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 h("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 f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 h("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 f.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 h("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 f.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: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:zc.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 h("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 f.fromPromise(this.__findDatasetItemsWithExperimentItems(t,r,o))}async __findDatasetItemsWithExperimentItems(t,r,o){var x,A;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((A=(x=await n.get(this._options.baseUrl))!=null?x:await n.get(this._options.environment))!=null?A: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 h("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 f.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: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:cr.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 h("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 f.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:Qe.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 h("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 f.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:ct.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 h("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 f.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:Er.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:Kc.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 h("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 f.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:Qc.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 h("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 f.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:Nr.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 h("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 f.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:qc.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:Fr.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 T(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new h("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 f.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:el.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 T(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 h("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 f.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: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")switch(i.error.statusCode){case 400:throw new T(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 h("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 f.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 h("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 f.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: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:lr.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:Br.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:lr.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 T(a.error.body,a.rawResponse);case 404:throw new _(a.error.body,a.rawResponse);case 409:throw new M(a.error.body,a.rawResponse);default:throw new p({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case "non-json":throw new p({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case "timeout":throw new h("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 ga=class{constructor(t={}){this._options=t;}findExperiments(t={},r){return f.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 A=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(A.ok)return {data:ul.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 T(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 h("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new p({message:A.error.errorMessage,rawResponse:A.rawResponse})}}createExperiment(t,r){return f.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: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 h("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createExperimentItems(t,r){return f.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: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: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 h("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 f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 h("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 f.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:Kr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 T(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 h("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 f.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:nr.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 h("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 f.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:fl.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 T(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 h("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 f.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:yl.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 T(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 h("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 f.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: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")switch(o.error.statusCode){case 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:$r.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new T(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:pt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:Qr.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 h("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 f.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:Yr.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 h("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 wa=class{constructor(t={}){this._options=t;}findFeedbackDefinitions(t={},r){return f.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=zi.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:Ll.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 h("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 f.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:Ml.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials: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 h("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 f.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:Hl.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 h("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 f.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:Zl.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 h("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 f.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 h("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 f.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 h("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 ha=class{constructor(t={}){this._options=t;}createGuardrails(t,r){return f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 fa=class{constructor(t={}){this._options=t;}deleteLlmProviderApiKeysBatch(t,r){return f.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 h("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 f.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:tm.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 h("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 f.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: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")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 h("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 f.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: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 _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:qr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 401:throw new X(i.error.body,i.rawResponse);case 403:throw new $(ee.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 Ra=class{constructor(t={}){this._options=t;}evaluateThreads(t,r){return f.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:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:qi.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 T(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:ea.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:qi.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 T(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 ba=class{constructor(t={}){this._options=t;}receiveProtobufTraces(t){return f.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 h("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 ya=class{constructor(t={}){this._options=t;}cancelStudioOptimizations(t,r){return f.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 De(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:oa.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 T(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 h("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new p({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createOptimization(t,r){return f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}upsertOptimization(t,r){return f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("Timeout exceeded when calling PUT /v1/private/optimizations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOptimizationsById(t,r){return f.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: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 h("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 f.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:oa.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 T(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 h("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 f.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:dr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:eo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse});switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:dr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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 _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 za=class{constructor(t={}){this._options=t;}findProjects(t={},r){return f.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 h("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new p({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createProject(t,r){return f.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: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 T(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 h("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectById(t,r){return f.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:Rt.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 h("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 f.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 h("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 f.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: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 T(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 h("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 f.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 h("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 f.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:Dm.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 h("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 f.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: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:Wm.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 T(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:Lm.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 h("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 f.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: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:Km.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 T(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 ka=class{constructor(t={}){this._options=t;}getPrompts(t={},r){return f.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:sd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")throw new p({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse});switch(g.error.reason){case "non-json":throw new p({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case "timeout":throw new h("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new p({message:g.error.errorMessage,rawResponse:g.rawResponse})}}createPrompt(t,r){return f.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:ao.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new T(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 h("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPromptVersion(t,r){return f.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: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:fe.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 T(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 h("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getPromptById(t,r){return f.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:ed.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 400:throw new T(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);case 409:throw new M(i.error.body,i.rawResponse);case 422:throw new W(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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 h("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 f.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 h("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 f.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:fe.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.fromPromise(this.__getPromptVersions(t,r,o))}async __getPromptVersions(t,r={},o){var u,g;let{page:i,size:a}=r,l={};i!=null&&(l.page=i.toString()),a!=null&&(l.size=a.toString());let d=await b({url:y((g=(u=await n.get(this._options.baseUrl))!=null?u:await n.get(this._options.environment))!=null?g:R.Default,`v1/private/prompts/${encodeURIComponent(t)}/versions`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(d.ok)return {data:id.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 h("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new p({message:d.error.errorMessage,rawResponse:d.rawResponse})}}restorePromptVersion(t,r,o){return f.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:fe.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 T(i.error.body,i.rawResponse);case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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: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:fe.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 T(o.error.body,o.rawResponse);case 404:throw new _(o.error.body,o.rawResponse);case 422:throw new W(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 Sa=class{constructor(t={}){this._options=t;}getServiceToggles(t){return f.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:pd.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 h("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 xa=class{constructor(t={}){this._options=t;}addSpanComment(t,r,o){return f.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 h("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 f.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 h("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 f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.fromPromise(this.__getSpansByProject(t,r))}async __getSpansByProject(t={},r){var Bd,Ld;let{page:o,size:i,projectName:a,projectId:l,traceId:d,type:u,filters:g,truncate:w,stripAttachments:k,sorting:S,exclude:x,fromTime:A,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=Mi.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),A!=null&&(O.from_time=A.toISOString()),B!=null&&(O.to_time=B.toISOString());let G=await b({url:y((Ld=(Bd=await n.get(this._options.baseUrl))!=null?Bd:await n.get(this._options.environment))!=null?Ld: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:ud.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 h("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new p({message:G.error.errorMessage,rawResponse:G.rawResponse})}}createSpan(t,r){return f.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:lo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 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 h("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 f.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:zt.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 404:throw new _(l.error.body,l.rawResponse);default:throw new p({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case "non-json":throw new p({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case "timeout":throw new h("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 f.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 De(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:uo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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 h("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 f.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:bt.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 h("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 f.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=Ni.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:sr.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 h("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 f.fromPromise(this.__getSpanComment(t,r,o))}async __getSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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=Fi.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:Qe.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 h("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 f.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: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: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 h("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 f.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:ho.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.fromPromise(this.__updateSpanComment(t,r,o))}async __updateSpanComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/spans/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 _a=class{constructor(t={}){this._options=t;}addThreadComment(t,r,o){return f.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 h("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 f.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 h("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 f.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 h("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 f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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,A={};o!=null&&(A.page=o.toString()),i!=null&&(A.size=i.toString()),a!=null&&(A.project_name=a),l!=null&&(A.project_id=l),d!=null&&(A.filters=d),u!=null&&(A.truncate=u.toString()),g!=null&&(A.strip_attachments=g.toString()),w!=null&&(A.sorting=w),k!=null&&(A.exclude=k),S!=null&&(A.from_time=S.toISOString()),x!=null&&(A.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: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(B.ok)return {data:Sd.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 h("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new p({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createTrace(t,r){return f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:St.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 h("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 f.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 h("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 f.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:bo.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data: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 h("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 f.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 h("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 f.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: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 h("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 f.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 h("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 f.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:bt.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 h("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 f.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:_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 h("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 f.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 h("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 f.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:Fe.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 h("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 f.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:Fe.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 h("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 f.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:Qe.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 h("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 f.fromPromise(this.__getThreadComment(t,r,o))}async __getThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("Timeout exceeded when calling GET /v1/private/traces/threads/{threadId}/comments/{commentId}.");case "unknown":throw new p({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getTraceComment(t,r,o){return f.fromPromise(this.__getTraceComment(t,r,o))}async __getTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(t)}`),method:"GET",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:L.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.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:ta.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:xt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new _(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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 A=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(A.ok)return {data:kd.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 h("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new p({message:A.error.errorMessage,rawResponse:A.rawResponse})}}openTraceThread(t,r){return f.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:ta.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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: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 h("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 f.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: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: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 h("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 f.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: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")switch(o.error.statusCode){case 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:Eo.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 T(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 h("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 f.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: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 _(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 h("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 f.fromPromise(this.__updateThreadComment(t,r,o))}async __updateThreadComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/threads/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 f.fromPromise(this.__updateTraceComment(t,r,o))}async __updateTraceComment(t,r,o){var a,l;let i=await b({url:y((l=(a=await n.get(this._options.baseUrl))!=null?a:await n.get(this._options.environment))!=null?l:R.Default,`v1/private/traces/comments/${encodeURIComponent(t)}`),method:"PATCH",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:L.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(i.ok)return {data:void 0,rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 404:throw new _(i.error.body,i.rawResponse);default:throw new p({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case "non-json":throw new p({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case "timeout":throw new h("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 Aa=class{constructor(t={}){this._options=t;}getWelcomeWizardStatus(t){return f.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:xd.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 h("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 f.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: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")throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 Ta=class{constructor(t={}){this._options=t;}costsSummary(t,r){return f.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:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.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 400:throw new T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:_t.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new _(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new h("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 f.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:_t.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:_t.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 T(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 h("Timeout exceeded when calling PUT /v1/private/workspaces/configurations.");case "unknown":throw new p({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteWorkspaceConfiguration(t){return f.fromPromise(this.__deleteWorkspaceConfiguration(t))}async __deleteWorkspaceConfiguration(t){var o,i;let r=await b({url:y((i=(o=await n.get(this._options.baseUrl))!=null?o:await n.get(this._options.environment))!=null?i:R.Default,"v1/private/workspaces/configurations"),method:"DELETE",headers:{"Comet-Workspace":await n.get(this._options.workspaceName)!=null?await n.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":m.type,"X-Fern-Runtime-Version":m.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(r.ok)return {data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 404:throw new _(r.error.body,r.rawResponse);default:throw new p({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case "non-json":throw new p({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case "timeout":throw new h("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 f.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:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ia.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:ia.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 f.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:gr.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(o.ok)return {data:_d.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 T(o.error.body,o.rawResponse);default:throw new p({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case "non-json":throw new p({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case "timeout":throw new h("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 Ea=class{constructor(t={}){this._options=t;}datasetsRedirect(t,r){return f.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 T(d.error.body,d.rawResponse);case 404:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new h("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 f.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 T(u.error.body,u.rawResponse);case 404:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new h("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 f.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 T(u.error.body,u.rawResponse);case 404:throw new _(u.error.body,u.rawResponse);default:throw new p({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case "non-json":throw new p({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case "timeout":throw new h("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 f.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 T(d.error.body,d.rawResponse);case 404:throw new _(d.error.body,d.rawResponse);default:throw new p({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case "non-json":throw new p({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case "timeout":throw new h("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 At=class{constructor(t={}){this._options=t;}get systemUsage(){var t;return (t=this._systemUsage)!=null?t:this._systemUsage=new aa(this._options)}get alerts(){var t;return (t=this._alerts)!=null?t:this._alerts=new na(this._options)}get annotationQueues(){var t;return (t=this._annotationQueues)!=null?t:this._annotationQueues=new sa(this._options)}get attachments(){var t;return (t=this._attachments)!=null?t:this._attachments=new pa(this._options)}get check(){var t;return (t=this._check)!=null?t:this._check=new ca(this._options)}get automationRuleEvaluators(){var t;return (t=this._automationRuleEvaluators)!=null?t:this._automationRuleEvaluators=new la(this._options)}get chatCompletions(){var t;return (t=this._chatCompletions)!=null?t:this._chatCompletions=new ma(this._options)}get dashboards(){var t;return (t=this._dashboards)!=null?t:this._dashboards=new da(this._options)}get datasets(){var t;return (t=this._datasets)!=null?t:this._datasets=new ua(this._options)}get experiments(){var t;return (t=this._experiments)!=null?t:this._experiments=new ga(this._options)}get feedbackDefinitions(){var t;return (t=this._feedbackDefinitions)!=null?t:this._feedbackDefinitions=new wa(this._options)}get guardrails(){var t;return (t=this._guardrails)!=null?t:this._guardrails=new ha(this._options)}get llmProviderKey(){var t;return (t=this._llmProviderKey)!=null?t:this._llmProviderKey=new fa(this._options)}get manualEvaluation(){var t;return (t=this._manualEvaluation)!=null?t:this._manualEvaluation=new Ra(this._options)}get openTelemetryIngestion(){var t;return (t=this._openTelemetryIngestion)!=null?t:this._openTelemetryIngestion=new ba(this._options)}get optimizations(){var t;return (t=this._optimizations)!=null?t:this._optimizations=new ya(this._options)}get projects(){var t;return (t=this._projects)!=null?t:this._projects=new za(this._options)}get prompts(){var t;return (t=this._prompts)!=null?t:this._prompts=new ka(this._options)}get serviceToggles(){var t;return (t=this._serviceToggles)!=null?t:this._serviceToggles=new Sa(this._options)}get spans(){var t;return (t=this._spans)!=null?t:this._spans=new xa(this._options)}get traces(){var t;return (t=this._traces)!=null?t:this._traces=new _a(this._options)}get welcomeWizard(){var t;return (t=this._welcomeWizard)!=null?t:this._welcomeWizard=new Aa(this._options)}get workspaces(){var t;return (t=this._workspaces)!=null?t:this._workspaces=new Ta(this._options)}get redirect(){var t;return (t=this._redirect)!=null?t:this._redirect=new Ea(this._options)}isAlive(t){return f.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 h("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new p({message:r.error.errorMessage,rawResponse:r.rawResponse})}}version(t){return f.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 h("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 Pa=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 va=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 Pa(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 ng={EXPERIMENTS:"api/v1/session/redirect/experiments/",PROJECT_BY_NAME:"redirect/projects"},Ca={EXPERIMENT_ID:"experiment_id",DATASET_ID:"dataset_id",PROJECT_NAME:"name",PATH:"path"},Vf=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,"="),Hf=s=>s.replace(/\/api$/,""),Jf=s=>Buffer.from(s).toString("base64"),sg=(s,t,r)=>{let o=Vf(r),i=`${t}?${o}`;return new URL(i,s).toString()},pg=({datasetId:s,experimentId:t,baseUrl:r})=>sg(r,ng.EXPERIMENTS,{[Ca.EXPERIMENT_ID]:t,[Ca.DATASET_ID]:s,[Ca.PATH]:Jf(r)});var cg=({projectName:s,workspaceName:t,apiUrl:r})=>{let o=Hf(r),i=`${t}/${ng.PROJECT_BY_NAME}`;return sg(o,i,{[Ca.PROJECT_NAME]:s})};var Xf=300,Ia=100,Tt=class{constructor({action:t,batchSize:r=Ia,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=Xf,enableCreateBatch:r=true,enableUpdateBatch:o=false,enableDeleteBatch:i=true,createBatchSize:a=Ia,updateBatchSize:l=Ia,deleteBatchSize:d=Ia,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 Tt({action:async g=>{await this.createEntities(Array.from(g.values()));},delay:t,enableBatch:r,batchSize:a,name:`${u}:createQueue`}),this.updateQueue=new Tt({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 Tt({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 ja=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 Ua=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 Da=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 Ma=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 Na=class extends At{constructor(r){super(r);this.setHeaders=r=>{this.requestOptions.headers=r;};this.requestOptions=(r==null?void 0:r.requestOptions)||{};}};var Fa=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 Ad=null;async function lg(){return Ad||(Ad=await Kf()),Ad}var Et=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||Sn.Sdk,this.data={...l};}getContent(t=false){return t?{...this.data,id:this.id}:{...this.data}}async contentHash(){let t=this.getContent(),r=Gf(t);return (await lg()).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 Ee(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 Pt(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 mg={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 Qf={DATASET_ITEM_MISSING_ID:"DATASET_ITEM_MISSING_ID"},Oa=class extends ne{constructor(t){super({message:mg.DATASET_ITEM_MISSING_ID(t),code:Qf.DATASET_ITEM_MISSING_ID});}};var Yf={SEARCH_TIMEOUT:"SEARCH_TIMEOUT"},Wa=class extends ne{constructor(t){super({message:t,code:Yf.SEARCH_TIMEOUT});}};var Ba={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 Td={JSON_PARSE_ERROR:"JSON_PARSE_ERROR",JSON_NOT_ARRAY:"JSON_NOT_ARRAY",JSON_ITEM_NOT_OBJECT:"JSON_ITEM_NOT_OBJECT"},La=class extends ne{constructor(t){let r=t instanceof Error?t:new Error(String(t));super({message:Ba.JSON_PARSE_ERROR,code:Td.JSON_PARSE_ERROR,originalError:r});}},Va=class extends ne{constructor(t){super({message:Ba.JSON_NOT_ARRAY(t),code:Td.JSON_NOT_ARRAY});}},Ha=class extends ne{constructor(t,r){super({message:Ba.JSON_ITEM_NOT_OBJECT(t,r),code:Td.JSON_ITEM_NOT_OBJECT});}};var wr=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=Pt(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 Oa(r);await this.insert(t);}}async delete(t){if(!t||t.length===0){z.info("No item IDs provided for deletion");return}let r=Pt(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 Ee(i,C.DatasetItemPublic,t)).map(l=>Et.fromApiModel(l))}async insertFromJson(t,r={},o=[]){let i;try{i=JSON.parse(t);}catch(l){throw new La(l)}if(!Array.isArray(i))throw new Va(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 Ha(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 Gf(o)}async getDeduplicatedItems(t){let r=[];for(let o of t){let i=new Et(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 Ed=class extends Error{constructor(t){super(t),this.name="DatasetError";}},vt=class extends Ed{constructor(t){super(`Dataset with name '${t}' not found`),this.name="DatasetNotFoundError";}};var Ja=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;}},Xa=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 qe=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=Pt(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 Ee(g,C.ExperimentItemCompare,u);if(w.length===0){d=!1;break}for(let k of w){let S=Xa.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||pn.apiUrl;return pg({datasetId:t.id,experimentId:this.id,baseUrl:r})}};var Ka={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
|
|
8
|
+
The prompts parameter is recommended for prompt version tracking.`};var Pd={EXPERIMENT_NOT_FOUND:"EXPERIMENT_NOT_FOUND",INVALID_CONFIG_TYPE:"INVALID_CONFIG_TYPE",CONFIG_PROMPTS_CONFLICT:"CONFIG_PROMPTS_CONFLICT"},Ct=class extends ne{constructor(t){super({message:Ka.EXPERIMENT_NOT_FOUND(t),code:Pd.EXPERIMENT_NOT_FOUND});}},It=class s extends ne{constructor(t,r){super({message:t,code:r});}static invalidConfigType(t){return new s(Ka.INVALID_CONFIG_TYPE(t),Pd.INVALID_CONFIG_TYPE)}static promptsConflict(){return new s(Ka.CONFIG_PROMPTS_CONFLICT(),Pd.CONFIG_PROMPTS_CONFLICT)}};function dg(s,t){if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw It.invalidConfigType(typeof s);if(t&&t.length>0&&(s!=null&&s.prompts))throw It.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 eR(s){try{let r=qf.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 ug(s,t,r){if(r!=="mustache")return;let o=eR(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(
|
|
10
|
+
`)}`)}}function Re(s,t,r){try{switch(ug(s,t,r),r){case "mustache":return qf.render(s,t,{},{escape:o=>o});case "jinja2":return oR.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 jt=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 Pe=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=>It.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 mg(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(iR(o))return null;throw o}}function dg(s,t,r){return t?t.template!==s.prompt||!tR(t.metadata,s.metadata)||t.type!==r:true}function tR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return oR(r,o)}function iR(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"]},ve={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"},ug={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},Ka={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function gg(s){let t=Ka.SPECIAL_FIELDS.includes(s),r=Object.keys(ve).includes(s);if(!t&&!r){let o=Object.keys(ve).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${o} are supported.`)}}function wg(s,t){if(!Ka.SPECIAL_FIELDS.includes(s)){let r=Object.keys(ve).join(", ");throw new Error(`Field ${s}.${t} is not supported, only the fields ${r} are supported.`)}if(s==="usage"&&!Ka.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 Td(s,t){let r=ug[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 fg(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 Ga(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var jt=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return gg(r),t.peekChar()==="."?this.parseFieldWithKey(t,r):{type:"simple",field:r,columnType:ve[r]}}static parseFieldName(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseFieldWithKey(t,r){t.advance();let o=this.parseKey(t);if(wg(r,o),r==="usage"){let i=`usage.${o}`;return {type:"simple",field:i,columnType:ve[i]}}return {type:"nested",field:r,key:o,columnType:ve[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 Ga(a,o,l),i}};var Ut=class{static parse(t,r){t.skipWhitespace();let o=t.peekChar(),i=this.tryParseSymbolicOperator(t,o);if(i)return Td(r,i),{operator:i};let a=this.parseWordOperator(t);return Td(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 Dt=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();}Ga(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 Ce=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=jt.parse(t),o=Ut.parse(t,this.getFieldName(r)),i=Dt.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 fg(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 hg(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 Ee(a,C.TracePublic,o)}async function Rg(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 bg(s){if(!s)return null;let r=new Ce(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 Ed=[],er=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=ng({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Wt(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 Pa({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 gr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new Pt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new gr({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 Pt)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 gr(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=Sn.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]=cg(o,i),g=q(),w=new qe({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 qe({id:r.id,name:r.name,datasetName:r.datasetName},this)}catch(r){throw r instanceof p&&r.statusCode===404?new vt(`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 Ee(r,C.ExperimentPublic)).map(i=>new qe({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 vt(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 qe({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 mg(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=dg(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=Pe.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 Pe.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 Ce(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 Pe.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=bg(o),g=r!=null?r:this.config.projectName,w=()=>hg(this.api,g,u,i,a);if(l===void 0)return await w();let k=await Rg(w,l,d*1e3,5e3);if(k.length<l)throw new Oa(`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=Kd(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 Ma(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new Ia(this.api,o),this.traceBatchQueue=new Ua(this.api,o),this.spanFeedbackScoresBatchQueue=new ja(this.api,o),this.traceFeedbackScoresBatchQueue=new Da(this.api,o),this.datasetBatchQueue=new Na(this.api,o),Ed.push(this);}};var nR="track.decorator",Mt=new AsyncLocalStorage,sR=()=>{let{span:s,trace:t}=Mt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function pR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function cR({name:s,parentSpan:t,projectName:r,trace:o,type:i="llm"}){z.debug("Creating new span:",{name:s,parentSpan:t==null?void 0:t.data.id,projectName:r,type:i});let a=o;a||(a=vd().trace({name:s,projectName:r}));let l=a.span({name:s,parentSpanId:t==null?void 0:t.data.id,projectName:r,type:i});return z.debug("Span created with ID:",l.data.id),{span:l,trace:a}}function lR({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 yg({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 zg({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 $a({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Mt.getStore(),{span:u,trace:g}=cR({name:s!=null?s:i.name||nR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Mt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{lR({args:l,span:u,trace:S});let x=i.apply(k,l);return pR(x)?x.then(_=>(yg({span:u,result:_,trace:S,enrichSpan:o}),_),_=>{throw zg({span:u,error:_,trace:S}),_}):(yg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw zg({span:u,error:x,trace:S}),x}})}}function xe(s,t){if(typeof s=="function")return $a({},s);let r=s;return t?$a(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 $a(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=$a(r,a),i}}var Pd=null;function vd(){return Pd===null&&(Pd=new er),Pd}var mR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([vd().flush(),...Ed.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 kg(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(dR(s,t,l))}}function dR(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 Ya=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 Pe=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=>jt.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 gg(s,t,r){try{return await s.retrievePromptVersion({name:t},r)}catch(o){if(sR(o))return null;throw o}}function wg(s,t,r){return t?t.template!==s.prompt||!nR(t.metadata,s.metadata)||t.type!==r:true}function nR(s,t){let r=s!=null?s:{},o=t!=null?t:{};return aR(r,o)}function sR(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"]},ve={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"},hg={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},Ga={SPECIAL_FIELDS:["usage","metadata","feedback_scores"],USAGE_KEYS:["total_tokens","prompt_tokens","completion_tokens"]};function fg(s){let t=Ga.SPECIAL_FIELDS.includes(s),r=Object.keys(ve).includes(s);if(!t&&!r){let o=Object.keys(ve).join(", ");throw new Error(`Field ${s} is not supported, only the fields ${o} are supported.`)}}function Rg(s,t){if(!Ga.SPECIAL_FIELDS.includes(s)){let r=Object.keys(ve).join(", ");throw new Error(`Field ${s}.${t} is not supported, only the fields ${r} are supported.`)}if(s==="usage"&&!Ga.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=hg[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 bg(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 $a(s,t,r){if(!s)throw new Error(`Missing closing quote for: ${r}`)}var Ut=class{static parse(t){t.skipWhitespace();let r=this.parseFieldName(t);return fg(r),t.peekChar()==="."?this.parseFieldWithKey(t,r):{type:"simple",field:r,columnType:ve[r]}}static parseFieldName(t){return t.consumeWhile(r=>oe.isFieldChar(r))}static parseFieldWithKey(t,r){t.advance();let o=this.parseKey(t);if(Rg(r,o),r==="usage"){let i=`usage.${o}`;return {type:"simple",field:i,columnType:ve[i]}}return {type:"nested",field:r,key:o,columnType:ve[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 $a(a,o,l),i}};var Dt=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 Mt=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();}$a(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 Ce=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=Ut.parse(t),o=Dt.parse(t,this.getFieldName(r)),i=Mt.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 bg(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 yg(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 Ee(a,C.TracePublic,o)}async function zg(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 kg(s){if(!s)return null;let r=new Ce(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 Cd=[],er=class{constructor(t){this.displayTraceLog=t=>{if(t===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=cg({apiUrl:this.config.apiUrl,projectName:t,workspaceName:this.config.workspaceName});z.info(`Started logging traces to the "${t}" project at ${Bt(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 va({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 wr(r,this)}catch(r){throw r instanceof p&&r.statusCode===404?new vt(t):r}};this.createDataset=async(t,r)=>{z.debug(`Creating dataset with name "${t}"`);let o=new wr({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 vt)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 wr(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=xn.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]=dg(o,i),g=q(),w=new qe({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 qe({id:r.id,name:r.name,datasetName:r.datasetName},this)}catch(r){throw r instanceof p&&r.statusCode===404?new Ct(`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 Ee(r,C.ExperimentPublic)).map(i=>new qe({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 Ct(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 qe({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 gg(this.api.prompts,t.name,this.api.requestOptions),i=(r=t.type)!=null?r:ue.MUSTACHE,a=wg(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=Pe.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 Pe.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 Ce(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 Pe.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=kg(o),g=r!=null?r:this.config.projectName,w=()=>yg(this.api,g,u,i,a);if(l===void 0)return await w();let k=await zg(w,l,d*1e3,5e3);if(k.length<l)throw new Wa(`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=Qd(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 Na(r);let o=this.config.holdUntilFlush?24*60*60*1e3:this.config.batchDelayMs;this.spanBatchQueue=new ja(this.api,o),this.traceBatchQueue=new Da(this.api,o),this.spanFeedbackScoresBatchQueue=new Ua(this.api,o),this.traceFeedbackScoresBatchQueue=new Ma(this.api,o),this.datasetBatchQueue=new Fa(this.api,o),Cd.push(this);}};var cR="track.decorator",Nt=new AsyncLocalStorage,lR=()=>{let{span:s,trace:t}=Nt.getStore()||{};if(!(!s||!t))return {span:s,trace:t}};function mR(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function dR({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 uR({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 Sg({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 xg({span:s,error:t,trace:r}){var o,i;z.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}),t instanceof Error&&s.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(o=t.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:t.message,exceptionType:t.name,traceback:(i=t.stack)!=null?i:""}}),r.end());}function Qa({name:s,projectName:t,type:r,enrichSpan:o}={},i){return function(...l){let d=Nt.getStore(),{span:u,trace:g}=dR({name:s!=null?s:i.name||cR,parentSpan:d==null?void 0:d.span,projectName:t,trace:d==null?void 0:d.trace,type:r}),w=!d,k=this;return Nt.run({span:u,trace:g},()=>{let S=w?g:void 0;try{uR({args:l,span:u,trace:S});let x=i.apply(k,l);return mR(x)?x.then(A=>(Sg({span:u,result:A,trace:S,enrichSpan:o}),A),A=>{throw xg({span:u,error:A,trace:S}),A}):(Sg({span:u,result:x,trace:S,enrichSpan:o}),x)}catch(x){throw xg({span:u,error:x,trace:S}),x}})}}function xe(s,t){if(typeof s=="function")return Qa({},s);let r=s;return t?Qa(r,t):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[l,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return Qa(r,l)}let[,,i]=o;if(!i||typeof i.value!="function")throw new Error("track decorator can only be applied to methods");let a=i.value;return i.value=Qa(r,a),i}}var Id=null;function jd(){return Id===null&&(Id=new er),Id}var gR=async()=>{z.debug("Starting flushAll operation");try{await Promise.all([jd().flush(),...Cd.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 _g(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(wR(s,t,l))}}function wR(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 Za=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=[
|
|
15
|
-
`),u=await r.ensureNameLoaded(),g=
|
|
14
|
+
No metrics available to display.`);return}let a=[...o.keys()].sort(),l=this.formatTime(i),d=[Ya.bold(`Total time: ${l}`),Ya.bold(`Number of samples: ${t.length}`),"",...a.map(w=>{let k=this.formatScore(o.get(w)||0);return Ya.green(`${w}: ${k} (avg)`)})].join(`
|
|
15
|
+
`),u=await r.ensureNameLoaded(),g=hR(d,{title:`${u} (${t.length} samples)`,titleAlignment:"left",padding:1,margin:0,borderColor:"cyan",borderStyle:"round"});z.info(`
|
|
16
16
|
`+g+`
|
|
17
|
-
`),z.info(
|
|
17
|
+
`),z.info(Ya.blue("Uploading results to Opik ... "));}static async displayExperimentLink(t){let r=await t.getUrl();z.info(`View the results ${Bt(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 Ag(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 Tg,Ud;Tg=[xe({name:"metrics_calculation",type:he.General})];var hr=class{constructor(t,r,o){f$1(Ud,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=fR({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}),Nt.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 A=x instanceof Error?x.message:String(x);z.error(`Error processing dataset item: ${S.id} - ${A}`),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 Ja({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(),Za.processResults(d,this.experiment,g)}async executeTask(t){let r={},o=[];z.debug(`Starting evaluation task on dataset item ${t.id}`),r=await xe({name:"llm_task",type:he.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{_g(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=Ag(o,l);d!==void 0&&(i[a]=d);}return i}};Ud=d(null),g(Ud,1,"calculateScores",Tg,hr),e$1(Ud,hr);var fr=class fr{static getInstance(t){return fr.instance||(fr.instance=new er(t)),fr.instance}};fr.instance=null;var qa=fr;async function Eg(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:qa.getInstance(),r=await t.createExperiment({name:s.experimentName,datasetName:s.dataset.name,experimentConfig:s.experimentConfig,prompts:s.prompts});try{let i=new hr(s,t,r);return z.info("Starting evaluation"),i.execute()}catch(i){throw z.error(`Error during evaluation: ${i}`),i}}var rr=class{constructor(t){this.modelName=t;}};var Ft=class s extends Error{constructor(t){super(t),this.name="ModelError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Rr=class s extends Ft{constructor(r,o){super(r);this.cause=o;this.name="ModelGenerationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},Ie=class s extends Ft{constructor(t){super(t),this.name="ModelConfigurationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function zR(s,t){return s.startsWith("gpt-")||s.startsWith("o1")||s.startsWith("o3")||s.startsWith("chatgpt-")}function kR(s,t){return s.startsWith("claude-")}function SR(s,t){return s.startsWith("gemini-")||s.startsWith("gemma-")}function Dd(s,t,r){if(!t)throw new Ie(`API key for ${s} is not configured. Please provide it via the 'apiKey' option or set the ${r} environment variable.`)}function Md(s,t){if(zR(s)){let r=(t==null?void 0:t.apiKey)||process.env.OPENAI_API_KEY;return Dd("OpenAI",r,"OPENAI_API_KEY"),createOpenAI({apiKey:r,...t})(s)}if(kR(s)){let r=(t==null?void 0:t.apiKey)||process.env.ANTHROPIC_API_KEY;return Dd("Anthropic",r,"ANTHROPIC_API_KEY"),createAnthropic({apiKey:r,...t})(s)}if(SR(s)){let r=(t==null?void 0:t.apiKey)||process.env.GOOGLE_API_KEY;return Dd("Google Gemini",r,"GOOGLE_API_KEY"),createGoogleGenerativeAI({apiKey:r,...t})(s)}throw new Ie(`Unable to detect provider for model ID: ${s}. Supported providers are OpenAI (gpt-*, o1*, o3*, chatgpt-*), Anthropic (claude-*), and Google Gemini (gemini-*, gemma-*).`)}var xR={inputTokens:"prompt_tokens",outputTokens:"completion_tokens",totalTokens:"total_tokens",reasoningTokens:"reasoning_tokens",cachedInputTokens:"cached_input_tokens"};function _R(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 Nd(s,t){if(!_R(s))return {model:t};let r={model:AR(s,t)},o=TR(s.usage);o&&(r.usage=o);let i=ER(s);i&&(r.provider=i);let a=vR(s);a&&(r.metadata=a);let l=CR(s);return l&&(r.output=l),r}function AR(s,t){var r,o;return (o=(r=s.response)==null?void 0:r.modelId)!=null?o:t}function TR(s){if(!s)return;let t={};for(let[r,o]of Object.entries(xR)){let i=s[r];i!==void 0&&(t[o]=i);}return Object.keys(t).length>0?t:void 0}function ER(s){if(!s.providerMetadata)return;let t=Object.keys(s.providerMetadata);return t.length>0?t[0]:void 0}function PR(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=PR(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 CR(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 br=class extends rr{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=Md(t,a),z.debug(`Initialized VercelAIChatModel with model ID: ${t}`)),i?(this._generateText=xe({name:"model.generateText",type:he.Llm,enrichSpan:l=>Nd(l,this.modelName)},generateText),this._generateObject=xe({name:"model.generateObject",type:he.Llm,enrichSpan:l=>Nd(l,this.modelName)},generateObject)):(this._generateText=generateText,this._generateObject=generateObject);}catch(l){throw new Ie(`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 Rr(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 Rr(i,o instanceof Error?o:new Error(String(o)))}}};var Cg="gpt-4o";function Fd(s,t){return new br(s,t)}function Ig(s,t){return new br(s,t)}function IR(s){return s instanceof rr}function jR(s){return typeof s=="object"&&s!==null&&"modelId"in s&&typeof s.modelId=="string"}function UR(s){return typeof s=="string"&&s.length>0}function DR(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: ${
|
|
21
|
+
- undefined (uses default model: ${Cg})
|
|
22
22
|
|
|
23
|
-
Received: ${t} ${r}`)}function
|
|
24
|
-
`)}function
|
|
25
|
-
`)}function
|
|
23
|
+
Received: ${t} ${r}`)}function Ot(s,t){if(s==null)return Fd(Cg,t);if(UR(s))return Fd(s,t);if(IR(s))return s;if(jR(s))return Ig(s,t);throw DR(s)}function jg(s){return s.map(t=>{let r=Array.isArray(t.content)?MR(t.content):t.content;return `${t.role}: ${r}`}).join(`
|
|
24
|
+
`)}function MR(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 NR(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 Ug(s,t,r){let o=NR(s.content,t,r);return {...s,content:o}}async function Sce(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=Ot(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=FR(t,s.messages,(i=s.templateType)!=null?i:ue.MUSTACHE,{temperature:s.temperature,seed:s.seed});return Eg({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 FR(s,t,r,o){return async i=>{let a=t.map(g=>Ug(g,i,r)),l=await s.generateProviderResponse(a,o),d=OR(l);return {input:jg(a),output:d}}}function OR(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=xe({name:this.name,type:he.General},o);}}};var WR=z$1.object({output:z$1.unknown(),expected:z$1.unknown()}),Dg=class extends pe{constructor(r="exact_match",o=true){super(r,o);this.validationSchema=WR;}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 BR=z$1.object({output:z$1.string(),substring:z$1.string()}),Mg=class extends pe{constructor(r="contains",o=true,i=false){super(r,o);this.validationSchema=BR;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 LR=z$1.object({output:z$1.string(),pattern:z$1.string(),flags:z$1.string().optional()}),Ng=class extends pe{constructor(r="regex_match",o=true){super(r,o);this.validationSchema=LR;}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 VR=z$1.object({output:z$1.unknown()}),Og=class extends pe{constructor(r="is_json_metric",o=true){super(r,o);this.validationSchema=VR;}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 Ot(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 Wg(s,t=[]){let r="";return t.length>0&&(r=`
|
|
26
26
|
|
|
27
27
|
###EXAMPLES###
|
|
28
28
|
|
|
@@ -84,7 +84,7 @@ ${r}
|
|
|
84
84
|
Analyze the following text and provide your verdict score, and reason in the specified JSON format:
|
|
85
85
|
|
|
86
86
|
${s}
|
|
87
|
-
`}var
|
|
87
|
+
`}var rn=class s extends Error{constructor(t){super(t),this.name="MetricError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},ce=class s extends rn{constructor(r,o){super(r);this.cause=o;this.name="MetricComputationError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}},on=class s extends rn{constructor(r,o){super(r);this.cause=o;this.name="JSONParsingError",Error.captureStackTrace&&Error.captureStackTrace(this,s);}};function je(s){try{return JSON.parse(s)}catch{return HR(s)}}function HR(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 on(`Failed to extract JSON from content: ${r}`,t instanceof Error?t:void 0)}}function Bg(s,t){try{let r=je(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 JR=z$1.object({output:z$1.string()}),XR=z$1.object({score:z$1.number(),reason:z$1.string()}),tn=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=JR;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{output:o}=r,i=Wg(o,this.fewShotExamples),a=this.buildModelOptions(),l=await this.model.generateString(i,XR,a);return Bg(l,this.name)}};function Lg(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
|
|
123
|
+
`}function Vg(s,t){try{let r=je(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 KR=z$1.object({input:z$1.string(),output:z$1.string()}),GR=z$1.object({score:z$1.number(),reason:z$1.string()}),an=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=KR;}async score(r){let{input:o,output:i}=r,a=Lg(o,i),l=this.buildModelOptions(),d=await this.model.generateString(a,GR,l);return Vg(d,this.name)}};var $R=`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
|
-
`,
|
|
158
|
+
`,QR=`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
|
|
189
|
+
`;function Hg(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
|
|
201
|
+
`)}`}function Jg(s,t,r,o=[]){let i=Hg(o,true);return $R.replace("{examples_str}",i).replace("{input}",s).replace("{context}",JSON.stringify(r)).replace("{output}",t)}function Xg(s,t,r=[]){let o=Hg(r,false);return QR.replace("{examples_str}",o).replace("{input}",s).replace("{output}",t)}function Kg(s,t){try{let r=je(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 YR=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),ZR=z$1.object({score:z$1.number(),reason:z$1.union([z$1.string(),z$1.array(z$1.string())])}),nn=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=YR;this.fewShotExamples=(a=r==null?void 0:r.fewShotExamples)!=null?a:[];}async score(r){let{input:o,output:i,context:a}=r,l=a?Jg(o,i,a,this.fewShotExamples):Xg(o,i,this.fewShotExamples),d=this.buildModelOptions(),u=await this.model.generateString(l,ZR,d);return Kg(u,this.name)}};var Gg=[{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."}],$g=[{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 qR(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
|
|
214
|
+
`)}function eb(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
|
|
226
|
+
`)}function Qg(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
|
-
${
|
|
272
|
+
${qR(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
|
|
285
|
+
`}function Yg(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
|
-
${
|
|
330
|
+
${eb(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
|
|
340
|
+
`}function Zg(s,t){try{let r=je(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 rb=z$1.object({input:z$1.string(),output:z$1.string(),context:z$1.array(z$1.string()).optional()}),ob=z$1.object({answer_relevance_score:z$1.number(),reason:z$1.string()}),sn=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=rb;this.fewShotExamplesWithContext=(a=r==null?void 0:r.fewShotExamples)!=null?a:Gg,this.fewShotExamplesNoContext=(l=r==null?void 0:r.fewShotExamplesNoContext)!=null?l:$g,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?Qg(o,i,a,this.fewShotExamplesWithContext):Yg(o,i,this.fewShotExamplesNoContext),d=this.buildModelOptions(),u=await this.model.generateString(l,ob,d);return Zg(u,this.name)}};export{sn as AnswerRelevance,ge as BaseLLMJudgeMetric,pe as BaseMetric,Mg as Contains,Dg as ExactMatch,nn as Hallucination,Og as IsJson,Ie as ModelConfigurationError,Ft as ModelError,Rr as ModelGenerationError,tn as Moderation,er as Opik,rr as OpikBaseModel,Ce as OpikQueryLanguage,he as OpikSpanType,Pe as Prompt,ue as PromptType,Ng as RegexMatch,an as Usefulness,br as VercelAIChatModel,Fd as createModel,Ig as createModelFromInstance,Md as detectProvider,ow as disableLogger,Eg as evaluate,Sce as evaluatePrompt,gR as flushAll,q as generateId,lR as getTrackContext,z as logger,Ot as resolveModel,Kd as setLoggerLevel,xe as track};
|