opik 1.5.2 → 1.5.4

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