arize-phoenix 8.28.0__py3-none-any.whl → 8.29.0__py3-none-any.whl

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.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- import{A as w,b5 as fe,b6 as Ae,b7 as ze,b8 as Tt,B as Dt,r as u,j as e,R as he,u as ut,w as I,l as s,aA as Le,aB as In,aD as we,aE as J,S as W,T as re,b9 as qe,ba as Je,ad as Dl,bb as Ki,ac as Qe,ah as ln,ag as G,U as xe,P as U,ax as ie,E as F,bc as Te,aI as ue,bd as Be,be as hm,a8 as _t,ay as Ca,a9 as Lt,bf as gn,bg as km,aJ as bm,bh as Sm,H as Ti,bi as mt,aP as _e,aO as Cn,bj as yn,bk as xn,m as yr,$ as vm,F as Pi,K as Cm,bl as Fm,bm as dl,bn as cl,bo as Ga,o as pt,bp as Km,aU as fr,bq as Tm,br as Ii,bs as Pm,bt as Im,bu as xm,bv as Dm,bw as _m,bx as Lm,by as wm,bz as Em,bA as Rm,bB as it,D as Mm,bC as Vm,bD as bt,g as hr,bE as Am,aF as _l,bF as kr,bG as br,bH as zm,ai as Nm,bI as $m,ae as Om,af as Qm,bJ as jm,n as qm}from"./vendor-BfhM_F1u.js";import{c as Z,D as ae,C as B,t as Ll,h as Dn,b as wt,L as Et,v as Rt,w as Sr,o as wl,P as Va,f as Oe,g as la,T as ve,E as Mt,q as ia,r as Aa,a as $e,d as ra,x as Fa,s as Vt,y as Bm,i as At,z as Um,A as Hm,B as Gm,G as El,H as Rl,u as Wm,J as Jm}from"./vendor-arizeai-CxXYQNUl.js";import{s as Zm,l as Xm,j as Ml,a as Ve,i as Vl,b as Ym,c as ep,d as ea,e as Fn,f as vr,D as Cr,g as Zn,h as tt,k as np,m as Ce,T as nn,n as ap,o as Al,p as xi,q as tp,r as Di,t as lp,u as ip,v as rp,G as zt,_ as h,w as v,x as V,I as _,E as gt,y as dn,z as C,A as X,R as Ke,B as Ie,C as ke,F as De,H as Ee,J as Re,K as cn,L as un,M as mn,N as zl,O as Fe,P as _n,Q as Fr,S as He,U as ne,V as ce,W as Ge,X as Kr,Y as It,Z as Ne,$ as zn,a0 as sp,a1 as Ye,a2 as Tr,a3 as Fl,a4 as Nl,a5 as $l,a6 as op,a7 as dp,a8 as Kl,a9 as St,aa as oe,ab as Pr,ac as cp,ad as up,ae as pn,af as mp,ag as En,ah as pp,ai as Ir,aj as Nt,ak as Ka,al as Ol,am as Ql,an as xr,ao as gp,ap as yp,aq as fp,ar as hp,as as kp,at as bp,au as Sp,av as rt,aw as vp,ax as me,ay as Tl,az as pe,aA as ge,aB as an,aC as Cp,aD as Fp,aE as Kp,aF as rn,aG as se,aH as Dr,aI as Tp,aJ as Pp,aK as Ip,aL as $t,aM as Ot,aN as _r,aO as xp,aP as Dp,aQ as _p,aR as Qt,aS as Lp,aT as Lr,aU as La,aV as st,aW as Ze,aX as wp,aY as jl,aZ as fn,a_ as Ep,a$ as Rp,b0 as Mp,b1 as Mn,b2 as Se,b3 as Ue,b4 as We,b5 as wr,b6 as sa,b7 as Me,b8 as za,b9 as Nn,ba as Vn,bb as jt,bc as Na,bd as Ta,be as Er,bf as sn,bg as Rr,bh as Vp,bi as ql,bj as fa,bk as Ap,bl as Gn,bm as zp,bn as Np,bo as Bl,bp as qt,bq as $n,br as oa,bs as _i,bt as Li,bu as $p,bv as Op,bw as Qp,bx as $a,by as jp,bz as qp,bA as ot,bB as Bp,bC as lt,bD as Kn,bE as Xn,bF as Bt,bG as Ut,bH as On,bI as Up,bJ as Hp,bK as on,bL as Tn,bM as ka,bN as Ul,bO as Mr,bP as Hl,bQ as Gp,bR as Wp,bS as Jp,bT as Gl,bU as Vr,bV as Ar,bW as zr,bX as Xe,bY as Nr,bZ as $r,b_ as Pl,b$ as Zp,c0 as Wl,c1 as Jl,c2 as Or,c3 as Xp,c4 as Yp,c5 as eg,c6 as Zl,c7 as ng,c8 as ag,c9 as Xl,ca as tg,cb as Qr,cc as lg,cd as ig,ce as rg,cf as sg,cg as og,ch as dg,ci as cg,cj as Ht,ck as ug,cl as mg,cm as jr,cn as qr,co as wi,cp as pg,cq as Ln,cr as Qn,cs as Yl,ct as Br,cu as Ur,cv as Ei,cw as Ri,cx as gg,cy as yg,cz as H,cA as Hr,cB as Gt,cC as Wt,cD as Oa,cE as Gr,cF as Qa,cG as ja,cH as Wr,cI as jn,cJ as Jt,cK as fg,cL as hg,cM as kg,cN as bg,cO as Sg,cP as vg,cQ as Cg,cR as ba,cS as Jr,cT as Fg,cU as Kg,cV as Mi,cW as Tg,cX as Pg,cY as Ig,cZ as xg,c_ as Dg,c$ as _g,d0 as Zr,d1 as Lg,d2 as wg,d3 as Eg,d4 as Rg,d5 as Sa,d6 as ei,d7 as Xr,d8 as _a,d9 as Zt,da as Yr,db as es,dc as ul,dd as Mg,de as ns,df as Vg,dg as ni,dh as Xt,di as kn,dj as Ag,dk as as,dl as zg,dm as Ng,dn as ts,dp as ls,dq as $g,dr as Og,ds as is,dt as Qg,du as na,dv as jg,dw as qg,dx as Vi,dy as Bg,dz as Ug,dA as Hg,dB as Gg,dC as Wg,dD as ml,dE as Jg,dF as wa,dG as Zg,dH as Xg,dI as Yg,dJ as ey,dK as Yt,dL as rs,dM as Ai,dN as ny,dO as ay,dP as ty,dQ as ly,dR as ss,dS as iy,dT as ry,dU as sy,dV as zi,dW as Ni}from"./components-BEtrHoeq.js";import{g as da,i as ca,d as oy,E as os,R as ua,k as ai,b as dy,p as yt,n as ds}from"./vendor-codemirror-B0NIFPOL.js";import{P as cs,C as us,T as qn,a as ms,R as Bn,b as ft,X as ma,Y as Pn,c as pa,B as Ra,A as dt,d as ps,e as ti,L as gs,f as cy}from"./vendor-recharts-CrrDFWK1.js";const uy=4,my={user:["user","human"],ai:["assistant","bot","ai"],system:["system"],tool:["tool"]},py="Unable to parse span input messages, expected messages which include a role and content.",gy="Unable to parse span output messages, expected messages which include a role and content.",yy="Unable to parse span output expected output.value to be present.",fy="Unable to parse span attributes, attributes must be valid JSON.",hy="Unable to parse model config, expected llm.model_name to be present.",ky="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",by="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",Sy="Unable to parse tools, expected tools to be an array of valid tools.",vy="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",$i={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"]},Yn="TOOL_CHOICE",Ea="tool_choice",vn="RESPONSE_FORMAT",bn="response_format",Cy=[Yn,vn],Fy=w.object({tool_call:w.object({id:w.string().optional(),function:w.object({name:w.string(),arguments:w.string()}).partial()}).partial()}).partial(),ys=w.object({[fe.message]:w.object({[Ae.role]:w.string(),[Ae.content]:w.union([w.string(),w.array(w.record(w.string(),w.unknown()))]).default(""),[Ae.tool_calls]:w.array(Fy).optional(),[Ae.tool_call_id]:w.string().optional()})}),Ky=w.object({[fe.llm]:w.object({[ze.input_messages]:w.array(ys)})}),Ty=w.object({[fe.llm]:w.object({[ze.output_messages]:w.array(ys)})}),Py=w.object({[fe.output]:w.object({value:w.string()})}),fs=Zm()(w.enum(["user","ai","system","tool"])),Iy=w.object({id:w.number(),role:fs,content:w.string().optional(),toolCallId:w.string().optional(),toolCalls:w.array(Xm).optional()}),xy=w.array(Iy),hs=w.lazy(()=>w.record(Ml)),Dy=hs,ks=w.string().transform((n,a)=>{const{json:t}=Ve(n);if(!Vl(t))return a.addIssue({code:w.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),w.NEVER;const{success:l,data:i}=Dy.safeParse(t);return l?i:(a.addIssue({code:w.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),w.NEVER)}).default("{}"),_y=w.object({[fe.llm]:w.object({[ze.provider]:w.string().optional(),[ze.model_name]:w.string()})}),bs=w.object({[fe.llm]:w.object({[ze.invocation_parameters]:ks})}),Ly=w.object({[fe.llm]:w.object({[ze.invocation_parameters]:ks.pipe(w.object({response_format:hs.optional()}))})}),wy=w.object({url:w.object({full:w.string(),path:w.string().optional()})}),Ey=w.string().transform((n,a)=>{const{json:t}=Ve(n);return t==null||!Vl(t)?(a.addIssue({code:w.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),w.NEVER):t}).transform((n,a)=>{const{data:t,success:l}=Ym.safeParse(n);return l?t:(a.addIssue({code:w.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),w.NEVER)}),Ry=w.object({[fe.llm]:w.object({[ze.tools]:w.array(w.object({[fe.tool]:w.object({[Tt.json_schema]:Ey})}).optional()).optional()}).optional()}).optional(),My=w.lazy(()=>w.object({type:w.literal("json_schema"),json_schema:w.object({name:w.string().describe("The name of the schema"),schema:ep.describe("The schema itself in JSON schema format"),strict:w.literal(!0).describe("The schema must be strict")})})),Vy=Dt(My,{removeAdditionalStrategy:"passthrough"}),Ay=w.string().transform((n,a)=>{const{json:t}=Ve(n);return ea(t)?Object.entries(t).reduce((i,[r,o])=>{if(typeof o=="string")i[r]=o;else{const{json:d}=Fn(o);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:w.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),w.NEVER)}),zy=w.object({[fe.llm]:w.object({[ze.prompt_template]:w.object({variables:Ay}).optional()}).optional()}).optional();function Ss(n){return fs.safeParse(n).success}function Wn(n){const a=n.toLowerCase();if(Ss(a))return a;for(const[t,l]of Object.entries(my))if(l.includes(a))return t;return np}function Ny({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:t})=>{var i,r,o,d;if(t==null)return null;let l={};if(((i=t.function)==null?void 0:i.arguments)!=null){const{json:c}=Ve(t.function.arguments);ea(c)&&(l=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":return{id:t.id??"",type:"function",function:{name:((r=t.function)==null?void 0:r.name)??"",arguments:l}};case"ANTHROPIC":return{id:t.id??"",type:"tool_use",name:((o=t.function)==null?void 0:o.name)??"",input:l};case"GOOGLE":return{id:t.id??"",function:{name:((d=t.function)==null?void 0:d.name)??"",arguments:l}};default:Ce()}}).filter(t=>t!=null)}function vs({messages:n,provider:a}){return n.map(({message:t})=>({id:Zn(),role:t.tool_call_id!=null?Wn("tool"):Wn(t.role),content:typeof t.content=="string"?t.content:void 0,toolCalls:Ny({provider:a,toolCalls:t.tool_calls}),toolCallId:t.tool_call_id}))}function $y({provider:n,parsedAttributes:a}){var l;const t=Ky.safeParse(a);if(!t.success)return{messageParsingErrors:[py],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=bs.safeParse(a);if(i){const o=t.data.llm.input_messages,d=(l=r.llm.invocation_parameters)==null?void 0:l.system;typeof d=="string"&&d&&(!o||o[0].message.role!=="system")&&t.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:vs({provider:n,messages:t.data.llm.input_messages})}}function Oy({provider:n,parsedAttributes:a}){const t=[],l=Ty.safeParse(a);if(l.success)return{output:vs({provider:n,messages:l.data.llm.output_messages}),outputParsingErrors:t};t.push(gy);const i=Py.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:t}:(t.push(yy),{output:void 0,outputParsingErrors:t})}function Cs(n){if(n==null)return null;switch(n.toLowerCase()){case"openai":return"OPENAI";case"anthropic":return"ANTHROPIC";case"google":return"GOOGLE";case"azure":return"AZURE_OPENAI";default:return null}}function Qy(n){for(const a of Object.keys($i))if($i[a].some(l=>n.includes(l)))return a;return Cr}function jy(n){const{success:a,data:t}=_y.safeParse(n);if(a){const l=Cs(t.llm.provider)||Qy(t.llm.model_name),i=qy(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,o])=>o!==null)),modelName:t.llm.model_name,provider:l,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[hy]}}function qy(n){const{success:a,data:t}=wy.safeParse(n);if(a)try{const l=new URL(t.url.full);let i=l;if(t.url.path)try{i=new URL(t.url.full.split(t.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:l.origin,apiVersion:l.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function By(n,a=[]){const{success:t,data:l}=bs.safeParse(n),i=[];return t||i.push(ky),{invocationParameters:ef((l==null?void 0:l.llm.invocation_parameters)??{},a),parsingErrors:i}}function Uy(n){const{success:a,data:t}=Ly.safeParse(n);return a?{responseFormat:t.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[by]}}function Hy(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(t=>(t==null?void 0:t.tool)==null?null:{id:tt(),definition:t.tool.json_schema}).filter(t=>t!=null)}function Gy(n){var l;const{data:a,success:t}=Ry.safeParse(n);return t?((l=a==null?void 0:a.llm)==null?void 0:l.tools)==null?{tools:null,parsingErrors:[]}:{tools:Hy(a),parsingErrors:[]}:{tools:null,parsingErrors:[Sy]}}function Wy(n){var l;const{success:a,data:t}=zy.safeParse(n);return a?((l=t==null?void 0:t.llm)==null?void 0:l.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:t.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[vy]}}function Jy(n){const{instance:a,instanceMessages:t}=vr(),l={...a,template:{__type:"chat",messages:Object.values(t)}},{json:i,parseError:r}=Ve(n.attributes);if(r)return{playgroundInstance:{...l,spanId:(n==null?void 0:n.id)??null},parsingErrors:[fy]};const o=n.invocationParameters,d=jy(i);let{modelConfig:c}=d;const{parsingErrors:p}=d,{messages:f,messageParsingErrors:m}=$y({provider:(c==null?void 0:c.provider)??l.model.provider,parsedAttributes:i}),{output:g,outputParsingErrors:y}=Oy({provider:(c==null?void 0:c.provider)??l.model.provider,parsedAttributes:i}),{invocationParameters:k,parsingErrors:b}=By(i,o),{variables:S,parsingErrors:K}=Wy(i),{parsingErrors:T}=Uy(i);c=c!=null?{...c,invocationParameters:T.length>0?k.filter(D=>D.invocationName!==bn&&D.canonicalName!==vn):k}:null;const{tools:x,parsingErrors:L}=Gy(i),P=f==null?void 0:f.map(D=>({...D,content:D.role==="tool"?li(D.content):D.content}));return{playgroundInstance:{...l,model:c??l.model,template:P!=null?{__type:"chat",messages:P}:l.template,output:g,spanId:n.id,tools:x??l.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...m,...y,...p,...L,...b,...T,...K]}}const Zy=n=>xy.safeParse(n).success,Fs=({instance:n,templateFormat:a})=>{if(a==nn.NONE)return[];const t=new Set,l=n.template.__type,i=ap(a);switch(l){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{t.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(o=>{t.add(o)});break}default:Ce()}return Array.from(t)},Xy=({instances:n,templateFormat:a})=>a==nn.NONE?[]:Array.from(new Set(n.flatMap(t=>Fs({instance:t,templateFormat:a})))),Ks=({instances:n,templateFormat:a,input:t})=>{if(a==nn.NONE)return{variablesMap:{},variableKeys:[]};const l=Xy({instances:n,templateFormat:a}),i=t.variablesValueCache??{};return{variablesMap:l.reduce((o,d)=>(o[d]=i[d]||"",o),{}),variableKeys:l}};function aa(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const Yy=(n,a)=>n.filter(t=>a.some(l=>aa(l,t))).map(t=>{var l;return{...t,invocationName:((l=a.find(i=>aa(i,t)))==null?void 0:l.invocationName)??t.invocationName}}),qa=n=>n.replace(/_([a-z])/g,(a,t)=>t.toUpperCase()),ef=(n,a)=>Object.entries(n).map(([t,l])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===t.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===t.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[qa(i.invocationInputField)]:l}}).filter(t=>t!=null),Ts=n=>{const{provider:a,validatedToolDefinition:t}=ip(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return t.function.name;case"ANTHROPIC":return t.name;case"UNKNOWN":return null;default:Ce()}},nf=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return{id:tt(),definition:Di(a)};case"ANTHROPIC":return{id:tt(),definition:lp(a)};case"GOOGLE":return{id:tt(),definition:Di(a)};default:Ce()}},af=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return xi();case"ANTHROPIC":return tp();case"GOOGLE":return xi();default:Ce()}};function tf(n){return{content:n.content,role:lf(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function lf(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ce()}}const Ps=({playgroundStore:n,instanceId:a,credentials:t})=>{var m;const{instances:l,allInstanceMessages:i}=n.getState(),r=l.find(g=>g.id===a);if(!r)throw new Error(`No instance found for id ${a}`);if(r.template.__type!=="chat")throw new Error("We only support chat templates for now");const o=r.template.messageIds.map(g=>i[g]).filter(g=>g!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const p=Al({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(g=>g.invocationName!==Ea&&g.canonicalName!==Yn),c.push({canonicalName:Yn,invocationName:Ea,valueJson:p})):c=c.filter(g=>g.invocationName!==Ea&&g.canonicalName!==Yn),c=d.length?Yy(c,d):c;const f=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{};return{messages:o.map(tf),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...f},invocationParameters:xs(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(g=>g.definition):void 0,apiKey:t[r.model.provider]||null,promptName:(m=r.prompt)==null?void 0:m.name}},el=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:t,...l}=n.template;return{...n,template:{...l,messages:n.template.messageIds.map(i=>a[i])}}}return n},rf=({playgroundStore:n,instanceId:a,credentials:t})=>{const l=Ps({playgroundStore:n,instanceId:a,credentials:t}),{instances:i,templateFormat:r,input:o,allInstanceMessages:d}=n.getState(),c=i.map(f=>el(f,d)),{variablesMap:p}=Ks({instances:c,input:o,templateFormat:r});return{...l,template:{variables:p,format:r}}},Oi=({playgroundStore:n,instanceId:a,credentials:t,datasetId:l})=>({...Ps({playgroundStore:n,instanceId:a,credentials:t}),templateFormat:n.getState().templateFormat,datasetId:l});function li(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const l=JSON.parse(n),i=typeof l=="string"?JSON.parse(l):l;return JSON.stringify(i,null,2)}}catch{}if(/^\s*[0-9{[]|true|false|null/.test(n))return n}return JSON.stringify(n,null,2)}function Is(n,a){return a.filter(t=>t.required).every(t=>n.some(l=>aa(l,t)))}const sf=n=>{for(const[a,t]of Object.entries(n))if(a.endsWith("DefaultValue")&&t!=null)return n[a]};function WC(n,a){const t=new Map(n.map(l=>[l.invocationName,l]));return a.forEach(l=>{var c;const i=l.invocationName,r=sf(l),o=qa(l.invocationInputField||"");if(!l.invocationName||!l.invocationInputField||!i||r==null||((c=t.get(i))==null?void 0:c[o])!=null)return;const d={canonicalName:l.canonicalName,invocationName:l.invocationName,[o]:r};t.set(i,d)}),Array.from(t.values())}const of=w.object({type:w.literal("enabled")}).passthrough(),df=w.object({type:w.enum(["any","tool"])}).passthrough(),cf=(n,a)=>{if(!a)return n;const t=n.some(l=>l.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&l.valueJson&&of.safeParse(l.valueJson).success);return n.filter(l=>{if(l.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!l.valueJson)return!1;if(t){if(l.canonicalName==="TEMPERATURE"||l.canonicalName==="TOP_P")return!1;if(l.canonicalName===Yn)return!df.safeParse(l.valueJson).success}return!0})},xs=(n,a,t)=>a==="ANTHROPIC"?cf(n,t):n,Ds=u.createContext(null);function JC({children:n,...a}){const[t]=u.useState(()=>rp(a));return e(Ds.Provider,{value:t,children:n})}function Ma(n,a){const t=he.useContext(Ds);if(!t)throw new Error("Missing CredentialsContext.Provider in the tree");return ut(t,n,a)}const _s=u.createContext(null);function uf(){const n=u.useContext(_s);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function ZC(n){return e(_s.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const Ls={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"GenerativeProvidersCard_data",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyEnvVar",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeySet",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ls.hash="0168d590171b96e7a2e41449a41754be";function mf({query:n}){const[a,t]=u.useState(null),l=Ma(f=>f),i=Ma(f=>f.setCredential),r=I.useFragment(Ls,n),o=u.useMemo(()=>[...r.modelProviders],[r]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:f})=>s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(zt,{provider:f.original.key,height:18}),f.original.name]})},{header:"Environment Variable",accessorKey:"apiKeyEnvVar",cell:({row:f})=>e(v,{children:f.original.apiKeyEnvVar})},{header:"configuration",accessorKey:"apiKeySet",cell:({row:f})=>f.original.dependenciesInstalled?l[f.original.key]?e(v,{color:"success",children:"local"}):f.original.apiKeySet?e(v,{color:"success",children:"configured on the server"}):e(v,{color:"text-700",children:"not configured"}):e(v,{color:"warning",children:"missing dependencies"})},{header:"",accessorKey:"id",cell:({row:f})=>e(h,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:e(V,{size:"S",leadingVisual:e(_,{svg:e(gt,{})}),onPress:()=>{t(f.original)}})})}],[l]),c=Le({columns:d,data:o,getCoreRowModel:we(),getSortedRowModel:In()}),p=c.getRowModel().rows;return s(B,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:[s("table",{css:dn,children:[e("thead",{children:c.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:e("div",{children:J(m.column.columnDef.header,m.getContext())})},m.id))},f.id))}),e("tbody",{children:p.map(f=>e("tr",{children:f.getVisibleCells().map(m=>e("td",{children:J(m.column.columnDef.cell,m.getContext())},m.id))},f.id))})]}),e(ae,{type:"modal",isDismissable:!0,onDismiss:()=>t(null),children:a&&s(Z,{title:`Set ${a.name} API Key`,size:"S",children:[s(C,{padding:"size-200",children:[e(C,{paddingBottom:"size-100",children:s(v,{size:"XS",children:["Set the credentials for the ",a.name," API. These credentials will be stored entirely in your browser and will only be sent to the server during API requests."]})}),s(X,{onChange:f=>{i({provider:a.key,value:f})},value:l[a.key],type:"password",children:[e(W,{children:`${a.name} API Key`}),e(re,{placeholder:`e.g. ${a.apiKeyEnvVar}`}),e(v,{slot:"description",children:"The API key will be stored locally in your browser"})]})]}),e(C,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:e(h,{direction:"row",justifyContent:"end",gap:"size-100",children:e(V,{variant:"primary",size:"S",onPress:()=>{t(null)},children:"Set API Key"})})})]})})]})}function XC(){const n=qe();return Je(n),e(mf,{query:n})}const ws={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAIProvidersPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"GenerativeProvidersCard_data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAIProvidersPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyEnvVar",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeySet",storageKey:null}],storageKey:null}]},params:{cacheID:"cc6e19e54ea894e905970362ee382e43",id:null,metadata:{},name:"settingsAIProvidersPageLoaderQuery",operationKind:"query",text:`query settingsAIProvidersPageLoaderQuery {
1
+ import{A as w,b5 as fe,b6 as Ae,b7 as ze,b8 as Tt,B as Dt,r as u,j as e,R as he,u as ut,w as I,l as s,aA as Le,aB as In,aD as we,aE as J,S as W,T as re,b9 as qe,ba as Je,ad as Dl,bb as Ki,ac as Qe,ah as ln,ag as G,U as xe,P as U,ax as ie,E as F,bc as Te,aI as ue,bd as Be,be as hm,a8 as _t,ay as Ca,a9 as Lt,bf as gn,bg as km,aJ as bm,bh as Sm,H as Ti,bi as mt,aP as _e,aO as Cn,bj as yn,bk as xn,m as yr,$ as vm,F as Pi,K as Cm,bl as Fm,bm as dl,bn as cl,bo as Ga,o as pt,bp as Km,aU as fr,bq as Tm,br as Ii,bs as Pm,bt as Im,bu as xm,bv as Dm,bw as _m,bx as Lm,by as wm,bz as Em,bA as Rm,bB as it,D as Mm,bC as Vm,bD as bt,g as hr,bE as Am,aF as _l,bF as kr,bG as br,bH as zm,ai as Nm,bI as $m,ae as Om,af as Qm,bJ as jm,n as qm}from"./vendor-BfhM_F1u.js";import{c as Z,D as ae,C as B,t as Ll,h as Dn,b as wt,L as Et,v as Rt,w as Sr,o as wl,P as Va,f as Oe,g as la,T as ve,E as Mt,q as ia,r as Aa,a as $e,d as ra,x as Fa,s as Vt,y as Bm,i as At,z as Um,A as Hm,B as Gm,G as El,H as Rl,u as Wm,J as Jm}from"./vendor-arizeai-CxXYQNUl.js";import{s as Zm,l as Xm,j as Ml,a as Ve,i as Vl,b as Ym,c as ep,d as ea,e as Fn,f as vr,D as Cr,g as Zn,h as tt,k as np,m as Ce,T as nn,n as ap,o as Al,p as xi,q as tp,r as Di,t as lp,u as ip,v as rp,G as zt,_ as h,w as v,x as V,I as _,E as gt,y as dn,z as C,A as X,R as Ke,B as Ie,C as ke,F as De,H as Ee,J as Re,K as cn,L as un,M as mn,N as zl,O as Fe,P as _n,Q as Fr,S as He,U as ne,V as ce,W as Ge,X as Kr,Y as It,Z as Ne,$ as zn,a0 as sp,a1 as Ye,a2 as Tr,a3 as Fl,a4 as Nl,a5 as $l,a6 as op,a7 as dp,a8 as Kl,a9 as St,aa as oe,ab as Pr,ac as cp,ad as up,ae as pn,af as mp,ag as En,ah as pp,ai as Ir,aj as Nt,ak as Ka,al as Ol,am as Ql,an as xr,ao as gp,ap as yp,aq as fp,ar as hp,as as kp,at as bp,au as Sp,av as rt,aw as vp,ax as me,ay as Tl,az as pe,aA as ge,aB as an,aC as Cp,aD as Fp,aE as Kp,aF as rn,aG as se,aH as Dr,aI as Tp,aJ as Pp,aK as Ip,aL as $t,aM as Ot,aN as _r,aO as xp,aP as Dp,aQ as _p,aR as Qt,aS as Lp,aT as Lr,aU as La,aV as st,aW as Ze,aX as wp,aY as jl,aZ as fn,a_ as Ep,a$ as Rp,b0 as Mp,b1 as Mn,b2 as Se,b3 as Ue,b4 as We,b5 as wr,b6 as sa,b7 as Me,b8 as za,b9 as Nn,ba as Vn,bb as jt,bc as Na,bd as Ta,be as Er,bf as sn,bg as Rr,bh as Vp,bi as ql,bj as fa,bk as Ap,bl as Gn,bm as zp,bn as Np,bo as Bl,bp as qt,bq as $n,br as oa,bs as _i,bt as Li,bu as $p,bv as Op,bw as Qp,bx as $a,by as jp,bz as qp,bA as ot,bB as Bp,bC as lt,bD as Kn,bE as Xn,bF as Bt,bG as Ut,bH as On,bI as Up,bJ as Hp,bK as on,bL as Tn,bM as ka,bN as Ul,bO as Mr,bP as Hl,bQ as Gp,bR as Wp,bS as Jp,bT as Gl,bU as Vr,bV as Ar,bW as zr,bX as Xe,bY as Nr,bZ as $r,b_ as Pl,b$ as Zp,c0 as Wl,c1 as Jl,c2 as Or,c3 as Xp,c4 as Yp,c5 as eg,c6 as Zl,c7 as ng,c8 as ag,c9 as Xl,ca as tg,cb as Qr,cc as lg,cd as ig,ce as rg,cf as sg,cg as og,ch as dg,ci as cg,cj as Ht,ck as ug,cl as mg,cm as jr,cn as qr,co as wi,cp as pg,cq as Ln,cr as Qn,cs as Yl,ct as Br,cu as Ur,cv as Ei,cw as Ri,cx as gg,cy as yg,cz as H,cA as Hr,cB as Gt,cC as Wt,cD as Oa,cE as Gr,cF as Qa,cG as ja,cH as Wr,cI as jn,cJ as Jt,cK as fg,cL as hg,cM as kg,cN as bg,cO as Sg,cP as vg,cQ as Cg,cR as ba,cS as Jr,cT as Fg,cU as Kg,cV as Mi,cW as Tg,cX as Pg,cY as Ig,cZ as xg,c_ as Dg,c$ as _g,d0 as Zr,d1 as Lg,d2 as wg,d3 as Eg,d4 as Rg,d5 as Sa,d6 as ei,d7 as Xr,d8 as _a,d9 as Zt,da as Yr,db as es,dc as ul,dd as Mg,de as ns,df as Vg,dg as ni,dh as Xt,di as kn,dj as Ag,dk as as,dl as zg,dm as Ng,dn as ts,dp as ls,dq as $g,dr as Og,ds as is,dt as Qg,du as na,dv as jg,dw as qg,dx as Vi,dy as Bg,dz as Ug,dA as Hg,dB as Gg,dC as Wg,dD as ml,dE as Jg,dF as wa,dG as Zg,dH as Xg,dI as Yg,dJ as ey,dK as Yt,dL as rs,dM as Ai,dN as ny,dO as ay,dP as ty,dQ as ly,dR as ss,dS as iy,dT as ry,dU as sy,dV as zi,dW as Ni}from"./components-DepxScNF.js";import{g as da,i as ca,d as oy,E as os,R as ua,k as ai,b as dy,p as yt,n as ds}from"./vendor-codemirror-B0NIFPOL.js";import{P as cs,C as us,T as qn,a as ms,R as Bn,b as ft,X as ma,Y as Pn,c as pa,B as Ra,A as dt,d as ps,e as ti,L as gs,f as cy}from"./vendor-recharts-CrrDFWK1.js";const uy=4,my={user:["user","human"],ai:["assistant","bot","ai"],system:["system"],tool:["tool"]},py="Unable to parse span input messages, expected messages which include a role and content.",gy="Unable to parse span output messages, expected messages which include a role and content.",yy="Unable to parse span output expected output.value to be present.",fy="Unable to parse span attributes, attributes must be valid JSON.",hy="Unable to parse model config, expected llm.model_name to be present.",ky="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",by="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",Sy="Unable to parse tools, expected tools to be an array of valid tools.",vy="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",$i={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"]},Yn="TOOL_CHOICE",Ea="tool_choice",vn="RESPONSE_FORMAT",bn="response_format",Cy=[Yn,vn],Fy=w.object({tool_call:w.object({id:w.string().optional(),function:w.object({name:w.string(),arguments:w.string()}).partial()}).partial()}).partial(),ys=w.object({[fe.message]:w.object({[Ae.role]:w.string(),[Ae.content]:w.union([w.string(),w.array(w.record(w.string(),w.unknown()))]).default(""),[Ae.tool_calls]:w.array(Fy).optional(),[Ae.tool_call_id]:w.string().optional()})}),Ky=w.object({[fe.llm]:w.object({[ze.input_messages]:w.array(ys)})}),Ty=w.object({[fe.llm]:w.object({[ze.output_messages]:w.array(ys)})}),Py=w.object({[fe.output]:w.object({value:w.string()})}),fs=Zm()(w.enum(["user","ai","system","tool"])),Iy=w.object({id:w.number(),role:fs,content:w.string().optional(),toolCallId:w.string().optional(),toolCalls:w.array(Xm).optional()}),xy=w.array(Iy),hs=w.lazy(()=>w.record(Ml)),Dy=hs,ks=w.string().transform((n,a)=>{const{json:t}=Ve(n);if(!Vl(t))return a.addIssue({code:w.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),w.NEVER;const{success:l,data:i}=Dy.safeParse(t);return l?i:(a.addIssue({code:w.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),w.NEVER)}).default("{}"),_y=w.object({[fe.llm]:w.object({[ze.provider]:w.string().optional(),[ze.model_name]:w.string()})}),bs=w.object({[fe.llm]:w.object({[ze.invocation_parameters]:ks})}),Ly=w.object({[fe.llm]:w.object({[ze.invocation_parameters]:ks.pipe(w.object({response_format:hs.optional()}))})}),wy=w.object({url:w.object({full:w.string(),path:w.string().optional()})}),Ey=w.string().transform((n,a)=>{const{json:t}=Ve(n);return t==null||!Vl(t)?(a.addIssue({code:w.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),w.NEVER):t}).transform((n,a)=>{const{data:t,success:l}=Ym.safeParse(n);return l?t:(a.addIssue({code:w.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),w.NEVER)}),Ry=w.object({[fe.llm]:w.object({[ze.tools]:w.array(w.object({[fe.tool]:w.object({[Tt.json_schema]:Ey})}).optional()).optional()}).optional()}).optional(),My=w.lazy(()=>w.object({type:w.literal("json_schema"),json_schema:w.object({name:w.string().describe("The name of the schema"),schema:ep.describe("The schema itself in JSON schema format"),strict:w.literal(!0).describe("The schema must be strict")})})),Vy=Dt(My,{removeAdditionalStrategy:"passthrough"}),Ay=w.string().transform((n,a)=>{const{json:t}=Ve(n);return ea(t)?Object.entries(t).reduce((i,[r,o])=>{if(typeof o=="string")i[r]=o;else{const{json:d}=Fn(o);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:w.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),w.NEVER)}),zy=w.object({[fe.llm]:w.object({[ze.prompt_template]:w.object({variables:Ay}).optional()}).optional()}).optional();function Ss(n){return fs.safeParse(n).success}function Wn(n){const a=n.toLowerCase();if(Ss(a))return a;for(const[t,l]of Object.entries(my))if(l.includes(a))return t;return np}function Ny({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:t})=>{var i,r,o,d;if(t==null)return null;let l={};if(((i=t.function)==null?void 0:i.arguments)!=null){const{json:c}=Ve(t.function.arguments);ea(c)&&(l=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":return{id:t.id??"",type:"function",function:{name:((r=t.function)==null?void 0:r.name)??"",arguments:l}};case"ANTHROPIC":return{id:t.id??"",type:"tool_use",name:((o=t.function)==null?void 0:o.name)??"",input:l};case"GOOGLE":return{id:t.id??"",function:{name:((d=t.function)==null?void 0:d.name)??"",arguments:l}};default:Ce()}}).filter(t=>t!=null)}function vs({messages:n,provider:a}){return n.map(({message:t})=>({id:Zn(),role:t.tool_call_id!=null?Wn("tool"):Wn(t.role),content:typeof t.content=="string"?t.content:void 0,toolCalls:Ny({provider:a,toolCalls:t.tool_calls}),toolCallId:t.tool_call_id}))}function $y({provider:n,parsedAttributes:a}){var l;const t=Ky.safeParse(a);if(!t.success)return{messageParsingErrors:[py],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=bs.safeParse(a);if(i){const o=t.data.llm.input_messages,d=(l=r.llm.invocation_parameters)==null?void 0:l.system;typeof d=="string"&&d&&(!o||o[0].message.role!=="system")&&t.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:vs({provider:n,messages:t.data.llm.input_messages})}}function Oy({provider:n,parsedAttributes:a}){const t=[],l=Ty.safeParse(a);if(l.success)return{output:vs({provider:n,messages:l.data.llm.output_messages}),outputParsingErrors:t};t.push(gy);const i=Py.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:t}:(t.push(yy),{output:void 0,outputParsingErrors:t})}function Cs(n){if(n==null)return null;switch(n.toLowerCase()){case"openai":return"OPENAI";case"anthropic":return"ANTHROPIC";case"google":return"GOOGLE";case"azure":return"AZURE_OPENAI";default:return null}}function Qy(n){for(const a of Object.keys($i))if($i[a].some(l=>n.includes(l)))return a;return Cr}function jy(n){const{success:a,data:t}=_y.safeParse(n);if(a){const l=Cs(t.llm.provider)||Qy(t.llm.model_name),i=qy(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,o])=>o!==null)),modelName:t.llm.model_name,provider:l,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[hy]}}function qy(n){const{success:a,data:t}=wy.safeParse(n);if(a)try{const l=new URL(t.url.full);let i=l;if(t.url.path)try{i=new URL(t.url.full.split(t.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:l.origin,apiVersion:l.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function By(n,a=[]){const{success:t,data:l}=bs.safeParse(n),i=[];return t||i.push(ky),{invocationParameters:ef((l==null?void 0:l.llm.invocation_parameters)??{},a),parsingErrors:i}}function Uy(n){const{success:a,data:t}=Ly.safeParse(n);return a?{responseFormat:t.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[by]}}function Hy(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(t=>(t==null?void 0:t.tool)==null?null:{id:tt(),definition:t.tool.json_schema}).filter(t=>t!=null)}function Gy(n){var l;const{data:a,success:t}=Ry.safeParse(n);return t?((l=a==null?void 0:a.llm)==null?void 0:l.tools)==null?{tools:null,parsingErrors:[]}:{tools:Hy(a),parsingErrors:[]}:{tools:null,parsingErrors:[Sy]}}function Wy(n){var l;const{success:a,data:t}=zy.safeParse(n);return a?((l=t==null?void 0:t.llm)==null?void 0:l.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:t.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[vy]}}function Jy(n){const{instance:a,instanceMessages:t}=vr(),l={...a,template:{__type:"chat",messages:Object.values(t)}},{json:i,parseError:r}=Ve(n.attributes);if(r)return{playgroundInstance:{...l,spanId:(n==null?void 0:n.id)??null},parsingErrors:[fy]};const o=n.invocationParameters,d=jy(i);let{modelConfig:c}=d;const{parsingErrors:p}=d,{messages:f,messageParsingErrors:m}=$y({provider:(c==null?void 0:c.provider)??l.model.provider,parsedAttributes:i}),{output:g,outputParsingErrors:y}=Oy({provider:(c==null?void 0:c.provider)??l.model.provider,parsedAttributes:i}),{invocationParameters:k,parsingErrors:b}=By(i,o),{variables:S,parsingErrors:K}=Wy(i),{parsingErrors:T}=Uy(i);c=c!=null?{...c,invocationParameters:T.length>0?k.filter(D=>D.invocationName!==bn&&D.canonicalName!==vn):k}:null;const{tools:x,parsingErrors:L}=Gy(i),P=f==null?void 0:f.map(D=>({...D,content:D.role==="tool"?li(D.content):D.content}));return{playgroundInstance:{...l,model:c??l.model,template:P!=null?{__type:"chat",messages:P}:l.template,output:g,spanId:n.id,tools:x??l.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...m,...y,...p,...L,...b,...T,...K]}}const Zy=n=>xy.safeParse(n).success,Fs=({instance:n,templateFormat:a})=>{if(a==nn.NONE)return[];const t=new Set,l=n.template.__type,i=ap(a);switch(l){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{t.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(o=>{t.add(o)});break}default:Ce()}return Array.from(t)},Xy=({instances:n,templateFormat:a})=>a==nn.NONE?[]:Array.from(new Set(n.flatMap(t=>Fs({instance:t,templateFormat:a})))),Ks=({instances:n,templateFormat:a,input:t})=>{if(a==nn.NONE)return{variablesMap:{},variableKeys:[]};const l=Xy({instances:n,templateFormat:a}),i=t.variablesValueCache??{};return{variablesMap:l.reduce((o,d)=>(o[d]=i[d]||"",o),{}),variableKeys:l}};function aa(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const Yy=(n,a)=>n.filter(t=>a.some(l=>aa(l,t))).map(t=>{var l;return{...t,invocationName:((l=a.find(i=>aa(i,t)))==null?void 0:l.invocationName)??t.invocationName}}),qa=n=>n.replace(/_([a-z])/g,(a,t)=>t.toUpperCase()),ef=(n,a)=>Object.entries(n).map(([t,l])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===t.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===t.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[qa(i.invocationInputField)]:l}}).filter(t=>t!=null),Ts=n=>{const{provider:a,validatedToolDefinition:t}=ip(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return t.function.name;case"ANTHROPIC":return t.name;case"UNKNOWN":return null;default:Ce()}},nf=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return{id:tt(),definition:Di(a)};case"ANTHROPIC":return{id:tt(),definition:lp(a)};case"GOOGLE":return{id:tt(),definition:Di(a)};default:Ce()}},af=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return xi();case"ANTHROPIC":return tp();case"GOOGLE":return xi();default:Ce()}};function tf(n){return{content:n.content,role:lf(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function lf(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ce()}}const Ps=({playgroundStore:n,instanceId:a,credentials:t})=>{var m;const{instances:l,allInstanceMessages:i}=n.getState(),r=l.find(g=>g.id===a);if(!r)throw new Error(`No instance found for id ${a}`);if(r.template.__type!=="chat")throw new Error("We only support chat templates for now");const o=r.template.messageIds.map(g=>i[g]).filter(g=>g!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const p=Al({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(g=>g.invocationName!==Ea&&g.canonicalName!==Yn),c.push({canonicalName:Yn,invocationName:Ea,valueJson:p})):c=c.filter(g=>g.invocationName!==Ea&&g.canonicalName!==Yn),c=d.length?Yy(c,d):c;const f=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{};return{messages:o.map(tf),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...f},invocationParameters:xs(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(g=>g.definition):void 0,apiKey:t[r.model.provider]||null,promptName:(m=r.prompt)==null?void 0:m.name}},el=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:t,...l}=n.template;return{...n,template:{...l,messages:n.template.messageIds.map(i=>a[i])}}}return n},rf=({playgroundStore:n,instanceId:a,credentials:t})=>{const l=Ps({playgroundStore:n,instanceId:a,credentials:t}),{instances:i,templateFormat:r,input:o,allInstanceMessages:d}=n.getState(),c=i.map(f=>el(f,d)),{variablesMap:p}=Ks({instances:c,input:o,templateFormat:r});return{...l,template:{variables:p,format:r}}},Oi=({playgroundStore:n,instanceId:a,credentials:t,datasetId:l})=>({...Ps({playgroundStore:n,instanceId:a,credentials:t}),templateFormat:n.getState().templateFormat,datasetId:l});function li(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const l=JSON.parse(n),i=typeof l=="string"?JSON.parse(l):l;return JSON.stringify(i,null,2)}}catch{}if(/^\s*[0-9{[]|true|false|null/.test(n))return n}return JSON.stringify(n,null,2)}function Is(n,a){return a.filter(t=>t.required).every(t=>n.some(l=>aa(l,t)))}const sf=n=>{for(const[a,t]of Object.entries(n))if(a.endsWith("DefaultValue")&&t!=null)return n[a]};function WC(n,a){const t=new Map(n.map(l=>[l.invocationName,l]));return a.forEach(l=>{var c;const i=l.invocationName,r=sf(l),o=qa(l.invocationInputField||"");if(!l.invocationName||!l.invocationInputField||!i||r==null||((c=t.get(i))==null?void 0:c[o])!=null)return;const d={canonicalName:l.canonicalName,invocationName:l.invocationName,[o]:r};t.set(i,d)}),Array.from(t.values())}const of=w.object({type:w.literal("enabled")}).passthrough(),df=w.object({type:w.enum(["any","tool"])}).passthrough(),cf=(n,a)=>{if(!a)return n;const t=n.some(l=>l.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&l.valueJson&&of.safeParse(l.valueJson).success);return n.filter(l=>{if(l.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!l.valueJson)return!1;if(t){if(l.canonicalName==="TEMPERATURE"||l.canonicalName==="TOP_P")return!1;if(l.canonicalName===Yn)return!df.safeParse(l.valueJson).success}return!0})},xs=(n,a,t)=>a==="ANTHROPIC"?cf(n,t):n,Ds=u.createContext(null);function JC({children:n,...a}){const[t]=u.useState(()=>rp(a));return e(Ds.Provider,{value:t,children:n})}function Ma(n,a){const t=he.useContext(Ds);if(!t)throw new Error("Missing CredentialsContext.Provider in the tree");return ut(t,n,a)}const _s=u.createContext(null);function uf(){const n=u.useContext(_s);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function ZC(n){return e(_s.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const Ls={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"GenerativeProvidersCard_data",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyEnvVar",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeySet",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ls.hash="0168d590171b96e7a2e41449a41754be";function mf({query:n}){const[a,t]=u.useState(null),l=Ma(f=>f),i=Ma(f=>f.setCredential),r=I.useFragment(Ls,n),o=u.useMemo(()=>[...r.modelProviders],[r]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:f})=>s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(zt,{provider:f.original.key,height:18}),f.original.name]})},{header:"Environment Variable",accessorKey:"apiKeyEnvVar",cell:({row:f})=>e(v,{children:f.original.apiKeyEnvVar})},{header:"configuration",accessorKey:"apiKeySet",cell:({row:f})=>f.original.dependenciesInstalled?l[f.original.key]?e(v,{color:"success",children:"local"}):f.original.apiKeySet?e(v,{color:"success",children:"configured on the server"}):e(v,{color:"text-700",children:"not configured"}):e(v,{color:"warning",children:"missing dependencies"})},{header:"",accessorKey:"id",cell:({row:f})=>e(h,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:e(V,{size:"S",leadingVisual:e(_,{svg:e(gt,{})}),onPress:()=>{t(f.original)}})})}],[l]),c=Le({columns:d,data:o,getCoreRowModel:we(),getSortedRowModel:In()}),p=c.getRowModel().rows;return s(B,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:[s("table",{css:dn,children:[e("thead",{children:c.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:e("div",{children:J(m.column.columnDef.header,m.getContext())})},m.id))},f.id))}),e("tbody",{children:p.map(f=>e("tr",{children:f.getVisibleCells().map(m=>e("td",{children:J(m.column.columnDef.cell,m.getContext())},m.id))},f.id))})]}),e(ae,{type:"modal",isDismissable:!0,onDismiss:()=>t(null),children:a&&s(Z,{title:`Set ${a.name} API Key`,size:"S",children:[s(C,{padding:"size-200",children:[e(C,{paddingBottom:"size-100",children:s(v,{size:"XS",children:["Set the credentials for the ",a.name," API. These credentials will be stored entirely in your browser and will only be sent to the server during API requests."]})}),s(X,{onChange:f=>{i({provider:a.key,value:f})},value:l[a.key],type:"password",children:[e(W,{children:`${a.name} API Key`}),e(re,{placeholder:`e.g. ${a.apiKeyEnvVar}`}),e(v,{slot:"description",children:"The API key will be stored locally in your browser"})]})]}),e(C,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:e(h,{direction:"row",justifyContent:"end",gap:"size-100",children:e(V,{variant:"primary",size:"S",onPress:()=>{t(null)},children:"Set API Key"})})})]})})]})}function XC(){const n=qe();return Je(n),e(mf,{query:n})}const ws={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAIProvidersPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"GenerativeProvidersCard_data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAIProvidersPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyEnvVar",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeySet",storageKey:null}],storageKey:null}]},params:{cacheID:"cc6e19e54ea894e905970362ee382e43",id:null,metadata:{},name:"settingsAIProvidersPageLoaderQuery",operationKind:"query",text:`query settingsAIProvidersPageLoaderQuery {
2
2
  ...GenerativeProvidersCard_data
3
3
  }
