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