opik 1.7.13 → 1.7.14

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.
@@ -0,0 +1,4 @@
1
+ import {a as a$1}from'./chunk-WOT6VMZA.js';import {link}from'ansi-escapes';import {Logger}from'tslog';import Dn from'fs';import sc from'ini';import up from'qs';import {v7}from'uuid';import {AsyncLocalStorage}from'node:async_hooks';var ac={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function Fn(s,i=s){return link(i,s)}var T=new Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),Mn=s=>{T.settings.minLevel=ac[s];},nc=()=>{T.settings.minLevel=100;};Mn(process.env.OPIK_LOG_LEVEL||"INFO");var cc="~/.opik.config",pc={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function Bn(s){return Object.fromEntries(Object.entries(s).filter(([,i])=>i!==void 0))}function lc(){return Bn({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function mc(){let s=process.env.OPIK_CONFIG_PATH||cc;if(!Dn.existsSync(s)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${s}`);return {}}try{let i=sc.parse(Dn.readFileSync(s,"utf8"));return i.opik?Bn({apiKey:i.opik.api_key,apiUrl:i.opik.url_override,projectName:i.opik.project_name,workspaceName:i.opik.workspace}):{}}catch(i){return T.error(`Error loading config file ${s}: ${i}`),{}}}function Vn(s){let i=lc(),r=mc();return dc({...pc,...r,...i,...s})}function dc(s){if(!s.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let i=uc(s.apiUrl);if(i&&!s.apiKey)throw new Error("OPIK_API_KEY is not set");if(i&&(!s.workspaceName||s.workspaceName==="default"))throw new Error("OPIK_WORKSPACE is not set");return s}function uc(s){return new URL(s).hostname.endsWith("comet.com")}var K={};a$1(K,{AssistantMessageRole:()=>xc,AttachmentListRequestEntityType:()=>Ln,BadRequestError:()=>v,CheckName:()=>sp,CheckPublicName:()=>pp,CheckPublicResult:()=>lp,CheckResult:()=>cp,ColumnCompareTypesItem:()=>vc,ColumnPublicTypesItem:()=>Nc,ColumnTypesItem:()=>Fc,CompleteMultipartUploadRequestEntityType:()=>gc,ConflictError:()=>J,DatasetItemCompareSource:()=>jc,DatasetItemPublicSource:()=>Uc,DatasetItemSource:()=>Tc,DatasetItemWriteSource:()=>Ec,DatasetPublicVisibility:()=>Ic,DatasetUpdateVisibility:()=>Xn,DatasetVisibility:()=>Ac,DatasetWriteVisibility:()=>On,DeleteAttachmentsRequestEntityType:()=>fc,DeltaRole:()=>Rc,DownloadAttachmentRequestEntityType:()=>Wn,ExperimentPublicType:()=>Dc,ExperimentType:()=>Mc,ExperimentWriteType:()=>Gn,FeedbackScoreBatchItemSource:()=>ap,FeedbackScoreCompareSource:()=>Cc,FeedbackScorePublicSource:()=>ip,FeedbackScoreSource:()=>Pc,FindFeedbackDefinitionsRequestType:()=>Hn,FindFeedbackScoreNames1RequestType:()=>ts,ForbiddenError:()=>D,GetSpanStatsRequestType:()=>as,GetSpansByProjectRequestType:()=>is,GuardrailName:()=>Bc,GuardrailResult:()=>Vc,GuardrailWriteName:()=>Lc,GuardrailWriteResult:()=>Wc,LlmAsJudgeMessagePublicRole:()=>zc,LlmAsJudgeMessageRole:()=>wc,LlmAsJudgeMessageWriteRole:()=>hc,LlmAsJudgeOutputSchemaPublicType:()=>kc,LlmAsJudgeOutputSchemaType:()=>bc,LlmAsJudgeOutputSchemaWriteType:()=>yc,LogItemLevel:()=>Sc,NotFoundError:()=>R,NotImplementedError:()=>ge,OptimizationPublicStatus:()=>Xc,OptimizationStatus:()=>Oc,OptimizationUpdateStatus:()=>Yn,OptimizationWriteStatus:()=>Qn,ProjectDetailedVisibility:()=>Yc,ProjectMetricRequestPublicInterval:()=>rs,ProjectMetricRequestPublicMetricType:()=>es,ProjectMetricResponsePublicInterval:()=>Qc,ProjectMetricResponsePublicMetricType:()=>$c,ProjectPublicVisibility:()=>Hc,ProjectUpdateVisibility:()=>qn,ProjectVisibility:()=>Gc,ProjectWriteVisibility:()=>Zn,PromptType:()=>Zc,PromptVersionDetailType:()=>ep,PromptVersionPublicType:()=>rp,PromptVersionType:()=>qc,PromptWriteType:()=>os,ProviderApiKeyProvider:()=>Kc,ProviderApiKeyPublicProvider:()=>Jc,ProviderApiKeyWriteProvider:()=>$n,ResponseFormatType:()=>_c,SpanFilterPublicOperator:()=>np,SpanPublicType:()=>tp,SpanSearchStreamRequestPublicType:()=>ns,SpanType:()=>ss,SpanWriteType:()=>op,StartMultipartUploadRequestEntityType:()=>Jn,TraceFilterPublicOperator:()=>mp,UnauthorizedError:()=>U,UnprocessableEntityError:()=>X,UploadAttachmentRequestEntityType:()=>Kn,attachments:()=>Ur,automationRuleEvaluators:()=>ni,chatCompletions:()=>si,check:()=>ai,datasets:()=>Nr,experiments:()=>Fr,feedbackDefinitions:()=>Mr,guardrails:()=>ci,llmProviderKey:()=>Dr,openTelemetryIngestion:()=>pi,optimizations:()=>Br,projects:()=>Vr,prompts:()=>Lr,redirect:()=>di,serviceToggles:()=>li,spans:()=>Wr,systemUsage:()=>ti,traces:()=>mi});var Ur={};a$1(Ur,{AttachmentListRequestEntityType:()=>Ln,DownloadAttachmentRequestEntityType:()=>Wn,StartMultipartUploadRequestEntityType:()=>Jn,UploadAttachmentRequestEntityType:()=>Kn});var Ln={Trace:"trace",Span:"span"};var Wn={Trace:"trace",Span:"span"};var Jn={Trace:"trace",Span:"span"};var Kn={Trace:"trace",Span:"span"};var Nr={};a$1(Nr,{DatasetUpdateVisibility:()=>Xn,DatasetWriteVisibility:()=>On});var On={Private:"private",Public:"public"};var Xn={Private:"private",Public:"public"};var Fr={};a$1(Fr,{ExperimentWriteType:()=>Gn});var Gn={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Mr={};a$1(Mr,{FindFeedbackDefinitionsRequestType:()=>Hn});var Hn={Numerical:"numerical",Categorical:"categorical"};var Dr={};a$1(Dr,{ProviderApiKeyWriteProvider:()=>$n});var $n={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Br={};a$1(Br,{OptimizationUpdateStatus:()=>Yn,OptimizationWriteStatus:()=>Qn});var Qn={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Yn={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Vr={};a$1(Vr,{ProjectMetricRequestPublicInterval:()=>rs,ProjectMetricRequestPublicMetricType:()=>es,ProjectUpdateVisibility:()=>qn,ProjectWriteVisibility:()=>Zn});var Zn={Private:"private",Public:"public"};var qn={Private:"private",Public:"public"};var es={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var rs={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Lr={};a$1(Lr,{PromptWriteType:()=>os});var os={Mustache:"mustache",Jinja2:"jinja2"};var Wr={};a$1(Wr,{FindFeedbackScoreNames1RequestType:()=>ts,GetSpanStatsRequestType:()=>as,GetSpansByProjectRequestType:()=>is,SpanSearchStreamRequestPublicType:()=>ns});var is={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ts={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var as={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ns={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ti={};var ai={};var ni={};var si={};var ci={};var pi={};var li={};var mi={};var di={};var gc={Trace:"trace",Span:"span"};var fc={Trace:"trace",Span:"span"};var wc={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var bc={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var hc={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var yc={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var zc={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var kc={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var Sc={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var xc={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Rc={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var _c={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Ac={Private:"private",Public:"public"};var Tc={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Pc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ec={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var vc={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var jc={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Cc={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Ic={Private:"private",Public:"public"};var Uc={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Nc={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Fc={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Mc={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Dc={Regular:"regular",Trial:"trial",MiniBatch:"mini-batch"};var Bc={Topic:"TOPIC",Pii:"PII"};var Vc={Passed:"passed",Failed:"failed"};var Lc={Topic:"TOPIC",Pii:"PII"};var Wc={Passed:"passed",Failed:"failed"};var Jc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Kc={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Oc={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Xc={Running:"running",Completed:"completed",Cancelled:"cancelled"};var Gc={Private:"private",Public:"public"};var Hc={Private:"private",Public:"public"};var $c={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST",GuardrailsFailedCount:"GUARDRAILS_FAILED_COUNT"};var Qc={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Yc={Private:"private",Public:"public"};var Zc={Mustache:"mustache",Jinja2:"jinja2"};var qc={Mustache:"mustache",Jinja2:"jinja2"};var ep={Mustache:"mustache",Jinja2:"jinja2"};var rp={Mustache:"mustache",Jinja2:"jinja2"};var ss={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var op={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ip={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var tp={General:"general",Tool:"tool",Llm:"llm",Guardrail:"guardrail"};var ap={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var np={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 sp={Topic:"TOPIC",Pii:"PII"};var cp={Passed:"passed",Failed:"failed"};var pp={Topic:"TOPIC",Pii:"PII"};var lp={Passed:"passed",Failed:"failed"};var mp={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 ae=(s,i,r)=>JSON.stringify(s,i,r);var c=class s extends Error{constructor({message:i,statusCode:r,body:o}){super(dp({message:i,statusCode:r,body:o})),Object.setPrototypeOf(this,s.prototype),r!=null&&(this.statusCode=r),o!==void 0&&(this.body=o);}};function dp({message:s,statusCode:i,body:r}){let o=[];return s!=null&&o.push(s),i!=null&&o.push(`Status code: ${i.toString()}`),r!=null&&o.push(`Body: ${ae(r,void 0,2)}`),o.join(`
2
+ `)}var f=class s extends Error{constructor(i){super(i),Object.setPrototypeOf(this,s.prototype);}};var U=class s extends c{constructor(i){super({message:"UnauthorizedError",statusCode:401,body:i}),Object.setPrototypeOf(this,s.prototype);}};var D=class s extends c{constructor(i){super({message:"ForbiddenError",statusCode:403,body:i}),Object.setPrototypeOf(this,s.prototype);}};var v=class s extends c{constructor(i){super({message:"BadRequestError",statusCode:400,body:i}),Object.setPrototypeOf(this,s.prototype);}};var R=class s extends c{constructor(i){super({message:"NotFoundError",statusCode:404,body:i}),Object.setPrototypeOf(this,s.prototype);}};var J=class s extends c{constructor(i){super({message:"ConflictError",statusCode:409,body:i}),Object.setPrototypeOf(this,s.prototype);}};var X=class s extends c{constructor(i){super({message:"UnprocessableEntityError",statusCode:422,body:i}),Object.setPrototypeOf(this,s.prototype);}};var ge=class s extends c{constructor(i){super({message:"NotImplementedError",statusCode:501,body:i}),Object.setPrototypeOf(this,s.prototype);}};var w={Default:"http://localhost:5173/api"};function cs(s,i){return Object.keys(i!=null?i:{}).length>0?`${s}?${up.stringify(i,{arrayFormat:"repeat"})}`:s}var l=gp();function gp(){var u,g,y,z,k;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"||((y=self.constructor)==null?void 0:y.name)==="ServiceWorkerGlobalScope"||((z=self.constructor)==null?void 0:z.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&&!!((k=process.versions)!=null&&k.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 ps(){return l.type==="node"&&l.parsedVersion!=null&&l.parsedVersion>=18?fetch:l.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function ls({body:s,type:i}){return i.includes("json")?ae(s):s}async function ms(s){return l.type==="node"&&l.parsedVersion!=null&&l.parsedVersion>=18?new(await import('./Node18UniversalStreamWrapper-GZXI7BSF.js')).Node18UniversalStreamWrapper(s):l.type!=="node"&&typeof fetch=="function"?new(await import('./UndiciStreamWrapper-4QYH36IP.js')).UndiciStreamWrapper(s):new(await import('./NodePre18StreamWrapper-TZYQXHQT.js')).NodePre18StreamWrapper(s)}async function ds(s,i){if(s.body!=null&&i==="blob")return await s.blob();if(s.body!=null&&i==="arrayBuffer")return await s.arrayBuffer();if(s.body!=null&&i==="sse")return s.body;if(s.body!=null&&i==="streaming")return ms(s.body);if(s.body!=null&&i==="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 fp="timeout";function us(s){let i=new AbortController,r=setTimeout(()=>i.abort(fp),s);return {signal:i.signal,abortId:r}}function gs(...s){let i=s.length===1&&Array.isArray(s[0])?s[0]:s,r=new AbortController;for(let o of i){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 fs=async(s,i,r,o,t,n,m,d,u)=>{let g=[],y;if(n!=null){let{signal:j,abortId:W}=us(n);y=W,g.push(j);}m!=null&&g.push(m);let z=gs(g),k=await s(i,{method:r,headers:o,body:t,signal:z,credentials:d?"include":void 0,duplex:u});return y!=null&&clearTimeout(y),k};function wp(s){let i=1+(Math.random()*2-1)*.2;return s*i}async function ws(s,i=2){let r=await s();for(let o=0;o<i&&([408,429].includes(r.status)||r.status>=500);++o){let t=Math.min(1e3*Math.pow(2,o),6e4),n=wp(t);await new Promise(m=>setTimeout(m,n)),r=await s();}return r}async function bp(s){let i={};if(s.body!==void 0&&s.contentType!=null&&(i["Content-Type"]=s.contentType),s.headers!=null)for(let[n,m]of Object.entries(s.headers))m!=null&&(i[n]=m);let r=cs(s.url,s.queryParameters),o=await ls({body:s.body,type:s.requestType==="json"?"json":"other"}),t=await ps();try{let n=await ws(async()=>fs(t,r,s.method,i,o,s.timeoutMs,s.abortSignal,s.withCredentials,s.duplex),s.maxRetries),m=await ds(n,s.responseType);return n.status>=200&&n.status<400?{ok:!0,body:m,headers:n.headers}:{ok:!1,error:{reason:"status-code",statusCode:n.status,body:m}}}catch(n){return s.abortSignal!=null&&s.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:n instanceof Error&&n.name==="AbortError"?{ok:false,error:{reason:"timeout"}}:n instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:n.message}}:{ok:false,error:{reason:"unknown",errorMessage:ae(n)}}}}var b=bp;var a={get:async s=>typeof s=="function"?s():s};var e={};a$1(e,{JsonError:()=>ne,ParseError:()=>se,any:()=>js,bigint:()=>hs,boolean:()=>Cs,booleanLiteral:()=>vs,date:()=>ys,discriminant:()=>Ls,enum_:()=>Kr,getObjectLikeUtils:()=>G,getObjectUtils:()=>oe,getSchemaUtils:()=>A,isProperty:()=>re,lazy:()=>zs,lazyObject:()=>Ts,list:()=>Xr,number:()=>Is,object:()=>Or,objectWithoutOptionalProperties:()=>As,optional:()=>ui,property:()=>Ss,record:()=>Ms,set:()=>Ds,string:()=>Us,stringLiteral:()=>Es,transform:()=>gi,undiscriminatedUnion:()=>Vs,union:()=>Js,unknown:()=>Ns,withParsedProperties:()=>wi});var x={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 _(s,i){return `Expected ${i}. Received ${hp(s)}.`}function hp(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 N(s){return {...s,json:bs(s.json),parse:bs(s.parse)}}function bs(s){return (i,r)=>{let o=s(i,r),{skipValidation:t=false}=r!=null?r:{};return !o.ok&&t?(console.warn(["Failed to validate.",...o.errors.map(n=>" - "+(n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message))].join(`
3
+ `)),{ok:true,value:i}):o}}function Jr(s){return s.path.length===0?s.message:`${s.path.join(" -> ")}: ${s.message}`}var ne=class s extends Error{constructor(r){super(r.map(Jr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};var se=class s extends Error{constructor(r){super(r.map(Jr).join("; "));this.errors=r;Object.setPrototypeOf(this,s.prototype);}};function A(s){return {nullable:()=>yp(s),optional:()=>ui(s),optionalNullable:()=>zp(s),transform:i=>gi(s,i),parseOrThrow:(i,r)=>{let o=s.parse(i,r);if(o.ok)return o.value;throw new se(o.errors)},jsonOrThrow:(i,r)=>{let o=s.json(i,r);if(o.ok)return o.value;throw new ne(o.errors)}}}function yp(s){let i={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:()=>x.NULLABLE};return {...i,...A(i)}}function ui(s){let i={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:()=>x.OPTIONAL};return {...i,...A(i)}}function zp(s){let i={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:()=>x.OPTIONAL_NULLABLE};return {...i,...A(i)}}function gi(s,i){let r={parse:(o,t)=>{let n=s.parse(o,t);return n.ok?{ok:true,value:i.transform(n.value)}:n},json:(o,t)=>{let n=i.untransform(o);return s.json(n,t)},getType:()=>s.getType()};return {...r,...A(r)}}function hs(){let s={parse:(i,{breadcrumbsPrefix:r=[]}={})=>typeof i=="bigint"?{ok:true,value:i}:typeof i=="number"?{ok:true,value:BigInt(i)}:{ok:false,errors:[{path:r,message:_(i,"bigint | number")}]},json:(i,{breadcrumbsPrefix:r=[]}={})=>typeof i!="bigint"?{ok:false,errors:[{path:r,message:_(i,"bigint")}]}:{ok:true,value:i},getType:()=>x.BIGINT};return {...N(s),...A(s)}}var kp=/^([+-]?\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 ys(){let s={parse:(i,{breadcrumbsPrefix:r=[]}={})=>typeof i!="string"?{ok:false,errors:[{path:r,message:_(i,"string")}]}:kp.test(i)?{ok:true,value:new Date(i)}:{ok:false,errors:[{path:r,message:_(i,"ISO 8601 date string")}]},json:(i,{breadcrumbsPrefix:r=[]}={})=>i instanceof Date?{ok:true,value:i.toISOString()}:{ok:false,errors:[{path:r,message:_(i,"Date object")}]},getType:()=>x.DATE};return {...N(s),...A(s)}}function B(s,i){return ()=>{let r={parse:i,json:i,getType:()=>s};return {...N(r),...A(r)}}}function Kr(s){let i=new Set(s);return B(x.ENUM,(o,{allowUnrecognizedEnumValues:t,breadcrumbsPrefix:n=[]}={})=>typeof o!="string"?{ok:false,errors:[{path:n,message:_(o,"string")}]}:!i.has(o)&&!t?{ok:false,errors:[{path:n,message:_(o,"enum")}]}:{ok:true,value:o})()}function zs(s){let i=fi(s);return {...i,...A(i)}}function fi(s){return {parse:(i,r)=>ce(s).parse(i,r),json:(i,r)=>ce(s).json(i,r),getType:()=>ce(s).getType()}}function ce(s){let i=s;return i.__zurg_memoized==null&&(i.__zurg_memoized=s()),i.__zurg_memoized}function fe(s){return Object.entries(s)}function we(s,i){let r=new Set(i);return Object.entries(s).reduce((o,[t,n])=>(r.has(t)&&(o[t]=n),o),{})}function ee(s){if(typeof s!="object"||s===null)return false;if(Object.getPrototypeOf(s)===null)return true;let i=s;for(;Object.getPrototypeOf(i)!==null;)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(s)===i}function be(s){return Object.keys(s)}function ks(s,i){let r=[],o=[];for(let t of s)i(t)?r.push(t):o.push(t);return [r,o]}function G(s){return {withParsedProperties:i=>wi(s,i)}}function wi(s,i){let r={parse:(o,t)=>{let n=s.parse(o,t);if(!n.ok)return n;let m=Object.entries(i).reduce((d,[u,g])=>({...d,[u]:typeof g=="function"?g(n.value):g}),{});return {ok:true,value:{...n.value,...m}}},json:(o,t)=>{var d;if(!ee(o))return {ok:false,errors:[{path:(d=t==null?void 0:t.breadcrumbsPrefix)!=null?d:[],message:_(o,"object")}]};let n=new Set(Object.keys(i)),m=we(o,Object.keys(o).filter(u=>!n.has(u)));return s.json(m,t)},getType:()=>s.getType()};return {...r,...A(r),...G(r)}}function Ss(s,i){return {rawKey:s,valueSchema:i,isProperty:true}}function re(s){return s.isProperty}function Or(s){let i={_getRawProperties:()=>Object.entries(s).map(([r,o])=>re(o)?o.rawKey:r),_getParsedProperties:()=>be(s),parse:(r,o)=>{let t={},n=[];for(let[m,d]of fe(s)){let u=re(d)?d.rawKey:m,g=re(d)?d.valueSchema:d,y={rawKey:u,parsedKey:m,valueSchema:g};t[u]=y,_s(g)&&n.push(u);}return xs({value:r,requiredKeys:n,getProperty:m=>{let d=t[m];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:[],m]})}}},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 t=[];for(let[n,m]of fe(s)){let d=re(m)?m.valueSchema:m;_s(d)&&t.push(n);}return xs({value:r,requiredKeys:t,getProperty:n=>{let m=s[n];if(m!=null)return re(m)?{transformedKey:m.rawKey,transform:d=>{var u;return m.valueSchema.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}:{transformedKey:n,transform:d=>{var u;return m.json(d,{...o,breadcrumbsPrefix:[...(u=o==null?void 0:o.breadcrumbsPrefix)!=null?u:[],n]})}}},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:()=>x.OBJECT};return {...N(i),...A(i),...G(i),...oe(i)}}function xs({value:s,requiredKeys:i,getProperty:r,unrecognizedObjectKeys:o="fail",skipValidation:t=false,breadcrumbsPrefix:n=[]}){if(!ee(s))return {ok:false,errors:[{path:n,message:_(s,"object")}]};let m=new Set(i),d=[],u={};for(let[g,y]of Object.entries(s)){let z=r(g);if(z!=null){m.delete(g);let k=z.transform(y);k.ok?u[z.transformedKey]=k.value:(u[g]=y,d.push(...k.errors));}else switch(o){case "fail":d.push({path:[...n,g],message:`Unexpected key "${g}"`});break;case "strip":break;case "passthrough":u[g]=y;break}}return d.push(...i.filter(g=>m.has(g)).map(g=>({path:n,message:`Missing required key "${g}"`}))),d.length===0||t?{ok:true,value:u}:{ok:false,errors:d}}function oe(s){return {extend:i=>{let r={_getParsedProperties:()=>[...s._getParsedProperties(),...i._getParsedProperties()],_getRawProperties:()=>[...s._getRawProperties(),...i._getRawProperties()],parse:(o,t)=>Rs({extensionKeys:i._getRawProperties(),value:o,transformBase:n=>s.parse(n,t),transformExtension:n=>i.parse(n,t)}),json:(o,t)=>Rs({extensionKeys:i._getParsedProperties(),value:o,transformBase:n=>s.json(n,t),transformExtension:n=>i.json(n,t)}),getType:()=>x.OBJECT};return {...r,...A(r),...G(r),...oe(r)}},passthrough:()=>{let i={_getParsedProperties:()=>s._getParsedProperties(),_getRawProperties:()=>s._getRawProperties(),parse:(r,o)=>{let t=s.parse(r,{...o,unrecognizedObjectKeys:"passthrough"});return t.ok?{ok:true,value:{...r,...t.value}}:t},json:(r,o)=>{let t=s.json(r,{...o,unrecognizedObjectKeys:"passthrough"});return t.ok?{ok:true,value:{...r,...t.value}}:t},getType:()=>x.OBJECT};return {...i,...A(i),...G(i),...oe(i)}}}}function Rs({extensionKeys:s,value:i,transformBase:r,transformExtension:o}){let t=new Set(s),[n,m]=ks(be(i),g=>t.has(g)),d=r(we(i,m)),u=o(we(i,n));return d.ok&&u.ok?{ok:true,value:{...d.value,...u.value}}:{ok:false,errors:[...d.ok?[]:d.errors,...u.ok?[]:u.errors]}}function _s(s){return !Sp(s)}function Sp(s){switch(s.getType()){case x.ANY:case x.UNKNOWN:case x.OPTIONAL:case x.OPTIONAL_NULLABLE:return true;default:return false}}function As(s){return Or(s)}function Ts(s){let i={...fi(s),_getRawProperties:()=>ce(s)._getRawProperties(),_getParsedProperties:()=>ce(s)._getParsedProperties()};return {...i,...A(i),...G(i),...oe(i)}}function Xr(s){let i={parse:(r,o)=>Ps(r,(t,n)=>{var m;return s.parse(t,{...o,breadcrumbsPrefix:[...(m=o==null?void 0:o.breadcrumbsPrefix)!=null?m:[],`[${n}]`]})}),json:(r,o)=>Ps(r,(t,n)=>{var m;return s.json(t,{...o,breadcrumbsPrefix:[...(m=o==null?void 0:o.breadcrumbsPrefix)!=null?m:[],`[${n}]`]})}),getType:()=>x.LIST};return {...N(i),...A(i)}}function Ps(s,i){return Array.isArray(s)?s.map((o,t)=>i(o,t)).reduce((o,t)=>{if(o.ok&&t.ok)return {ok:true,value:[...o.value,t.value]};let n=[];return o.ok||n.push(...o.errors),t.ok||n.push(...t.errors),{ok:false,errors:n}},{ok:true,value:[]}):{ok:false,errors:[{message:_(s,"list"),path:[]}]}}function Es(s){return B(x.STRING_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:_(r,`"${s}"`)}]})()}function vs(s){return B(x.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:o=[]}={})=>r===s?{ok:true,value:s}:{ok:false,errors:[{path:o,message:_(r,`${s.toString()}`)}]})()}var js=B(x.ANY,s=>({ok:true,value:s}));var Cs=B(x.BOOLEAN,(s,{breadcrumbsPrefix:i=[]}={})=>typeof s=="boolean"?{ok:true,value:s}:{ok:false,errors:[{path:i,message:_(s,"boolean")}]});var Is=B(x.NUMBER,(s,{breadcrumbsPrefix:i=[]}={})=>typeof s=="number"?{ok:true,value:s}:{ok:false,errors:[{path:i,message:_(s,"number")}]});var Us=B(x.STRING,(s,{breadcrumbsPrefix:i=[]}={})=>typeof s=="string"?{ok:true,value:s}:{ok:false,errors:[{path:i,message:_(s,"string")}]});var Ns=B(x.UNKNOWN,s=>({ok:true,value:s}));function Ms(s,i){let r={parse:(o,t)=>Fs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var m;return s.parse(n,{...t,breadcrumbsPrefix:[...(m=t==null?void 0:t.breadcrumbsPrefix)!=null?m:[],`${n} (key)`]})},transformValue:(n,m)=>{var d;return i.parse(n,{...t,breadcrumbsPrefix:[...(d=t==null?void 0:t.breadcrumbsPrefix)!=null?d:[],`${m}`]})},breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix}),json:(o,t)=>Fs({value:o,isKeyNumeric:s.getType()===x.NUMBER,transformKey:n=>{var m;return s.json(n,{...t,breadcrumbsPrefix:[...(m=t==null?void 0:t.breadcrumbsPrefix)!=null?m:[],`${n} (key)`]})},transformValue:(n,m)=>{var d;return i.json(n,{...t,breadcrumbsPrefix:[...(d=t==null?void 0:t.breadcrumbsPrefix)!=null?d:[],`${m}`]})},breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix}),getType:()=>x.RECORD};return {...N(r),...A(r)}}function Fs({value:s,isKeyNumeric:i,transformKey:r,transformValue:o,breadcrumbsPrefix:t=[]}){return ee(s)?fe(s).reduce((n,[m,d])=>{if(d===void 0)return n;let u=n,g=m;if(i){let j=m.length>0?Number(m):NaN;isNaN(j)||(g=j);}let y=r(g),z=o(d,g);if(u.ok&&y.ok&&z.ok)return {ok:true,value:{...u.value,[y.value]:z.value}};let k=[];return u.ok||k.push(...u.errors),y.ok||k.push(...y.errors),z.ok||k.push(...z.errors),{ok:false,errors:k}},{ok:true,value:{}}):{ok:false,errors:[{path:t,message:_(s,"object")}]}}function Ds(s){let i=Xr(s),r={parse:(o,t)=>{let n=i.parse(o,t);return n.ok?{ok:true,value:new Set(n.value)}:n},json:(o,t)=>{var m;return o instanceof Set?i.json([...o],t):{ok:false,errors:[{path:(m=t==null?void 0:t.breadcrumbsPrefix)!=null?m:[],message:_(o,"Set")}]}},getType:()=>x.SET};return {...N(r),...A(r)}}function Vs(s){let i={parse:(r,o)=>Bs((t,n)=>t.parse(r,n),s,o),json:(r,o)=>Bs((t,n)=>t.json(r,n),s,o),getType:()=>x.UNDISCRIMINATED_UNION};return {...N(i),...A(i)}}function Bs(s,i,r){let o=[];for(let[t,n]of i.entries()){let m=s(n,{...r,skipValidation:false});if(m.ok)return m;for(let d of m.errors)o.push({path:d.path,message:`[Variant ${t}] ${d.message}`});}return {ok:false,errors:o}}function Ls(s,i){return {parsedDiscriminant:s,rawDiscriminant:i}}function Js(s,i){let r=typeof s=="string"?s:s.rawDiscriminant,o=typeof s=="string"?s:s.parsedDiscriminant,t=Kr(be(i)),n={parse:(m,d)=>Ws({value:m,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:u=>{var g;return t.parse(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],r]})},getAdditionalPropertiesSchema:u=>i[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.parse(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),json:(m,d)=>Ws({value:m,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:u=>{var g;return t.json(u,{allowUnrecognizedEnumValues:d==null?void 0:d.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(g=d==null?void 0:d.breadcrumbsPrefix)!=null?g:[],o]})},getAdditionalPropertiesSchema:u=>i[u],allowUnrecognizedUnionMembers:d==null?void 0:d.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,g)=>g.json(u,d),breadcrumbsPrefix:d==null?void 0:d.breadcrumbsPrefix}),getType:()=>x.UNION};return {...N(n),...A(n),...G(n)}}function Ws({value:s,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:o,getAdditionalPropertiesSchema:t,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:m,breadcrumbsPrefix:d=[]}){if(!ee(s))return {ok:false,errors:[{path:d,message:_(s,"object")}]};let{[i]:u,...g}=s;if(u==null)return {ok:false,errors:[{path:d,message:`Missing discriminant ("${i}")`}]};let y=o(u);if(!y.ok)return {ok:false,errors:y.errors};let z=t(y.value);if(z==null)return n?{ok:true,value:{[r]:y.value,...g}}:{ok:false,errors:[{path:[...d,i],message:"Unexpected discriminant value"}]};let k=m(g,z);return k.ok?{ok:true,value:{[r]:u,...k.value}}:k}function xp(s){var i=[];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 t=s[o];if(typeof t!="string")throw new TypeError("Url must be a string. Received "+t);t!==""&&(o>0&&(t=t.replace(/^[\/]+/,"")),o<s.length-1?t=t.replace(/[\/]+$/,""):t=t.replace(/[\/]+$/,"/"),i.push(t));}var n=i.join("/");n=n.replace(/\/(\?|&|#[^!])/g,"$1");var m=n.split("?");return n=m.shift()+(m.length>0?"?":"")+m.join("&"),n}function h(){var s;return typeof arguments[0]=="object"?s=arguments[0]:s=[].slice.call(arguments),xp(s)}var I={};a$1(I,{AssistantMessage:()=>Et,AssistantMessageRole:()=>Pt,Attachment:()=>Li,AttachmentListRequestEntityType:()=>Gr,AttachmentPage:()=>Wi,AuthDetailsHolder:()=>Gi,AutomationRuleEvaluator:()=>Ep,AutomationRuleEvaluatorLlmAsJudge:()=>et,AutomationRuleEvaluatorLlmAsJudgePublic:()=>cr,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>ct,AutomationRuleEvaluatorObjectPublic:()=>yt,AutomationRuleEvaluatorPagePublic:()=>zt,AutomationRuleEvaluatorPublic:()=>kt,AutomationRuleEvaluatorUpdate:()=>Tt,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>_t,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>At,AutomationRuleEvaluatorUserDefinedMetricPython:()=>rt,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>pr,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>lt,AutomationRuleEvaluatorWrite:()=>mt,AvgValueStatPublic:()=>gn,BatchDelete:()=>F,BiInformation:()=>Fi,BiInformationResponse:()=>ar,CategoricalFeedbackDefinition:()=>pa,CategoricalFeedbackDefinitionCreate:()=>ua,CategoricalFeedbackDefinitionPublic:()=>br,CategoricalFeedbackDefinitionUpdate:()=>xa,CategoricalFeedbackDetail:()=>ca,CategoricalFeedbackDetailCreate:()=>da,CategoricalFeedbackDetailPublic:()=>ba,CategoricalFeedbackDetailUpdate:()=>Sa,ChatCompletionChoice:()=>Ct,ChatCompletionRequest:()=>ir,ChatCompletionResponse:()=>Nt,Check:()=>xn,CheckName:()=>kn,CheckPublic:()=>Pn,CheckPublicName:()=>An,CheckPublicResult:()=>Tn,CheckResult:()=>Sn,ChunkedOutputJsonNode:()=>Cp,ChunkedOutputJsonNodePublic:()=>Np,ChunkedOutputJsonNodePublicType:()=>sa,ChunkedOutputJsonNodeType:()=>ia,Column:()=>ra,ColumnCompare:()=>Vt,ColumnCompareTypesItem:()=>Bt,ColumnPublic:()=>Zt,ColumnPublicTypesItem:()=>Yt,ColumnTypesItem:()=>ea,Comment:()=>M,CommentCompare:()=>Lt,CommentPublic:()=>te,CompleteMultipartUploadRequest:()=>Po,CompleteMultipartUploadRequestEntityType:()=>Ji,CompletionTokensDetails:()=>It,CountValueStatPublic:()=>fn,CreatePromptVersionDetail:()=>Le,DataPointNumberPublic:()=>La,Dataset:()=>vp,DatasetIdentifier:()=>Se,DatasetIdentifierPublic:()=>Re,DatasetItem:()=>Dt,DatasetItemBatch:()=>jp,DatasetItemBatchWrite:()=>ze,DatasetItemCompare:()=>Xt,DatasetItemCompareSource:()=>Wt,DatasetItemPageCompare:()=>Gt,DatasetItemPagePublic:()=>qt,DatasetItemPublic:()=>dr,DatasetItemPublicSource:()=>Qt,DatasetItemSource:()=>Mt,DatasetItemStreamRequest:()=>_e,DatasetItemWrite:()=>hi,DatasetItemWriteSource:()=>bi,DatasetItemsDelete:()=>xe,DatasetPagePublic:()=>$t,DatasetPublic:()=>ue,DatasetPublicVisibility:()=>Ht,DatasetUpdate:()=>ke,DatasetUpdateVisibility:()=>qr,DatasetVisibility:()=>Ft,DatasetWrite:()=>ye,DatasetWriteVisibility:()=>Zr,DeleteAttachmentsRequest:()=>Pp,DeleteAttachmentsRequestEntityType:()=>Oi,DeleteFeedbackScore:()=>Sr,DeleteIdsHolder:()=>ur,DeleteTraceThreads:()=>Ze,Delta:()=>jt,DeltaRole:()=>vt,DownloadAttachmentRequestEntityType:()=>Hr,ErrorInfo:()=>Y,ErrorInfoPublic:()=>xr,ErrorInfoWrite:()=>Ke,ErrorMessage:()=>O,ErrorMessageDetail:()=>Kp,ErrorMessageDetailed:()=>Wp,ErrorMessagePublic:()=>Up,Experiment:()=>Ip,ExperimentItem:()=>Te,ExperimentItemCompare:()=>Ot,ExperimentItemPublic:()=>mr,ExperimentItemStreamRequest:()=>ve,ExperimentItemsBatch:()=>Pe,ExperimentItemsDelete:()=>Ee,ExperimentPagePublic:()=>na,ExperimentPublic:()=>wr,ExperimentPublicType:()=>aa,ExperimentStreamRequestPublic:()=>je,ExperimentType:()=>ta,ExperimentWrite:()=>Ae,ExperimentWriteType:()=>ro,ExportTraceServiceRequest:()=>Bp,Feedback:()=>Fp,FeedbackCreate:()=>wa,FeedbackDefinitionPagePublic:()=>za,FeedbackObjectPublic:()=>ya,FeedbackPublic:()=>ka,FeedbackScore:()=>H,FeedbackScoreAverage:()=>q,FeedbackScoreAverageDetailed:()=>Ha,FeedbackScoreAveragePublic:()=>gr,FeedbackScoreBatch:()=>Tr,FeedbackScoreBatchItem:()=>zn,FeedbackScoreBatchItemSource:()=>yn,FeedbackScoreCompare:()=>Kt,FeedbackScoreCompareSource:()=>Jt,FeedbackScoreNames:()=>Va,FeedbackScorePublic:()=>Rr,FeedbackScorePublicSource:()=>mn,FeedbackScoreSource:()=>yi,FeedbackUpdate:()=>Aa,FindFeedbackDefinitionsRequestType:()=>to,FindFeedbackScoreNames1RequestType:()=>zo,Function:()=>or,FunctionCall:()=>Z,GetSpanStatsRequestType:()=>ko,GetSpansByProjectRequestType:()=>yo,Guardrail:()=>Ea,GuardrailBatch:()=>Mp,GuardrailBatchWrite:()=>tr,GuardrailName:()=>Ta,GuardrailResult:()=>Pa,GuardrailWrite:()=>Ni,GuardrailWriteName:()=>Ii,GuardrailWriteResult:()=>Ui,GuardrailsValidation:()=>Rn,GuardrailsValidationPublic:()=>En,JsonNode:()=>S,JsonNodeCompare:()=>Eo,JsonNodeDetail:()=>zi,JsonNodePublic:()=>L,JsonNodeWrite:()=>V,JsonObjectSchema:()=>rr,JsonSchema:()=>vi,JsonSchemaElement:()=>_o,LlmAsJudgeCode:()=>nr,LlmAsJudgeCodePublic:()=>bt,LlmAsJudgeCodeWrite:()=>st,LlmAsJudgeMessage:()=>Yi,LlmAsJudgeMessagePublic:()=>gt,LlmAsJudgeMessagePublicRole:()=>ut,LlmAsJudgeMessageRole:()=>Qi,LlmAsJudgeMessageWrite:()=>tt,LlmAsJudgeMessageWriteRole:()=>it,LlmAsJudgeModelParameters:()=>$i,LlmAsJudgeModelParametersPublic:()=>dt,LlmAsJudgeModelParametersWrite:()=>ot,LlmAsJudgeOutputSchema:()=>qi,LlmAsJudgeOutputSchemaPublic:()=>wt,LlmAsJudgeOutputSchemaPublicType:()=>ft,LlmAsJudgeOutputSchemaType:()=>Zi,LlmAsJudgeOutputSchemaWrite:()=>nt,LlmAsJudgeOutputSchemaWriteType:()=>at,LogItem:()=>xt,LogItemLevel:()=>St,LogPage:()=>Rt,Message:()=>Ti,MultipartUploadPart:()=>Ki,NumericalFeedbackDefinition:()=>ma,NumericalFeedbackDefinitionCreate:()=>fa,NumericalFeedbackDefinitionPublic:()=>hr,NumericalFeedbackDefinitionUpdate:()=>_a,NumericalFeedbackDetail:()=>la,NumericalFeedbackDetailCreate:()=>ga,NumericalFeedbackDetailPublic:()=>ha,NumericalFeedbackDetailUpdate:()=>Ra,Optimization:()=>Vp,OptimizationPagePublic:()=>Na,OptimizationPublic:()=>zr,OptimizationPublicStatus:()=>Ua,OptimizationStatus:()=>Ia,OptimizationUpdate:()=>Ne,OptimizationUpdateStatus:()=>po,OptimizationWrite:()=>Ue,OptimizationWriteStatus:()=>co,PageColumns:()=>oa,PercentageValueStatPublic:()=>wn,PercentageValues:()=>ie,PercentageValuesDetailed:()=>$a,PercentageValuesPublic:()=>fr,Project:()=>Lp,ProjectDetailed:()=>Ya,ProjectDetailedVisibility:()=>Qa,ProjectMetricRequestPublic:()=>De,ProjectMetricRequestPublicInterval:()=>fo,ProjectMetricRequestPublicMetricType:()=>go,ProjectMetricResponsePublic:()=>Oa,ProjectMetricResponsePublicInterval:()=>Ja,ProjectMetricResponsePublicMetricType:()=>Wa,ProjectPagePublic:()=>Da,ProjectPublic:()=>kr,ProjectPublicVisibility:()=>Ma,ProjectRetrieveDetailed:()=>Be,ProjectStatItemObjectPublic:()=>hn,ProjectStatsPublic:()=>Ar,ProjectStatsSummary:()=>Ga,ProjectStatsSummaryItem:()=>Xa,ProjectUpdate:()=>Me,ProjectUpdateVisibility:()=>uo,ProjectVisibility:()=>Fa,ProjectWrite:()=>Fe,ProjectWriteVisibility:()=>mo,Prompt:()=>Jp,PromptDetail:()=>rn,PromptPagePublic:()=>sn,PromptPublic:()=>nn,PromptType:()=>Za,PromptUpdatable:()=>We,PromptVersion:()=>en,PromptVersionDetail:()=>Q,PromptVersionDetailType:()=>ki,PromptVersionLink:()=>vo,PromptVersionLinkPublic:()=>jo,PromptVersionLinkWrite:()=>io,PromptVersionPagePublic:()=>an,PromptVersionPublic:()=>tn,PromptVersionPublicType:()=>on,PromptVersionRetrieveDetail:()=>Je,PromptVersionType:()=>qa,PromptWrite:()=>Ve,PromptWriteType:()=>bo,ProviderApiKey:()=>Dp,ProviderApiKeyPagePublic:()=>ja,ProviderApiKeyProvider:()=>Ca,ProviderApiKeyPublic:()=>yr,ProviderApiKeyPublicProvider:()=>va,ProviderApiKeyUpdate:()=>Ie,ProviderApiKeyWrite:()=>Ce,ProviderApiKeyWriteProvider:()=>no,ResponseFormat:()=>ji,ResponseFormatType:()=>Ei,ResultsNumberPublic:()=>Ka,ScoreName:()=>Ba,ServiceTogglesConfig:()=>cn,Span:()=>ln,SpanBatch:()=>Op,SpanBatchWrite:()=>Xe,SpanFilterPublic:()=>Ri,SpanFilterPublicOperator:()=>xi,SpanPagePublic:()=>un,SpanPublic:()=>_r,SpanPublicType:()=>dn,SpanSearchStreamRequestPublic:()=>He,SpanSearchStreamRequestPublicType:()=>So,SpanType:()=>pn,SpanUpdate:()=>Ge,SpanWrite:()=>Oe,SpanWriteType:()=>Si,SpansCountResponse:()=>Di,StartMultipartUploadRequest:()=>he,StartMultipartUploadRequestEntityType:()=>$r,StartMultipartUploadResponse:()=>Xi,StreamOptions:()=>Pi,Tool:()=>Ci,ToolCall:()=>lr,Trace:()=>_n,TraceBatch:()=>Xp,TraceBatchWrite:()=>Qe,TraceCountResponse:()=>Vi,TraceFilterPublic:()=>Ai,TraceFilterPublicOperator:()=>_i,TracePagePublic:()=>jn,TracePublic:()=>Pr,TraceSearchStreamRequestPublic:()=>er,TraceThread:()=>Er,TraceThreadIdentifier:()=>qe,TraceThreadPage:()=>vn,TraceUpdate:()=>Ye,TraceWrite:()=>$e,UploadAttachmentRequestEntityType:()=>Qr,Usage:()=>Ut,UserDefinedMetricPythonCode:()=>sr,UserDefinedMetricPythonCodePublic:()=>ht,UserDefinedMetricPythonCodeWrite:()=>pt,WorkspaceNameHolder:()=>Hi,WorkspaceSpansCount:()=>Mi,WorkspaceTraceCount:()=>Bi,attachments:()=>pe,chatCompletions:()=>Ao,datasets:()=>eo,experiments:()=>le,feedbackDefinitions:()=>ao,guardrails:()=>To,llmProviderKey:()=>so,optimizations:()=>lo,projects:()=>wo,prompts:()=>ho,spans:()=>me,traces:()=>de});var pe={};a$1(pe,{AttachmentListRequestEntityType:()=>Gr,DownloadAttachmentRequestEntityType:()=>Hr,StartMultipartUploadRequest:()=>he,StartMultipartUploadRequestEntityType:()=>$r,UploadAttachmentRequestEntityType:()=>Qr,uploadAttachment:()=>Yr});var Gr=e.enum_(["trace","span"]);var Hr=e.enum_(["trace","span"]);var $r=e.enum_(["trace","span"]);var Qr=e.enum_(["trace","span"]);var Yr={};a$1(Yr,{Request:()=>Rp});var Rp=e.record(e.string(),e.unknown());var he=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",$r),entityId:e.property("entity_id",e.string()),path:e.string()});var eo={};a$1(eo,{DatasetIdentifier:()=>Se,DatasetIdentifierPublic:()=>Re,DatasetItemBatchWrite:()=>ze,DatasetItemStreamRequest:()=>_e,DatasetItemsDelete:()=>xe,DatasetUpdate:()=>ke,DatasetUpdateVisibility:()=>qr,DatasetWrite:()=>ye,DatasetWriteVisibility:()=>Zr});var Zr=e.enum_(["private","public"]);var qr=e.enum_(["private","public"]);var ye=e.object({id:e.string().optional(),name:e.string(),visibility:Zr.optional(),description:e.string().optional()});var bi=e.enum_(["manual","trace","span","sdk"]);var S=e.record(e.string(),e.unknown());var hi=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:bi,data:S});var ze=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(hi)});var ke=e.object({name:e.string(),description:e.string().optional(),visibility:qr.optional()});var Se=e.object({datasetName:e.property("dataset_name",e.string())});var xe=e.object({itemIds:e.property("item_ids",e.list(e.string()))});var Re=e.object({datasetName:e.property("dataset_name",e.string())});var _e=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 le={};a$1(le,{ExperimentItemStreamRequest:()=>ve,ExperimentItemsBatch:()=>Pe,ExperimentItemsDelete:()=>Ee,ExperimentStreamRequestPublic:()=>je,ExperimentWrite:()=>Ae,ExperimentWriteType:()=>ro,findFeedbackScoreNames:()=>oo});var ro=e.enum_(["regular","trial","mini-batch"]);var oo={};a$1(oo,{Response:()=>_p});var _p=e.list(e.string());var V=e.record(e.string(),e.unknown());var io=e.object({id:e.string()});var Ae=e.object({id:e.string().optional(),datasetName:e.property("dataset_name",e.string()),name:e.string().optional(),metadata:V.optional(),type:ro.optional(),optimizationId:e.property("optimization_id",e.string().optional()),promptVersion:e.property("prompt_version",io.optional()),promptVersions:e.property("prompt_versions",e.list(io).optional())});var yi=e.enum_(["ui","sdk","online_scoring"]);var H=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:yi,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 M=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 Te=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:S.optional(),output:S.optional(),feedbackScores:e.property("feedback_scores",e.list(H).optional()),comments:e.list(M).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())});var Pe=e.object({experimentItems:e.property("experiment_items",e.list(Te))});var Ee=e.object({ids:e.list(e.string())});var ve=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 je=e.object({name:e.string(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional())});var ao={};a$1(ao,{FindFeedbackDefinitionsRequestType:()=>to});var to=e.enum_(["numerical","categorical"]);var so={};a$1(so,{ProviderApiKeyUpdate:()=>Ie,ProviderApiKeyWrite:()=>Ce,ProviderApiKeyWriteProvider:()=>no});var no=e.enum_(["openai","anthropic","gemini","openrouter"]);var Ce=e.object({provider:no,apiKey:e.property("api_key",e.string()),name:e.string().optional()});var Ie=e.object({apiKey:e.property("api_key",e.string()),name:e.string().optional()});var lo={};a$1(lo,{OptimizationUpdate:()=>Ne,OptimizationUpdateStatus:()=>po,OptimizationWrite:()=>Ue,OptimizationWriteStatus:()=>co});var co=e.enum_(["running","completed","cancelled"]);var po=e.enum_(["running","completed","cancelled"]);var Ue=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:co,metadata:V.optional()});var Ne=e.object({name:e.string().optional(),status:po.optional()});var wo={};a$1(wo,{ProjectMetricRequestPublic:()=>De,ProjectMetricRequestPublicInterval:()=>fo,ProjectMetricRequestPublicMetricType:()=>go,ProjectRetrieveDetailed:()=>Be,ProjectUpdate:()=>Me,ProjectUpdateVisibility:()=>uo,ProjectWrite:()=>Fe,ProjectWriteVisibility:()=>mo});var mo=e.enum_(["private","public"]);var uo=e.enum_(["private","public"]);var go=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var fo=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Fe=e.object({name:e.string(),visibility:mo.optional(),description:e.string().optional()});var Me=e.object({name:e.string().optional(),description:e.string().optional(),visibility:uo.optional()});var De=e.object({metricType:e.property("metric_type",go.optional()),interval:fo.optional(),intervalStart:e.property("interval_start",e.date().optional()),intervalEnd:e.property("interval_end",e.date().optional())});var Be=e.object({name:e.string()});var ho={};a$1(ho,{CreatePromptVersionDetail:()=>Le,PromptUpdatable:()=>We,PromptVersionRetrieveDetail:()=>Je,PromptWrite:()=>Ve,PromptWriteType:()=>bo});var bo=e.enum_(["mustache","jinja2"]);var Ve=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:bo.optional()});var zi=e.record(e.string(),e.unknown());var ki=e.enum_(["mustache","jinja2"]);var Q=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:zi.optional(),type:ki.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Le=e.object({name:e.string(),version:Q});var We=e.object({name:e.string(),description:e.string().optional()});var Je=e.object({name:e.string(),commit:e.string().optional()});var me={};a$1(me,{FindFeedbackScoreNames1RequestType:()=>zo,GetSpanStatsRequestType:()=>ko,GetSpansByProjectRequestType:()=>yo,SpanBatchWrite:()=>Xe,SpanSearchStreamRequestPublic:()=>He,SpanSearchStreamRequestPublicType:()=>So,SpanUpdate:()=>Ge,findFeedbackScoreNames1:()=>xo});var yo=e.enum_(["general","tool","llm","guardrail"]);var zo=e.enum_(["general","tool","llm","guardrail"]);var ko=e.enum_(["general","tool","llm","guardrail"]);var So=e.enum_(["general","tool","llm","guardrail"]);var xo={};a$1(xo,{Response:()=>Ap});var Ap=e.list(e.string());var Si=e.enum_(["general","tool","llm","guardrail"]);var Ke=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Oe=e.object({id:e.string().optional(),projectName:e.property("project_name",e.string().optional()),traceId:e.property("trace_id",e.string()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:Si,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:V.optional(),output:V.optional(),metadata:V.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",Ke.optional()),totalEstimatedCost:e.property("total_estimated_cost",e.number().optional()),totalEstimatedCostVersion:e.property("total_estimated_cost_version",e.string().optional())});var Xe=e.object({spans:e.list(Oe)});var Y=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var Ge=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()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.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",Y.optional())});var xi=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ri=e.object({field:e.string().optional(),operator:xi.optional(),key:e.string().optional(),value:e.string().optional()});var He=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:So.optional(),filters:e.list(Ri).optional(),limit:e.number().optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),truncate:e.boolean().optional()});var de={};a$1(de,{DeleteTraceThreads:()=>Ze,TraceBatchWrite:()=>Qe,TraceSearchStreamRequestPublic:()=>er,TraceThreadIdentifier:()=>qe,TraceUpdate:()=>Ye,findFeedbackScoreNames2:()=>Ro});var Ro={};a$1(Ro,{Response:()=>Tp});var Tp=e.list(e.string());var $e=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:V.optional(),output:V.optional(),metadata:V.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Ke.optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),threadId:e.property("thread_id",e.string().optional())});var Qe=e.object({traces:e.list($e)});var Ye=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:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Y.optional()),threadId:e.property("thread_id",e.string().optional())});var Ze=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 qe=e.object({projectId:e.property("project_id",e.string()),threadId:e.property("thread_id",e.string())});var _i=e.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ai=e.object({field:e.string().optional(),operator:_i.optional(),key:e.string().optional(),value:e.string().optional()});var er=e.object({projectName:e.property("project_name",e.string().optional()),projectId:e.property("project_id",e.string().optional()),filters:e.list(Ai).optional(),lastRetrievedId:e.property("last_retrieved_id",e.string().optional()),limit:e.number().optional(),truncate:e.boolean().optional()});var Ao={};a$1(Ao,{ChatCompletionRequest:()=>ir});var Ti=e.record(e.string(),e.unknown());var Pi=e.object({includeUsage:e.property("include_usage",e.boolean().optional())});var Ei=e.enum_(["text","json_object","json_schema"]);var _o=e.object({type:e.string().optional()});var rr=e.object({type:e.string().optional(),description:e.string().optional(),properties:e.record(e.string(),_o).optional(),required:e.list(e.string()).optional(),additionalProperties:e.boolean().optional(),defs:e.property("$defs",e.record(e.string(),_o).optional())});var vi=e.object({name:e.string().optional(),strict:e.boolean().optional(),schema:rr.optional()});var ji=e.object({type:Ei.optional(),jsonSchema:e.property("json_schema",vi.optional())});var or=e.object({name:e.string().optional(),description:e.string().optional(),strict:e.boolean().optional(),parameters:rr.optional()});var Ci=e.object({type:e.stringLiteral("function").optional(),function:or.optional()});var Z=e.object({name:e.string().optional(),arguments:e.string().optional()});var ir=e.object({model:e.string().optional(),messages:e.list(Ti).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",Pi.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",ji.optional()),seed:e.number().optional(),tools:e.list(Ci).optional(),toolChoice:e.property("tool_choice",e.record(e.string(),e.unknown()).optional()),parallelToolCalls:e.property("parallel_tool_calls",e.boolean().optional()),functions:e.list(or).optional(),functionCall:e.property("function_call",Z.optional())});var To={};a$1(To,{GuardrailBatchWrite:()=>tr});var Ii=e.enum_(["TOPIC","PII"]);var Ui=e.enum_(["passed","failed"]);var Ni=e.object({entityId:e.property("entity_id",e.string()),secondaryId:e.property("secondary_id",e.string()),projectName:e.property("project_name",e.string().optional()),name:Ii,result:Ui,config:S,details:S});var tr=e.object({guardrails:e.list(Ni)});var Fi=e.object({workspaceId:e.property("workspace_id",e.string().optional()),user:e.string().optional(),count:e.number().optional()});var ar=e.object({biInformation:e.property("bi_information",e.list(Fi).optional())});var Mi=e.object({workspace:e.string().optional(),spanCount:e.property("span_count",e.number().optional())});var Di=e.object({workspacesSpansCount:e.property("workspaces_spans_count",e.list(Mi).optional())});var Bi=e.object({workspace:e.string().optional(),traceCount:e.property("trace_count",e.number().optional())});var Vi=e.object({workspacesTracesCount:e.property("workspaces_traces_count",e.list(Bi).optional())});var Li=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 Wi=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Li).optional(),sortableBy:e.list(e.string()).optional()});var O=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var Ji=e.enum_(["trace","span"]);var Ki=e.object({eTag:e.property("e_tag",e.string()),partNumber:e.property("part_number",e.number())});var Po=e.object({fileName:e.property("file_name",e.string()),projectName:e.property("project_name",e.string().optional()),entityType:e.property("entity_type",Ji),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(Ki))});var Oi=e.enum_(["trace","span"]);var Pp=e.object({fileNames:e.property("file_names",e.list(e.string())),entityType:e.property("entity_type",Oi),entityId:e.property("entity_id",e.string()),containerId:e.property("container_id",e.string())});var Xi=e.object({uploadId:e.property("upload_id",e.string()),preSignUrls:e.property("pre_sign_urls",e.list(e.string()))});var Gi=e.record(e.string(),e.unknown());var Hi=e.object({workspaceName:e.property("workspace_name",e.string().optional())});var $i=e.object({name:e.string(),temperature:e.number()});var Qi=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var Yi=e.object({role:Qi,content:e.string()});var Zi=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var qi=e.object({name:e.string(),type:Zi,description:e.string()});var nr=e.object({model:$i,messages:e.list(Yi),variables:e.record(e.string(),e.string()),schema:e.list(qi)});var et=e.object({code:nr.optional()});var sr=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var rt=e.object({code:sr.optional()});var Ks=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",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()),action:e.stringLiteral("evaluator").optional()}),Ep=e.union("type",{llm_as_judge:et.extend(Ks),user_defined_metric_python:rt.extend(Ks)}).transform({transform:s=>s,untransform:s=>s});var ot=e.object({name:e.string(),temperature:e.number()});var it=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var tt=e.object({role:it,content:e.string()});var at=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var nt=e.object({name:e.string(),type:at,description:e.string()});var st=e.object({model:ot,messages:e.list(tt),variables:e.record(e.string(),e.string()),schema:e.list(nt)});var ct=e.object({code:st.optional()});var pt=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var lt=e.object({code:pt.optional()});var Os=e.object({projectId:e.property("project_id",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),action:e.stringLiteral("evaluator").optional()}),mt=e.union("type",{llm_as_judge:ct.extend(Os),user_defined_metric_python:lt.extend(Os)}).transform({transform:s=>s,untransform:s=>s});var F=e.object({ids:e.list(e.string())});var dt=e.object({name:e.string(),temperature:e.number()});var ut=e.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var gt=e.object({role:ut,content:e.string()});var ft=e.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var wt=e.object({name:e.string(),type:ft,description:e.string()});var bt=e.object({model:dt,messages:e.list(gt),variables:e.record(e.string(),e.string()),schema:e.list(wt)});var cr=e.object({code:bt.optional()});var ht=e.object({metric:e.string(),arguments:e.record(e.string(),e.string())});var pr=e.object({code:ht.optional()});var Xs=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",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()),action:e.stringLiteral("evaluator").optional()}),yt=e.union("type",{llm_as_judge:cr.extend(Xs),user_defined_metric_python:pr.extend(Xs)}).transform({transform:s=>s,untransform:s=>s});var zt=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(yt).optional()});var Gs=e.object({id:e.string().optional(),projectId:e.property("project_id",e.string().optional()),projectName:e.property("project_name",e.string().optional()),name:e.string(),samplingRate:e.property("sampling_rate",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()),action:e.stringLiteral("evaluator").optional()}),kt=e.union("type",{llm_as_judge:cr.extend(Gs),user_defined_metric_python:pr.extend(Gs)}).transform({transform:s=>s,untransform:s=>s});var St=e.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var xt=e.object({timestamp:e.date().optional(),ruleId:e.property("rule_id",e.string().optional()),level:St.optional(),message:e.string().optional(),markers:e.record(e.string(),e.string()).optional()});var Rt=e.object({content:e.list(xt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var _t=e.object({code:nr.optional()});var At=e.object({code:sr.optional()});var Hs=e.object({name:e.string(),samplingRate:e.property("sampling_rate",e.number().optional()),projectId:e.property("project_id",e.string().optional()),action:e.stringLiteral("evaluator").optional()}),Tt=e.union("type",{llm_as_judge:_t.extend(Hs),user_defined_metric_python:At.extend(Hs)}).transform({transform:s=>s,untransform:s=>s});var Pt=e.enum_(["system","user","assistant","tool","function"]);var lr=e.object({id:e.string().optional(),index:e.number().optional(),type:e.stringLiteral("function").optional(),function:Z.optional()});var Et=e.object({role:Pt.optional(),content:e.string().optional(),name:e.string().optional(),toolCalls:e.property("tool_calls",e.list(lr).optional()),refusal:e.boolean().optional(),functionCall:e.property("function_call",Z.optional())});var vt=e.enum_(["system","user","assistant","tool","function"]);var jt=e.object({role:vt.optional(),content:e.string().optional(),toolCalls:e.property("tool_calls",e.list(lr).optional()),functionCall:e.property("function_call",Z.optional())});var Ct=e.object({index:e.number().optional(),message:Et.optional(),delta:jt.optional(),finishReason:e.property("finish_reason",e.string().optional())});var It=e.object({reasoningTokens:e.property("reasoning_tokens",e.number().optional())});var Ut=e.object({totalTokens:e.property("total_tokens",e.number().optional()),promptTokens:e.property("prompt_tokens",e.number().optional()),completionTokens:e.property("completion_tokens",e.number().optional()),completionTokensDetails:e.property("completion_tokens_details",It.optional())});var Nt=e.object({id:e.string().optional(),created:e.number().optional(),model:e.string().optional(),choices:e.list(Ct).optional(),usage:Ut.optional(),systemFingerprint:e.property("system_fingerprint",e.string().optional())});var Ft=e.enum_(["private","public"]);var vp=e.object({id:e.string().optional(),name:e.string(),visibility:Ft.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()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var Mt=e.enum_(["manual","trace","span","sdk"]);var Dt=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Mt,data:S,experimentItems:e.property("experiment_items",e.list(Te).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 jp=e.object({datasetName:e.property("dataset_name",e.string().optional()),datasetId:e.property("dataset_id",e.string().optional()),items:e.list(Dt)});var Bt=e.enum_(["string","number","object","boolean","array","null"]);var Vt=e.object({name:e.string().optional(),types:e.list(Bt).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var Lt=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 Wt=e.enum_(["manual","trace","span","sdk"]);var Eo=e.record(e.string(),e.unknown());var Jt=e.enum_(["ui","sdk","online_scoring"]);var Kt=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:Jt,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 Ot=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:Eo.optional(),output:Eo.optional(),feedbackScores:e.property("feedback_scores",e.list(Kt).optional()),comments:e.list(Lt).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())});var Xt=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Wt,data:S,experimentItems:e.property("experiment_items",e.list(Ot).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 Gt=e.object({content:e.list(Xt).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Vt).optional()});var Ht=e.enum_(["private","public"]);var ue=e.object({id:e.string().optional(),name:e.string(),visibility:Ht.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()),mostRecentExperimentAt:e.property("most_recent_experiment_at",e.date().optional()),lastCreatedExperimentAt:e.property("last_created_experiment_at",e.date().optional()),lastCreatedOptimizationAt:e.property("last_created_optimization_at",e.date().optional())});var $t=e.object({content:e.list(ue).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional()});var Qt=e.enum_(["manual","trace","span","sdk"]);var mr=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())});var dr=e.object({id:e.string().optional(),traceId:e.property("trace_id",e.string().optional()),spanId:e.property("span_id",e.string().optional()),source:Qt,data:S,experimentItems:e.property("experiment_items",e.list(mr).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 Yt=e.enum_(["string","number","object","boolean","array","null"]);var Zt=e.object({name:e.string().optional(),types:e.list(Yt).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var qt=e.object({content:e.list(dr).optional(),page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),columns:e.list(Zt).optional()});var ea=e.enum_(["string","number","object","boolean","array","null"]);var ra=e.object({name:e.string().optional(),types:e.list(ea).optional(),filterFieldPrefix:e.property("filter_field_prefix",e.string().optional()),filterField:e.string().optional()});var oa=e.object({columns:e.list(ra).optional()});var ia=e.object({typeName:e.string().optional()});var Cp=e.object({type:ia.optional(),closed:e.boolean().optional()});var ta=e.enum_(["regular","trial","mini-batch"]);var q=e.object({name:e.string(),value:e.number()});var ie=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var vo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var Ip=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:S.optional(),type:ta.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(q).optional()),comments:e.list(M).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",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()),promptVersion:e.property("prompt_version",vo.optional()),promptVersions:e.property("prompt_versions",e.list(vo).optional())});var ur=e.object({ids:e.list(e.string())});var te=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 L=e.record(e.string(),e.unknown());var aa=e.enum_(["regular","trial","mini-batch"]);var gr=e.object({name:e.string(),value:e.number()});var fr=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var jo=e.object({id:e.string(),commit:e.string().optional(),promptId:e.property("prompt_id",e.string().optional())});var wr=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:L.optional(),type:aa.optional(),optimizationId:e.property("optimization_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(gr).optional()),comments:e.list(te).optional(),traceCount:e.property("trace_count",e.number().optional()),createdAt:e.property("created_at",e.date().optional()),duration:fr.optional(),totalEstimatedCost:e.property("total_estimated_cost",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()),promptVersion:e.property("prompt_version",jo.optional()),promptVersions:e.property("prompt_versions",e.list(jo).optional())});var na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(wr).optional(),sortableBy:e.list(e.string()).optional()});var Up=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var sa=e.object({typeName:e.string().optional()});var Np=e.object({type:sa.optional(),closed:e.boolean().optional()});var ca=e.object({categories:e.record(e.string(),e.number())});var pa=e.object({details:ca.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 la=e.object({max:e.number(),min:e.number()});var ma=e.object({details:la.optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var $s=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),Fp=e.union("type",{numerical:ma.extend($s),categorical:pa.extend($s)}).transform({transform:s=>s,untransform:s=>s});var da=e.object({categories:e.record(e.string(),e.number())});var ua=e.object({details:da.optional()});var ga=e.object({max:e.number(),min:e.number()});var fa=e.object({details:ga.optional()});var Qs=e.object({id:e.string().optional(),name:e.string()}),wa=e.union("type",{numerical:fa.extend(Qs),categorical:ua.extend(Qs)}).transform({transform:s=>s,untransform:s=>s});var ba=e.object({categories:e.record(e.string(),e.number())});var br=e.object({details:ba.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 ha=e.object({max:e.number(),min:e.number()});var hr=e.object({details:ha.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 Ys=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),ya=e.union("type",{numerical:hr.extend(Ys),categorical:br.extend(Ys)}).transform({transform:s=>s,untransform:s=>s});var za=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(ya).optional()});var Zs=e.object({id:e.string().optional(),name:e.string(),createdAt:e.date().optional(),createdBy:e.string().optional(),lastUpdatedAt:e.date().optional(),lastUpdatedBy:e.string().optional()}),ka=e.union("type",{numerical:hr.extend(Zs),categorical:br.extend(Zs)}).transform({transform:s=>s,untransform:s=>s});var Sa=e.object({categories:e.record(e.string(),e.number())});var xa=e.object({details:Sa.optional()});var Ra=e.object({max:e.number(),min:e.number()});var _a=e.object({details:Ra.optional()});var qs=e.object({id:e.string().optional(),name:e.string()}),Aa=e.union("type",{numerical:_a.extend(qs),categorical:xa.extend(qs)}).transform({transform:s=>s,untransform:s=>s});var Ta=e.enum_(["TOPIC","PII"]);var Pa=e.enum_(["passed","failed"]);var Ea=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()),name:Ta,result:Pa,config:S,details:S});var Mp=e.object({guardrails:e.list(Ea)});var va=e.enum_(["openai","anthropic","gemini","openrouter"]);var yr=e.object({id:e.string().optional(),provider:va,apiKey:e.property("api_key",e.string()),name: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 ja=e.object({size:e.number().optional(),total:e.number().optional(),content:e.list(yr).optional(),sortableBy:e.list(e.string()).optional()});var Ca=e.enum_(["openai","anthropic","gemini","openrouter"]);var Dp=e.object({id:e.string().optional(),provider:Ca,apiKey:e.property("api_key",e.string()),name: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 Bp=S;var Ia=e.enum_(["running","completed","cancelled"]);var Vp=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:Ia,metadata:S.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(q).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 Ua=e.enum_(["running","completed","cancelled"]);var zr=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:Ua,metadata:L.optional(),datasetId:e.property("dataset_id",e.string().optional()),numTrials:e.property("num_trials",e.number().optional()),feedbackScores:e.property("feedback_scores",e.list(gr).optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),lastUpdatedBy:e.property("last_updated_by",e.string().optional())});var Na=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(zr).optional(),sortableBy:e.list(e.string()).optional()});var Fa=e.enum_(["private","public"]);var Lp=e.object({id:e.string().optional(),name:e.string(),visibility:Fa.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(q).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",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())});var Ma=e.enum_(["private","public"]);var kr=e.object({id:e.string().optional(),name:e.string(),visibility:Ma.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 Da=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(kr).optional(),sortableBy:e.list(e.string()).optional()});var Ba=e.object({name:e.string().optional()});var Va=e.object({scores:e.list(Ba).optional()});var La=e.object({time:e.date(),value:e.number().optional()});var Wa=e.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST","GUARDRAILS_FAILED_COUNT"]);var Ja=e.enum_(["HOURLY","DAILY","WEEKLY"]);var Ka=e.object({name:e.string().optional(),data:e.list(La).optional()});var Oa=e.object({projectId:e.property("project_id",e.string().optional()),metricType:e.property("metric_type",Wa.optional()),interval:Ja.optional(),results:e.list(Ka).optional()});var Xa=e.object({projectId:e.property("project_id",e.string().optional()),feedbackScores:e.property("feedback_scores",e.list(q).optional()),duration:ie.optional(),totalEstimatedCost:e.property("total_estimated_cost",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())});var Ga=e.object({content:e.list(Xa).optional()});var Ha=e.object({name:e.string(),value:e.number()});var $a=e.object({p50:e.number().optional(),p90:e.number().optional(),p99:e.number().optional()});var Qa=e.enum_(["private","public"]);var Ya=e.object({id:e.string().optional(),name:e.string(),visibility:Qa.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(Ha).optional()),duration:$a.optional(),totalEstimatedCost:e.property("total_estimated_cost",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())});var Wp=e.object({errors:e.list(e.string()).optional()});var Za=e.enum_(["mustache","jinja2"]);var qa=e.enum_(["mustache","jinja2"]);var en=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:S.optional(),type:qa.optional(),changeDescription:e.property("change_description",e.string().optional()),variables:e.list(e.string()).optional(),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var Jp=e.object({id:e.string().optional(),name:e.string(),description:e.string().optional(),template:e.string().optional(),metadata:S.optional(),changeDescription:e.property("change_description",e.string().optional()),type:Za.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",en.optional())});var Kp=e.object({code:e.number().optional(),message:e.string().optional(),details:e.string().optional()});var rn=e.object({id:e.string().optional(),name:e.string(),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()),versionCount:e.property("version_count",e.number().optional()),latestVersion:e.property("latest_version",Q.optional())});var on=e.enum_(["mustache","jinja2"]);var tn=e.object({id:e.string().optional(),promptId:e.property("prompt_id",e.string().optional()),commit:e.string().optional(),template:e.string(),metadata:L.optional(),type:on.optional(),changeDescription:e.property("change_description",e.string().optional()),createdAt:e.property("created_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional())});var an=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(tn).optional()});var nn=e.object({id:e.string().optional(),name:e.string(),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()),versionCount:e.property("version_count",e.number().optional())});var sn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(nn).optional()});var cn=e.object({pythonEvaluatorEnabled:e.boolean()});var pn=e.enum_(["general","tool","llm","guardrail"]);var ln=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()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:pn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:S.optional(),output:S.optional(),metadata:S.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",Y.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(H).optional()),comments:e.list(M).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 Op=e.object({spans:e.list(ln)});var Sr=e.object({name:e.string()});var xr=e.object({exceptionType:e.property("exception_type",e.string()),message:e.string().optional(),traceback:e.string()});var mn=e.enum_(["ui","sdk","online_scoring"]);var Rr=e.object({name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:mn,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 dn=e.enum_(["general","tool","llm","guardrail"]);var _r=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()),parentSpanId:e.property("parent_span_id",e.string().optional()),name:e.string(),type:dn,startTime:e.property("start_time",e.date()),endTime:e.property("end_time",e.date().optional()),input:L.optional(),output:L.optional(),metadata:L.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()),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(Rr).optional()),comments:e.list(te).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 un=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(_r).optional(),sortableBy:e.list(e.string()).optional()});var gn=e.object({value:e.number().optional()});var fn=e.object({value:e.number().optional()});var wn=e.object({value:fr.optional()});var bn=e.object({name:e.string().optional()}),hn=e.union("type",{PERCENTAGE:wn.extend(bn),COUNT:fn.extend(bn),AVG:gn.extend(bn)}).transform({transform:s=>s,untransform:s=>s});var Ar=e.object({stats:e.list(hn).optional()});var yn=e.enum_(["ui","sdk","online_scoring"]);var zn=e.object({id:e.string(),projectName:e.property("project_name",e.string().optional()),name:e.string(),categoryName:e.property("category_name",e.string().optional()),value:e.number(),reason:e.string().optional(),source:yn});var Tr=e.object({scores:e.list(zn)});var kn=e.enum_(["TOPIC","PII"]);var Sn=e.enum_(["passed","failed"]);var xn=e.object({name:kn.optional(),result:Sn.optional()});var Rn=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(xn).optional()});var _n=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:S.optional(),output:S.optional(),metadata:S.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",Y.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(H).optional()),comments:e.list(M).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(Rn).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())});var Xp=e.object({traces:e.list(_n)});var An=e.enum_(["TOPIC","PII"]);var Tn=e.enum_(["passed","failed"]);var Pn=e.object({name:An.optional(),result:Tn.optional()});var En=e.object({spanId:e.property("span_id",e.string().optional()),checks:e.list(Pn).optional()});var Pr=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:L.optional(),output:L.optional(),metadata:L.optional(),tags:e.list(e.string()).optional(),errorInfo:e.property("error_info",xr.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(Rr).optional()),comments:e.list(te).optional(),guardrailsValidations:e.property("guardrails_validations",e.list(En).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())});var Er=e.object({id:e.string().optional(),projectId:e.property("project_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",S.optional()),lastMessage:e.property("last_message",S.optional()),numberOfMessages:e.property("number_of_messages",e.number().optional()),lastUpdatedAt:e.property("last_updated_at",e.date().optional()),createdBy:e.property("created_by",e.string().optional()),createdAt:e.property("created_at",e.date().optional())});var vn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Er).optional()});var jn=e.object({page:e.number().optional(),size:e.number().optional(),total:e.number().optional(),content:e.list(Pr).optional(),sortableBy:e.list(e.string()).optional()});var Co=class{constructor(i={}){this._options=i;}async getDatasetBiInfo(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return ar.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new c({message:r.error.errorMessage})}}async getExperimentBiInfo(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return ar.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new c({message:r.error.errorMessage})}}async getSpansCountForWorkspaces(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return Di.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesBiInfo(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return ar.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async getTracesCountForWorkspaces(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return Vi.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Io=class{constructor(i={}){this._options=i;}async attachmentList(i,r){var z,k;let{page:o,size:t,projectId:n,entityType:m,entityId:d,path:u}=i,g={};o!=null&&(g.page=o.toString()),t!=null&&(g.size=t.toString()),g.project_id=n,g.entity_type=Gr.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"}),g.entity_id=d,g.path=u;let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(y.ok)return Wi.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new U(y.error.body);case 403:throw new D(O.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new c({message:y.error.errorMessage})}}async completeMultiPartUpload(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Po.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new U(o.error.body);case 403:throw new D(O.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAttachments(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Po.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new U(o.error.body);case 403:throw new D(O.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async downloadAttachment(i,r){var z,k;let{workspaceName:o,containerId:t,entityType:n,entityId:m,fileName:d,mimeType:u}=i,g={};o!=null&&(g.workspace_name=o),g.container_id=t,g.entity_type=Hr.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),g.entity_id=m,g.file_name=d,g.mime_type=u;let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(y.ok)return y.body;if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new U(y.error.body);case 403:throw new D(O.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new c({message:y.error.errorMessage})}}async startMultiPartUpload(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:he.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(o.ok)return Xi.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new U(o.error.body);case 403:throw new D(O.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new c({message:o.error.errorMessage})}}async uploadAttachment(i,r){var z,k;let{fileName:o,projectName:t,mimeType:n,entityType:m,entityId:d,body:u}=i,g={};g.file_name=o,t!=null&&(g.project_name=t),n!=null&&(g.mime_type=n),g.entity_type=Qr.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"}),g.entity_id=d;let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:g,requestType:"json",body:pe.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(!y.ok){if(y.error.reason==="status-code")switch(y.error.statusCode){case 401:throw new U(y.error.body);case 403:throw new D(O.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:y.error.statusCode,body:y.error.body})}switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new c({message:y.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Uo=class{constructor(i={}){this._options=i;}async access(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Gi.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new U(o.error.body);case 403:throw new D(O.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getWorkspaceName(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return Hi.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new U(r.error.body);case 403:throw new D(O.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:r.error.statusCode,body:r.error.body})}switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var No=class{constructor(i={}){this._options=i;}async findEvaluators(i={},r){var g,y;let{projectId:o,name:t,page:n,size:m}=i,d={};o!=null&&(d.project_id=o),t!=null&&(d.name=t),n!=null&&(d.page=n.toString()),m!=null&&(d.size=m.toString());let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 zt.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new c({message:u.error.errorMessage})}}async createAutomationRuleEvaluator(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:mt.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteAutomationRuleEvaluatorBatch(i,r){var d,u;let{projectId:o,body:t}=i,n={};o!=null&&(n.project_id=o);let m=await b({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:w.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,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(!m.ok){if(m.error.reason==="status-code")throw new c({statusCode:m.error.statusCode,body:m.error.body});switch(m.error.reason){case "non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new c({message:m.error.errorMessage})}}}async getEvaluatorById(i,r={},o){var d,u;let{projectId:t}=r,n={};t!=null&&(n.project_id=t);let m=await b({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:w.Default,`v1/private/automations/evaluators/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,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(m.ok)return kt.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(m.error.reason==="status-code")throw new c({statusCode:m.error.statusCode,body:m.error.body});switch(m.error.reason){case "non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:m.error.errorMessage})}}async updateAutomationRuleEvaluator(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/automations/evaluators/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async getEvaluatorLogsById(i,r={},o){var d,u;let{size:t}=r,n={};t!=null&&(n.size=t.toString());let m=await b({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:w.Default,`v1/private/automations/evaluators/${encodeURIComponent(i)}/logs`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,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(m.ok)return Rt.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(m.error.reason==="status-code")throw new c({statusCode:m.error.statusCode,body:m.error.body});switch(m.error.reason){case "non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new c({message:m.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Fo=class{constructor(i={}){this._options=i;}async createChatCompletions(i={},r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ir.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(o.ok)return Nt.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Mo=class{constructor(i={}){this._options=i;}async findDatasets(i={},r){var z,k;let{page:o,size:t,withExperimentsOnly:n,promptId:m,name:d,sorting:u}=i,g={};o!=null&&(g.page=o.toString()),t!=null&&(g.size=t.toString()),n!=null&&(g.with_experiments_only=n.toString()),m!=null&&(g.prompt_id=m),d!=null&&(g.name=d),u!=null&&(g.sorting=u);let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(y.ok)return $t.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new c({message:y.error.errorMessage})}}async createDataset(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ye.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createOrUpdateDatasetItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ze.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getDatasetById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/datasets/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateDataset(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/datasets/${encodeURIComponent(i)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:ke.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteDataset(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/datasets/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetByName(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Se.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:xe.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteDatasetsBatch(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findDatasetItemsWithExperimentItems(i,r,o){var z,k;let{page:t,size:n,experimentIds:m,filters:d,truncate:u}=r,g={};t!=null&&(g.page=t.toString()),n!=null&&(g.size=n.toString()),g.experiment_ids=m,d!=null&&(g.filters=d),u!=null&&(g.truncate=u.toString());let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,`v1/private/datasets/${encodeURIComponent(i)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(y.ok)return Gt.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new c({message:y.error.errorMessage})}}async getDatasetByIdentifier(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Re.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(o.ok)return ue.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItemById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/datasets/items/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 dr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getDatasetItems(i,r={},o){var g,y;let{page:t,size:n,truncate:m}=r,d={};t!=null&&(d.page=t.toString()),n!=null&&(d.size=n.toString()),m!=null&&(d.truncate=m.toString());let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,`v1/private/datasets/${encodeURIComponent(i)}/items`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:d,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(u.ok)return qt.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new c({message:u.error.errorMessage})}}async getDatasetItemsOutputColumns(i,r={},o){var d,u;let{experimentIds:t}=r,n={};t!=null&&(n.experiment_ids=t);let m=await b({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:w.Default,`v1/private/datasets/${encodeURIComponent(i)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:n,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(m.ok)return oa.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(m.error.reason==="status-code")throw new c({statusCode:m.error.statusCode,body:m.error.body});switch(m.error.reason){case "non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new c({message:m.error.errorMessage})}}async streamDatasetItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:_e.jsonOrThrow(i,{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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Do=class{constructor(i={}){this._options=i;}async findExperiments(i={},r){var k,j;let{page:o,size:t,datasetId:n,name:m,datasetDeleted:d,promptId:u,sorting:g}=i,y={};o!=null&&(y.page=o.toString()),t!=null&&(y.size=t.toString()),n!=null&&(y.datasetId=n),m!=null&&(y.name=m),d!=null&&(y.dataset_deleted=d.toString()),u!=null&&(y.prompt_id=u),g!=null&&(y.sorting=g);let z=await b({url:h((j=(k=await a.get(this._options.baseUrl))!=null?k:await a.get(this._options.environment))!=null?j:w.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(z.ok)return na.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new v(z.error.body);default:throw new c({statusCode:z.error.statusCode,body:z.error.body})}switch(z.error.reason){case "non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new c({message:z.error.errorMessage})}}async createExperiment(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ae.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createExperimentItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Pe.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ee.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteExperimentsById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ur.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames(i={},r){var m,d;let{experimentIds:o}=i,t={};o!=null&&(t.experiment_ids=o);let n=await b({url:h((d=(m=await a.get(this._options.baseUrl))!=null?m:await a.get(this._options.environment))!=null?d:w.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:t,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return le.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getExperimentById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/experiments/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 wr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getExperimentItemById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/experiments/items/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 mr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async streamExperimentItems(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ve.jsonOrThrow(i,{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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async streamExperiments(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/experiments/stream"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:je.jsonOrThrow(i,{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 o.body;if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/experiments/stream.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Bo=class{constructor(i={}){this._options=i;}async findFeedbackDefinitions(i={},r){var g,y;let{page:o,size:t,name:n,type:m}=i,d={};o!=null&&(d.page=o.toString()),t!=null&&(d.size=t.toString()),n!=null&&(d.name=n),m!=null&&(d.type=to.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"}));let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 za.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new c({message:u.error.errorMessage})}}async createFeedbackDefinition(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:wa.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getFeedbackDefinitionById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/feedback-definitions/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 ka.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateFeedbackDefinition(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/feedback-definitions/${encodeURIComponent(i)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Aa.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteFeedbackDefinitionById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/feedback-definitions/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteFeedbackDefinitionsBatch(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Vo=class{constructor(i={}){this._options=i;}async createGuardrails(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/guardrails"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:tr.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/guardrails.");case "unknown":throw new c({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Lo=class{constructor(i={}){this._options=i;}async deleteLlmProviderApiKeysBatch(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findLlmProviderKeys(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return ja.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new c({message:r.error.errorMessage})}}async storeLlmProviderApiKey(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ce.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new U(o.error.body);case 403:throw new D(O.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getLlmProviderApiKeyById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/llm-provider-key/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 yr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateLlmProviderApiKey(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/llm-provider-key/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ie.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new U(t.error.body);case 403:throw new D(O.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Wo=class{constructor(i={}){this._options=i;}async receiveProtobufTraces(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Jo=class{constructor(i={}){this._options=i;}async findOptimizations(i={},r){var y,z;let{page:o,size:t,datasetId:n,name:m,datasetDeleted:d}=i,u={};o!=null&&(u.page=o.toString()),t!=null&&(u.size=t.toString()),n!=null&&(u.dataset_id=n),m!=null&&(u.name=m),d!=null&&(u.dataset_deleted=d.toString());let g=await b({url:h((z=(y=await a.get(this._options.baseUrl))!=null?y:await a.get(this._options.environment))!=null?z:w.Default,"v1/private/optimizations"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Na.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new v(g.error.body);default:throw new c({statusCode:g.error.statusCode,body:g.error.body})}switch(g.error.reason){case "non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations.");case "unknown":throw new c({message:g.error.errorMessage})}}async createOptimization(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/optimizations"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ue.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteOptimizationsById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/optimizations/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:ur.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/optimizations/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getOptimizationById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/optimizations/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 zr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/optimizations/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateOptimizationsById(i,r={},o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/optimizations/${encodeURIComponent(i)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ne.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/optimizations/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ko=class{constructor(i={}){this._options=i;}async findProjects(i={},r){var g,y;let{page:o,size:t,name:n,sorting:m}=i,d={};o!=null&&(d.page=o.toString()),t!=null&&(d.size=t.toString()),n!=null&&(d.name=n),m!=null&&(d.sorting=m);let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Da.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new c({message:u.error.errorMessage})}}async createProject(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Fe.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getProjectById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/projects/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 kr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteProjectById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/projects/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateProject(i,r={},o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/projects/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Me.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new v(t.error.body);case 422:throw new X(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteProjectsBatch(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNamesByProjectIds(i={},r){var m,d;let{projectIds:o}=i,t={};o!=null&&(t.project_ids=o);let n=await b({url:h((d=(m=await a.get(this._options.baseUrl))!=null?m:await a.get(this._options.environment))!=null?d:w.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:t,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return Va.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getProjectMetrics(i,r={},o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/projects/${encodeURIComponent(i)}/metrics`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:De.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(t.ok)return Oa.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new v(t.error.body);case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new c({message:t.error.errorMessage})}}async getProjectStats(i={},r){var g,y;let{page:o,size:t,name:n,sorting:m}=i,d={};o!=null&&(d.page=o.toString()),t!=null&&(d.size=t.toString()),n!=null&&(d.name=n),m!=null&&(d.sorting=m);let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Ga.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new c({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new c({message:u.error.errorMessage})}}async retrieveProject(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Be.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(o.ok)return Ya.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 404:throw new R(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Oo=class{constructor(i={}){this._options=i;}async getPrompts(i={},r){var u,g;let{page:o,size:t,name:n}=i,m={};o!=null&&(m.page=o.toString()),t!=null&&(m.size=t.toString()),n!=null&&(m.name=n);let d=await b({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:w.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:(r==null?void 0: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 sn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new c({message:d.error.errorMessage})}}async createPrompt(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ve.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 409:throw new J(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createPromptVersion(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Le.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(o.ok)return Q.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 409:throw new J(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/prompts/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 rn.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async updatePrompt(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/prompts/${encodeURIComponent(i)}`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:We.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new v(t.error.body);case 404:throw new R(t.error.body);case 409:throw new J(t.error.body);case 422:throw new X(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deletePrompt(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/prompts/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deletePromptsBatch(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getPromptVersionById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/prompts/versions/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Q.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new c({message:o.error.errorMessage})}}async getPromptVersions(i,r={},o){var u,g;let{page:t,size:n}=r,m={};t!=null&&(m.page=t.toString()),n!=null&&(m.size=n.toString());let d=await b({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:w.Default,`v1/private/prompts/${encodeURIComponent(i)}/versions`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",queryParameters:m,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 an.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new c({message:d.error.errorMessage})}}async retrievePromptVersion(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Je.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(o.ok)return Q.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 404:throw new R(o.error.body);case 422:throw new X(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Xo=class{constructor(i={}){this._options=i;}async getServiceToggles(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"v1/private/toggles"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return cn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/toggles.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Go=class{constructor(i={}){this._options=i;}async addSpanComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/${encodeURIComponent(i)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new c({message:t.error.errorMessage})}}}async addSpanFeedbackScore(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/${encodeURIComponent(i)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:H.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new c({message:t.error.errorMessage})}}}async getSpansByProject(i={},r){var Un,Nn;let{page:o,size:t,projectName:n,projectId:m,traceId:d,type:u,filters:g,truncate:y,sorting:z,exclude:k}=i,j={};o!=null&&(j.page=o.toString()),t!=null&&(j.size=t.toString()),n!=null&&(j.project_name=n),m!=null&&(j.project_id=m),d!=null&&(j.trace_id=d),u!=null&&(j.type=yo.jsonOrThrow(u,{unrecognizedObjectKeys:"strip"})),g!=null&&(j.filters=g),y!=null&&(j.truncate=y.toString()),z!=null&&(j.sorting=z),k!=null&&(j.exclude=k);let W=await b({url:h((Nn=(Un=await a.get(this._options.baseUrl))!=null?Un:await a.get(this._options.environment))!=null?Nn:w.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:j,requestType:"json",timeoutMs:(r==null?void 0: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 un.parseOrThrow(W.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(W.error.reason==="status-code")throw new c({statusCode:W.error.statusCode,body:W.error.body});switch(W.error.reason){case "non-json":throw new c({statusCode:W.error.statusCode,body:W.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new c({message:W.error.errorMessage})}}async createSpan(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Oe.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(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new J(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createSpans(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Xe.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getSpanById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/spans/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 _r.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteSpanById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/spans/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")switch(o.error.statusCode){case 501:throw new ge(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateSpan(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ge.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteSpanComments(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteSpanFeedbackScore(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/${encodeURIComponent(i)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Sr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new c({message:t.error.errorMessage})}}}async findFeedbackScoreNames1(i={},r){var d,u;let{projectId:o,type:t}=i,n={};o!=null&&(n.project_id=o),t!=null&&(n.type=zo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}));let m=await b({url:h((u=(d=await a.get(this._options.baseUrl))!=null?d:await a.get(this._options.environment))!=null?u:w.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(m.ok)return me.findFeedbackScoreNames1.Response.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(m.error.reason==="status-code")throw new c({statusCode:m.error.statusCode,body:m.error.body});switch(m.error.reason){case "non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new c({message:m.error.errorMessage})}}async getSpanComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/${encodeURIComponent(r)}/comments/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(t.ok)return M.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new c({message:t.error.errorMessage})}}async getSpanStats(i={},r){var y,z;let{projectId:o,projectName:t,traceId:n,type:m,filters:d}=i,u={};o!=null&&(u.project_id=o),t!=null&&(u.project_name=t),n!=null&&(u.trace_id=n),m!=null&&(u.type=ko.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),d!=null&&(u.filters=d);let g=await b({url:h((z=(y=await a.get(this._options.baseUrl))!=null?y:await a.get(this._options.environment))!=null?z:w.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Ar.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(g.error.reason==="status-code")throw new c({statusCode:g.error.statusCode,body:g.error.body});switch(g.error.reason){case "non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new c({message:g.error.errorMessage})}}async scoreBatchOfSpans(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Tr.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchSpans(i={},r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:He.jsonOrThrow(i,{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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateSpanComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/spans/comments/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var Ho=class{constructor(i={}){this._options=i;}async addTraceComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/${encodeURIComponent(i)}/comments`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new c({message:t.error.errorMessage})}}}async addTraceFeedbackScore(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/${encodeURIComponent(i)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:H.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new c({message:t.error.errorMessage})}}}async getTracesByProject(i={},r){var j,W;let{page:o,size:t,projectName:n,projectId:m,filters:d,truncate:u,sorting:g,exclude:y}=i,z={};o!=null&&(z.page=o.toString()),t!=null&&(z.size=t.toString()),n!=null&&(z.project_name=n),m!=null&&(z.project_id=m),d!=null&&(z.filters=d),u!=null&&(z.truncate=u.toString()),g!=null&&(z.sorting=g),y!=null&&(z.exclude=y);let k=await b({url:h((W=(j=await a.get(this._options.baseUrl))!=null?j:await a.get(this._options.environment))!=null?W:w.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:(r==null?void 0: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 jn.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(k.error.reason==="status-code")throw new c({statusCode:k.error.statusCode,body:k.error.body});switch(k.error.reason){case "non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new c({message:k.error.errorMessage})}}async createTrace(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:$e.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new c({message:o.error.errorMessage})}}}async createTraces(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Qe.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new c({message:o.error.errorMessage})}}}async getTraceById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/traces/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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 Pr.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}async deleteTraceById(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,`v1/private/traces/${encodeURIComponent(i)}`),method:"DELETE",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new c({message:o.error.errorMessage})}}}async updateTrace(i,r={},o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Ye.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteTraceComments(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraceFeedbackScore(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/${encodeURIComponent(i)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:Sr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new c({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new c({message:t.error.errorMessage})}}}async deleteTraceThreads(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Ze.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async deleteTraces(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new c({message:o.error.errorMessage})}}}async findFeedbackScoreNames2(i={},r){var m,d;let{projectId:o}=i,t={};o!=null&&(t.project_id=o);let n=await b({url:h((d=(m=await a.get(this._options.baseUrl))!=null?m:await a.get(this._options.environment))!=null?d:w.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:t,requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(n.ok)return de.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new c({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new c({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new c({message:n.error.errorMessage})}}async getTraceStats(i={},r){var u,g;let{projectId:o,projectName:t,filters:n}=i,m={};o!=null&&(m.project_id=o),t!=null&&(m.project_name=t),n!=null&&(m.filters=n);let d=await b({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:w.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:(r==null?void 0: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 Ar.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new c({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new c({message:d.error.errorMessage})}}async getTraceComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/${encodeURIComponent(r)}/comments/${encodeURIComponent(i)}`),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(t.ok)return M.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new c({message:t.error.errorMessage})}}async getTraceThread(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:qe.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(o.ok)return Er.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new R(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new c({message:o.error.errorMessage})}}async getTraceThreads(i={},r){var z,k;let{page:o,size:t,projectName:n,projectId:m,truncate:d,filters:u}=i,g={};o!=null&&(g.page=o.toString()),t!=null&&(g.size=t.toString()),n!=null&&(g.project_name=n),m!=null&&(g.project_id=m),d!=null&&(g.truncate=d.toString()),u!=null&&(g.filters=u);let y=await b({url:h((k=(z=await a.get(this._options.baseUrl))!=null?z:await a.get(this._options.environment))!=null?k:w.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(y.ok)return vn.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(y.error.reason==="status-code")throw new c({statusCode:y.error.statusCode,body:y.error.body});switch(y.error.reason){case "non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new c({message:y.error.errorMessage})}}async scoreBatchOfTraces(i,r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:Tr.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(!o.ok){if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new c({message:o.error.errorMessage})}}}async searchTraces(i={},r){var t,n;let o=await b({url:h((n=(t=await a.get(this._options.baseUrl))!=null?t:await a.get(this._options.environment))!=null?n:w.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",body:er.jsonOrThrow(i,{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 o.body;if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new v(o.error.body);case 401:throw new U(o.error.body);default:throw new c({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new c({message:o.error.errorMessage})}}async updateTraceComment(i,r,o){var n,m;let t=await b({url:h((m=(n=await a.get(this._options.baseUrl))!=null?n:await a.get(this._options.environment))!=null?m:w.Default,`v1/private/traces/comments/${encodeURIComponent(i)}`),method:"PATCH",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...o==null?void 0:o.headers},contentType:"application/json",requestType:"json",body:M.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(o==null?void 0:o.timeoutInSeconds)!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o==null?void 0:o.maxRetries,withCredentials:true,abortSignal:o==null?void 0:o.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new R(t.error.body);default:throw new c({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new c({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new c({message:t.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var $o=class{constructor(i={}){this._options=i;}async datasetsRedirect(i,r){var u,g;let{datasetId:o,workspaceName:t,path:n}=i,m={};m.dataset_id=o,t!=null&&(m.workspace_name=t),m.path=n;let d=await b({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:w.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:(r==null?void 0: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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new v(d.error.body);case 404:throw new R(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new c({message:d.error.errorMessage})}}}async experimentsRedirect(i,r){var g,y;let{datasetId:o,experimentId:t,workspaceName:n,path:m}=i,d={};d.dataset_id=o,d.experiment_id=t,n!=null&&(d.workspace_name=n),d.path=m;let u=await b({url:h((y=(g=await a.get(this._options.baseUrl))!=null?g:await a.get(this._options.environment))!=null?y:w.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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){if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new v(u.error.body);case 404:throw new R(u.error.body);default:throw new c({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case "non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new c({message:u.error.errorMessage})}}}async projectsRedirect(i,r){var u,g;let{traceId:o,workspaceName:t,path:n}=i,m={};m.trace_id=o,t!=null&&(m.workspace_name=t),m.path=n;let d=await b({url:h((g=(u=await a.get(this._options.baseUrl))!=null?u:await a.get(this._options.environment))!=null?g:w.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:(r==null?void 0: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){if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new v(d.error.body);case 404:throw new R(d.error.body);default:throw new c({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new c({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new c({message:d.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var vr=class{constructor(i={}){this._options=i;}get systemUsage(){var i;return (i=this._systemUsage)!=null?i:this._systemUsage=new Co(this._options)}get attachments(){var i;return (i=this._attachments)!=null?i:this._attachments=new Io(this._options)}get check(){var i;return (i=this._check)!=null?i:this._check=new Uo(this._options)}get automationRuleEvaluators(){var i;return (i=this._automationRuleEvaluators)!=null?i:this._automationRuleEvaluators=new No(this._options)}get chatCompletions(){var i;return (i=this._chatCompletions)!=null?i:this._chatCompletions=new Fo(this._options)}get datasets(){var i;return (i=this._datasets)!=null?i:this._datasets=new Mo(this._options)}get experiments(){var i;return (i=this._experiments)!=null?i:this._experiments=new Do(this._options)}get feedbackDefinitions(){var i;return (i=this._feedbackDefinitions)!=null?i:this._feedbackDefinitions=new Bo(this._options)}get guardrails(){var i;return (i=this._guardrails)!=null?i:this._guardrails=new Vo(this._options)}get llmProviderKey(){var i;return (i=this._llmProviderKey)!=null?i:this._llmProviderKey=new Lo(this._options)}get openTelemetryIngestion(){var i;return (i=this._openTelemetryIngestion)!=null?i:this._openTelemetryIngestion=new Wo(this._options)}get optimizations(){var i;return (i=this._optimizations)!=null?i:this._optimizations=new Jo(this._options)}get projects(){var i;return (i=this._projects)!=null?i:this._projects=new Ko(this._options)}get prompts(){var i;return (i=this._prompts)!=null?i:this._prompts=new Oo(this._options)}get serviceToggles(){var i;return (i=this._serviceToggles)!=null?i:this._serviceToggles=new Xo(this._options)}get spans(){var i;return (i=this._spans)!=null?i:this._spans=new Go(this._options)}get traces(){var i;return (i=this._traces)!=null?i:this._traces=new Ho(this._options)}get redirect(){var i;return (i=this._redirect)!=null?i:this._redirect=new $o(this._options)}async isAlive(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new c({message:r.error.errorMessage})}}async version(i){var o,t;let r=await b({url:h((t=(o=await a.get(this._options.baseUrl))!=null?o:await a.get(this._options.environment))!=null?t:w.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await a.get(this._options.workspaceName)!=null?await a.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":l.type,"X-Fern-Runtime-Version":l.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(r.ok)return r.body;if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body});switch(r.error.reason){case "non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody});case "timeout":throw new f("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new c({message:r.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await a.get(this._options.apiKey)}}};var jr=()=>v7();var Qo=class{constructor(i,r){this.data=i;this.opik=r;this.end=()=>this.update({endTime:new Date});this.score=i=>{var r;this.opik.spanFeedbackScoresBatchQueue.create({...i,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=i=>{var o;let r={parentSpanId:this.data.parentSpanId,projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,traceId:this.data.traceId,...i};return this.opik.spanBatchQueue.update(this.data.id,r),this.data={...this.data,...i},this};}};var Yo=class{constructor(i,r){this.data=i;this.opik=r;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=i=>{var r;this.opik.traceFeedbackScoresBatchQueue.create({...i,projectName:(r=this.data.projectName)!=null?r:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=i=>{var n,m;let r=(m=(n=this.data.projectName)!=null?n:i.projectName)!=null?m:this.opik.config.projectName,o={id:jr(),startTime:new Date,...i,projectName:r,traceId:this.data.id};this.opik.spanBatchQueue.create(o);let t=new Qo(o,this.opik);return this.spans.push(t),t};this.update=i=>{var o;let r={projectName:(o=this.data.projectName)!=null?o:this.opik.config.projectName,...i};return this.opik.traceBatchQueue.update(this.data.id,r),this.data={...this.data,...r},this};}};var Hp=s=>s.replace("/api",""),ec=({apiUrl:s,projectName:i,workspaceName:r})=>{let o=encodeURIComponent(i);return `${Hp(s)}/${r}/redirect/projects?name=${o}`};var $p=300,Qp=100,Cr=class{constructor({action:i,batchSize:r=Qp,delay:o,enableBatch:t,name:n="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=(i,r)=>{if(this.queue.set(i,r),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(i,r)=>{let o=this.queue.get(i);o&&(this.queue.set(i,{...o,...r}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let i=new Map(this.queue);this.queue.clear(),T.debug(`Adding ${i.size} items to ${this.name} promise:`,i),this.promise=this.promise.finally(()=>(T.debug(`Flushing ${this.name}:`,i),this.action(i))).catch(r=>{T.error(`Failed to flush ${this.name}:`,r,i);}),await this.promise;};this.action=i,this.batchSize=r,this.delay=o,this.enableBatch=t,this.name=n;}},$=class{constructor({delay:i=$p,enableCreateBatch:r=true,enableDeleteBatch:o=true,name:t="BatchQueue"}){this.create=i=>{let r=this.getId(i);this.createQueue.add(r,i);};this.get=async i=>{let r=this.createQueue.queue.get(i);return r||this.getEntity(i)};this.update=(i,r)=>{if(this.createQueue.queue.get(i)){this.createQueue.update(i,r);return}this.updateQueue.add(i,r);};this.delete=i=>{if(this.createQueue.queue.has(i)){this.createQueue.queue.delete(i);return}this.deleteQueue.add(i);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=t,this.createQueue=new Cr({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:i,enableBatch:r,name:`${t}:createQueue`}),this.updateQueue=new Cr({action:async n=>{await this.createQueue.flush();let m=Array.from(n.entries());for(let[d,u]of m)await this.updateEntity(d,u);},delay:i,enableBatch:false,name:`${t}:updateQueue`}),this.deleteQueue=new Cr({action:async n=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(n.keys()));},delay:i,enableBatch:o,name:`${t}:deleteQueue`});}};var Zo=class extends ${constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.spans.createSpans({spans:r});}async getEntity(r){return await this.api.spans.getSpanById(r)}async updateEntity(r,o){await this.api.spans.updateSpan(r,o);}async deleteEntities(r){for(let o of r)await this.api.spans.deleteSpanById(o);}};var qo=class extends ${constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"SpanFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.spans.scoreBatchOfSpans({scores:r});}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});}};var ei=class extends ${constructor(r,o){super({delay:o,name:"TraceBatchQueue"});this.api=r;}getId(r){return r.id}async createEntities(r){await this.api.traces.createTraces({traces:r});}async getEntity(r){return await this.api.traces.getTraceById(r)}async updateEntity(r,o){await this.api.traces.updateTrace(r,o);}async deleteEntities(r){await this.api.traces.deleteTraces({ids:r});}};var ri=class extends ${constructor(r,o){super({delay:o,enableDeleteBatch:false,name:"TraceFeedbackScoresBatchQueue"});this.api=r;}getId(r){return {id:r.id,name:r.name}}async createEntities(r){await this.api.traces.scoreBatchOfTraces({scores:r});}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});}};var Cn=[],Ir=class{constructor(i){this.displayTraceLog=i=>{if(i===this.lastProjectNameLogged||!this.config.apiUrl)return;let r=ec({apiUrl:this.config.apiUrl,projectName:i,workspaceName:this.config.workspaceName});T.info(`Started logging traces to the "${i}" project at ${Fn(r)}`),this.lastProjectNameLogged=i;};this.trace=i=>{var t;T.debug("Creating new trace with data:",i);let r=(t=i.projectName)!=null?t:this.config.projectName,o=new Yo({id:jr(),startTime:new Date,...i,projectName:r},this);return this.traceBatchQueue.create(o.data),T.debug("Trace added to the queue with ID:",o.data.id),this.displayTraceLog(r),o};this.flush=async()=>{T.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),T.info("Successfully flushed all data to Opik");}catch(i){T.error("Error during flush operation:",{error:i instanceof Error?i.message:i});}};T.debug("Initializing OpikClient with config:",i),this.config=Vn(i),this.api=new vr({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new Zo(this.api),this.traceBatchQueue=new ei(this.api),this.spanFeedbackScoresBatchQueue=new qo(this.api),this.traceFeedbackScoresBatchQueue=new ri(this.api),Cn.push(this);}};var Zp="track.decorator",In=new AsyncLocalStorage,qp=()=>{let{span:s,trace:i}=In.getStore()||{};if(!(!s||!i))return {span:s,trace:i}};function el(s){return !!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function rl({name:s,parentSpan:i,projectName:r,trace:o,type:t="llm"}){T.debug("Creating new span:",{name:s,parentSpan:i==null?void 0:i.data.id,projectName:r,type:t});let n=o;n||(n=ii.trace({name:s,projectName:r}));let m=n.span({name:s,parentSpanId:i==null?void 0:i.data.id,projectName:r,type:t});return T.debug("Span created with ID:",m.data.id),{span:m,trace:n}}function ol({args:s,span:i,trace:r}){if(T.debug("Starting span execution:",{spanId:i.data.id,traceId:r==null?void 0:r.data.id}),s.length===0)return;let o={arguments:s};T.debug("Recording span input"),i.update({input:o}),r&&(T.debug("Recording trace input"),r.update({input:o}));}function rc({result:s,span:i,trace:r}){T.debug("Recording successful execution:",{spanId:i.data.id,traceId:r==null?void 0:r.data.id});let o=typeof s=="object"?s:{result:s},t=new Date;i.update({endTime:t,output:o}),r&&r.update({endTime:t,output:o});}function oc({span:s,error:i,trace:r}){var o,t;T.error("Recording execution error:",{spanId:s.data.id,traceId:r==null?void 0:r.data.id,error:i instanceof Error?{name:i.name,message:i.message,stack:i.stack}:i}),i instanceof Error&&s.update({errorInfo:{message:i.message,exceptionType:i.name,traceback:(o=i.stack)!=null?o:""}}),s.end(),r&&(r.update({errorInfo:{message:i.message,exceptionType:i.name,traceback:(t=i.stack)!=null?t:""}}),r.end());}function oi({name:s,projectName:i,type:r}={},o){return function(...n){let m=In.getStore(),{span:d,trace:u}=rl({name:s!=null?s:o.name||Zp,parentSpan:m==null?void 0:m.span,projectName:i,trace:m==null?void 0:m.trace,type:r}),g=!m,y=this;return In.run({span:d,trace:u},()=>{try{ol({args:n,span:d,trace:g?u:void 0});let z=o.apply(y,n);return el(z)?z.then(k=>(rc({span:d,result:k,trace:g?u:void 0}),k),k=>{throw oc({span:d,error:k,trace:g?u:void 0}),k}):(rc({span:d,result:z,trace:g?u:void 0}),z)}catch(z){throw oc({span:d,error:z,trace:g?u:void 0}),z}})}}function il(s,i){if(typeof s=="function")return oi({},s);let r=s;return i?oi(r,i):function(...o){if(o.length===2&&typeof o[1]=="object"&&o[1]!==null&&"kind"in o[1]){let[m,d]=o;if(d.kind!=="method")throw new Error("track decorator is only applicable to methods");return oi(r,m)}let[,,t]=o;if(!t||typeof t.value!="function")throw new Error("track decorator can only be applied to methods");let n=t.value;return t.value=oi(r,n),t}}var ii=new Ir;var tl=async()=>{T.debug("Starting flushAll operation");try{await Promise.all([ii.flush(),...Cn.map(s=>s.flush())]),T.debug("flushAll operation completed successfully");}catch(s){throw T.error("Error during flushAll operation:",{error:s instanceof Error?s.message:s,stack:s instanceof Error?s.stack:void 0}),s}};
4
+ export{T as a,Mn as b,nc as c,ss as d,jr as e,Ir as f,qp as g,il as h,ii as i,tl as j};