4
4
 
@@ -1884,7 +1884,6 @@ fragment SpanAside_span on Span {
1884
1884
  justify-content: center;
1885
1885
  height: 100%;
1886
1886
  min-height: 75px;
1887
- padding: var(--ac-global-dimension-static-size-200);
1888
1887
  .controls {
1889
1888
  transition: opacity 0.2s ease-in-out;
1890
1889
  opacity: 0;
@@ -1911,7 +1910,7 @@ fragment SpanAside_span on Span {
1911
1910
  overflow-y: auto;
1912
1911
  padding: var(--ac-global-dimension-static-size-100)
1913
1912
  var(--ac-global-dimension-static-size-200);
1914
- `,children:n})}function ck({getValue:n,collapseSingleKey:a}){const t=n();return e(yd,{children:e($a,{json:t,space:2,collapseSingleKey:a})})}function uk({isRunning:n,instanceVariables:a,datasetExampleInput:t}){const l=u.useMemo(()=>{const i=ea(t)?t:{};return a.filter(r=>i[r]==null)},[t,a]);return n?e(Fe,{}):l.length===0?null:e(yi,{children:`Missing input for variable${l.length>1?"s":""}: ${l.join(", ")}`})}function mk({exampleData:n,setDialog:a}){const{span:t,content:l,toolCalls:i,errorMessage:r,experimentRunId:o}=n,d=t!=null,c=o!=null,p=u.useMemo(()=>{if(d||c)return s(U,{children:[c&&s(ve,{children:[e(V,{size:"S","aria-label":"View experiment run details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{a(e(d0,{runId:o}))})}}),e($e,{children:"View run details"})]}),d&&e(U,{children:s(ve,{children:[e(V,{size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(jt,{})}),onPress:()=>{u.startTransition(()=>{a(e(md,{traceId:t.context.traceId,projectId:t.project.id,title:"Experiment Run Trace"}))})}}),e($e,{children:"View Trace"})]})})]})},[o,c,d,a,t]);return e(gd,{controls:p,children:s(h,{direction:"column",gap:"size-200",children:[r!=null?e(yi,{children:r}):null,e(v,{children:l}),i!=null?Object.values(i).map(f=>f==null?null:e(pd,{toolCall:f},f.id)):null,d?e(gk,{span:t}):null]})})}const pk=u.memo(function({isRunning:a,instanceId:t,exampleId:l,setDialog:i,instanceVariables:r,datasetExampleInput:o}){const d=xa(c=>{var p;return(p=c.exampleResponsesMap[t])==null?void 0:p[l]});return d==null?e(uk,{isRunning:a,instanceVariables:r,datasetExampleInput:o}):e(mk,{exampleData:d,setDialog:i})});function gk({span:n}){return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(oa,{tokenCountTotal:n.tokenCountTotal||0,tokenCountPrompt:n.tokenCountPrompt||0,tokenCountCompletion:n.tokenCountCompletion||0}),e(Me,{latencyMs:n.latencyMs||0})]})}function fd({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(t=>e("td",{style:{padding:0,height:1,width:`calc(var(--col-${t.column.id}-size) * 1px)`,wordBreak:"break-all"},children:J(t.column.columnDef.cell,t.getContext())},t.id))},a.id))})}const yk=he.memo(fd,(n,a)=>n.table.options.data===a.table.options.data);function fk({datasetId:n}){const a=I.useRelayEnvironment(),t=O(q=>q.instances),l=O(q=>q.allInstanceMessages),i=O(q=>q.templateFormat),r=O(q=>q.updateInstance),o=xa(q=>q.updateExampleData),d=xa(q=>q.setExampleDataForInstance),c=xa(q=>q.resetExampleData),p=xa(q=>q.appendExampleDataToolCallChunk),f=xa(q=>q.appendExampleDataTextChunk),[m,g]=u.useState(null),[,y]=xn(),k=t.some(q=>q.activeRunId!==null),b=Ma(q=>q),S=O(q=>q.markPlaygroundInstanceComplete),K=Ba(),T=Ie(),x=u.useCallback(q=>le=>{var M;if(le==null)return;const te=le.chatCompletionOverDataset;switch(te.__typename){case"ChatCompletionSubscriptionExperiment":r({instanceId:q,patch:{experimentId:te.experiment.id},dirty:null});break;case"ChatCompletionSubscriptionResult":if(te.datasetExampleId==null)return;o({instanceId:q,exampleId:te.datasetExampleId,patch:{span:te.span,experimentRunId:(M=te.experimentRun)==null?void 0:M.id}});break;case"ChatCompletionSubscriptionError":if(te.datasetExampleId==null)return;o({instanceId:q,exampleId:te.datasetExampleId,patch:{errorMessage:te.message}});break;case"TextChunk":if(te.datasetExampleId==null)return;f({instanceId:q,exampleId:te.datasetExampleId,textChunk:te.content});break;case"ToolCallChunk":{if(te.datasetExampleId==null)return;p({instanceId:q,exampleId:te.datasetExampleId,toolCallChunk:te});break}case"%other":return;default:return Ce()}},[f,p,o,r]),[L]=I.useMutation(Uo),P=u.useCallback(q=>(le,te)=>{if(S(q),te){T({title:"Chat completion failed",message:te[0].message});return}r({instanceId:q,patch:{experimentId:le.chatCompletionOverDataset.experimentId},dirty:null}),d({instanceId:q,data:sk(le.chatCompletionOverDataset)})},[S,T,d,r]);u.useEffect(()=>{if(!k)return;const{instances:q,streaming:le,updateInstance:te}=K.getState();if(c(),le){const M=[];for(const E of q){const{activeRunId:N}=E;if(te({instanceId:E.id,patch:{experimentId:null},dirty:null}),N===null)continue;const ee={input:Oi({credentials:b,instanceId:E.id,playgroundStore:K,datasetId:n})},ye={subscription:Ho,variables:ee,onNext:x(E.id),onCompleted:()=>{S(E.id)},onError:Un=>{S(E.id);const Ha=Ar(Un);Ha!=null&&Ha.length>0?T({title:"Failed to get output",message:Ha.join(`
1913
+ `,children:n})}function ck({getValue:n,collapseSingleKey:a}){const t=n();return e(yd,{children:e($a,{json:t,space:2,collapseSingleKey:a})})}function uk({isRunning:n,instanceVariables:a,datasetExampleInput:t}){const l=u.useMemo(()=>{const i=ea(t)?t:{};return a.filter(r=>i[r]==null)},[t,a]);return n?e(Fe,{}):l.length===0?null:e(yi,{children:`Missing input for variable${l.length>1?"s":""}: ${l.join(", ")}`})}function mk({exampleData:n,setDialog:a}){const{span:t,content:l,toolCalls:i,errorMessage:r,experimentRunId:o}=n,d=t!=null,c=o!=null,p=u.useMemo(()=>{if(d||c)return s(U,{children:[c&&s(ve,{children:[e(V,{size:"S","aria-label":"View experiment run details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{a(e(d0,{runId:o}))})}}),e($e,{children:"View run details"})]}),d&&e(U,{children:s(ve,{children:[e(V,{size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(jt,{})}),onPress:()=>{u.startTransition(()=>{a(e(md,{traceId:t.context.traceId,projectId:t.project.id,title:"Experiment Run Trace"}))})}}),e($e,{children:"View Trace"})]})})]})},[o,c,d,a,t]);return e(gd,{controls:p,children:e(C,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r!=null?e(yi,{children:r}):null,e(v,{children:l}),i!=null?Object.values(i).map(f=>f==null?null:e(pd,{toolCall:f},f.id)):null,d?e(gk,{span:t}):null]})})})}const pk=u.memo(function({isRunning:a,instanceId:t,exampleId:l,setDialog:i,instanceVariables:r,datasetExampleInput:o}){const d=xa(c=>{var p;return(p=c.exampleResponsesMap[t])==null?void 0:p[l]});return d==null?e(uk,{isRunning:a,instanceVariables:r,datasetExampleInput:o}):e(mk,{exampleData:d,setDialog:i})});function gk({span:n}){return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(oa,{tokenCountTotal:n.tokenCountTotal||0,tokenCountPrompt:n.tokenCountPrompt||0,tokenCountCompletion:n.tokenCountCompletion||0}),e(Me,{latencyMs:n.latencyMs||0})]})}function fd({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(t=>e("td",{style:{padding:0,width:`calc(var(--col-${t.column.id}-size) * 1px)`,wordBreak:"break-all"},children:J(t.column.columnDef.cell,t.getContext())},t.id))},a.id))})}const yk=he.memo(fd,(n,a)=>n.table.options.data===a.table.options.data);function fk({datasetId:n}){const a=I.useRelayEnvironment(),t=O(q=>q.instances),l=O(q=>q.allInstanceMessages),i=O(q=>q.templateFormat),r=O(q=>q.updateInstance),o=xa(q=>q.updateExampleData),d=xa(q=>q.setExampleDataForInstance),c=xa(q=>q.resetExampleData),p=xa(q=>q.appendExampleDataToolCallChunk),f=xa(q=>q.appendExampleDataTextChunk),[m,g]=u.useState(null),[,y]=xn(),k=t.some(q=>q.activeRunId!==null),b=Ma(q=>q),S=O(q=>q.markPlaygroundInstanceComplete),K=Ba(),T=Ie(),x=u.useCallback(q=>le=>{var M;if(le==null)return;const te=le.chatCompletionOverDataset;switch(te.__typename){case"ChatCompletionSubscriptionExperiment":r({instanceId:q,patch:{experimentId:te.experiment.id},dirty:null});break;case"ChatCompletionSubscriptionResult":if(te.datasetExampleId==null)return;o({instanceId:q,exampleId:te.datasetExampleId,patch:{span:te.span,experimentRunId:(M=te.experimentRun)==null?void 0:M.id}});break;case"ChatCompletionSubscriptionError":if(te.datasetExampleId==null)return;o({instanceId:q,exampleId:te.datasetExampleId,patch:{errorMessage:te.message}});break;case"TextChunk":if(te.datasetExampleId==null)return;f({instanceId:q,exampleId:te.datasetExampleId,textChunk:te.content});break;case"ToolCallChunk":{if(te.datasetExampleId==null)return;p({instanceId:q,exampleId:te.datasetExampleId,toolCallChunk:te});break}case"%other":return;default:return Ce()}},[f,p,o,r]),[L]=I.useMutation(Uo),P=u.useCallback(q=>(le,te)=>{if(S(q),te){T({title:"Chat completion failed",message:te[0].message});return}r({instanceId:q,patch:{experimentId:le.chatCompletionOverDataset.experimentId},dirty:null}),d({instanceId:q,data:sk(le.chatCompletionOverDataset)})},[S,T,d,r]);u.useEffect(()=>{if(!k)return;const{instances:q,streaming:le,updateInstance:te}=K.getState();if(c(),le){const M=[];for(const E of q){const{activeRunId:N}=E;if(te({instanceId:E.id,patch:{experimentId:null},dirty:null}),N===null)continue;const ee={input:Oi({credentials:b,instanceId:E.id,playgroundStore:K,datasetId:n})},ye={subscription:Ho,variables:ee,onNext:x(E.id),onCompleted:()=>{S(E.id)},onError:Un=>{S(E.id);const Ha=Ar(Un);Ha!=null&&Ha.length>0?T({title:"Failed to get output",message:Ha.join(`
1915
1914
  `),expireMs:1e4}):T({title:"Failed to get output",message:Un.message,expireMs:1e4})}},en=pt.requestSubscription(a,ye);M.push(en)}return()=>{for(const E of M)E.dispose()}}else{const M=[];for(const E of q){const{activeRunId:N}=E;if(N===null)continue;te({instanceId:E.id,patch:{experimentId:null},dirty:null});const ee={input:Oi({credentials:b,instanceId:E.id,playgroundStore:K,datasetId:n})},ye=L({variables:ee,onCompleted:P(E.id),onError(en){S(E.id);const Un=De(en);Un!=null&&Un.length>0?T({title:"Failed to get output",message:Un.join(`
1916
1915
  `),expireMs:1e4}):T({title:"Failed to get output",message:en.message,expireMs:1e4})}});M.push(ye)}return()=>{for(const E of M)E.dispose()}}},[b,n,a,L,k,S,T,P,x,K,c]);const{dataset:D}=I.useLazyLoadQuery(Jo,{datasetId:n}),$=u.useRef(null),{data:R,loadNext:Q,hasNext:z,isLoadingNext:A}=I.usePaginationFragment(Wo,D),j=u.useMemo(()=>R.examples.edges.map(q=>{const le=q.example,te=le.revision;return{id:le.id,input:te.input,output:te.output}}),[R]),Y=u.useMemo(()=>t.map((q,le)=>{const te=el(q,l),M=Fs({instance:te,templateFormat:i});return{id:`instance-${q.id}`,header:()=>s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Gl,{index:le}),e("span",{children:"Output"})]}),cell:({row:E})=>e(pk,{instanceId:q.id,exampleId:E.original.id,isRunning:k,setDialog:g,instanceVariables:M,datasetExampleInput:E.original.input}),size:500}}),[k,t,i,l]),de=[{header:"input",accessorKey:"input",cell:({row:q})=>e(gd,{controls:s(ve,{children:[e(V,{size:"S","aria-label":"View example details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{y(le=>(le.set("exampleId",q.original.id),le))}}),e($e,{children:"View Example"})]}),children:e(yd,{children:e($a,{json:q.original.input,disableTitle:!0,space:2,collapseSingleKey:!1})})}),size:200},{header:"reference output",accessorKey:"output",cell:q=>ck({...q,collapseSingleKey:!0}),size:200},...Y],be=Le({columns:de,data:j,getCoreRowModel:we(),columnResizeMode:"onChange"}),hn=be.getRowModel().rows.length===0,ga=u.useCallback(q=>{if(q){const{scrollHeight:le,scrollTop:te,clientHeight:M}=q;le-te-M<300&&!A&&z&&Q(rk)}},[z,A,Q]),Ua=he.useMemo(()=>{const q=be.getFlatHeaders(),le={};for(let te=0;te<q.length;te++){const M=q[te];le[`--header-${M.id}-size`]=M.getSize(),le[`--col-${M.column.id}-size`]=M.column.getSize()}return le},[be.getState().columnSizingInfo,be.getState().columnSizing,de.length]);return s("div",{css:F`
1917
1916
  flex: 1 1 auto;
@@ -3881,7 +3880,7 @@ await assistant({
3881
3880
  .ac-dropdown-button {
3882
3881
  min-width: var(--ac-global-dimension-static-size-300);
3883
3882
  }
3884
- `,or=ii,$c=({table:n})=>{const a=ue();return e("tbody",{children:n.getRowModel().rows.map(t=>e("tr",{onClick:()=>a(`${encodeURIComponent(t.id)}`),children:t.getVisibleCells().map(l=>e("td",{style:{height:1,width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(l.column.columnDef.cell,l.getContext())},l.id))},t.id))})},PS=he.memo($c,(n,a)=>n.table.options.data===a.table.options.data);function IS(n){const a=u.useRef(null),[t,l]=u.useState([]),{filterIoSubstring:i}=Vc(),{fetchKey:r}=Pa(),{data:o,loadNext:d,hasNext:c,isLoadingNext:p,refetch:f}=I.usePaginationFragment(zc,n.project),m=u.useMemo(()=>o.sessions.edges.map(({session:A})=>({...A,tokenCountTotal:A.tokenUsage.total})),[o.sessions]),g=[{header:"session id",accessorKey:"sessionId",enableSorting:!1,cell:Ee},{header:"first input",accessorKey:"firstInput.value",enableSorting:!1,cell:Ee},{header:"last output",accessorKey:"lastOutput.value",enableSorting:!1,cell:Ee},{header:"start time",accessorKey:"startTime",enableSorting:!0,cell:Re},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:Re},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:A})=>{const j=A();return j===null||typeof j!="number"?null:e(Me,{latencyMs:j})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:A})=>{const j=A();return j===null||typeof j!="number"?null:e(Me,{latencyMs:j})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({row:A,getValue:j})=>{const Y=j();if(Y==null||typeof Y!="number")return"--";const{prompt:de,completion:be}=A.original.tokenUsage;return e(oa,{tokenCountTotal:Y,tokenCountPrompt:de||0,tokenCountCompletion:be||0})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:as}];u.useEffect(()=>{const A=t[0];u.startTransition(()=>{f({sort:A?{col:A.id,dir:A.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:or,filterIoSubstring:i},{fetchPolicy:"store-and-network"})})},[t,f,i,r]);const y=he.useCallback(A=>{if(A){const{scrollHeight:j,scrollTop:Y,clientHeight:de}=A;j-Y-de<300&&!p&&c&&d(or)}},[c,p,d]),[k,b]=u.useState({}),S=je(A=>A.columnVisibility),K=je(A=>A.columnSizing),T=je(A=>A.setColumnSizing),x=Le({columns:g,data:m,onExpandedChange:b,manualSorting:!0,state:{sorting:t,expanded:k,columnVisibility:S,columnSizing:K},columnResizeMode:"onChange",onColumnSizingChange:T,enableSubRowSelection:!1,onSortingChange:l,getCoreRowModel:we(),getSortedRowModel:In(),getExpandedRowModel:br(),getRowId:A=>A.id}),P=x.getRowModel().rows.length===0,{columnSizingInfo:D,columnSizing:$}=x.getState(),R=x.getFlatHeaders,Q=g.length,z=he.useMemo(()=>{const A=R(),j={};for(let Y=0;Y<A.length;Y++){const de=A[Y];j[`--header-${de.id}-size`]=de.getSize(),j[`--col-${de.column.id}-size`]=de.column.getSize()}return j},[R,D,$,Q]);return s("div",{css:bi,children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(hS,{})}),e("div",{css:F`
3883
+ `,or=ii,$c=({table:n})=>{const a=ue();return e("tbody",{children:n.getRowModel().rows.map(t=>e("tr",{onClick:()=>a(`${encodeURIComponent(t.id)}`),children:t.getVisibleCells().map(l=>e("td",{style:{width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(l.column.columnDef.cell,l.getContext())},l.id))},t.id))})},PS=he.memo($c,(n,a)=>n.table.options.data===a.table.options.data);function IS(n){const a=u.useRef(null),[t,l]=u.useState([]),{filterIoSubstring:i}=Vc(),{fetchKey:r}=Pa(),{data:o,loadNext:d,hasNext:c,isLoadingNext:p,refetch:f}=I.usePaginationFragment(zc,n.project),m=u.useMemo(()=>o.sessions.edges.map(({session:A})=>({...A,tokenCountTotal:A.tokenUsage.total})),[o.sessions]),g=[{header:"session id",accessorKey:"sessionId",enableSorting:!1,cell:Ee},{header:"first input",accessorKey:"firstInput.value",enableSorting:!1,cell:Ee},{header:"last output",accessorKey:"lastOutput.value",enableSorting:!1,cell:Ee},{header:"start time",accessorKey:"startTime",enableSorting:!0,cell:Re},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:Re},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:A})=>{const j=A();return j===null||typeof j!="number"?null:e(Me,{latencyMs:j})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:A})=>{const j=A();return j===null||typeof j!="number"?null:e(Me,{latencyMs:j})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({row:A,getValue:j})=>{const Y=j();if(Y==null||typeof Y!="number")return"--";const{prompt:de,completion:be}=A.original.tokenUsage;return e(oa,{tokenCountTotal:Y,tokenCountPrompt:de||0,tokenCountCompletion:be||0})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:as}];u.useEffect(()=>{const A=t[0];u.startTransition(()=>{f({sort:A?{col:A.id,dir:A.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:or,filterIoSubstring:i},{fetchPolicy:"store-and-network"})})},[t,f,i,r]);const y=he.useCallback(A=>{if(A){const{scrollHeight:j,scrollTop:Y,clientHeight:de}=A;j-Y-de<300&&!p&&c&&d(or)}},[c,p,d]),[k,b]=u.useState({}),S=je(A=>A.columnVisibility),K=je(A=>A.columnSizing),T=je(A=>A.setColumnSizing),x=Le({columns:g,data:m,onExpandedChange:b,manualSorting:!0,state:{sorting:t,expanded:k,columnVisibility:S,columnSizing:K},columnResizeMode:"onChange",onColumnSizingChange:T,enableSubRowSelection:!1,onSortingChange:l,getCoreRowModel:we(),getSortedRowModel:In(),getExpandedRowModel:br(),getRowId:A=>A.id}),P=x.getRowModel().rows.length===0,{columnSizingInfo:D,columnSizing:$}=x.getState(),R=x.getFlatHeaders,Q=g.length,z=he.useMemo(()=>{const A=R(),j={};for(let Y=0;Y<A.length;Y++){const de=A[Y];j[`--header-${de.id}-size`]=de.getSize(),j[`--col-${de.column.id}-size`]=de.column.getSize()}return j},[R,D,$,Q]);return s("div",{css:bi,children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(hS,{})}),e("div",{css:F`
3885
3884
  flex: 1 1 auto;
3886
3885
  overflow: auto;
3887
3886
  `,onScroll:A=>y(A.target),ref:a,children:s("table",{css:sa,style:{...z,width:x.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:x.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(j=>e("th",{style:{width:`calc(var(--header-${j.id}-size) * 1px)`},children:j.isPlaceholder?null:s(U,{children:[s("div",{"data-sortable":j.column.getCanSort(),className:j.column.getCanSort()?"cursor-pointer":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[J(j.column.columnDef.header,j.getContext()),j.column.getIsSorted()?e(_,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(cn,{}):e(un,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},A.id))}),P?e(TS,{}):D.isResizingColumn?e(PS,{table:x}):e($c,{table:x})]})})]})}const Oc=u.createContext(null);function sl(){const n=u.useContext(Oc);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function Si(n){const[a,t]=u.useState(""),l=u.useCallback(r=>{u.startTransition(()=>{t(r)})},[]),i=u.useCallback(r=>{u.startTransition(()=>{a.length>0?t(a+" and "+r):t(r)})},[a]);return e(Oc.Provider,{value:{filterCondition:a,setFilterCondition:l,appendFilterCondition:i},children:n.children})}function vi({children:n}){const{projectId:a}=Be();if(!a)throw new Error("projectId is required");const{tab:t}=rl();if(!Xs(t))throw new Error(`Invalid tab: ${t}`);return e(gS,{projectId:a,tableId:t||"table",children:n})}function xS({queryReference:n}){const a=I.usePreloadedQuery(io,n);return e(pS,{children:e(IS,{project:a.project})})}const K2=()=>{const{sessionsQueryReference:n}=nl();return n?s(vi,{children:[e(Si,{children:e(u.Suspense,{fallback:e(Fe,{}),children:e(xS,{queryReference:n})})}),e(u.Suspense,{children:e(Te,{})})]}):null},Qc=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},t={defaultValue:30,kind:"LocalArgument",name:"first"},l={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"orphanSpanAsRootSpan"},r={defaultValue:!0,kind:"LocalArgument",name:"rootSpansOnly"},o={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},d={defaultValue:null,kind:"LocalArgument",name:"timeRange"},c=[{kind:"Variable",name:"id",variableName:"id"}],p={kind:"Variable",name:"after",variableName:"after"},f={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},m={kind:"Variable",name:"first",variableName:"first"},g={kind:"Variable",name:"rootSpansOnly",variableName:"rootSpansOnly"},y={kind:"Variable",name:"sort",variableName:"sort"},k={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},K=[p,f,m,{kind:"Variable",name:"orphanSpanAsRootSpan",variableName:"orphanSpanAsRootSpan"},g,y,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],T=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,t,l,i,r,o,d],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[p,f,m,g,y],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,t,i,r,o,d,l],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[k,{kind:"TypeDiscriminator",abstractKey:"__isNode"},b,{kind:"InlineFragment",selections:[S,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:K,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"span",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[b,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[b,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:T,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:T,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[S,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[k],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:K,filters:["sort","rootSpansOnly","filterCondition","orphanSpanAsRootSpan","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"724a34c18ec17312b01be5ccae4d7159",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
@@ -4152,7 +4151,7 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
4152
4151
  z-index: 1000;
4153
4152
  box-shadow: 8px 8px 20px 0 rgba(0, 0, 0, 0.4);
4154
4153
  border-radius: var(--ac-global-rounding-medium);
4155
- `,children:[e(C,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(v,{children:`${c.length} span${k?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(V,{variant:"default",size:"S",onPress:p,children:"Cancel"}),s(Va,{placement:"top end",crossOffset:300,isOpen:o,onOpenChange:T=>{d(T)},children:[e(Oe,{children:e(V,{variant:"default",size:"S",leadingVisual:m?e(We,{}):e(Nt,{}),onPress:()=>{d(!0)},isDisabled:m,children:m?"Adding...":"Add to Dataset"})}),e(u.Suspense,{children:e(qS,{onDatasetSelected:T=>{b(T),d(!1)},onCreateNewDataset:()=>{d(!1),l(e(Z,{title:"New Dataset",isDismissable:!0,onDismiss:()=>l(null),children:e(is,{onDatasetCreateError:T=>{const x=De(T);r({title:"Dataset creation failed",message:`Failed to create dataset: ${(x==null?void 0:x[0])??T.message}`})},onDatasetCreated:T=>{l(null),i({title:"Dataset created",message:`${T.name} has been successfully created.`}),d(!0)}})}))}})})]}),e(V,{variant:"danger",size:"S",leadingVisual:e(_,{svg:y?e(We,{}):e(Ye,{})}),isDisabled:y,onPress:K,children:y?"Deleting...":"Delete"})]})]})}),e(ae,{onDismiss:()=>{l(null)},children:t})]})}const ct="annotations",Rn=":",ru={col:"startTime",dir:"desc"};function su(n){let a=null,t=null;if(n.id&&n.id.startsWith(ct)){const[,l,i]=n.id.split(Rn);t={attr:l,name:i}}else a=n.id;return{col:a,evalResultKey:t,dir:n.desc?"desc":"asc"}}const Ft=ii,US={minSize:100};function HS(n){return n==="root"||n==="all"}const ou=({table:n,hasNext:a,onLoadNext:t,tableWidth:l,isLoadingNext:i})=>{const r=ue();return s("tbody",{children:[n.getRowModel().rows.map(o=>e("tr",{onClick:()=>r(`${o.original.trace.traceId}?selectedSpanNodeId=${o.original.id}`),children:o.getVisibleCells().map(d=>e("td",{style:{height:1,width:`calc(var(--col-${d.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${d.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(d.column.columnDef.cell,d.getContext())},d.id))},o.id)),a?e(Qg,{onLoadMore:t,width:l,isLoadingNext:i},"load-more"):null]})},GS=he.memo(ou,(n,a)=>n.table.options.data===a.table.options.data);function WS(n){const{fetchKey:a}=Pa(),t=u.useRef(null),l=u.useRef(!0),[i,r]=u.useState({}),[o,d]=u.useState([]),[c,p]=u.useState(""),[f,m]=u.useState(!0),g=je(E=>E.columnVisibility),{data:y,loadNext:k,hasNext:b,isLoadingNext:S,refetch:K}=I.usePaginationFragment(jc,n.project),T=je(E=>E.annotationColumnVisibility),x=u.useMemo(()=>Object.keys(T).filter(E=>T[E]),[T]),L=u.useMemo(()=>y.spans.edges.map(({span:N})=>N),[y]),P=x.map(E=>({header:E,columns:[{header:"label",accessorKey:`${ct}${Rn}label${Rn}${E}`,cell:({row:N})=>{const ee=N.original.spanAnnotations.find(ye=>ye.name===E);return ee?ee.label:null}},{header:"score",accessorKey:`${ct}${Rn}score${Rn}${E}`,cell:({row:N})=>{const ee=N.original.spanAnnotations.find(ye=>ye.name===E);return ee?ee.score:null}}]})),D=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Aa,{children:[e(se,{level:3,weight:"heavy",children:"Feedback"}),e(ia,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"feedback",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:E})=>s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[E.original.spanAnnotations.map(N=>e(za,{annotation:N,layout:"horizontal",width:"500px",extra:e(Uc,{annotation:N}),children:e(Nn,{annotation:N,annotationDisplayPreference:"label"})},N.name)),E.original.documentRetrievalMetrics.map(N=>s(U,{children:[e(tn,{name:N.evaluationName,metric:"ndcg",score:N.ndcg},"ndcg"),e(tn,{name:N.evaluationName,metric:"precision",score:N.precision},"precision"),e(tn,{name:N.evaluationName,metric:"hit",score:N.hit},"hit")]}))]})},...P],$=[{id:"select",maxSize:10,header:({table:E})=>e(na,{checked:E.getIsAllRowsSelected(),indeterminate:E.getIsSomeRowsSelected(),onChange:E.getToggleAllRowsSelectedHandler()}),cell:({row:E})=>e(na,{checked:E.getIsSelected(),disabled:!E.getCanSelect(),indeterminate:E.getIsSomeSelected(),onChange:E.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:E})=>{const N=E();return e(h,{direction:"row",gap:"size-50",alignItems:"center",children:e(qt,{statusCode:N})})}},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:E})=>e(Bl,{spanKind:E()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:E,row:N})=>{const ee=N.original,{traceId:ye}=ee.trace;return e(Ze,{to:`${ye}?selectedSpanNodeId=${ee.id}`,children:E()})}},{header:"input",accessorKey:"input.value",cell:Ee,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:Ee,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:({row:E})=>e(Bc,{metadata:E.original.metadata}),enableSorting:!1},...D,{header:"start time",accessorKey:"startTime",cell:Re},{header:"latency",accessorKey:"latencyMs",cell:({getValue:E})=>{const N=E();return N===null||typeof N!="number"?null:e(Me,{latencyMs:N})}},{header:f?"cumulative tokens":"total tokens",accessorKey:f?"cumulativeTokenCountTotal":"tokenCountTotal",cell:({row:E,getValue:N})=>{if(N()===null)return"--";const ye=E.original,en=f?ye.cumulativeTokenCountTotal:ye.tokenCountTotal,Un=f?ye.cumulativeTokenCountPrompt:ye.tokenCountPrompt,Ha=f?ye.cumulativeTokenCountCompletion:ye.tokenCountCompletion;return e(oa,{tokenCountTotal:en||0,tokenCountPrompt:Un||0,tokenCountCompletion:Ha||0})}}];u.useEffect(()=>{if(l.current===!0){l.current=!1;return}u.startTransition(()=>{const E=o[0];K({sort:E?su(E):ru,after:null,first:Ft,filterCondition:c,rootSpansOnly:f},{fetchPolicy:"store-and-network"})})},[o,K,c,a,f]);const R=u.useCallback(E=>{if(E){const{scrollHeight:N,scrollTop:ee,clientHeight:ye}=E;N-ee-ye<300&&!S&&b&&k(Ft)}},[b,S,k]),Q=je(E=>E.setColumnSizing),z=je(E=>E.columnSizing),A=Le({columns:$,data:L,state:{sorting:o,columnVisibility:g,rowSelection:i,columnSizing:z},defaultColumn:US,columnResizeMode:"onChange",manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnSizingChange:Q,getCoreRowModel:we(),getSortedRowModel:In()}),j=A.getRowModel().rows,Y=A.getSelectedRowModel().rows,de=Y.map(E=>({id:E.original.id,traceId:E.original.trace.id})),be=u.useCallback(()=>{r({})},[r]),wn=j.length===0,hn=A.getAllColumns().filter(E=>E.columns.length===0),{columnSizingInfo:ga,columnSizing:Ua}=A.getState(),q=A.getFlatHeaders,le=hn.length,[te,M]=he.useMemo(()=>{const E=q(),N={};let ee=0;for(let ye=0;ye<E.length;ye++){const en=E[ye];N[`--header-${en.id}-size`]=en.getSize(),N[`--col-${en.column.id}-size`]=en.column.getSize(),ee+=en.getSize()}return[N,ee]},[q,ga,Ua,le]);return s("div",{css:bi,children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Yc,{onValidCondition:p}),s(Xl,{"aria-label":"Toggle between root and all spans",selectionMode:"single",selectedKeys:[f?"root":"all"],onSelectionChange:E=>{if(E.size===0)return;const N=E.keys().next().value;if(HS(N))m(N==="root");else throw new Error(`Unknown root span filter selection: ${N}`)},children:[e(Xn,{"aria-label":"root spans",id:"root",children:"Root Spans"}),e(Xn,{"aria-label":"all spans",id:"all",children:"All"})]}),e(Wc,{columns:hn,query:y}),e(MS,{})]})}),e("div",{css:F`
4154
+ `,children:[e(C,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(v,{children:`${c.length} span${k?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(V,{variant:"default",size:"S",onPress:p,children:"Cancel"}),s(Va,{placement:"top end",crossOffset:300,isOpen:o,onOpenChange:T=>{d(T)},children:[e(Oe,{children:e(V,{variant:"default",size:"S",leadingVisual:m?e(We,{}):e(Nt,{}),onPress:()=>{d(!0)},isDisabled:m,children:m?"Adding...":"Add to Dataset"})}),e(u.Suspense,{children:e(qS,{onDatasetSelected:T=>{b(T),d(!1)},onCreateNewDataset:()=>{d(!1),l(e(Z,{title:"New Dataset",isDismissable:!0,onDismiss:()=>l(null),children:e(is,{onDatasetCreateError:T=>{const x=De(T);r({title:"Dataset creation failed",message:`Failed to create dataset: ${(x==null?void 0:x[0])??T.message}`})},onDatasetCreated:T=>{l(null),i({title:"Dataset created",message:`${T.name} has been successfully created.`}),d(!0)}})}))}})})]}),e(V,{variant:"danger",size:"S",leadingVisual:e(_,{svg:y?e(We,{}):e(Ye,{})}),isDisabled:y,onPress:K,children:y?"Deleting...":"Delete"})]})]})}),e(ae,{onDismiss:()=>{l(null)},children:t})]})}const ct="annotations",Rn=":",ru={col:"startTime",dir:"desc"};function su(n){let a=null,t=null;if(n.id&&n.id.startsWith(ct)){const[,l,i]=n.id.split(Rn);t={attr:l,name:i}}else a=n.id;return{col:a,evalResultKey:t,dir:n.desc?"desc":"asc"}}const Ft=ii,US={minSize:100};function HS(n){return n==="root"||n==="all"}const ou=({table:n,hasNext:a,onLoadNext:t,tableWidth:l,isLoadingNext:i})=>{const r=ue();return s("tbody",{children:[n.getRowModel().rows.map(o=>e("tr",{onClick:()=>r(`${o.original.trace.traceId}?selectedSpanNodeId=${o.original.id}`),children:o.getVisibleCells().map(d=>e("td",{style:{width:`calc(var(--col-${d.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${d.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(d.column.columnDef.cell,d.getContext())},d.id))},o.id)),a?e(Qg,{onLoadMore:t,width:l,isLoadingNext:i},"load-more"):null]})},GS=he.memo(ou,(n,a)=>n.table.options.data===a.table.options.data);function WS(n){const{fetchKey:a}=Pa(),t=u.useRef(null),l=u.useRef(!0),[i,r]=u.useState({}),[o,d]=u.useState([]),[c,p]=u.useState(""),[f,m]=u.useState(!0),g=je(E=>E.columnVisibility),{data:y,loadNext:k,hasNext:b,isLoadingNext:S,refetch:K}=I.usePaginationFragment(jc,n.project),T=je(E=>E.annotationColumnVisibility),x=u.useMemo(()=>Object.keys(T).filter(E=>T[E]),[T]),L=u.useMemo(()=>y.spans.edges.map(({span:N})=>N),[y]),P=x.map(E=>({header:E,columns:[{header:"label",accessorKey:`${ct}${Rn}label${Rn}${E}`,cell:({row:N})=>{const ee=N.original.spanAnnotations.find(ye=>ye.name===E);return ee?ee.label:null}},{header:"score",accessorKey:`${ct}${Rn}score${Rn}${E}`,cell:({row:N})=>{const ee=N.original.spanAnnotations.find(ye=>ye.name===E);return ee?ee.score:null}}]})),D=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Aa,{children:[e(se,{level:3,weight:"heavy",children:"Feedback"}),e(ia,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"feedback",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:E})=>s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[E.original.spanAnnotations.map(N=>e(za,{annotation:N,layout:"horizontal",width:"500px",extra:e(Uc,{annotation:N}),children:e(Nn,{annotation:N,annotationDisplayPreference:"label"})},N.name)),E.original.documentRetrievalMetrics.map(N=>s(U,{children:[e(tn,{name:N.evaluationName,metric:"ndcg",score:N.ndcg},"ndcg"),e(tn,{name:N.evaluationName,metric:"precision",score:N.precision},"precision"),e(tn,{name:N.evaluationName,metric:"hit",score:N.hit},"hit")]}))]})},...P],$=[{id:"select",maxSize:10,header:({table:E})=>e(na,{checked:E.getIsAllRowsSelected(),indeterminate:E.getIsSomeRowsSelected(),onChange:E.getToggleAllRowsSelectedHandler()}),cell:({row:E})=>e(na,{checked:E.getIsSelected(),disabled:!E.getCanSelect(),indeterminate:E.getIsSomeSelected(),onChange:E.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:E})=>{const N=E();return e(h,{direction:"row",gap:"size-50",alignItems:"center",children:e(qt,{statusCode:N})})}},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:E})=>e(Bl,{spanKind:E()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:E,row:N})=>{const ee=N.original,{traceId:ye}=ee.trace;return e(Ze,{to:`${ye}?selectedSpanNodeId=${ee.id}`,children:E()})}},{header:"input",accessorKey:"input.value",cell:Ee,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:Ee,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:({row:E})=>e(Bc,{metadata:E.original.metadata}),enableSorting:!1},...D,{header:"start time",accessorKey:"startTime",cell:Re},{header:"latency",accessorKey:"latencyMs",cell:({getValue:E})=>{const N=E();return N===null||typeof N!="number"?null:e(Me,{latencyMs:N})}},{header:f?"cumulative tokens":"total tokens",accessorKey:f?"cumulativeTokenCountTotal":"tokenCountTotal",cell:({row:E,getValue:N})=>{if(N()===null)return"--";const ye=E.original,en=f?ye.cumulativeTokenCountTotal:ye.tokenCountTotal,Un=f?ye.cumulativeTokenCountPrompt:ye.tokenCountPrompt,Ha=f?ye.cumulativeTokenCountCompletion:ye.tokenCountCompletion;return e(oa,{tokenCountTotal:en||0,tokenCountPrompt:Un||0,tokenCountCompletion:Ha||0})}}];u.useEffect(()=>{if(l.current===!0){l.current=!1;return}u.startTransition(()=>{const E=o[0];K({sort:E?su(E):ru,after:null,first:Ft,filterCondition:c,rootSpansOnly:f},{fetchPolicy:"store-and-network"})})},[o,K,c,a,f]);const R=u.useCallback(E=>{if(E){const{scrollHeight:N,scrollTop:ee,clientHeight:ye}=E;N-ee-ye<300&&!S&&b&&k(Ft)}},[b,S,k]),Q=je(E=>E.setColumnSizing),z=je(E=>E.columnSizing),A=Le({columns:$,data:L,state:{sorting:o,columnVisibility:g,rowSelection:i,columnSizing:z},defaultColumn:US,columnResizeMode:"onChange",manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnSizingChange:Q,getCoreRowModel:we(),getSortedRowModel:In()}),j=A.getRowModel().rows,Y=A.getSelectedRowModel().rows,de=Y.map(E=>({id:E.original.id,traceId:E.original.trace.id})),be=u.useCallback(()=>{r({})},[r]),wn=j.length===0,hn=A.getAllColumns().filter(E=>E.columns.length===0),{columnSizingInfo:ga,columnSizing:Ua}=A.getState(),q=A.getFlatHeaders,le=hn.length,[te,M]=he.useMemo(()=>{const E=q(),N={};let ee=0;for(let ye=0;ye<E.length;ye++){const en=E[ye];N[`--header-${en.id}-size`]=en.getSize(),N[`--col-${en.column.id}-size`]=en.column.getSize(),ee+=en.getSize()}return[N,ee]},[q,ga,Ua,le]);return s("div",{css:bi,children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Yc,{onValidCondition:p}),s(Xl,{"aria-label":"Toggle between root and all spans",selectionMode:"single",selectedKeys:[f?"root":"all"],onSelectionChange:E=>{if(E.size===0)return;const N=E.keys().next().value;if(HS(N))m(N==="root");else throw new Error(`Unknown root span filter selection: ${N}`)},children:[e(Xn,{"aria-label":"root spans",id:"root",children:"Root Spans"}),e(Xn,{"aria-label":"all spans",id:"all",children:"All"})]}),e(Wc,{columns:hn,query:y}),e(MS,{})]})}),e("div",{css:F`
4156
4155
  flex: 1 1 auto;
4157
4156
  overflow: auto;
4158
4157
  `,onScroll:E=>R(E.target),ref:t,children:s("table",{css:sa,style:{...te,width:A.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:A.getHeaderGroups().map(E=>e("tr",{children:E.headers.map(N=>e("th",{style:{width:`calc(var(--header-${N.id}-size) * 1px)`},children:N.isPlaceholder?null:s(U,{children:[s("div",{className:N.column.getCanSort()?"cursor-pointer":"",onClick:N.column.getToggleSortingHandler(),style:{left:N.getStart(),width:N.getSize()},children:[J(N.column.columnDef.header,N.getContext()),N.column.getIsSorted()?e(_,{className:"sort-icon",svg:N.column.getIsSorted()==="asc"?e(cn,{}):e(un,{})}):null]}),e("div",{onMouseDown:N.getResizeHandler(),onTouchStart:N.getResizeHandler(),className:`resizer ${N.column.getIsResizing()?"isResizing":""}`})]})},N.id))},E.id))}),wn?e(Hc,{projectName:y.name}):ga.isResizingColumn?e(GS,{table:A,hasNext:b,onLoadNext:()=>k(Ft),tableWidth:M,isLoadingNext:S}):e(ou,{table:A,hasNext:b,onLoadNext:()=>k(Ft),tableWidth:M,isLoadingNext:S})]})}),Y.length?e(iu,{selectedSpans:de,onClearSelection:be}):null]})}function JS({queryReference:n}){const a=I.usePreloadedQuery(lo,n);return e(WS,{project:a.project})}const T2=()=>{const{spansQueryReference:n}=nl();return n?s(vi,{children:[e(Si,{children:e(u.Suspense,{fallback:e(Fe,{}),children:e(JS,{queryReference:n})})}),e(u.Suspense,{children:e(Te,{})})]}):null},du=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},t={defaultValue:30,kind:"LocalArgument",name:"first"},l={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],d={kind:"Variable",name:"after",variableName:"after"},c={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},p={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},m={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},k=[d,c,p,{kind:"Literal",name:"rootSpansOnly",value:!0},f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],b={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},x=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],L={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:x,storageKey:null},P={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:x,storageKey:null},D={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},R={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[g,y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},Q={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[n,a,t,l,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[d,c,p,f],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,t,i,r,l],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,{kind:"TypeDiscriminator",abstractKey:"__isNode"},g,{kind:"InlineFragment",selections:[y,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:k,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[g,b,y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},S,K,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},T,L,P,D,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[g,$,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null}],storageKey:null},R,Q,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[g,b,y,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S,K,T,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},L,P,D,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[g,$],storageKey:null},R,Q],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:k,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"d0a1b8418330452126093b027f027f43",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
