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