@@ -4270,7 +4269,7 @@ fragment TracesTable_spans_1XEuU on Project {
4270
4269
  }
4271
4270
  id
4272
4271
  }
4273
- `}}}();du.hash="946e6d9bfbf43ac9def8bfcc2ff30661";const cu=function(){var n=["rootSpans"],a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},d=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],c={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:d,storageKey:null},p={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:d,storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},g={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,a,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},y={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterCondition"},{defaultValue:30,kind:"LocalArgument",name:"first"},{defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},{kind:"RootArgument",name:"timeRange"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:du,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"TracesTable_spans",selections:[a,{args:null,kind:"FragmentSpread",name:"SpanColumnSelector_annotations"},{alias:"rootSpans",args:[{kind:"Variable",name:"filterCondition",variableName:"filterCondition"},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"SpanConnection",kind:"LinkedField",name:"__TracesTable_rootSpans_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,l,a,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},i,r,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},o,c,p,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,m,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null}],storageKey:null},g,y,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,l,a,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},i,r,o,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},c,p,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,m],storageKey:null},g,y],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},t],type:"Project",abstractKey:null}}();cu.hash="946e6d9bfbf43ac9def8bfcc2ff30661";const dr=ii,ZS=50,uu=({table:n})=>{const a=ue();return e("tbody",{children:n.getRowModel().rows.map(t=>e("tr",{onClick:()=>a(`${t.original.trace.traceId}`),"data-is-additional-row":t.original.__additionalRow,css:ev,children:t.getVisibleCells().map(l=>e("td",{style:{height:1,width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(l.column.columnDef.cell,l.getContext())},l.id))},t.id))})},XS=he.memo(uu,(n,a)=>n.table.options.data===a.table.options.data),YS=({row:n})=>n.original.__additionalRow?null:e(Bc,{metadata:n.original.metadata}),ev=F`
4272
+ `}}}();du.hash="946e6d9bfbf43ac9def8bfcc2ff30661";const cu=function(){var n=["rootSpans"],a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},d=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],c={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:d,storageKey:null},p={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:d,storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},g={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,a,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},y={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterCondition"},{defaultValue:30,kind:"LocalArgument",name:"first"},{defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},{kind:"RootArgument",name:"timeRange"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:du,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"TracesTable_spans",selections:[a,{args:null,kind:"FragmentSpread",name:"SpanColumnSelector_annotations"},{alias:"rootSpans",args:[{kind:"Variable",name:"filterCondition",variableName:"filterCondition"},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"SpanConnection",kind:"LinkedField",name:"__TracesTable_rootSpans_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,l,a,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},i,r,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},o,c,p,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,m,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null}],storageKey:null},g,y,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,l,a,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},i,r,o,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},c,p,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,m],storageKey:null},g,y],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},t],type:"Project",abstractKey:null}}();cu.hash="946e6d9bfbf43ac9def8bfcc2ff30661";const dr=ii,ZS=50,uu=({table:n})=>{const a=ue();return e("tbody",{children:n.getRowModel().rows.map(t=>e("tr",{onClick:()=>a(`${t.original.trace.traceId}`),"data-is-additional-row":t.original.__additionalRow,css:ev,children:t.getVisibleCells().map(l=>e("td",{style:{width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J(l.column.columnDef.cell,l.getContext())},l.id))},t.id))})},XS=he.memo(uu,(n,a)=>n.table.options.data===a.table.options.data),YS=({row:n})=>n.original.__additionalRow?null:e(Bc,{metadata:n.original.metadata}),ev=F`
4274
4273
  &[data-is-additional-row="true"] {
4275
4274
  box-shadow: inset 0 -10px 20px var(--ac-global-color-grey-100);
4276
4275
  }
@@ -5095,7 +5094,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
5095
5094
  align-items: center;
5096
5095
  color: var(--ac-global-color-primary);
5097
5096
  gap: var(--ac-global-dimension-size-50);
5098
- `;function uC(n){const{datasetId:a,experimentIds:t,displayFullText:l}=n,[i,r]=u.useState(""),o=I.useLazyLoadQuery(Qu,{experimentIds:t,datasetId:a,filterCondition:i}),d=u.useMemo(()=>{var T,x;return((x=(T=o.dataset)==null?void 0:T.experiments)==null?void 0:x.edges.reduce((L,P)=>{var D,$;return L[P.experiment.id]={...P.experiment,projectId:(($=(D=P.experiment)==null?void 0:D.project)==null?void 0:$.id)||null},L},{}))||{}},[o]),c=u.useMemo(()=>o.comparisons.map(T=>{const x=T.runComparisonItems.reduce((L,P)=>(L[P.experimentId]=P,L),{});return{...T,id:T.example.id,input:T.example.revision.input,referenceOutput:T.example.revision.referenceOutput,runComparisonMap:x}}),[o]),[p,f]=u.useState(null),m=u.useMemo(()=>[{header:"input",accessorKey:"input",minWidth:500,cell:({row:T})=>e(Ai,{controls:s(ve,{children:[e(V,{size:"S","aria-label":"View example details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{f(e(u.Suspense,{children:e(gi,{exampleId:T.original.example.id,onDismiss:()=>{f(null)}})}))})}}),e($e,{children:"View Example"})]}),children:e(Kt,{children:e(Ci,{children:e($a,{json:T.original.input,disableTitle:!0,space:l?2:0})})})})},{header:"reference output",accessorKey:"referenceOutput",minWidth:500,cell:T=>e(Kt,{children:l?yC(T):wa(T)})}],[l]),g=u.useMemo(()=>t.map(T=>({header:()=>{var $,R,Q,z;const x=($=d[T])==null?void 0:$.name,L=(R=d[T])==null?void 0:R.metadata,P=(Q=d[T])==null?void 0:Q.projectId,D=((z=d[T])==null?void 0:z.sequenceNumber)||0;return s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"space-between",children:[s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",children:[e(Yt,{sequenceNumber:D}),e(v,{children:x})]}),e(rs,{experimentId:T,metadata:L,isQuiet:!0,projectId:P,canDeleteExperiment:!1})]})},accessorKey:T,minSize:500,cell:({row:x})=>{var A,j;const L=x.original.runComparisonMap[T],P=(L==null?void 0:L.runs.length)||0;if(P===0)return e(ur,{});if(P>1)return e(v,{color:"warning",children:`${P} runs`});const D=L==null?void 0:L.runs[0];let $=null;const R=(A=D==null?void 0:D.trace)==null?void 0:A.traceId,Q=(j=D==null?void 0:D.trace)==null?void 0:j.projectId;return R&&Q&&($=s(ve,{children:[e(V,{variant:"default",className:"trace-button",size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(jt,{})}),onPress:()=>{u.startTransition(()=>{f(e(Ju,{traceId:R,projectId:Q,title:"Experiment Run Trace"}))})}}),e($e,{children:"View Trace"})]})),D?e(Ai,{controls:s(U,{children:[s(ve,{children:[e(V,{variant:"default",className:"expand-button",size:"S","aria-label":"View example run details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{f(e(fC,{selectedExample:x.original,datasetId:a,experimentInfoById:d}))})}}),e($e,{children:"View run details"})]}),$]}),children:e(Kt,{children:e(gC,{...D,displayFullText:l,setDialog:f})})}):e(Kt,{children:e(ur,{})})}})),[t,d,a,l]),y=u.useMemo(()=>[...m,...g],[m,g]),k=Le({columns:y,data:c,getCoreRowModel:we(),columnResizeMode:"onChange"}),b=he.useMemo(()=>{const T=k.getFlatHeaders(),x={};for(let L=0;L<T.length;L++){const P=T[L];x[`--header-${P.id}-size`]=P.getSize(),x[`--col-${P.column.id}-size`]=P.column.getSize()}return x},[k.getState().columnSizingInfo,k.getState().columnSizing]),K=k.getRowModel().rows.length===0;return e(C,{overflow:"auto",children:s(h,{direction:"column",height:"100%",children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(sC,{onValidCondition:r})}),s("div",{css:dC,children:[s("table",{css:F(dn,Vr),style:{...b,width:k.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:k.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(x=>s("th",{style:{width:`calc(var(--header-${x==null?void 0:x.id}-size) * 1px)`},children:[e("div",{children:J(x.column.columnDef.header,x.getContext())}),e("div",{onMouseDown:x.getResizeHandler(),onTouchStart:x.getResizeHandler(),className:`resizer ${x.column.getIsResizing()?"isResizing":""}`})]},x.id))},T.id))}),K?e(mn,{}):k.getState().columnSizingInfo.isResizingColumn?e(mC,{table:k}):e(Hu,{table:k})]}),e(ae,{isDismissable:!0,type:"slideOver",onDismiss:()=>{f(null)},children:p})]})]})})}function Hu({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(t=>e("td",{style:{height:1,width:`calc(var(--col-${t.column.id}-size) * 1px)`,padding:0},children:J(t.column.columnDef.cell,t.getContext())},t.id))},a.id))})}const mC=he.memo(Hu,(n,a)=>n.table.options.data===a.table.options.data);function pC(n){const{datasetId:a,exampleId:t}=n,l=ue();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(Dn,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return l(`/datasets/${a}/examples/${t}`);default:Ce()}},children:e(ie,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(ay,{})}),e(v,{children:"Go to example"})]})},"gotoExample")})})}function gC(n){const{output:a,error:t,startTime:l,endTime:i,annotations:r,displayFullText:o,setDialog:d}=n;if(t)return e(Gu,{error:t});const c=r!=null&&r.edges.length?r.edges.map(p=>p.annotation):[];return s(h,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(Ci,{children:e($a,{json:a,disableTitle:!0,space:o?2:0})}),s("ul",{css:F`
5097
+ `;function uC(n){const{datasetId:a,experimentIds:t,displayFullText:l}=n,[i,r]=u.useState(""),o=I.useLazyLoadQuery(Qu,{experimentIds:t,datasetId:a,filterCondition:i}),d=u.useMemo(()=>{var T,x;return((x=(T=o.dataset)==null?void 0:T.experiments)==null?void 0:x.edges.reduce((L,P)=>{var D,$;return L[P.experiment.id]={...P.experiment,projectId:(($=(D=P.experiment)==null?void 0:D.project)==null?void 0:$.id)||null},L},{}))||{}},[o]),c=u.useMemo(()=>o.comparisons.map(T=>{const x=T.runComparisonItems.reduce((L,P)=>(L[P.experimentId]=P,L),{});return{...T,id:T.example.id,input:T.example.revision.input,referenceOutput:T.example.revision.referenceOutput,runComparisonMap:x}}),[o]),[p,f]=u.useState(null),m=u.useMemo(()=>[{header:"input",accessorKey:"input",minWidth:500,cell:({row:T})=>e(Ai,{controls:s(ve,{children:[e(V,{size:"S","aria-label":"View example details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{f(e(u.Suspense,{children:e(gi,{exampleId:T.original.example.id,onDismiss:()=>{f(null)}})}))})}}),e($e,{children:"View Example"})]}),children:e(Kt,{children:e(Ci,{children:e($a,{json:T.original.input,disableTitle:!0,space:l?2:0})})})})},{header:"reference output",accessorKey:"referenceOutput",minWidth:500,cell:T=>e(Kt,{children:l?yC(T):wa(T)})}],[l]),g=u.useMemo(()=>t.map(T=>({header:()=>{var $,R,Q,z;const x=($=d[T])==null?void 0:$.name,L=(R=d[T])==null?void 0:R.metadata,P=(Q=d[T])==null?void 0:Q.projectId,D=((z=d[T])==null?void 0:z.sequenceNumber)||0;return s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"space-between",children:[s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",children:[e(Yt,{sequenceNumber:D}),e(v,{children:x})]}),e(rs,{experimentId:T,metadata:L,isQuiet:!0,projectId:P,canDeleteExperiment:!1})]})},accessorKey:T,minSize:500,cell:({row:x})=>{var A,j;const L=x.original.runComparisonMap[T],P=(L==null?void 0:L.runs.length)||0;if(P===0)return e(ur,{});if(P>1)return e(v,{color:"warning",children:`${P} runs`});const D=L==null?void 0:L.runs[0];let $=null;const R=(A=D==null?void 0:D.trace)==null?void 0:A.traceId,Q=(j=D==null?void 0:D.trace)==null?void 0:j.projectId;return R&&Q&&($=s(ve,{children:[e(V,{variant:"default",className:"trace-button",size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(jt,{})}),onPress:()=>{u.startTransition(()=>{f(e(Ju,{traceId:R,projectId:Q,title:"Experiment Run Trace"}))})}}),e($e,{children:"View Trace"})]})),D?e(Ai,{controls:s(U,{children:[s(ve,{children:[e(V,{variant:"default",className:"expand-button",size:"S","aria-label":"View example run details",leadingVisual:e(_,{svg:e(ot,{})}),onPress:()=>{u.startTransition(()=>{f(e(fC,{selectedExample:x.original,datasetId:a,experimentInfoById:d}))})}}),e($e,{children:"View run details"})]}),$]}),children:e(Kt,{children:e(gC,{...D,displayFullText:l,setDialog:f})})}):e(Kt,{children:e(ur,{})})}})),[t,d,a,l]),y=u.useMemo(()=>[...m,...g],[m,g]),k=Le({columns:y,data:c,getCoreRowModel:we(),columnResizeMode:"onChange"}),b=he.useMemo(()=>{const T=k.getFlatHeaders(),x={};for(let L=0;L<T.length;L++){const P=T[L];x[`--header-${P.id}-size`]=P.getSize(),x[`--col-${P.column.id}-size`]=P.column.getSize()}return x},[k.getState().columnSizingInfo,k.getState().columnSizing]),K=k.getRowModel().rows.length===0;return e(C,{overflow:"auto",children:s(h,{direction:"column",height:"100%",children:[e(C,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(sC,{onValidCondition:r})}),s("div",{css:dC,children:[s("table",{css:F(dn,Vr),style:{...b,width:k.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:k.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(x=>s("th",{style:{width:`calc(var(--header-${x==null?void 0:x.id}-size) * 1px)`},children:[e("div",{children:J(x.column.columnDef.header,x.getContext())}),e("div",{onMouseDown:x.getResizeHandler(),onTouchStart:x.getResizeHandler(),className:`resizer ${x.column.getIsResizing()?"isResizing":""}`})]},x.id))},T.id))}),K?e(mn,{}):k.getState().columnSizingInfo.isResizingColumn?e(mC,{table:k}):e(Hu,{table:k})]}),e(ae,{isDismissable:!0,type:"slideOver",onDismiss:()=>{f(null)},children:p})]})]})})}function Hu({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(t=>e("td",{style:{width:`calc(var(--col-${t.column.id}-size) * 1px)`,padding:0},children:J(t.column.columnDef.cell,t.getContext())},t.id))},a.id))})}const mC=he.memo(Hu,(n,a)=>n.table.options.data===a.table.options.data);function pC(n){const{datasetId:a,exampleId:t}=n,l=ue();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(Dn,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return l(`/datasets/${a}/examples/${t}`);default:Ce()}},children:e(ie,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(ay,{})}),e(v,{children:"Go to example"})]})},"gotoExample")})})}function gC(n){const{output:a,error:t,startTime:l,endTime:i,annotations:r,displayFullText:o,setDialog:d}=n;if(t)return e(Gu,{error:t});const c=r!=null&&r.edges.length?r.edges.map(p=>p.annotation):[];return s(h,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(Ci,{children:e($a,{json:a,disableTitle:!0,space:o?2:0})}),s("ul",{css:F`
5099
5098
  display: flex;
5100
5099
  flex-direction: row;
5101
5100
  gap: var(--ac-global-dimension-static-size-100);
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.28.0"
1
+ __version__ = "8.29.0"